void Logo::applyState() { StateObject::applyState(); core->setClearColor(Vector(1,1,1)); //glClearColor(1,1,1,0); //core->enable2D(800); /* Quad *q = new Quad; { q->setTexture("zs"); q->width=800; q->height=100; q->position = Vector(400,300); q->alpha = 0; q->alpha.interpolateTo(1, 3, 0); } addRenderObject(q); addAction(&jumpTitle, MOUSE_BUTTON_LEFT, 1); */ Quad *q = new Quad; { q->setTexture("sky"); q->setWidthHeight(800, 600); q->position = Vector(400,300); q->alpha = 0; q->alpha.interpolateTo(1, 3, 0); } addRenderObject(q); }
void Quad::spawnChildClone(float t) { if (!this->texture) return; Quad *q = new Quad; q->setTexture(this->texture->name); q->setLife(t+0.1f); q->setDecayRate(1); q->width = this->width; q->height = this->height; q->alpha = 1; q->alpha.interpolateTo(0, t); if (isfh()) q->flipHorizontal(); q->position = this->position; q->followCamera = this->followCamera; q->scale = this->scale; q->offset = this->offset; q->blendType = this->blendType; //q->parentManagedPointer = true; //q->renderBeforeParent = false; core->getTopStateData()->addRenderObject(q, this->layer); //addChild(q); }
void Nag::applyState() { StateObject::applyState(); click = 0; dsq->cursor->offset.stop(); dsq->cursor->internalOffset.stop(); dsq->cursor->offset = Vector(0,0,0); dsq->cursor->internalOffset = Vector(0,0,0); dsq->cursor->color = Vector(0,0,0); dsq->sound->stopMusic(); hitBuy = false; core->setInputGrab(false); grab = false; dsq->overlay2->alpha = 0; dsq->stopVoice(); Quad *bg = new Quad("nag/nag", Vector(400,400)); bg->setWidthHeight(800, 800); bg->followCamera = 1; addRenderObject(bg, LR_BACKGROUND); AquariaMenuItem *buy = new AquariaMenuItem(); buy->followCamera = 1; buy->position = Vector(630, 400); //300, 540); //buy->setLabel("Buy"); buy->useGlow("particles/glow", 480, 128); buy->event.set(MakeFunctionEvent(Nag, onBuy)); buy->setDirMove(DIR_LEFT, buy); buy->setDirMove(DIR_RIGHT, buy); buy->setDirMove(DIR_UP, buy); addRenderObject(buy, LR_BACKGROUND); AquariaMenuItem *exit = new AquariaMenuItem(); exit->followCamera = 1; exit->position = Vector(732, 543); //exit->setLabel("Exit"); exit->useGlow("particles/glow", 128, 64); exit->event.set(MakeFunctionEvent(Nag, onExit)); exit->setDirMove(DIR_LEFT, exit); exit->setDirMove(DIR_RIGHT, exit); exit->setDirMove(DIR_DOWN, exit); addRenderObject(exit, LR_BACKGROUND); buy->setDirMove(DIR_DOWN, exit); exit->setDirMove(DIR_UP, buy); buy->setFocus(true); ic = 0; irot.clear(); //Vector framePos(235, 405); Vector framePos(240, 400); Vector frameScale(0.98, 0.98); for (int i = 0; i < numScreens; i++) { std::ostringstream os; os << "nag/s-" << numToZeroString(i, 4); Quad *q = new Quad(os.str(), framePos); q->setTexture(os.str()); if (i != 0) q->alpha = 0; else { q->alpha = 0; q->alpha.interpolateTo(1, nagFadeTime); } q->scale = Vector(0.75, 0.75) * frameScale; addRenderObject(q, LR_BACKGROUND); irot.push_back(q); } Quad *frame = new Quad("nag/nag-frame", framePos); frame->scale = frameScale; addRenderObject(frame, LR_BACKGROUND); dsq->toggleCursor(1, 0.5); dsq->fade(0, 1); dsq->main(1); dsq->sound->playMusic("openwaters3", SLT_NORMAL, SFT_IN, 2); }
void GameOver::applyState() { const bool frameOutputGameOver = false; core->sound->fadeMusic(SFT_OUT, 1); //float transTime = 0.01; //core->sound->fadeOut(transTime); StateObject::applyState(); core->globalScale = Vector(1,1); core->globalScaleChanged(); core->cameraPos = Vector(0,0,0); core->sound->playSfx("Death"); if (frameOutputGameOver) { dsq->fpsText->alpha = 0; core->frameOutputMode = true; } Quad *q = new Quad; { q->color = 0; q->setWidthHeight(800, 600); q->position = Vector(400,300,-0.1); } addRenderObject(q); /* BitmapText *b = new BitmapText(&dsq->font); { int sz = 64; b->setFontSize(sz); b->setText("GAME OVER"); b->position = Vector(400+sz/2,300-sz/2); } addRenderObject(b); */ //core->main(transTime); frame1 = new Quad; { frame1->setTexture("gameover-0004"); frame1->position = Vector(400,300); frame1->setWidthHeight(600, 600); } addRenderObject(frame1, LR_BACKGROUND); frame2 = new Quad; { frame2->setTexture("gameover-0003"); frame2->position = Vector(400,300); frame2->setWidthHeight(600, 600); } addRenderObject(frame2, LR_BACKGROUND); frame3 = new Quad; { frame3->setTexture("gameover-0002"); frame3->position = Vector(400,300); frame3->setWidthHeight(600, 600); } addRenderObject(frame3, LR_BACKGROUND); Quad *frame4 = new Quad; { frame4->setTexture("gameover-0001"); frame4->position = Vector(400,300); frame4->setWidthHeight(600, 600); } addRenderObject(frame4, LR_BACKGROUND); Quad *shockLines = new Quad; { shockLines->setTexture("shock-lines"); shockLines->position = Vector(400,300); shockLines->setWidthHeight(800, 600); shockLines->setBlendType(RenderObject::BLEND_ADD); shockLines->scale.interpolateTo(Vector(4,4), 1); } addRenderObject(shockLines, LR_BACKGROUND); core->main(0.033); if (core->afterEffectManager) { core->afterEffectManager->clear(); core->afterEffectManager->addEffect(new ShockEffect(Vector(core->width/2, core->height/2),core->screenCenter, 0.07,0.03,30,0.2f, 1.1)); } //dsq->screenTransition->transition(0); dsq->overlay->alpha = 0; //core->main(0.1); //frame3->alpha.interpolateTo(0, GO_ANIM_TIME); core->main(GO_ANIM_TIME); frame4->alpha.interpolateTo(0, GO_ANIM_TIME); core->main(GO_ANIM_TIME); frame3->alpha.interpolateTo(0, GO_ANIM_TIME); core->main(GO_ANIM_TIME); frame2->alpha.interpolateTo(0, GO_ANIM_TIME); core->main(GO_ANIM_TIME); frame1->alpha.interpolateTo(0, GO_ANIM_TIME); core->main(GO_ANIM_TIME); core->main(1.5); //core->sound->streamMusic("Requiem", 0); if (dsq->recentSaveSlot != -1) { // game over recent save load dsq->sound->stopMusic(); float transferSeconds = dsq->continuity.seconds; dsq->continuity.loadFile(dsq->recentSaveSlot); /* //float lastLoadSeconds = dsq->continuity.seconds; // time spent on a session that ended with death is the // difference between the current total time and the last save time? // nope. // ignore doing the above for now! */ dsq->continuity.seconds = transferSeconds; dsq->game->transitionToScene(dsq->game->sceneToLoad); } else dsq->title(); //core->main(transTime); if (frameOutputGameOver) core->frameOutputMode = false; /* addAction(MakeFunctionEvent(GameOver, onClick), ActionMapper::MOUSE_BUTTON_LEFT, 0); timer = 1; */ }