void ExamplesMainInit() { #ifdef EXAMPLE_DEBUG_ONLY // Test for Debug only examples #ifndef IW_DEBUG DisplayMessage("This example is designed to run from a Debug build. Please build the example in Debug mode and run it again."); return 0; #endif #endif IwGxInit(); //IwResManagerInit(); //IwGxFontInit(); // Set screen clear colour IwGxSetColClear(0xff, 0xff, 0xff, 0xff); // white background IwGxPrintSetColour(0, 0, 0); // black font // Determine if the device has a keyboard if (s3eKeyboardGetInt(S3E_KEYBOARD_HAS_KEYPAD) || s3eKeyboardGetInt(S3E_KEYBOARD_HAS_ALPHA)) g_DeviceHasKeyboard = true; // User code init ExampleInit(); }
void Button::Render() { if(btn_type==IMAGE) Iw2DDrawImage(_image, m_ImgPos); else { Iw2DSetColour(bg_color); if(btn_type==RECT||btn_type==TEXT) Iw2DFillRect(m_BGPos,m_BGSize); else if(btn_type==SPHERE) Iw2DFillArc(m_BGPos+CIwSVec2(m_BGSize.x/2,m_BGSize.y/2), m_BGSize, iwangle(0), iwangle(0x1600), 40); if(btn_type==TEXT) { uint8 rgb[4]; rgb[0]=(text_color & 0x000000ff);//A rgb[1]=(text_color & 0x0000ff00) >>8;//B rgb[2]=(text_color & 0x00ff0000) >>16;//G rgb[3]=(text_color & 0xff000000) >>24;//R IwGxPrintSetColour(rgb[3], rgb[2], rgb[1]); IwGxPrintSetScale(2); IwGxPrintString(m_TextPos.x, m_TextPos.y, m_text); } Iw2DSetColour(C_WHITE); }
//----------------------------------------------------------------------------- // Main global function //----------------------------------------------------------------------------- int main() { #ifdef EXAMPLE_DEBUG_ONLY // Test for Debug only examples #ifndef IW_DEBUG DisplayMessage("This example is designed to run from a Debug build. Please build the example in Debug mode and run it again."); return 0; #endif #endif //IwGx can be initialised in a number of different configurations to help the linker eliminate unused code. //Normally, using IwGxInit() is sufficient. //To only include some configurations, see the documentation for IwGxInit_Base(), IwGxInit_GLRender() etc. IwGxInit(); // Example main loop ExampleInit(); // Set screen clear colour IwGxSetColClear(0xff, 0xff, 0xff, 0xff); IwGxPrintSetColour(128, 128, 128); while (1) { s3eDeviceYield(0); s3eKeyboardUpdate(); s3ePointerUpdate(); int64 start = s3eTimerGetMs(); bool result = ExampleUpdate(); if ( (result == false) || (s3eKeyboardGetState(s3eKeyEsc) & S3E_KEY_STATE_DOWN) || (s3eKeyboardGetState(s3eKeyAbsBSK) & S3E_KEY_STATE_DOWN) || (s3eDeviceCheckQuitRequest()) ) break; // Clear the screen IwGxClear(IW_GX_COLOUR_BUFFER_F | IW_GX_DEPTH_BUFFER_F); RenderButtons(); RenderSoftkeys(); ExampleRender(); // Attempt frame rate while ((s3eTimerGetMs() - start) < MS_PER_FRAME) { int32 yield = (int32) (MS_PER_FRAME - (s3eTimerGetMs() - start)); if (yield<0) break; s3eDeviceYield(yield); } } ExampleShutDown(); DeleteButtons(); IwGxTerminate(); return 0; }
S3E_MAIN_DECL void IwMain() { Init(); // Set screen clear colour IwGxSetColClear(0, 0, 0, 0xff); IwGxPrintSetColour(128, 128, 128); while (1) { s3eDeviceYield(0); s3eKeyboardUpdate(); s3ePointerUpdate(); int64 start = s3eTimerGetMs(); bool result = Update(); if ( ((result == false) || (s3eKeyboardGetState(s3eKeyEsc) & S3E_KEY_STATE_DOWN) || (s3eKeyboardGetState(s3eKeyAbsBSK) & S3E_KEY_STATE_DOWN) || (s3eDeviceCheckQuitRequest())) ) break; Render(); // Attempt frame rate while ((s3eTimerGetMs() - start) < MS_PER_FRAME) { int32 yield = (int32) (MS_PER_FRAME - (s3eTimerGetMs() - start)); if (yield<0) break; s3eDeviceYield(yield); } } ShutDown(); }
void Panel::Render() { if(isDisplay){ if(m_images.size()>0) { Iw2DDrawImage(m_images[m_images.size()-1], m_BGPos); } else { Iw2DSetColour(bg_color); Iw2DFillRect(m_BGPos,m_BGSize); Iw2DSetColour(0xffffffff); } if(m_text!="") { IwGxPrintSetColour(text_color[3], text_color[2], text_color[1]); IwGxPrintSetScale(m_TextScale); IwGxPrintString(m_TextPos.x, m_TextPos.y, m_text); } for(int i=m_btns.size()-1;i!=-1;i--) m_btns[i]->Render(); } }
void menu() { MenuInit(); //MusicInit("./textures/musicOn.jpg"); g_Input.gameOff(); MenuRender(); MusicRender(); while(!g_Input.getGame()) { int64 start = s3eTimerGetMs(); while ((s3eTimerGetMs() - start) < MS_PER_FRAME) { int32 yield = (int32) (MS_PER_FRAME - (s3eTimerGetMs() - start)); if (yield<0) break; s3eDeviceYield(yield); } if (g_Input.getTouchCount() != 0) { int x = g_Input.getTouch(0)->x; int y = g_Input.getTouch(0)->y; if (x <= 750 && x >= 500 && y <= 400 && y >= 200) { if (g_Input.getSound()) { MusicShutDown(); MusicInit("./textures/musicOf.jpg"); MusicRender(); g_Input.soundOff(); } else { MusicShutDown(); MusicInit("./textures/musicOn.jpg"); MusicRender(); g_Input.soundOn(); } } if (x <= 1270 && x >= 500 && y <= 190 && y >= 10) g_Input.gameOn(); } } //MusicShutDown(); //MenuShutDown(); IwGxSetColClear(0xff, 0xff, 0xff, 0xff); IwGxPrintSetColour(128, 128, 128); g_Input.initTimer(); g_Input.setTotalTime(); g_Input.setPosInitY(g_Input.getAccelerometerY()); SplashInit(); SplashUpdate("loading"); SplashRender(); MenuShutDown(); if (initMenu) { //Creating objects corazon = new corazones("corazones", 64, 64, -100, 1,2,false); for (int i=0; i<10; i++) { garras[i] = new claws("claws", 128, 128, -150,1,2,false); } maxiCoin = new Coin("./textures/monedas200pts.png", 128, 128, -150,1,2,false); for (int j=0; j<20; j++) { miniCoins[j] = new MiniCoin("coins", 64, 64, -100,1,2,true); } for (int i=0; i<10; i++) { tnts[i] = new Tnt("tnts", 128, 128, -150,1,2,false); } tank = new Tank(); tank->Init("./textures/tank.png", 256, 256, -300,1,2,false); chuletas = new Chuletas(); chuletas->Init("./textures/chuletas.png", 512, 512, -600,1,2,false); } SplashShutDown(); //SplashInit(); //SplashUpdate("go"); ciclo(); }