Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make use of window close and add another ESC keycode #79

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions rawdraw.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ unsigned long iframeno = 0;

void HandleKey( int keycode, int bDown )
{
if( keycode == 27 ) exit( 0 );
printf( "Key: %d -> %d\n", keycode, bDown );
if( keycode == 27 || keycode == CNFG_KEY_ESCAPE) exit( 0 );
}

void HandleButton( int x, int y, int button, int bDown )
Expand All @@ -32,6 +32,14 @@ void HandleMotion( int x, int y, int mask )
// printf( "Motion: %d,%d (%d)\n", x, y, mask );
}


void HandleDestroy()
{
printf( "Destroying\n" );
exit(10);
}


#define HMX 40
#define HMY 40
short screenx, screeny;
Expand Down Expand Up @@ -152,13 +160,6 @@ void DrawHeightmap()

}


void HandleDestroy()
{
printf( "Destroying\n" );
exit(10);
}

uint32_t randomtexturedata[65536];

int main()
Expand Down Expand Up @@ -190,7 +191,8 @@ int main()
iframeno++;
RDPoint pto[3];

CNFGHandleInput();
// CNFGHandleInput() returns 0 on recieving a window close request.
if (!CNFGHandleInput()) HandleDestroy();

CNFGClearFrame();
CNFGColor( 0xFFFFFFFF );
Expand Down