Changes

Jump to: navigation, search

OOP344 20102 IOFrame test main

785 bytes added, 07:37, 23 June 2010
Created page with '<big><syntaxhighlight lang=cpp> #include "iotext.h" #include "ioframe.h" int main(){ int ro = 0; int co = 0; bool done = false; int key = 0; iof_init(); int rows = i…'
<big><syntaxhighlight lang=cpp>
#include "iotext.h"
#include "ioframe.h"

int main(){
int ro = 0;
int co = 0;
bool done = false;
int key = 0;
iof_init();
int rows = iof_rows();
int cols = iof_cols();
IOFrame ioframe(8, 30, 5, 10, true);
while(!done){
iof_clrscr();
ioframe.draw(ro, co);
key = iof_getch();
switch(key){
case RIGHT_KEY:
if(co + 40 < cols)
co++;
break;
case LEFT_KEY:
if(co + 30 > 0)
co--;
break;
case DOWN_KEY:
if(ro + 13 < rows )
ro++;
break;
case UP_KEY:
if(ro + 8 > 0 )
ro--;
break;
case ESCAPE_KEY:
done = true;
break;
}
}
iof_end();
return 0;
}
</syntaxhighlight></big>

Navigation menu