void WorldMap::drawAndUpdateCurrentScreen(sf::RenderWindow& mainWindow){ if (Static::toDelete.size() > 0){ freeSpace(gameMainVector,player->worldX,player->worldY); freeSpace(dungeonVector, player->worldX, player->worldY); freeSpace(secretRoomVector, player->worldX, player->worldY); //used when teleporting from one layer point to another layer differnet point such as triforce. freeSpace(gameMainVector, player->prevWorldX, player->prevWorldY); freeSpace(dungeonVector, player->prevWorldX, player->prevWorldY); freeSpace(secretRoomVector, player->prevWorldX, player->prevWorldY); } if(player->currentLayer==OverWorld){ if(player->movePlayerToNewVector) movePlayerToDifferentRoomVector(player->prevWorldX, player->prevWorldY, player->worldX, player->worldY); drawScreen(mainWindow, &gameBackgroundVector[player->worldX][player->worldY]); for(auto& obj : gameMainVector[player->worldX][player->worldY]) { if (!player->movePlayerToNewVector){ //if true the current vector may have changed mid loop since worldX/worldY //may be udpated(Teleport to Artifact room for example) //->unpredictable errors in other object update from previous vector. obj->update(&gameMainVector[player->worldX][player->worldY]); obj->draw(mainWindow); } } if (Static::toAdd.size()>0) addToGameVector(&gameMainVector[player->worldX][player->worldY]); } else if(player->currentLayer == InsideShop) { if(player->movePlayerToNewVector) movePlayerToDifferentRoomVector(player->prevWorldX, player->prevWorldY, player->worldX, player->worldY); drawScreen(mainWindow, &secretRoomBackgroundVector[player->worldX][player->worldY]); for(auto& obj : secretRoomVector[player->worldX][player->worldY]) { if (!player->movePlayerToNewVector){ obj->update(&secretRoomVector[player->worldX][player->worldY]); obj->draw(mainWindow); } } if (Static::toAdd.size()>0) addToGameVector(&secretRoomVector[player->worldX][player->worldY]); } else if(player->currentLayer == Dungeon) { if(player->movePlayerToNewVector) movePlayerToDifferentRoomVector(player->prevWorldX, player->prevWorldY, player->worldX, player->worldY); drawScreen(mainWindow, &dungeonBackgroundVector[player->worldX][player->worldY]); for(auto& obj : dungeonVector[player->worldX][player->worldY]) { if (!player->movePlayerToNewVector){ obj->update(&dungeonVector[player->worldX][player->worldY]); obj->draw(mainWindow); } } if (Static::toAdd.size()>0) addToGameVector(&dungeonVector[player->worldX][player->worldY]); } }
//-------------------------------------------------------------- void testApp::draw(){ switch (state) { case STATE_TENT: drawTent(); break; case STATE_MODEL: drawModel(); break; case STATE_SCREEN: drawScreen(); break; default: break; } switch (state) { case STATE_TENT: case STATE_MODEL: { ofSetColor(255); string msg = string("Using mouse inputs to navigate ('m' to toggle): ") + (cam.getMouseInputEnabled() ? "YES" : "NO"); msg += "\nfps: " + ofToString(ofGetFrameRate(), 2); ofDrawBitmapString(msg, 10, 20); } break; case STATE_SCREEN: break; default: break; } }
void game::run(){ //TODO nanti harus diganti init(); drawCanvas(0,0,0,255); drawTextCentered("GRAPHICAT",9,50,3,255,0,0,255); drawTextCentered("PLANE SHOOTER",13,150,3,255,0,0,255); drawTextCentered("Press A or D to move ship left or right",39,250,1,255,0,0,255); drawTextCentered("Press J or L to rotate the ship turret",38,300,1,255,0,0,255); drawTextCentered("Press Space to shoot",20,350,1,255,0,0,255); drawTextCentered("Press Q to change weapon",24,400,1,255,0,0,255); printToScreen(); sleep(5); while (!gameOver()){ updateControls(); updateLogic(); drawScreen(); usleep(200); } usleep(500); drawTextCentered("YOU WIN",7,300,5,255,0,0,255); printToScreen(); usleep(500); finishPrinter(); resetTermios(); sleep(2); }
void drawSplashScreen(const std::string &filename){ if(splashScreen.ID) gl::DeleteTextures(1, &splashScreen.ID); else { ResourceLoader loader; loader.reloadShader("ApplyFBO"); splashScreen = loader.loadImage(filename); glfwShowWindow(Global::main.window); glfwSetWindowPos(Global::main.window, Global::main.screenSize.x/2.f - splashScreen.width/2, Global::main.screenSize.y/2.f - splashScreen.height/2); glfwSetWindowSize(Global::main.window, splashScreen.width, splashScreen.height); } gl::Viewport(0, 0, splashScreen.width, splashScreen.height); gl::ClearColor(0.f, 0.f, 0.f, 0.f); gl::Clear(gl::COLOR_BUFFER_BIT); gl::DepthMask(gl::FALSE_); gl::Enable(gl::BLEND); gl::BlendFunc(gl::SRC_ALPHA, gl::ONE_MINUS_SRC_ALPHA); gl::BindBuffer(gl::ARRAY_BUFFER, 0); gl::DisableVertexAttribArray(0); gl::BindFramebuffer(gl::DRAW_FRAMEBUFFER, 0); auto shader = assets::getShader("ApplyFBO"); shader.bind(); float width = Global::main.size.x; float height = Global::main.size.y; shader.texture("uTexture", splashScreen.ID); drawScreen(); glfwSwapBuffers(Global::main.window); CHECK_FOR_ERRORS }
void ovenGraphScreen::initScreen (void) { int8_t error; //*****Buttons*************************************************************/ error = myBui.btns.initBtn (TOTAL_BUTTONS); if (error < 0) myBui.error ("Button"); myBui.btns.addBtn (STOP_BTN, 635, 395, 150, 65, &scrColors.btn_c, "Stop"); myBui.btns.addBtn (START_BTN, 635, 395, 150, 65, &scrColors.barGFill_c, "Start", &scrColors.bckgnd_c); myBui.btns.addBtn (ACK_BTN, _LEFT + 220, 395, 230, 65, &scrColors.btn_c); myBui.btns.disableBtn (ACK_BTN); for (uint8_t i = 0; i < (TOTAL_BUTTONS - PREHEAT_H_BOX); ++i) myBui.btns.addHitBox (i + PREHEAT_H_BOX, _BOX_LEFT, i * 65 + 60, 130, 15); //*****Text Box************************************************************/ error = myBui.textBox.initTextBox(NUM_T_BOX); if (error < 0) myBui.error ("Text Box"); myBui.textBox.addTextBox (TEMPERATURE_T_BOX, _LEFT, 395, 100); myBui.textBox.addTextBox (RUNTIME_T_BOX, _LEFT, 435, 100); myBui.textBox.addTextBox (SETPOINT_T_BOX, _LEFT + 110, 395, 100); myBui.textBox.addTextBox (STAGE_T_BOX, _LEFT + 110, 435, 100); for (uint8_t i = 0; i < (NUM_T_BOX - PREHEAT_T_BOX); ++i) myBui.textBox.addTextBox (i + PREHEAT_T_BOX, _BOX_LEFT, i * 65 + 60, 130, 15); drawScreen (); drawn = true; }
void PBR(Camera &camera){ GPU_SCOPE_TIMER(); setupFBO_11_withDepth(Textures::HDRScene); gl::Disable(gl::BLEND); gl::Enable(gl::DEPTH_TEST); gl::DepthMask(gl::FALSE_); gl::DepthFunc(gl::NOTEQUAL); gl::ClearColor(0.0,0.0,0.0,0.0); gl::Clear(gl::COLOR_BUFFER_BIT); auto shader = assets::getShader("PBR"); shader.bind(); shader.uniform("uInvPV", camera.invPV); shader.uniform("uEye", camera.position.xyz()); shader.uniform("uViewDir", camera.at.xyz()); shader.uniform("uPixelSize", Global::main.pixelSize); shader.uniform("uLightScale", 1.f); // shader.texture("uNormal", Textures::normalBuffer, 0); // shader.texture("uDepth", Textures::depthBuffer, 1); shader.texture("uColor", Textures::colorBuffer, 0); shader.texture("uLight", Textures::LightIntensity, 1); shader.texture("uSpecular", Textures::Specular, 2); drawScreen(); gl::DepthFunc(gl::LEQUAL); CHECK_FOR_ERRORS }
void BbvsEngine::loadScene(int sceneNum) { debug(0, "BbvsEngine::loadScene() sceneNum: %d", sceneNum); Common::String sprFilename = Common::String::format("vnm/vspr%04d.vnm", sceneNum); Common::String gamFilename = Common::String::format("vnm/game%04d.vnm", sceneNum); _screen->clear(); _spriteModule->load(sprFilename.c_str()); _gameModule->load(gamFilename.c_str()); Palette palette = _spriteModule->getPalette(); _screen->setPalette(palette); // Preload sounds for (uint i = 0; i < _gameModule->getPreloadSoundsCount(); ++i) { Common::String filename = Common::String::format("snd/snd%05d.aif", _gameModule->getPreloadSound(i)); _sound->loadSound(filename); } if (sceneNum >= kMainMenu) { DrawList drawList; drawList.add(_gameModule->getBgSpriteIndex(0), 0, 0, 0); _screen->drawDrawList(drawList, _spriteModule); drawScreen(); } }
void GenericSkin::mouseMultiReleased(int x, int y) { if(mTouchedInside) { mTouchedInside = false; mIsSimulatingMultiTouch = false; // blits the current screen again since the // two multi touch markers will othervise be // visible. drawScreen(); if( x>=screenRect.x && x<screenRect.x+screenRect.w && y>=screenRect.y && y<screenRect.y+screenRect.h) { mListener->onMoSyncPointerRelease(x-screenRect.x, y-screenRect.y, 0); mListener->onMoSyncPointerRelease(x-screenRect.x, y-screenRect.y, 1); return; } return; } if(!mPressedKey) return; mListener->onMoSyncKeyRelease(mPressedKey); keyReleased(mPressedKey); mPressedKey = 0; }
void mainLoop() { while(1) { updateTime(); handleEvents(); if(network != NULL) network->timepass(); tracker.timepass(); if (activeFrame) activeFrame->timepass(); if(engine != NULL) { if(engine->controller) engine->controller->timepass(getDt()); if(engine->view) engine->view->timepass(getDt()); for(unsigned ii=0; ii < engine->aiPlayers.size(); ii++) engine->aiPlayers[ii]->timepass(getDt()); } drawScreen(); if(shouldDestroyEngine) { if(engine) { delete engine; engine = NULL; } if(network) { delete network; network = NULL; } shouldDestroyEngine = false; } } }
void mainLoop(Cryptogram *cr) { WINDOW *main = initscr(); WINDOW *menu = subwin(main, 1, COLS, 0, 0); WINDOW *message = subwin(main, LINES-4, COLS, 1, 0); WINDOW *alphabet = subwin(main, 3, COLS, LINES-3, 0); start_color(); init_pair(1, COLOR_GREEN, COLOR_BLACK); init_pair(2, COLOR_BLUE, COLOR_BLACK); init_pair(3, COLOR_WHITE, COLOR_BLACK); char opt; while (1) { drawScreen(menu, message, alphabet, cr); wmove(main, 0, strlen(MENUBAR)); wrefresh(main); noecho(); opt = getch(); echo(); if ( (opt=='q') || (opt=='Q') ) break; handleKey(opt, menu, message, alphabet, cr); } endwin(); }
void ToltecsEngine::updateScreen() { _sound->updateSpeech(); _screen->updateShakeScreen(); // TODO: Set quit flag if (shouldQuit()) return; if (!_movieSceneFlag) updateInput(); else _mouseButton = 0; // TODO? Check keyb _counter01--; if (_counter01 <= 0) { _counter01 = MIN(_counter02, 30); _counter02 = 0; drawScreen(); _flag01 = 1; _counter02 = 1; } else { _flag01 = 0; } static uint32 prevUpdateTime = 0; uint32 currUpdateTime; do { currUpdateTime = _system->getMillis(); _counter02 = (currUpdateTime - prevUpdateTime) / 13; } while (_counter02 == 0); prevUpdateTime = currUpdateTime; }
/** * Method for handling events that do not have predefined methods. */ void customEvent(const MAEvent& event) { // If the event type is screen changed we update the display. if (EVENT_TYPE_SCREEN_CHANGED == event.type) { drawScreen(); } }
void emulationLoop() { cpucycle(&p); if ((&p)->drawflag) { glClear(GL_COLOR_BUFFER_BIT); drawScreen(); (&p)->drawflag = 0; } }
void QVFbView::viewportPaintEvent( QPaintEvent *pe ) { QRect r( pe->rect() ); r.moveBy( contentsX(), contentsY() ); r = QRect(int(r.x()/zm),int(r.y()/zm), int(r.width()/zm)+1,int(r.height()/zm)+1); setDirty(r); drawScreen(); }
/* MARK: - Activate and Deactivate */ void activate(void) { moduleActivated = 1; /* create three empty screens */ lcd_screens_create(3); activeDisplay = TIDE_DISPLAY_STATE_GRAPH; lcd_screen_activate(activeDisplay); drawScreen(); }
void buttonDown(void) { if (activeDisplay <= 0) activeDisplay = 2; else activeDisplay = (activeDisplay - 1) % 3; lcd_screen_activate(activeDisplay); drawScreen(); }
/** * Constructor. */ MyMoblet() { // Set the orientation mode to dynamic, so that it is possible to switch // between portrait and landscape orientations. You can also use these // syscalls to lock the screen in PORTRAIT or LANDSCAPE mode. maScreenSetSupportedOrientations(MA_SCREEN_ORIENTATION_DYNAMIC); // Update the display. drawScreen(); }
void MDCWindow::incLevel() { loadLevel(++currentLevel); drawScreen(); if(currentLevel == 0xFF) { ui->IncLevelButton->setDisabled(true); } ui->DecLevelButton->setEnabled(true); ui->LevelLabel->setText(QString().setNum(currentLevel, 16).toUpper()); }
int simTick() { if (KEY_DOWN_NOW(BUTTON_SELECT)) { while (KEY_DOWN_NOW(BUTTON_SELECT)) { } return 0; } drawScreen(); waitForVBlank(); flipPage(); return 1; }
int Screen::select(int max){ int v=1; // initialize the interaction loop to run bool continue_looping = true; // draw the current screen drawScreen(v); do { // draw the new screen refresh(); // obtain character from keyboard int ch = getch(); // operate based on input character switch (ch) { case KEY_UP: if(v>0) //arrow goes up v--; if(v==0) //arrow goes to bottom v=max; break; case KEY_DOWN: if(v<max+1) //arrows goes down v++; if(v==max+1) //arrow goes back to top v=1; break; case 10: //Enter Key continue_looping = false; break; } drawScreen(v); } while(continue_looping); return v; }
void ShadowVolume::draw(Vector4<float> lightPos, Vector3<float> cameraPos, const Vector3<float> *ownerVertex) { Vector3<double> cameraPosD; cameraPosD.x = (double)cameraPos.x; cameraPosD.y = (double)cameraPos.y; cameraPosD.z = (double)cameraPos.z; calcShadowVolume(lightPos, ownerVertex, shadowPos, 8); glDisable(GL_LIGHTING); glDisable(GL_LIGHT0); //ここからステンシルシャドウの処理 glEnable(GL_STENCIL_TEST); glDepthMask(GL_FALSE); glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); glStencilFuncSeparate(GL_FRONT_AND_BACK, GL_ALWAYS, 0, ~0); glStencilOpSeparate(GL_FRONT, GL_KEEP, GL_KEEP, GL_INCR_WRAP);//表面は「+1」 glStencilOpSeparate(GL_BACK, GL_KEEP, GL_KEEP, GL_DECR_WRAP);//裏面は「-1」 //シャドーボリュームを描画する glBegin(GL_TRIANGLE_FAN); glVertex3f(lightPos.x, lightPos.y, lightPos.z); for(int loop = 0; loop < 3;++loop) { glVertex3f(shadowPos[loop].x, shadowPos[loop].y, shadowPos[loop].z); } glVertex3f(shadowPos[0].x, shadowPos[0].y, shadowPos[0].z); glEnd(); glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); glDepthMask(GL_TRUE); glStencilFunc(GL_NOTEQUAL, 0, ~0); //ステンシル値が0じゃない部分が影 glStencilOp( GL_KEEP, GL_KEEP, GL_KEEP ); ////ステンシルバッファを可視化 glPushMatrix(); //Tracball::getInstance().applyOfShadow(); glDepthMask(GL_FALSE); glEnable(GL_BLEND); //ブレンド有効化 glColor4f(0.0f, 0.0f, 0.0f, 0.5f); drawScreen(30, cameraPosD, 1); //スクリーン描画(fovy,znearをわたす) glColor4f(1.0f, 1.0f, 1.0f, 1.0f); glDisable(GL_BLEND); //ブレンド無効化 glDepthMask(GL_TRUE); glPopMatrix(); glDisable(GL_STENCIL_TEST); glEnable(GL_LIGHTING); glEnable(GL_LIGHT0); }
void QVFbView::setZoom( double z ) { if ( zm != z ) { zm = z; setDirty(QRect(0,0,hdr->width,hdr->height)); resizeContents( int(hdr->width*z), int(hdr->height*z) ); updateGeometry(); qApp->sendPostedEvents(); topLevelWidget()->adjustSize(); drawScreen(); } }
void MDCWindow::actionOpen_ROM() { // Get the filepath of a file to open from the user QString fileName = QFileDialog::getOpenFileName(this, tr("Open ROM"), "", tr("SNES ROM images (*.smc *.sfc);; All files (*.*)")); // If the file was selected, open it if(fileName.compare("")) { // Creae a file object from the filename QFile openedFile(fileName); // Catch a failed attempt to open the file in read-only mode if(!openedFile.open(QIODevice::ReadOnly)) { QMessageBox::critical(this, "Failed to open ROM!", "The file \"" + fileName + "\" could not be opened!"); return; } // Read contents of the file into a byte array QByteArray tempFileData(openedFile.readAll()); openedFile.close(); // Validate the file size QString errorMSG(validateROM(tempFileData)); if(errorMSG.compare("")) { QMessageBox::critical(this, "Failed to open ROM!", errorMSG); return; } // Enable all disable controls ui->actionSave_ROM->setEnabled(true); ui->actionLoad_Level->setEnabled(true); ui->SaveFileButton->setEnabled(true); ui->OpenLevelButton->setEnabled(true); ui->IncLevelButton->setEnabled(true); ui->LevelLabel->setText("0"); // Set globals to the opened data file = tempFileData; header = file.size() % 0x100000; setWindowTitle(QFileInfo(openedFile).fileName().append(" - My Dream Course")); // Load level 0 as the default level currentLevel = 0; loadLevel(currentLevel); // Draw the screen after level 0 has been loaded drawScreen(); } }
int main(int argc, char** argv) { //const SDL_VideoInfo info = NULL; SDL1.2 int width = 0; int height = 0; int bpp = 0; int flags = 0; if (SDL_Init(SDL_INIT_VIDEO) < 0) { std::cout << "\nVideo initialization failed"; quit(1); } width = 640; height = 480; SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5); // at least 5bpp SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 5); SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5); SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16); SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); //flags = SDL_OPENGL; SDL_Window *mWindow = SDL_CreateWindow("SDL project", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, width, height, SDL_WINDOW_OPENGL);// | SDL_WINDOW_FULLSCREEN if (mWindow == NULL)//Verify window quit(1); SDL_GLContext renderingContex = SDL_GL_CreateContext(mWindow); if (renderingContex == NULL)//Verify rendering contex quit(1); setupOpengl(width, height); //Main loop while (true) { processEvents(); drawScreen(mWindow); } return 0; }
void endEditing(void) { /* calculate minutes left for next low */ uint16_t nextLowMinutes = timeInMinutes(enteredTimeOfNextLow); uint16_t nowInMinutes = timeNowInMinutes(); uint16_t diff = nextLowMinutes - nowInMinutes; if (diff < 0) { /* the next low is tomorrow! */ diff = (twentyFourHoursInMinutes - nowInMinutes) + nextLowMinutes; } tide = timeFromMinutes(diff); editModeActivated = 0; display_clear(0, 0); drawScreen(); }
int ECCalibrateScreen::handleScreen() { int pressed_button = myButtons.checkButtons(); if (pressed_button==backButton) { handleExitScreen(); return EC_BUTTON; } if (pressed_button==resetButton) { factoryReset(); } if (pressed_button==infoButton) { getInfo(); } if (pressed_button==readButton) { getSingleReading(); } if (pressed_button==tempReadButton) { getTempSingleReading(); } if (pressed_button==startButton) { setStartMode(); } if (pressed_button==stopButton) { setStopMode(); } if (pressed_button==calibrateButton) { startCalibration(); } if (pressed_button==subBackButton && !factReset) { drawScreen(); } factReset = false; return NONE; }
int PlugScreen::handleScreen() { //return handleScreenButtons(myButtons.checkButtons()); int pressed_button = myButtons.checkButtons(); if (pressed_button==back2SetupButton) { NewRemoteReceiver::deinit(); return BACK2SETUP_BUTTON; } if (pressed_button==lightsButton) { resetButtons(); drawPrepareScreen(); plugDevice.lights = true; NewRemoteReceiver::init(RECEIVER_PIN, 1, waitForReceiver); Serial.println("PlugScreen::handlePlugScreen SET TIMER \n"); } if (pressed_button==heaterButton) { resetButtons(); drawPrepareScreen(); plugDevice.heater = true; NewRemoteReceiver::init(RECEIVER_PIN, 1, waitForReceiver); } if (pressed_button==pumpButton) { resetButtons(); drawPrepareScreen(); plugDevice.pump = true; NewRemoteReceiver::init(RECEIVER_PIN, 1, waitForReceiver); } if (pressed_button==settingsButton) { NewRemoteReceiver::deinit(); return PLUGS_SETTINGS_BUTTON; } if (pressed_button==exitButton) { NewRemoteReceiver::deinit(); drawScreen(); } Serial.println("PlugScreen::handlePlugScreen end \n"); }
int main(void) { color_t color = Black; uint16_t pen = 0; halInit(); chSysInit(); gdispInit(); ginputGetMouse(0); gdispSetOrientation(GDISP_ROTATE_90); drawScreen(); while (TRUE) { ginputGetMouseStatus(0, &ev); if (!(ev.current_buttons & GINPUT_MOUSE_BTN_LEFT)) continue; /* inside color box ? */ if(ev.y >= OFFSET && ev.y <= COLOR_SIZE) { if(GET_COLOR(0)) color = Black; else if(GET_COLOR(1)) color = Red; else if(GET_COLOR(2)) color = Yellow; else if(GET_COLOR(3)) color = Green; else if(GET_COLOR(4)) color = Blue; else if(GET_COLOR(5)) color = White; /* inside pen box ? */ } else if(ev.x >= OFFSET && ev.x <= PEN_SIZE) { if(GET_PEN(1)) pen = 0; else if(GET_PEN(2)) pen = 1; else if(GET_PEN(3)) pen = 2; else if(GET_PEN(4)) pen = 3; else if(GET_PEN(5)) pen = 4; /* inside drawing area ? */ } else if(DRAW_AREA(ev.x, ev.y)) { if(pen == 0) gdispDrawPixel(ev.x, ev.y, color); else gdispFillCircle(ev.x, ev.y, pen, color); } } }
void lodoovka_redraw() { draw_desktop(); window_sref sref = window_stack; if(window_stack) { do { window_draw(sref->wnd); } while((sref = sref->next)); } draw_plusbtn(); drawScreen(); }
void QVFbView::timeout() { lock(); if ( animation ) { QRect r( hdr->update ); r = r.intersect( QRect(0, 0, hdr->width, hdr->height ) ); if ( r.isEmpty() ) { animation->appendBlankFrame(); } else { int l; QImage img = getBuffer( r, l ); animation->appendFrame(img,QPoint(r.x(),r.y())); } } if ( hdr->dirty ) { drawScreen(); } unlock(); }