int main(int argc,char** argv) { int width=400,height=300,w=20,x,y; double r,phi=0; rfbScreenInfoPtr server=rfbGetScreen(&argc,argv,width,height,8,3,4); server->frameBuffer=(char*)malloc(width*height*4); initBackground(server); server->deferUpdateTime=0; rfbInitServer(server); r=0; while(1) { if(r<=0) { initBackground(server); rfbMarkRectAsModified(server,0,0,width,height); r=0.43; phi=0; } else { r-=0.0001; phi+=0.02; if(phi>2*M_PI) phi-=2*M_PI; } x=width*(0.5+cos(phi)*r); y=height*(0.5+sin(phi)*r); if(x>=0 && y>=0 && x+w<=width && y+w<=height) { unsigned int dx=width*0.5*(1-cos(phi)*r)-x, dy=height*0.5*(1-sin(phi)*r)-y; rfbDoCopyRect(server,x,y,x+w,y+w,-dx,-dy); } rfbProcessEvents(server,50000); } return(0); }
void initGame(int stg) { status = IN_GAME; initShip(); initShots(); initFoes(); initFrags(); initBonuses(); initBackground(); initBarrages(stagePrm[stg][0], stagePrm[stg][1], stagePrm[stg][2]); initGameState(stg); if ( stg < STAGE_NUM ) { setStageBackground(stg%5+1); playMusic(stg%5+1); } else { if ( !insane ) { setStageBackground(0); playMusic(0); } else { setStageBackground(6); playMusic(6); } } }
Tutorial::Tutorial(sf::RenderWindow& window, ResourceManager& resourceManager, SoundManager& soundManager) : loopState(WAIT) , firstFadingFrame(false) , fadeIndexA(0) , fadeIndexB(1) , ANIMATION_SPEED(350) , TIME_TO_WAIT_TILL_NEXT_SWITCH(8.f) // in seconds , alpha1(255) , alpha2(0) , window(&window) , resourceManager(&resourceManager) , soundManager(&soundManager) , goToMenu(false) , leftMouseClicked(false) , rightMouseClicked(false) { initBackground(); background[0].setTexture(resourceManager.getTexture(ResourceManager::SPLASH_SCREEN)); background[1].setTexture(resourceManager.getTexture(ResourceManager::TUT1)); background[2].setTexture(resourceManager.getTexture(ResourceManager::TUT2)); background[3].setTexture(resourceManager.getTexture(ResourceManager::TUT3)); background[4].setTexture(resourceManager.getTexture(ResourceManager::TUT4)); background[5].setTexture(resourceManager.getTexture(ResourceManager::TUT5)); background[6].setTexture(resourceManager.getTexture(ResourceManager::TUT6)); background[7].setTexture(resourceManager.getTexture(ResourceManager::TUT7)); background[8].setTexture(resourceManager.getTexture(ResourceManager::TUT8)); background[9].setTexture(resourceManager.getTexture(ResourceManager::TUT9)); skipToMenuButton.setPosition(WINDOW_WIDTH_TO_CALCULATE - 250.f, 15.f); skipToMenuButton.setSize(sf::Vector2f(338.f * 0.7f , 73.f * 0.7f)); skipToMenuButton.setTexture(resourceManager.getTexture(ResourceManager::TEXT_SPRITE)); skipToMenuButton.setTextureRect(resourceManager.getTextureRect(ResourceManager::TEXT_SKIP_TO_MENU)); skipToMenuButton.setFillColor(sf::Color::Black); }
UserDesktopDlg::UserDesktopDlg(const User& user, const QSize& size, QWidget * parent/* = 0*/) : QDialog(parent, QT_DEFAULT_DIALOG_HINTS | Qt::WindowMinMaxButtonsHint | Qt::WindowSystemMenuHint) , m_autosize(false) { ui.setupUi(this); setWindowIcon(QIcon(APPICON)); this->resize(size); ui.userdesktopWidget->setUserID(user.nUserID); connect(this, SIGNAL(userDesktopWindowUpdate(int,int)), ui.userdesktopWidget, SLOT(slotDesktopUpdate(int,int))); connect(ui.userdesktopWidget, SIGNAL(userDesktopWindowEnded(int)), SIGNAL(userDesktopWindowEnded(int))); connect(this, SIGNAL(userDesktopCursorUpdate(int,const DesktopInput&)), ui.userdesktopWidget, SLOT(slotDesktopCursorUpdate(int,const DesktopInput&))); connect(this, SIGNAL(userUpdated(const User&)), ui.userdesktopWidget, SLOT(slotUserUpdated(const User&))); ui.userdesktopWidget->slotDesktopUpdate(user.nUserID, -1); slotUserUpdate(user); initBackground(); #if defined(Q_OS_DARWIN) setMacResizeMargins(this, ui.horizontalLayout); #endif }
bool ChatOnBedRoom::init() { if (!Layer::init()) { return false; } initBackground(); mMe = PersonManager::getInstance()->getMe(); this->addChild(mMe, 10); mSpouse = PersonManager::getInstance()->getSpouse(); this->addChild(mSpouse, 10); mMe->setPosition(Point(MyInitLocationX, InitLocationY)); mSpouse->setPosition(Point(SpouseInitLocationX, InitLocationY)); mMe->setFaceLeft(true); mSpouse->setFaceLeft(false); mMe->getScaleX() > 0 ? mMe->setScaleX(ChatPersonScaleX) : mMe->setScaleX(-ChatPersonScaleX); mMe->setScaleY(ChatPersonScaleY); mSpouse->getScaleX() > 0 ? mSpouse->setScaleX(ChatPersonScaleX) : mSpouse->setScaleX(-ChatPersonScaleX); mSpouse->setScaleY(ChatPersonScaleY); mMe->play(Person::Action::STAND); mSpouse->play(Person::Action::STAND); return true; }
int main(int argc, char* args[]) { int mainsurfX = 90; int mainsurfY = 75; GameData data; initGameData(data, mainsurfX, mainsurfY); data.RPG = initLevelData( "rpg", mainsurfX, mainsurfY); SetConsWinSize(mainsurfX*9, mainsurfY*10); new_GFSurface* surf = initBackground(mainsurfX, mainsurfY, CC_Cyan); pushGameSuface(data, *surf); Tasker tasker = processPrepair(); processPush(tasker, activeRPG, "RPG"); processPush(tasker, activeGraphic, "graph"); while (true) { processIterator(data, tasker); } return 0; }
// on "init" you need to initialize your instance bool MainScene::init() { ////////////////////////////// // 1. super init first if ( !Layer::init() ) { return false; } initBackground(); curEquipment = NULL; Size winSize = Director::getInstance()->getWinSize(); Vec2 origin = Director::getInstance()->getVisibleOrigin(); TableView* tableView = TableView::create(this, Size(winSize.width, 200)); tableView->setDirection(ScrollView::Direction::HORIZONTAL); tableView->setAnchorPoint(Vec2::ANCHOR_MIDDLE); tableView->setPosition(Point(winSize.width*0.2 + origin.x, winSize.height/2 + origin.y - 50)); tableView->setDelegate(this); this->addChild(tableView); tableView->reloadData(); auto listener = EventListenerKeyboard::create(); listener->onKeyReleased = CC_CALLBACK_2(MainScene::onKeyReleased,this); Director::getInstance()->getEventDispatcher()->addEventListenerWithSceneGraphPriority(listener,this); return true; }
int dispThread(SceSize args, void *argp) { sceIoChdir(cwd); initBackground(); while (exit_state != EXCEPTION) { if (exit_state) { setFadeMode(&main_fade,FADE_IN,0); if (getFadeState(&main_fade) == FADE_DONE) break; } if (checkGameState(GSQUARE)) { g2dClear(BLACK); dispgSquare(); } if (checkGameState(BANNER)) { g2dClear(BLACK); dispBanner(); } if (checkGameState(MENU)) { drawMovingBackground(); dispMenu(); } if (checkGameState(INGAME)) { drawMovingBackground(); camera(); drawLevel(); drawUI(); } if (checkGameState(LEVEL_TITLE)) { g2dClear(WHITE); intraFontSetStyle(seriffont,1.f,BLACK,0,0,INTRAFONT_ALIGN_CENTER); intraFontPrint(seriffont,G2D_SCR_W/2,G2D_SCR_H/2,lvl.title); } if (checkGameState(END)) { g2dClear(WHITE); g2dBeginRects(img.end); { g2dAdd(); } g2dEnd(); } drawFade(&main_fade); g2dFlip(G2D_VSYNC); } if (exit_state == EXCEPTION) dispException(); return 0; }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) , m_defaultMasterDelay(5) , m_defaultLoginDelay(15) , m_defaultLength(8) , m_removeText(tr("&Remove URL && User")) , m_saveText(tr("&Save URL && User")) , m_saveToolTip(tr("Save current URL & User. Passwords are not saved.")) , m_removeToolTip(tr("Don't remember current URL & User anymore.")) , m_masterPasswordText(tr("<b>Master password:</b>")) , m_masterDelay(m_defaultMasterDelay) , m_loginDelay(m_defaultLoginDelay) , m_autoCopy(false) , m_autoClear(false) , m_alwaysOnTop(true) , m_masterEdit(new QLineEdit(this)) , m_masterLabel(new QLabel(this)) , m_userEdit(new QLineEdit(this)) , m_passwdEdit(new QLineEdit(this)) , m_urlCombo(new QComboBox(this)) , m_genButton(new QPushButton(tr("&Show password!"), this)) , m_saveButton(new QPushButton(m_saveText, this)) , m_lengthSpinBox(new QSpinBox(this)) , m_masterTimer(new QTimer) , m_timeLine(new QTimeLine) , m_settingsDlg(new SettingsDlg(this)) { setWindowTitle("Fleeting Password Manager"); setWindowIcon(QIcon(":/fleetingpm.png")); initWidgets(); initMenu(); initBackground(); loadSettings(); // Apply window flags if (m_alwaysOnTop) { setWindowFlags(windowFlags() | Qt::WindowStaysOnTopHint); } // Initialize the timer used when fading out the login details. m_timeLine->setDuration(m_loginDelay * 1000); connect(m_timeLine, SIGNAL(frameChanged(int)), this, SLOT(decreasePasswordAlpha(int))); connect(m_timeLine, SIGNAL(finished()), this, SLOT(invalidateAll())); m_timeLine->setFrameRange(0, 255); // Initialize the timer used when showing the // master password. m_masterTimer->setInterval(m_masterDelay * 60 * 1000); m_masterTimer->setSingleShot(true); connect(m_masterTimer, SIGNAL(timeout()), m_masterEdit, SLOT(clear())); connect(m_masterEdit, SIGNAL(textChanged(QString)), m_masterTimer, SLOT(start())); // Load previous location or center the window. centerOrRestoreLocation(); }
void AssassinWar::gameRun() { setWindowState(Qt::WindowFullScreen); initBackground(MapManager::instance().getMapBackground(m_pGameScreen->getMapName())); m_bIsAWRun = true; }
bool BackgroundLayer::init(void) { if (!Layer::init()) { return false; } initBackground(); return true; }
void Tutorial::reset() { goToMenu = false; fadeIndexA = 1; fadeIndexB = 2; initBackground(); background[1].setFillColor(sf::Color(255, 255, 255, 255)); // set second screen opaqe }
void SmoothMeter::draw() { int value = (int)lrint(_smoothValue); float angle = angleForValue(_smoothValue, _max) * 180 / M_PI; if (0 == _backgroundTexture) { glGenTextures(1, &_backgroundTexture); glBindTexture(GL_TEXTURE_RECTANGLE_ARB, _backgroundTexture); initBackground(_w, _h, _max); } if (0 == _needleTexture) { glGenTextures(1, &_needleTexture); glBindTexture(GL_TEXTURE_RECTANGLE_ARB, _needleTexture); initNeedle(_w, _h, _max); } if (0 == _legendTexture) { _legendTexture = CreateTextureWithLabel(_legend, 36, false, LEGEND_WIDTH, LEGEND_HEIGHT); } glEnable(GL_TEXTURE_RECTANGLE_ARB); glMatrixMode(GL_TEXTURE); glPushMatrix(); glLoadIdentity(); glScalef(_w, _h, 1); glMatrixMode(GL_MODELVIEW); glBindTexture(GL_TEXTURE_RECTANGLE_ARB, _backgroundTexture); DrawQuad(_w* -0.5, _h* -0.5, _w, _h); glBindTexture(GL_TEXTURE_RECTANGLE_ARB, _needleTexture); glPushMatrix(); glRotatef(angle, 0, 0, 1); DrawQuad(_w* -0.5, _h* -0.5, _w, _h); glPopMatrix(); glMatrixMode(GL_TEXTURE); glPopMatrix(); glMatrixMode(GL_MODELVIEW); glBindTexture(GL_TEXTURE_RECTANGLE_ARB, 0); glDisable(GL_TEXTURE_RECTANGLE_ARB); glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, _legendTexture); DrawQuadInverted(-0.5 * LEGEND_WIDTH, -220, LEGEND_WIDTH, LEGEND_HEIGHT); // FIXME purge unused values, or don't use the global cache glBindTexture(GL_TEXTURE_2D, value_texture_for(value)); DrawQuadInverted(-0.5 * VALUE_WIDTH, -110, VALUE_WIDTH, VALUE_HEIGHT); glBindTexture(GL_TEXTURE_2D, 0); glDisable(GL_TEXTURE_2D); }
void AssassinWar::showMainWin() { resize(MAIN_WIN_WIDTH, MAIN_WIN_WIDTH / 2); initBackground(BACKGROUND_IMG); move((m_iScreenWidth - MAIN_WIN_WIDTH) / 2, (m_iScreenHeight - (MAIN_WIN_WIDTH / 2)) / 2); setMouseTracking(true); }
//初期化 bool GameLayer::init() { if (!Layer::init()) return false; initBackground(); //背景の初期化 initBalls(); //ボールの初期表示 return true; }
bool GamePlayScene::init() { if (!Layer::init()) { return false; } initBackground(); initGameBoard(); initNavigator(); initTouchListener(); return true; }
bool MainGameLayer::init() { isLeftTouched = false; isSwipeStart = false; iSwipeStartY = 0; iSwipeEndY = 0; // Touch Director* director = Director::getInstance(); director->getTouchDispatcher()->addTargetedDelegate(this, 0, true); // box2d physics Box2dDirectorLayer* box2dDL = Box2dDirectorLayer::create(); addChild(box2dDL, 1, kTagLayerBox2dD); // background initBackground(); // HUD initHUD(); // Particles _bladeSparkle = ParticleSystemQuad::create("Particles/blade_sparkle.plist"); _bladeSparkle->stopSystem(); addChild(_bladeSparkle, 3); // Sounds SimpleAudioEngine::getInstance()->preloadEffect("Sounds/swoosh.caf"); SimpleAudioEngine::getInstance()->preloadEffect("Sounds/squash.caf"); SimpleAudioEngine::getInstance()->preloadEffect("Sounds/toss_consecutive.caf"); SimpleAudioEngine::getInstance()->preloadEffect("Sounds/toss_simultaneous.caf"); SimpleAudioEngine::getInstance()->preloadEffect("Sounds/toss_bomb.caf"); SimpleAudioEngine::getInstance()->preloadEffect("Sounds/lose_life.caf"); SimpleAudioEngine::getInstance()->playBackgroundMusic("Sounds/nature_bgm.aifc"); _timeCurrent = 0; //// TMX /*TileMapLayer* tilemapL = TileMapLayer::create(); addChild(tilemapL, 1, kTagTileMap); tilemapL->createWithTMX("grassMap.tmx"); */ //addMissionaries(); // polygon sprite /*PolygonSprite *sprite = (new Watermelon())->initWithWorld(box2dDL->world); addChild(sprite, 1); sprite->activateCollisions();*/ // Raycast //_raycastCallback = new RaycastCallback(); return true; }
void handle_events(object_list * L){ SDL_Event event; SDL_Surface *superman = NULL; SDL_Rect supermanCoord, backgroundCoord, pipeCoord; SDL_Surface *background = NULL; int continuer = 1; int collisionSupermanEdge = 0; int collisionSupermanPipe = 0; int collision = 0; background = SDL_LoadBMP("background.bmp"); backgroundCoord = initBackground(backgroundCoord); superman = SDL_LoadBMP("superman.bmp"); SDL_SetColorKey(superman, SDL_SRCCOLORKEY, SDL_MapRGB(superman->format,0 ,255 ,0)); supermanCoord = initSuperman(supermanCoord); while(continuer){ SDL_PollEvent(&event); switch(event.type){ case SDL_QUIT: continuer = 0; break; case SDL_KEYDOWN: switch(event.key.keysym.sym){ case SDLK_SPACE: supermanCoord.y -= 3; break; default: break; } } supermanCoord.y += 1; collisionSupermanPipe = printAllPipe(L, supermanCoord); //superman tape un tuyau collisionSupermanEdge = !checkCollide(supermanCoord, backgroundCoord); //superman sort de l'écran collision = collisionSupermanPipe || collisionSupermanEdge; //OU logique entre les 2 collisions possibles if(collision == 0){ //pas de collision moveAllPipe(L); SDL_BlitSurface(background, NULL, screen, &backgroundCoord); SDL_BlitSurface(superman, NULL, screen, &supermanCoord); printAllPipe(L, supermanCoord); } else{ freeList(L); init(); } SDL_Flip(screen); } SDL_FreeSurface(background); SDL_FreeSurface(superman); }
void initTitle(void) { startSectionTransition(); stopMusic(); app.delegate.logic = &logic; app.delegate.draw = &draw; memset(&app.keyboard, 0, sizeof(int) * MAX_KEYBOARD_KEYS); battle.camera.x = battle.camera.y = 0; destroyBattle(); logo = getTexture("gfx/title/logo.png"); pandoranWar = getTexture("gfx/title/pandoran.png"); background = getTexture("gfx/backgrounds/background02.jpg"); earthTexture = getTexture("gfx/planets/earth.png"); earth.x = rand() % SCREEN_WIDTH; earth.y = -(128 + (rand() % 128)); initBackground(); initEffects(); initFighters(); updateAllMissions(); getWidget("campaign", "title")->action = campaign; getWidget("challenges", "title")->action = challenges; getWidget("trophies", "title")->action = trophies; getWidget("stats", "title")->action = stats; getWidget("fighterDB", "title")->action = fighterDatabase; getWidget("options", "title")->action = options; getWidget("credits", "title")->action = credits; getWidget("quit", "title")->action = quit; getWidget("ok", "stats")->action = ok; getWidget("ok", "trophies")->action = ok; getWidget("ok", "fighterDB")->action = ok; show = SHOW_TITLE; endSectionTransition(); playMusic("music/main/Rise of spirit.ogg", 0); }
bool LevelSelection::init() { if (!CCLayer::init()) { return false; } initMembers(); initBackground(); initMenu(); return true; }
void GameOver::onEnter() { Layer::onEnter(); //背景を表示 initBackground(); initMenu(); initShowScore(); }
void initTitle() { int stg; status = TITLE; stg = initTitleAtr(); initBoss(); initShip(); initLasers(); initFrags(); initShots(); initBackground(0); initTitleStage(stg); left = -1; }
void initTitle() { int stg; status = TITLE; stg = initTitleAtr(); initShip(); initShots(); initFrags(); initBonuses(); initBackground(); setStageBackground(1); initTitleStage(stg); }
bool MarketScene::init() { bool bRet = false; do { CC_BREAK_IF(!CCScene::init()); initBackground(); initLabelAtlas(); initButton(); scheduleUpdate(); bRet = true; } while (0); return bRet; }
/* on "init" you need to initialize your instance */ bool GameMenuScene::init() { ////////////////////////////// // 1. super init first if (!Layer::init()) { return false; } initEnvironment(); initBackground(); initMainMenu(); initAircraft(); return true; }
bool GameLayer::init() { //NULLIFY! ground = NULL; m_world = NULL; cannon = NULL; background = NULL; backgroundLight = NULL; //SET WIN SIZE winSize = Director::getInstance()->getVisibleSize(); worldStartX = 0; worldEndX = 5*winSize.width/3; worldHeight = worldEndX; perspectiveX = (3*winSize.width)/4; trajectoryFrames = 0; if ( !Layer::init() ) return false; directionPoint.Set( 100, 100 ); globalScale = 0.5; //INIT BACKGROUND initBackground(); //INIT BOX2D initBox2D(); //CREATE GROUND initGround(); //GENERATE CLOUDS generateClouds(); //CREATE CANNON initCannon(); //GENERATE ENEMIES generateEnemies(); this->setTouchEnabled(true); this->schedule( schedule_selector(GameLayer::tick) ); return true; }
DockAppItem::DockAppItem(QWidget *parent) : DockItem(parent) { m_appManager = new DBusDockedAppManager(this); m_dockModeData = DockModeData::instance(); connect(m_dockModeData, &DockModeData::dockModeChanged,this, &DockAppItem::onDockModeChanged); setFixedSize(m_dockModeData->getNormalItemWidth(), m_dockModeData->getItemHeight()); initAppIcon(); initBackground(); initTitle(); m_appIcon->raise(); initClientManager(); initPreviewContainer(); }
BackgroundSpawnScheduler::BackgroundSpawnScheduler(FightLayer* field) { this->field = field; cave = (BackgroundSpawnSchedulerTimer*)malloc(sizeof(BackgroundSpawnSchedulerTimer) * 9); cave[0] = BackgroundSpawnSchedulerTimer(EnumBackground::CAVE_1_0, field, this, 5, EnumBackground::ArrangePosition::FIXED); cave[1] = BackgroundSpawnSchedulerTimer(EnumBackground::CAVE_1_1, field, this, 3, EnumBackground::ArrangePosition::RANDOM); cave[2] = BackgroundSpawnSchedulerTimer(EnumBackground::CAVE_1_2, field, this, 3, EnumBackground::ArrangePosition::RANDOM); cave[3] = BackgroundSpawnSchedulerTimer(EnumBackground::CAVE_1_3, field, this, 3, EnumBackground::ArrangePosition::RANDOM); cave[4] = BackgroundSpawnSchedulerTimer(EnumBackground::CAVE_2_0, field, this, 5, EnumBackground::ArrangePosition::FIXED); cave[5] = BackgroundSpawnSchedulerTimer(EnumBackground::CAVE_2_1, field, this, 3, EnumBackground::ArrangePosition::RANDOM); cave[6] = BackgroundSpawnSchedulerTimer(EnumBackground::CAVE_2_2, field, this, 3, EnumBackground::ArrangePosition::RANDOM); cave[7] = BackgroundSpawnSchedulerTimer(EnumBackground::CAVE_2_3, field, this, 3, EnumBackground::ArrangePosition::RANDOM); cave[8] = BackgroundSpawnSchedulerTimer(EnumBackground::CAVE_2_4, field, this, 5, EnumBackground::ArrangePosition::RANDOM); pole = BackgroundSpawnSchedulerTimer(EnumBackground::POLE, field, this, 2, EnumBackground::ArrangePosition::FIXED); tile = BackgroundSpawnSchedulerTimer(EnumBackground::TILE, field, this, 0.5f, EnumBackground::ArrangePosition::FIXED); tile.setTimer(1.5); backgroundSpeed = new float(-100); initBackground(); }
//初期化 bool GameLayer::init() { if (!Layer::init()) return false; // シングルタップイベントの取得 auto touchListener = EventListenerTouchOneByOne::create(); touchListener->setSwallowTouches(_swallowsTouches); touchListener->onTouchBegan = CC_CALLBACK_2(GameLayer::onTouchBegan, this); touchListener->onTouchMoved = CC_CALLBACK_2(GameLayer::onTouchMoved, this); touchListener->onTouchEnded = CC_CALLBACK_2(GameLayer::onTouchEnded, this); touchListener->onTouchCancelled = CC_CALLBACK_2(GameLayer::onTouchCancelled, this); _eventDispatcher->addEventListenerWithSceneGraphPriority(touchListener, this); initBackground(); //背景の初期化 initBalls(); //ボールの初期表示 return true; }
void PointCloudViewer::init() { glEnable(GL_POINT_SMOOTH); glHint(GL_POINT_SMOOTH_HINT, GL_NICEST); glEnable(GL_BLEND); glPointSize(3); glLineWidth(10); setMouseTracking(true); texid = bindTexture(QImage(rgbImg->ptr(), rgbImg->cols, rgbImg->rows, QImage::Format_RGB888), GL_TEXTURE_2D, GL_RGB, QGLContext::LinearFilteringBindOption); initBackground(); initLights(); initBuffers(); restoreStateFromFile(); setAnimationPeriod(10); startAnimation(); }