Â
Â
Hi and Good Day TechyV!
I was making a card game program this last day, but after I wrote GUI, I’m stuck with drawing cards. I tried many  software programs but none of them help me though. Now may I ask you, what would be my action if you had written GUI code? Learning DirectX would be much for such simple game. How Windows’ Solitare run smoothly even it doesn’t rotate? And how to make card game images for c program? Any help would be nice.
Thanks,
Brant Joseph
Â
Â
How to make card game images for c program
If you run below mentioned code you will get the required GUI for Cards:
Source code:
win = ui.window(150, 100);
win.setUseCartesianCoordinates(true);
win.drawRect(0,0,150,100, ui.color("green"));
// Draws a picture of a card on the window win at position (x,y)
// value is from 1-13
// suit is from 1-4 (for hearts, diamonds, clubs, and spades)
//
function drawCard(x, y, value, suit)
{
var suits = ['u2665', 'u2666', 'u2663', 'u2660'];
var vals = ['A','2','3','4','5','6','7','8',
'9','10','J','Q','K'];
var fontFamily = ui.isHTML5 ? "sans-serif" : "SansSerif";
var font = win.getFontWithPixelSize(fontFamily,
true, false, 15);
win.drawRect(x, y, x+27, y+37, ui.color("black"));
win.drawRect(x+1, y+1, x+26, y+36, ui.color("white"));
var color = ui.color("black");
if (suit <= 2)
color = ui.color("red");
win.drawString(x+5, y+20, vals[value-1], font, color);
win.drawString(x+5, y+5, suits[suit-1], font, color);
}
drawCard(5, 10, 10, 1);
drawCard(35, 10, 1, 2);
drawCard(65, 10, 12, 3);
drawCard(95, 10, 8, 4);
sleep(2);
Finally steps are:
 1. Draw the background using green color using win.drawRect(0,0,150,100, ui.color("green"));
 2. drawCard() is used to draw individual cards
Thanks