Easyx的简单小例子

#include
int main()
{
initgraph(640, 480);
RECT rt;


GetClientRect(GetHWnd(), &rt);


bool top = true;
bool left = false;
bool right = true;
bool bottom = false;


int cx = 0;
int cy = 0;
setfillcolor(GREEN);
BeginBatchDraw();
while (true)
{
cleardevice();
if (cx>=rt.right-50)
{
left = true;
right = false;
}
else if (cx<=rt.left)
{
left = false;
right = true;


}
if (left)
{
cx--;
}
if (right)
{
cx++;
}


if (cy >= rt.bottom - 50)
{
top = true;
bottom = false;
}
else if (cy <= rt.top)
{
bottom = 1;
top = false;
}
if (bottom)
{
cy++;
}
if (top)
{
cy--;
}
solidcircle(cx, cy, 50);
FlushBatchDraw();
}
EndBatchDraw();
return 0;
}

你可能感兴趣的:(Easyx库)