Back to Evolution Project page
00001 #include "ScreenGame.h" 00002 #include "Screen.h" 00003 #include "configs.h" 00004 00005 int TScreenGame::Show() { 00006 int ox, oy; 00007 char text[1000]; 00008 CL_Display::clear_display(); 00009 00010 tile_bg(); 00011 font->print_left(10, 50, "LOADING MAP... Please wait..."); 00012 CL_Display::flip_display(); 00013 00014 if (!gamelevel->LoadFromFile(INTRO_LEVEL)) { 00015 g_print("ERROR: Can't load file '%s'\n", INTRO_LEVEL); 00016 return SCREEN_QUIT; 00017 } 00018 00019 do { 00020 ox = gamelevel->get_offsetx(); 00021 oy = gamelevel->get_offsety(); 00022 tile_bg(); 00023 gamelevel->Draw(); 00024 sprintf(text, "Game screen (%d , %d) ", ox, oy); 00025 font->print_left(10, 10, text); 00026 //Put all on screen... 00027 CL_Display::flip_display(); 00028 00029 00030 CL_System::keep_alive(); 00031 if (CL_Keyboard::get_keycode(CL_KEY_UP) ) { 00032 oy--; 00033 gamelevel->set_offsety(oy); 00034 } 00035 else if (CL_Keyboard::get_keycode(CL_KEY_DOWN) ) { 00036 oy++; 00037 gamelevel->set_offsety(oy); 00038 } 00039 if (CL_Keyboard::get_keycode(CL_KEY_LEFT) ) { 00040 ox--; 00041 gamelevel->set_offsetx(ox); 00042 } 00043 else if (CL_Keyboard::get_keycode(CL_KEY_RIGHT) ) { 00044 ox++; 00045 gamelevel->set_offsetx(ox); 00046 } 00047 if (CL_Keyboard::get_keycode(CL_KEY_ESCAPE) ) { 00048 break; 00049 } 00050 00051 } while(1); 00052 // wait_for_key(CL_KEY_ESCAPE); 00053 00054 return SCREEN_DEFAULT; 00055 }