bool HelloWorldUpdate() { if(s3eKeyboardGetState(s3eKeyBack) & S3E_KEY_STATE_RELEASED) { s3eDebugTraceLine("back check"); std::hash_map<char*, char*>::iterator ihashMap; if(hashMap.size() > 1) { ihashMap = hashMap.find("ShowAt"); if(ihashMap->second == "both"){ vservManagerFetchingAdData(); }else if(ihashMap->second == "end") { vservManagerFetchingAdData(); } else if(ihashMap->second == "start"){ s3eDeviceExit(); return false; } } } if(CheckButtonStatus("Exit") & S3E_KEY_STATE_RELEASED) /*S3E_KEY_STATE_PRESSED)*/ { s3eDebugTraceLine("Exit check"); HelloWorldShutDown(); return false; } return true; }
void CameraViewInit() { // Camera field of view IwGxSetPerspMul((float) IwGxGetScreenWidth() / 1.3); IwGxSetFarZNearZ(0x2000,0x10); ghost_Model = NULL; ghostCollision = NULL; ghost_Skin = NULL; ghost_Skel = NULL; for (int i = 0; i < 5; i++) { ghost_Anims[i] = NULL; } ghostMatrix = NULL; ghost_Player = NULL; // Initiate collision builder before loading models IW_CLASS_REGISTER(GhostCollision); #ifdef IW_BUILD_RESOURCES IwGetModelBuilder()->SetPostBuildFn(&BuildCollision); #endif LoadSkelman(); LoadViking(); // Set up camera capture if (s3eCameraAvailable()) { // Register callback to receive camera frames s3eCameraRegister(S3E_CAMERA_UPDATE_STREAMING, frameReceived, NULL); // Request medium sized image (for decent frame rate) with a platform independent format s3eCameraStart(S3E_CAMERA_STREAMING_SIZE_HINT_MEDIUM, S3E_CAMERA_PIXEL_TYPE_RGB565_CONVERTED, S3E_CAMERA_STREAMING_QUALITY_HINT_MED); } else { s3eDebugTraceLine("Camera Extension not available!"); } tutorialView->setTutorial(getFightTutorial()); }
void createButton(char* p_btnName) { // Draw button area int fontWidth = s3eDebugGetInt(S3E_DEBUG_FONT_WIDTH); int x,y,width; if(p_btnName != NULL && strlen(p_btnName) > 1) width = strlen(p_btnName)*fontWidth+10; int height = 40; //x = IwGxGetScreenWidth() - width; x = s3eSurfaceGetInt(S3E_SURFACE_WIDTH) - width; y = 2; if (!(s3ePointerGetState(S3E_POINTER_BUTTON_SELECT) & S3E_POINTER_STATE_UP)) { int pointerx = s3ePointerGetX(); int pointery = s3ePointerGetY(); if (pointerx >=x && pointerx <= x+width && pointery >=y && pointery <= y+height) { if (s3ePointerGetState(S3E_POINTER_BUTTON_SELECT) & S3E_POINTER_STATE_DOWN) { keyPressedState = S3E_KEY_STATE_DOWN; } if (s3ePointerGetState(S3E_POINTER_BUTTON_SELECT) & S3E_POINTER_STATE_PRESSED) { keyPressedState = S3E_KEY_STATE_PRESSED; } if (s3ePointerGetState(S3E_POINTER_BUTTON_SELECT) & S3E_POINTER_STATE_RELEASED) { keyPressedState = S3E_KEY_STATE_RELEASED; s3eDebugTraceLine("-------------Example Update Key Released-------------------"); } } } if (s3ePointerGetState(S3E_POINTER_BUTTON_SELECT) & S3E_POINTER_STATE_RELEASED) { char color[64] = "`xe0ff00"; char* dispText = strcat(color,p_btnName); s3eDebugPrint(x+5, 20, dispText, 0); } if (s3ePointerGetInt(S3E_POINTER_AVAILABLE)) { if (keyPressedState == S3E_KEY_STATE_DOWN) { char color[64] = "`xe0ff00"; char* dispText = strcat(color,p_btnName); s3eDebugPrint(x+5, 20, dispText, 0); } else if(keyPressedState == S3E_KEY_STATE_PRESSED) { DrawButtonRect(x, y, width, height,97,97,249); char color[64] = "`xe0ff00"; char* dispText = strcat(color,p_btnName); s3eDebugPrint(x+5, 20, dispText, 0); } else if(keyPressedState == S3E_KEY_STATE_RELEASED) { s3eSurfaceClear(0,0,0); char color[64] = "`xe0ff00"; char* dispText = strcat(color,p_btnName); s3eDebugPrint(x+5, 20, dispText, 0); } else { char color[64] = "`xD8F809"; char* dispText = strcat(color,p_btnName); s3eDebugPrint(x+5, 20, dispText, 0); } } }
int32 MapBackground::GotData(void* pDownloaderVoid, void* pThisAndTileVoid) { CIwHTTP* pDownloader = (CIwHTTP*)pDownloaderVoid; ThisAndTile* pThisAndTile = (ThisAndTile*)pThisAndTileVoid; MapBackground* pThis = pThisAndTile->pThis; MapTile* pMapTile = pThisAndTile->pTile; // This is the callback indicating that a ReadContent call has // completed. Either we've finished, or a bigger buffer is // needed. If the correct ammount of data was supplied initially, // then this will only be called once. However, it may well be // called several times when using chunked encoding. // Firstly see if there's an error condition. if (pDownloader->GetStatus() == S3E_RESULT_ERROR) { // Something has gone wrong //status = kOK; s3eDebugTraceLine("Error downloading tile data - error"); } else if (pDownloader->ContentReceived() != pDownloader->ContentLength()) { s3eDebugTraceLine("Error downloading tile data - length"); // We have some data but not all of it. We need more space. uint32 oldLen = pThis->gResultLen; // If iwhttp has a guess how big the next bit of data is (this // basically means chunked encoding is being used), allocate // that much space. Otherwise guess. if (pThis->gResultLen < pDownloader->ContentExpected()) { pThis->gResultLen = pDownloader->ContentExpected(); } else { pThis->gResultLen += 1024; } // Allocate some more space and fetch the data. pThis->gResult = (char*)s3eRealloc(pThis->gResult, pThis->gResultLen); pDownloader->ReadContent(&pThis->gResult[oldLen], pThis->gResultLen - oldLen, &MapBackground::GotData); } else { // Put the results pointer returned from CIwHTTP::Get into a s3eFile then create an CIwImage _STL::string imageType; bool isJpg = false; bool isValid = false; pDownloader->GetHeader("content-type", imageType); if (strstr(imageType.c_str(), "image/jpeg")) { isJpg = true; isValid = true; } else if (strstr(imageType.c_str(), "image/png")) { isJpg = false; isValid = true; } else { // we got a 404 isValid = false; } if (pThis->gResult) { pThis->CreateMapTileImage(pMapTile, pThis->gResult, pThis->gResultLen, isJpg); if (isValid) { pThis->SaveMapTileImage(pMapTile, pThis->gResult, pThis->gResultLen, isJpg); } } } pThis->g_bInProgress = false; pMapTile->bInProgress = false; return 0; }