TransitionManager::~TransitionManager() { IW_CALLSTACK("TransitionManager::~TransitionManager"); IwGxClear(); IwGxFlush(); Destroy(); }
void myIwGxPrepareStars() { Iw2DFinishDrawing(); IwGxClear(IW_GX_DEPTH_BUFFER_F); // ssend_vertices = 0; }
//----------------------------------------------------------------------------- void HexMapTest::Render() { // if (mouse_mode == MOUSE_MODE_CHECKING) { // int32 px = IwGxGetScreenWidth() - s3ePointerGetX(); // int32 py = IwGxGetScreenHeight() - s3ePointerGetY(); int32 closestX = -1, closestY = -1; CIwVec3 vect = getWorldCoords(s3ePointerGetX(), s3ePointerGetY()); // hexGrid->findClosestArray(origin, dir, closestX, closestY); //WORKING!!! hexGrid->findClosestSimple(vect.x, vect.y, closestX, closestY); DebugPrint(closestX, closestY); } // s_PickSurface->MakeCurrent(); // Clear the screen IwGxClear(IW_GX_COLOUR_BUFFER_F | IW_GX_DEPTH_BUFFER_F); // Set the model matrix IwGxSetModelMatrix(&s_ModelMatrix); hexGrid->render(); // End drawing IwGxFlush(); IwGxPrintSetScale(2); IwGxPrintFrameRate(0, 0); // Swap buffers IwGxSwapBuffers(); }
//----------------------------------------------------------------------------- // CIwRenderSlotClear //----------------------------------------------------------------------------- void CIwRenderSlotClear::Render() { IW_CALLSTACK("CIwRenderSlotClear::Render") // Clear backbuffer IwGxClear(IW_GX_COLOUR_BUFFER_F | IW_GX_DEPTH_BUFFER_F); }
//----------------------------------------------------------------------------- // 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; }
int main() { IwGxInit(); Iw2DInit(); AppWarp::Client* WarpClientRef; AppWarp::Client::initialize("b29f4030aba3b2bc7002c4eae6815a4130c862c386e43ae2a0a092b27de1c5af","bf45f27e826039754f8dda659166d59ffb7b9dce830ac51d6e6b576ae4b26f7e"); WarpClientRef = AppWarp::Client::getInstance(); MenuScreen *menu = new MenuScreen; GameScreen *game = new GameScreen(WarpClientRef); Game *gm = new Game; gm->AddScene("game",game); gm->AddScene("menu",menu); menu->game = game; menu->app = gm; Listener listener(WarpClientRef,game); WarpClientRef->setConnectionRequestListener(&listener); WarpClientRef->setRoomRequestListener(&listener); WarpClientRef->setNotificationListener(&listener); s3ePointerRegister(S3E_POINTER_BUTTON_EVENT,(s3eCallback)HandleSingleTouchButtonCB,gm); while(!s3eDeviceCheckQuitRequest()) { s3eKeyboardUpdate(); if(s3eKeyboardGetState(s3eKeyAbsBSK) & S3E_KEY_STATE_DOWN) break; WarpClientRef->update(); s3ePointerUpdate(); IwGxClear(IW_GX_COLOUR_BUFFER_F | IW_GX_DEPTH_BUFFER_F); IwGxPrintSetScale(2); IwGxPrintString(0,0,game->msg.c_str()); gm->Move(); gm->Render(); Iw2DSurfaceShow(); s3eDeviceYield(); } s3ePointerUnRegister(S3E_POINTER_BUTTON_EVENT,(s3eCallback)HandleSingleTouchButtonCB); gm->CleanUp(); delete menu; delete game; delete gm; WarpClientRef->terminate(); Iw2DTerminate(); IwGxTerminate(); }
int main() { Initialize(); // --HowTo: Load the tmx map from the json file tmxparser::Map_t *map = new tmxparser::Map_t; tmxparser::parseTmxFromJSON_file("testLevel.json", map); // --HowTo: Create a renderer tmxparser::TmxRenderer *renderer = new tmxparser::TmxRenderer(map); // an offset to use for scrolling the map CIwFVec2 offset(0,0); IwGxSetColClear(0x2f, 0x3f, 0x3f, 0xff); // Loop forever, until the user or the OS performs some action to quit the app while (!s3eDeviceCheckQuitRequest()) { //Update the input systems s3eKeyboardUpdate(); s3ePointerUpdate(); // Clear the surface IwGxClear(IW_GX_COLOUR_BUFFER_F | IW_GX_DEPTH_BUFFER_F); // --HowTo: render all layers, at original pixel size: //renderer->Render(offset); // --HowTo: render all layers at reduced/scaled tile size renderer->Render(offset, CIwFVec2(64.0f, 64.0f)); // --HowTo: render only one layer at original pixel size //renderer->RenderLayer(0, offset, CIwFVec2(0.0f, 0.0f)); // --HowTo: render only one layer at scaled pixel size //renderer->RenderLayer(0, offset, CIwFVec2(64.0f, 64.0f)); // advance offset offset.x += 3; if (offset.x>1900) offset.x =0; // Standard EGL-style flush of drawing to the surface IwGxFlush(); IwGxSwapBuffers(); s3eDeviceYield(0); } delete renderer; delete map; Terminate(); // Return return 0; }
void Render() { // Clear the screen IwGxClear(IW_GX_COLOUR_BUFFER_F | IW_GX_DEPTH_BUFFER_F); gPM->DrawParticles(); gPM->Flush(); IwGxFlush(); IwGxSwapBuffers(); }
// Example showing how to use the s3eWwise extension int main() { IW_CALLSTACK("main"); s3eDebugOutputString("Booting s3eWwise example"); initWwise(); s3ePointerRegister(S3E_POINTER_BUTTON_EVENT, (s3eCallback)buttonEvent, NULL); s3ePointerRegister(S3E_POINTER_MOTION_EVENT, (s3eCallback)motionEvent, NULL); IwGxInit(); IwGxSetColClear(0, 0, 0, 0xff); while(!s3eDeviceCheckQuitRequest()) { std::stringstream str; s3eWwiseSoundEngineRenderAudio(); IwGxClear(); IwGxPrintString(100, 100, "s3eWwise"); IwGxPrintString(100, 300, "Touch to fire event"); str << "RPM = " << rpm; IwGxPrintString(100, 400, str.str().c_str()); str.str(std::string()); str << "TH = " << touchHeight; IwGxPrintString(100, 500, str.str().c_str()); str.str(std::string()); str << "Height = " << height; IwGxPrintString(100, 600, str.str().c_str()); str.str(std::string()); IwGxFlush(); IwGxSwapBuffers(); s3eDeviceYield(0); } IwGxTerminate(); s3ePointerUnRegister(S3E_POINTER_BUTTON_EVENT, (s3eCallback)buttonEvent); s3ePointerUnRegister(S3E_POINTER_MOTION_EVENT, (s3eCallback)motionEvent); shutdownWwise(); return 0; }
void ciclo() { if (g_Input.getSound()) g_Input.playSong(); while (!s3eDeviceCheckQuitRequest()) { if (g_Input.getLifes()<1) { gameOver(); } if (menuB) break; s3eDeviceBacklightOn(); g_Input.updateSound(); s3eDeviceYield(0); int64 start = s3eTimerGetMs(); bool result = BaconUpdate(); bool result2 = FondoUpdate(); IwGxClear(IW_GX_COLOUR_BUFFER_F | IW_GX_DEPTH_BUFFER_F); IwGxLightingOff(); FondoRender(); LifeStatusRender(); BaconRender(); insertaObstaculos(); spriteManager->render(); chuletas->render(); tank->render(); IwGxLightingOn(); FontLifeRender(); FontCoinsRender(); IwGxFlush(); IwGxSwapBuffers(); //g_Input.setScore(g_Input.getScore()+1); // Attempt frame rate /*while ((s3eTimerGetMs() - start) < MS_PER_FRAME) { int32 yield = (int32) (MS_PER_FRAME - (s3eTimerGetMs() - start)); if (yield<0) break; s3eDeviceYield(yield); }*/ } }
void Game::Render() { IwGxClear( IW_GX_COLOUR_BUFFER_F | IW_GX_DEPTH_BUFFER_F ); m_postProcessing->PreRender(); GameState::RenderCurrentState(); m_postProcessing->PostRender(); IwGxFlush(); IwGxSwapBuffers(); }
void Render() { // Clear the screen to a pale blue IwGxSetColClear(128, 224, 255, 0); IwGxClear(IW_GX_COLOUR_BUFFER_F | IW_GX_DEPTH_BUFFER_F); // Render the UI for (uint32 i = 0; i < BUTTON_COUNT; i++) { gButton[i]->Render(); } // Finish rendering and display on screen IwGxFlush(); IwGxSwapBuffers(); }
void render() { IwGxClear(); for (int index = 0; index < 4; ++index) { m_controllers[index].Render(); } IwGxPrintString(300, 50, g_debugButtonEvent); IwGxPrintString(300, 75, g_debugKeyEvent); IwGxPrintString(300, 100, g_debugMotionEvent); IwGxPrintString(300, 125, g_debugTouchEvent); IwGxPrintString(300, 150, g_debugTouchMotionEvent); IwGxFlush(); IwGxSwapBuffers(); }
void ExampleRender() { //IW_PROFILE_NEWFRAME(); CIwProfileIteratorDerived pProfileIterator(CIwProfileManager::Get().GetRoot()); pProfileIterator.First(); int iy = 30; while (!pProfileIterator.IsDone()) { PrintfProperty(10, iy, pProfileIterator.GetCurrentName(), pProfileIterator.GetCurrentLastTime()); pProfileIterator.Next(); iy += 10; } PrintfProperty(10, 90, "points: ", (float)m_pAnimator->GetCurrentSpline()->GetPointCount()); IW_PROFILE_START("render"); CIwMaterial* pMat; // Clear the screen IwGxClear(IW_GX_COLOUR_BUFFER_F | IW_GX_DEPTH_BUFFER_F); //// Allocate and initialise material from the IwGx global cache pMat = IW_GX_ALLOC_MATERIAL(); //// Set this as the active material IwGxSetMaterial(pMat); m_pSplinePoly2Tri->Render(); //IwGxSetColStream(s_Cols, 8); m_pBall->Render(); IwGxSetColStream(NULL); // End drawing IwGxFlush(); IW_PROFILE_STOP(); // Swap buffers IwGxSwapBuffers(); }
void CEndGameState::Render() { IW_CALLSTACK("CEndGameState::Render"); IwGxClear(IW_GX_COLOUR_BUFFER_F | IW_GX_DEPTH_BUFFER_F); GetWorld().Render(); IwGxLightingOff(); IwGxSetScreenSpaceOrg( &CIwSVec2::g_Zero ); CIwColour* cols = IW_GX_ALLOC(CIwColour, 4); memset(cols, 255, sizeof(CIwColour) * 4 ); if (GetWorld().GetUICar()->GetPosition() == 1 ) { CIwMaterial* mat = (CIwMaterial *)IwGetResManager()->GetGroupNamed("ui")->GetResNamed("youwin", IW_GX_RESTYPE_MATERIAL); IwGxSetMaterial(mat); } else { CIwMaterial* mat = (CIwMaterial *)IwGetResManager()->GetGroupNamed("ui")->GetResNamed("youlose", IW_GX_RESTYPE_MATERIAL); IwGxSetMaterial(mat); } const uint32 imageWidth = 128; const uint32 imageHeight = 32; CIwSVec2 XY( (int16)((IwGxGetScreenWidth()/2) - (imageWidth/2)), (int16)(IwGxGetScreenHeight()/4) ), dXY( (int16)imageWidth, (int16)imageHeight ); IwGxDrawRectScreenSpace(&XY, &dXY, cols); IwGxLightingOn(); IwGxFlush(); IwGxSwapBuffers(); #ifdef IW_DEBUG // Reset metrics for next frame IwGxMetricsReset(); #endif }
int main() { IwGxInit(); IwGxSetColClear(0, 0, 0xff, 0xff); while (!s3eDeviceCheckQuitRequest() && !(s3eKeyboardGetState(s3eKeyEsc) & S3E_KEY_STATE_DOWN) && !(s3eKeyboardGetState(s3eKeyAbsBSK) & S3E_KEY_STATE_DOWN)) { IwGxClear(); IwGxPrintString(120, 150, "Hello, World!"); IwGxFlush(); IwGxSwapBuffers(); s3eDeviceYield(0); } IwGxTerminate(); return 0; }
bool ExamplesMainUpdate() { s3eDeviceYield(0); s3eKeyboardUpdate(); s3ePointerUpdate(); int64 start = s3eTimerGetMs(); if (!ExampleUpdate() || ExampleCheckQuit()) { s3eDebugTracePrintf("ExampleUpdate returned false, exiting.."); return false; } // Clear the screen if (g_ClearScreen) IwGxClear(IW_GX_COLOUR_BUFFER_F | IW_GX_DEPTH_BUFFER_F); ButtonsRender(); if (g_DrawCursor) CursorRender(); SoftkeysRender(); // User code render ExampleRender(); // Attempt frame rate while ((s3eTimerGetMs() - start) < MS_PER_FRAME) { int32 yield = (int32) (MS_PER_FRAME - (s3eTimerGetMs() - start)); if (yield<0) break; s3eDeviceYield(yield); } IwGxFlush(); IwGxSwapBuffers(); return true; }
void CRenderer::Begin() { s3eDeviceYield(0); IwGxLightingOff(); //IwGxLightingAmbient(true); IwGxSetScreenSpaceOrg( &CIwSVec2::g_Zero ); //IwGxSetScreenSpaceSlot( 0 ); //IwGxLightingDiffuse( false ); IwGxClear(IW_GX_COLOUR_BUFFER_F | IW_GX_DEPTH_BUFFER_F); if (mIsResetDeviceparam) { mIsResetDeviceparam = false; UpdateDeviceParams(); if ( mOnResetparams != NULL ) { mOnResetparams(); } } ResetBuffers(); }
bool MapViewUpdate() { // Clear the screen IwGxClear(IW_GX_COLOUR_BUFFER_F | IW_GX_DEPTH_BUFFER_F); renderMap(); renderMapPlayer(); renderMapXpBar(); renderMapHealth(); Player* player = getGameState()->getPlayer(); IntroState introState = getGameState()->getIntroState(); if (lastLoses < player->getLoseCount() || lastWins < player->getWinCount()) { lastLoses = player->getLoseCount(); lastWins = player->getWinCount(); mapGhost2->setCentre(CIwFVec2(IwGxGetScreenWidth()*0.80f, IwGxGetScreenHeight()*0.70f)); mapGhost2->setNotice(false); if (introState == INTRO_DEFEND) { mapGhost2->moveGhost(CIwFVec2(IwGxGetScreenWidth()/2, IwGxGetScreenHeight()/2), arrivalCallback); } } if (introState == INTRO_ATTACK) { mapGhost->Update(); mapGhost->Render(); } mapGhost2->Update(); mapGhost2->Render(); IwGxFlush(); IwGxSwapBuffers(); return true; }
//----------------------------------------------------------------------------- void ExampleRender() { // Clear screen IwGxClear( IW_GX_COLOUR_BUFFER_F | IW_GX_DEPTH_BUFFER_F ); // Render text int sx = 10; int sy = 40; std::list<Request *>::const_iterator e = manager.get_queue().end(); std::list<Request *>::const_iterator i = manager.get_queue().begin(); int count = 0; for( ; i != e; i++ ) { char buf[1024]; const char *name = HTTPStatusName[(*i)->get_state()]; snprintf(buf, 1023, "%d) %s: %s/%d (%s)",count,(*i)->get_url().c_str(),name,(*i)->get_content_length(),(*i)->get_errmsg().c_str()); IwGxPrintString(sx, sy, buf, true); sy += 20; count++; } // Swap buffers IwGxFlush(); IwGxSwapBuffers(); }
bool CameraViewUpdate() { if (viewFightInitRequired()) initFightView(); bool ghostAvailable = getGameState()->getGhost() != NULL; // Clear the screen IwGxClear(IW_GX_COLOUR_BUFFER_F | IW_GX_DEPTH_BUFFER_F); if (ghostAvailable && (!gameIsHalt() || getGameState()->getGhost()->isDead())) { updateGhost(); } renderCamera(); setupPlayer(); if (ghostAvailable) renderGhost(); playerAttackView->Render(); playerHit->Render(); manaBar->Render(); cameraDefend->Update(); cameraDefend->Render(); tutorialView->Render(); IwGxFlush(); IwGxSwapBuffers(); IwGxTickUpdate(); return true; }
void MapBackground::DownloadTiles() { CIwTexture* tx = (CIwTexture*)IwGetResManager()->GetResNamed("logo", IW_GX_RESTYPE_TEXTURE); uint32 w1 = tx->GetWidth(); uint32 h1 = tx->GetHeight(); //static CIwSVec2 uvs[4] = //{ // CIwSVec2(0 << 12, 0 << 12), // CIwSVec2(0 << 12, 1 << 12), // CIwSVec2(1 << 12, 1 << 12), // CIwSVec2(1 << 12, 0 << 12), //}; static CIwSVec2 uvs[4] = { CIwSVec2((0 << 12) + 10, (0 << 12) + 10), CIwSVec2((0 << 12) + 10, (1 << 12) - 10), CIwSVec2((1 << 12) - 10, (1 << 12) - 10), CIwSVec2((1 << 12) - 10, (0 << 12) + 10), }; int w = w1/2; int h = h1/2; int counter = 0; while (true) { IwGetHTTPQueue()->Update(); IwGetNotificationHandler()->Update(); IwGetMultiplayerHandler()->Update(); IwGxClear(IW_GX_COLOUR_BUFFER_F | IW_GX_DEPTH_BUFFER_F); CIwMaterial* pMat = IW_GX_ALLOC_MATERIAL(); pMat->SetModulateMode(CIwMaterial::MODULATE_NONE); pMat->SetTexture(tx); IwGxSetMaterial(pMat); CIwMat rotMat; rotMat.SetIdentity(); double perCentAngle = (counter / 80.0); iwangle degAng = (iwangle)(IW_GEOM_ONE * perCentAngle); rotMat.SetRotZ(degAng); rotMat.t.z = -0x200; IwGxSetViewMatrix(&rotMat); CIwSVec3* pWSCoords= IW_GX_ALLOC(CIwSVec3, 4); pWSCoords[0].x = -w; pWSCoords[0].y = -h; pWSCoords[1].x = -w; pWSCoords[1].y = h; pWSCoords[2].x = w; pWSCoords[2].y = h; pWSCoords[3].x = w; pWSCoords[3].y = -h; pWSCoords[0].z = pWSCoords[1].z = pWSCoords[2].z = pWSCoords[3].z = 0; if (!g_bInProgress) { MapTile* pNextDownload = GetNextDownload(NULL); if (pNextDownload) { IwGetNotificationHandler()->PushNotification((int)this, pNextDownload->szImageUrl, 10*1000); g_bInProgress = true; LoadMapTileImage(pNextDownload); } else { IwGetNotificationHandler()->ClearNotification((int)this); break; } } IwGxSetVertStreamWorldSpace(pWSCoords, 4); IwGxSetUVStream(uvs); IwGxDrawPrims(IW_GX_QUAD_LIST, NULL, 4); IwGetNotificationHandler()->Render(); IwGxFlush(); IwGxSwapBuffers(); s3eDeviceYield(50); counter++; } }
void Transitions2D::Slide(DIR d, uint8 transitionSpeed, bool skipFirstAndLastFrame) { IwGxSetColClear(0, 0, 0, 0); if (mStartTexture == NULL || mEndTexture == NULL) return; if (transitionSpeed == 0) transitionSpeed = 1; IwGxScreenOrient orient = IwGxGetScreenOrient(); if (isUsingPrivateTextures) IwGxSetScreenOrient(IW_GX_ORIENT_NONE); CIwMaterial* startMat; CIwMaterial* endMat; int w = mStartTexture->GetWidth(); int h = mStartTexture->GetHeight(); int pos = 0; int speed, size; if (d == LEFT || d == RIGHT) { speed = (int)((transitionSpeed * w) / 255.0); size = w; } else { speed = (int)((transitionSpeed * h) / 255.0); size = h; } if (skipFirstAndLastFrame) pos += speed; while (pos < size) { IwGxClear(); if (d == LEFT) { startMat = IW_GX_ALLOC_MATERIAL(); startMat->SetTexture(mStartTexture); IwGxSetMaterial(startMat); IwGxDrawRectScreenSpace(&CIwSVec2(-pos, 0), &CIwSVec2(mStartTexture->GetWidth(), mStartTexture->GetHeight())); endMat = IW_GX_ALLOC_MATERIAL(); endMat->SetTexture(mEndTexture); IwGxSetMaterial(endMat); IwGxDrawRectScreenSpace(&CIwSVec2(-pos + size, 0), &CIwSVec2(mEndTexture->GetWidth(), mEndTexture->GetHeight())); } else if (d == RIGHT) { endMat = IW_GX_ALLOC_MATERIAL(); endMat->SetTexture(mEndTexture); IwGxSetMaterial(endMat); IwGxDrawRectScreenSpace(&CIwSVec2(pos - size, 0), &CIwSVec2(mEndTexture->GetWidth(), mEndTexture->GetHeight())); startMat = IW_GX_ALLOC_MATERIAL(); startMat->SetTexture(mStartTexture); IwGxSetMaterial(startMat); IwGxDrawRectScreenSpace(&CIwSVec2(pos, 0), &CIwSVec2(mStartTexture->GetWidth(), mStartTexture->GetHeight())); } else if (d == UP) { startMat = IW_GX_ALLOC_MATERIAL(); startMat->SetTexture(mStartTexture); IwGxSetMaterial(startMat); IwGxDrawRectScreenSpace(&CIwSVec2(0, -pos), &CIwSVec2(mStartTexture->GetWidth(), mStartTexture->GetHeight())); endMat = IW_GX_ALLOC_MATERIAL(); endMat->SetTexture(mEndTexture); IwGxSetMaterial(endMat); IwGxDrawRectScreenSpace(&CIwSVec2(0, -pos + size), &CIwSVec2(mEndTexture->GetWidth(), mEndTexture->GetHeight())); } else if (d == DOWN) { endMat = IW_GX_ALLOC_MATERIAL(); endMat->SetTexture(mEndTexture); IwGxSetMaterial(endMat); IwGxDrawRectScreenSpace(&CIwSVec2(0, pos - size), &CIwSVec2(mEndTexture->GetWidth(), mEndTexture->GetHeight())); startMat = IW_GX_ALLOC_MATERIAL(); startMat->SetTexture(mStartTexture); IwGxSetMaterial(startMat); IwGxDrawRectScreenSpace(&CIwSVec2(0, pos), &CIwSVec2(mStartTexture->GetWidth(), mStartTexture->GetHeight())); } IwGxFlush(); IwGxSwapBuffers(); s3eDeviceYield(40); pos += speed; } if (!skipFirstAndLastFrame) { IwGxClear(); endMat = IW_GX_ALLOC_MATERIAL(); endMat->SetTexture(mEndTexture); IwGxSetMaterial(endMat); IwGxDrawRectScreenSpace(&CIwSVec2(0, 0), &CIwSVec2(mEndTexture->GetWidth(), mEndTexture->GetHeight())); IwGxFlush(); IwGxSwapBuffers(); } if (isUsingPrivateTextures) { delete mStartTexture; delete mEndTexture; mStartTexture = NULL; mEndTexture = NULL; } IwGxSetScreenOrient(orient); }
void Desktop::update() { IwGxClear(IW_GX_COLOUR_BUFFER_F | IW_GX_DEPTH_BUFFER_F); }
void Transitions2D::Fade(uint8 transitionSpeed, bool skipFirstAndLastFrame) { IwGxSetColClear(0, 0, 0, 0); if (mStartTexture == NULL || mEndTexture == NULL) return; if (transitionSpeed == 0) transitionSpeed = 1; IwGxScreenOrient orient = IwGxGetScreenOrient(); if (isUsingPrivateTextures) IwGxSetScreenOrient(IW_GX_ORIENT_NONE); int alpha = 0; if (skipFirstAndLastFrame) alpha += transitionSpeed; CIwMaterial* startMat; CIwMaterial* endMat; while (alpha <= 255) { IwGxClear(); startMat = IW_GX_ALLOC_MATERIAL(); startMat->SetTexture(mStartTexture); IwGxSetMaterial(startMat); IwGxDrawRectScreenSpace(&CIwSVec2(0, 0), &CIwSVec2(mStartTexture->GetWidth(), mStartTexture->GetHeight())); endMat = IW_GX_ALLOC_MATERIAL(); endMat->SetTexture(mEndTexture); endMat->SetAlphaMode(CIwMaterial::ALPHA_BLEND); endMat->SetColAmbient(255, 255, 255, alpha); IwGxSetMaterial(endMat); IwGxDrawRectScreenSpace(&CIwSVec2(0, 0), &CIwSVec2(mEndTexture->GetWidth(), mEndTexture->GetHeight())); IwGxFlush(); IwGxSwapBuffers(); s3eDeviceYield(40); alpha += transitionSpeed; } if (!skipFirstAndLastFrame) { IwGxClear(); endMat = IW_GX_ALLOC_MATERIAL(); endMat->SetTexture(mEndTexture); IwGxSetMaterial(endMat); IwGxDrawRectScreenSpace(&CIwSVec2(0, 0), &CIwSVec2(mEndTexture->GetWidth(), mEndTexture->GetHeight())); IwGxFlush(); IwGxSwapBuffers(); } if (isUsingPrivateTextures) { delete mStartTexture; delete mEndTexture; mStartTexture = NULL; mEndTexture = NULL; } IwGxSetScreenOrient(orient); }
void doMain() { if(s3ePointerGetInt(S3E_POINTER_MULTI_TOUCH_AVAILABLE)){ s3ePointerRegister(S3E_POINTER_TOUCH_EVENT, (s3eCallback)MultiTouchButtonCB, NULL); s3ePointerRegister(S3E_POINTER_TOUCH_MOTION_EVENT, (s3eCallback)MultiTouchMotionCB, NULL); } else { s3ePointerRegister(S3E_POINTER_BUTTON_EVENT, (s3eCallback)SingleTouchButtonCB, NULL); s3ePointerRegister(S3E_POINTER_MOTION_EVENT, (s3eCallback)SingleTouchMotionCB, NULL); } IwGetResManager()->LoadGroup("resource_groups/palate.group"); palateGroup = IwGetResManager()->GetGroupNamed("Palate"); std::vector<int> ui_texture_hashes; uint background_hash = IwHashString("background_clean"); CIwResList* resources = palateGroup->GetListHashed(IwHashString("CIwTexture")); for(CIwManaged** itr = resources->m_Resources.GetBegin(); itr != resources->m_Resources.GetEnd(); ++itr) { if(background_hash != (*itr)->m_Hash) { ui_texture_hashes.push_back((*itr)->m_Hash); } } CIwMaterial* background = new CIwMaterial(); background->SetTexture((CIwTexture*)palateGroup->GetResNamed("background_clean", IW_GX_RESTYPE_TEXTURE)); background->SetModulateMode(CIwMaterial::MODULATE_NONE); background->SetAlphaMode(CIwMaterial::ALPHA_DEFAULT); unit_ui = new CIwMaterial(); unit_ui->SetModulateMode(CIwMaterial::MODULATE_NONE); unit_ui->SetAlphaMode(CIwMaterial::ALPHA_DEFAULT); unit_ui->SetTexture((CIwTexture*)palateGroup->GetResNamed("TAKE2", IW_GX_RESTYPE_TEXTURE)); CIwSVec2 bg_wh(320, 480); CIwSVec2 ui_wh(80, 480); CIwSVec2 ui_offset(240, 0); CIwSVec2 uv(0, 0); CIwSVec2 duv(IW_GEOM_ONE, IW_GEOM_ONE); init(); IwGxLightingOff(); IwGxSetColClear(255, 255, 255, 255); float worldScrollMultiplier = 0.75; if(s3eDeviceGetInt(S3E_DEVICE_OS) == S3E_OS_ID_IPHONE) { worldScrollMultiplier = 0.925; } while (1) { int64 start = s3eTimerGetMs(); s3eDeviceYield(0); s3eKeyboardUpdate(); s3ePointerUpdate(); if ((s3eKeyboardGetState(s3eKeyEsc) & S3E_KEY_STATE_DOWN) || (s3eKeyboardGetState(s3eKeyAbsBSK) & S3E_KEY_STATE_DOWN) || (s3eDeviceCheckQuitRequest())) { break; } switch(currentState) { case MAIN_MENU: if(s3ePointerGetState(S3E_POINTER_BUTTON_SELECT) & S3E_POINTER_STATE_PRESSED) { currentState = IN_GAME; } if(frameCount % FRAMES_PER_UPDATE == 0) { mainMenu->tick(); } mainMenu->render(); break; case IN_GAME: IwGxSetMaterial(background); IwGxSetScreenSpaceSlot(-1); IwGxDrawRectScreenSpace(&CIwSVec2::g_Zero, &bg_wh, &uv, &duv); IwGxSetMaterial(unit_ui); IwGxSetScreenSpaceSlot(1); IwGxDrawRectScreenSpace(&ui_offset, &ui_wh, &uv, &duv); if (worldScrollSpeed > .0005 || worldScrollSpeed < -.0005) { game->rotate(worldScrollSpeed); worldScrollSpeed *= worldScrollMultiplier; } if(frameCount % FRAMES_PER_UPDATE == 0) { game->tick(); } game->render(); if(!renderTouches()) { break; } break; } IwGxFlush(); IwGxSwapBuffers(); // Attempt frame rate while ((s3eTimerGetMs() - start) < MS_PER_FRAME){ int32 yield = (MS_PER_FRAME - (s3eTimerGetMs() - start)); if (yield < 0) { break; } s3eDeviceYield(yield); } frameCount++; IwGxClear(IW_GX_COLOUR_BUFFER_F | IW_GX_DEPTH_BUFFER_F); } delete game; delete mainMenu; delete localPlayer; delete opponentPlayer; delete background; delete unit_ui; palateGroup->Finalise(); for(int i = 0; i < MAX_TOUCHES; ++i) if(touches[i].unit) delete touches[i].unit; }
int main(int, char**) { IwGxInit(); // Setup Dear ImGui binding IMGUI_CHECKVERSION(); ImGui::CreateContext(); ImGuiIO& io = ImGui::GetIO(); (void)io; //io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls ImGui_Marmalade_Init(true); // Setup style ImGui::StyleColorsDark(); //ImGui::StyleColorsClassic(); // Load Fonts // - If no fonts are loaded, dear imgui will use the default font. You can also load multiple fonts and use ImGui::PushFont()/PopFont() to select them. // - AddFontFromFileTTF() will return the ImFont* so you can store it if you need to select the font among multiple. // - If the file cannot be loaded, the function will return NULL. Please handle those errors in your application (e.g. use an assertion, or display an error and quit). // - The fonts will be rasterized at a given size (w/ oversampling) and stored into a texture when calling ImFontAtlas::Build()/GetTexDataAsXXXX(), which ImGui_ImplXXXX_NewFrame below will call. // - Read 'misc/fonts/README.txt' for more instructions and details. // - Remember that in C/C++ if you want to include a backslash \ in a string literal you need to write a double backslash \\ ! //io.Fonts->AddFontDefault(); //io.Fonts->AddFontFromFileTTF("../../misc/fonts/Roboto-Medium.ttf", 16.0f); //io.Fonts->AddFontFromFileTTF("../../misc/fonts/Cousine-Regular.ttf", 15.0f); //io.Fonts->AddFontFromFileTTF("../../misc/fonts/DroidSans.ttf", 16.0f); //io.Fonts->AddFontFromFileTTF("../../misc/fonts/ProggyTiny.ttf", 10.0f); //ImFont* font = io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\ArialUni.ttf", 18.0f, NULL, io.Fonts->GetGlyphRangesJapanese()); //IM_ASSERT(font != NULL); bool show_demo_window = true; bool show_another_window = false; ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f); // Main loop while (true) { if (s3eDeviceCheckQuitRequest()) break; // Poll and handle inputs // You can read the io.WantCaptureMouse, io.WantCaptureKeyboard flags to tell if dear imgui wants to use your inputs. // - When io.WantCaptureMouse is true, do not dispatch mouse input data to your main application. // - When io.WantCaptureKeyboard is true, do not dispatch keyboard input data to your main application. // Generally you may always pass all inputs to dear imgui, and hide them from your application based on those two flags. s3eKeyboardUpdate(); s3ePointerUpdate(); // Start the Dear ImGui frame ImGui_Marmalade_NewFrame(); ImGui::NewFrame(); // 1. Show the big demo window (Most of the sample code is in ImGui::ShowDemoWindow()! You can browse its code to learn more about Dear ImGui!). if (show_demo_window) ImGui::ShowDemoWindow(&show_demo_window); // 2. Show a simple window that we create ourselves. We use a Begin/End pair to created a named window. { static float f = 0.0f; static int counter = 0; ImGui::Begin("Hello, world!"); // Create a window called "Hello, world!" and append into it. ImGui::Text("This is some useful text."); // Display some text (you can use a format strings too) ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our window open/close state ImGui::Checkbox("Another Window", &show_another_window); ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float using a slider from 0.0f to 1.0f ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color if (ImGui::Button("Button")) // Buttons return true when clicked (most widgets return true when edited/activated) counter++; ImGui::SameLine(); ImGui::Text("counter = %d", counter); ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate); ImGui::End(); } // 3. Show another simple window. if (show_another_window) { ImGui::Begin("Another Window", &show_another_window); // Pass a pointer to our bool variable (the window will have a closing button that will clear the bool when clicked) ImGui::Text("Hello from another window!"); if (ImGui::Button("Close Me")) show_another_window = false; ImGui::End(); } // Rendering ImGui::Render(); IwGxSetColClear(clear_color.x * 255, clear_color.y * 255, clear_color.z * 255, clear_color.w * 255); IwGxClear(); ImGui_Marmalade_RenderDrawData(ImGui::GetDrawData()); IwGxSwapBuffers(); s3eDeviceYield(0); } // Cleanup ImGui_Marmalade_Shutdown(); ImGui::DestroyContext(); IwGxTerminate(); return 0; }
void Graphics::preRender() { IwGxClear(IW_GX_COLOUR_BUFFER_F | IW_GX_COLOUR_BUFFER_F); IwGxLightingOff(); }
void N2F::Iw3D::Iw2DHelper::ClearScreen() { IwGxClear(); return; }