mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2025-02-03 18:14:01 +00:00
update texcoords of quads which have AUTO_VIRTUAL* set properly
move auto size vars & handling to PauseQuad, since not every quad needs this.
This commit is contained in:
parent
0391052e51
commit
4852eb533b
10 changed files with 98 additions and 99 deletions
|
@ -419,7 +419,8 @@ protected:
|
|||
void onEnterState(int action) OVERRIDE;
|
||||
void onExitState(int action) OVERRIDE;
|
||||
std::vector<ParticleEffect*>targetQuads;
|
||||
Quad *blinder, *fader, *tripper;
|
||||
PauseQuad *blinder, *tripper;
|
||||
Quad *fader;
|
||||
void applyBlindEffects();
|
||||
void removeBlindEffects();
|
||||
|
||||
|
|
|
@ -861,7 +861,8 @@ void DSQ::init()
|
|||
precacher.setBaseDir(this->getBaseTexturePath());
|
||||
precacher.precacheTex("loading/*.png");
|
||||
|
||||
Quad *loadbg = new Quad;
|
||||
PauseQuad *loadbg = new PauseQuad;
|
||||
loadbg->pauseLevel = 99;
|
||||
loadbg->position = Vector(400,300);
|
||||
loadbg->color = Vector(0.06f, 0.06f, 0.08f);
|
||||
loadbg->followCamera = 1;
|
||||
|
@ -1012,7 +1013,8 @@ void DSQ::init()
|
|||
addRenderObject(versionLabel, LR_REGISTER_TEXT);
|
||||
|
||||
|
||||
subbox = new Quad();
|
||||
subbox = new PauseQuad();
|
||||
subbox->pauseLevel = 99;
|
||||
subbox->position = Vector(400,580);
|
||||
subbox->alpha = 0;
|
||||
subbox->alphaMod = 0.7f;
|
||||
|
@ -1051,7 +1053,8 @@ void DSQ::init()
|
|||
achievement_text->setAlign(ALIGN_LEFT);
|
||||
addRenderObject(achievement_text, LR_SUBTITLES);
|
||||
|
||||
cutscene_bg = new Quad();
|
||||
cutscene_bg = new PauseQuad();
|
||||
cutscene_bg->pauseLevel = 99;
|
||||
cutscene_bg->autoWidth = AUTO_VIRTUALWIDTH;
|
||||
cutscene_bg->color = 0;
|
||||
cutscene_bg->alphaMod = 0.75;
|
||||
|
@ -1108,8 +1111,9 @@ void DSQ::init()
|
|||
|
||||
debugLog("6");
|
||||
|
||||
overlay = new Quad;
|
||||
overlay = new PauseQuad;
|
||||
{
|
||||
overlay->pauseLevel = 99;
|
||||
overlay->position = Vector(400,300,3);
|
||||
overlay->color = 0;
|
||||
overlay->autoWidth = AUTO_VIRTUALWIDTH;
|
||||
|
@ -1119,8 +1123,9 @@ void DSQ::init()
|
|||
}
|
||||
addRenderObject(overlay, LR_OVERLAY);
|
||||
|
||||
overlay2 = new Quad;
|
||||
overlay2 = new PauseQuad;
|
||||
{
|
||||
overlay2->pauseLevel = 99;
|
||||
overlay2->position = Vector(400,300);
|
||||
overlay2->color = 0;
|
||||
overlay2->autoWidth = AUTO_VIRTUALWIDTH;
|
||||
|
@ -1130,8 +1135,9 @@ void DSQ::init()
|
|||
}
|
||||
addRenderObject(overlay2, LR_OVERLAY);
|
||||
|
||||
overlay3 = new Quad;
|
||||
overlay3 = new PauseQuad;
|
||||
{
|
||||
overlay3->pauseLevel = 99;
|
||||
overlay3->position = Vector(400,300);
|
||||
overlay3->color = 0;
|
||||
overlay3->autoWidth = AUTO_VIRTUALWIDTH;
|
||||
|
@ -1141,8 +1147,9 @@ void DSQ::init()
|
|||
}
|
||||
addRenderObject(overlay3, LR_OVERLAY);
|
||||
|
||||
overlayRed = new Quad;
|
||||
overlayRed = new PauseQuad;
|
||||
{
|
||||
overlayRed->pauseLevel = 99;
|
||||
overlayRed->position = Vector(400,300);
|
||||
overlayRed->color = Vector(1,0,0);
|
||||
overlayRed->alphaMod = 0.5;
|
||||
|
@ -1153,8 +1160,9 @@ void DSQ::init()
|
|||
}
|
||||
addRenderObject(overlayRed, LR_OVERLAY);
|
||||
|
||||
sceneColorOverlay = new Quad;
|
||||
sceneColorOverlay = new PauseQuad;
|
||||
{
|
||||
sceneColorOverlay->pauseLevel = 99;
|
||||
sceneColorOverlay->position = Vector(400,300);
|
||||
sceneColorOverlay->color = Vector(1,1,1);
|
||||
sceneColorOverlay->alpha = 1;
|
||||
|
@ -1165,8 +1173,9 @@ void DSQ::init()
|
|||
}
|
||||
addRenderObject(sceneColorOverlay, LR_SCENE_COLOR);
|
||||
|
||||
tfader = new Quad;
|
||||
tfader = new PauseQuad;
|
||||
{
|
||||
tfader->pauseLevel = 99;
|
||||
tfader->position = Vector(400,300,3);
|
||||
tfader->color = 0;
|
||||
tfader->autoWidth = AUTO_VIRTUALWIDTH;
|
||||
|
@ -1176,6 +1185,19 @@ void DSQ::init()
|
|||
}
|
||||
addRenderObject(tfader, LR_TRANSITION);
|
||||
|
||||
blackout = new PauseQuad;
|
||||
{
|
||||
blackout->pauseLevel = 99;
|
||||
blackout->color = 0;
|
||||
blackout->autoWidth = AUTO_VIRTUALWIDTH;
|
||||
blackout->autoHeight = AUTO_VIRTUALHEIGHT;
|
||||
blackout->followCamera = 1;
|
||||
blackout->position = Vector(400,300);
|
||||
blackout->alphaMod = 0.75f;
|
||||
blackout->alpha = 0;
|
||||
}
|
||||
addRenderObject(blackout, LR_MENU);
|
||||
|
||||
screenTransition = new AquariaScreenTransition();
|
||||
{
|
||||
screenTransition->position = Vector(400,300);
|
||||
|
@ -2356,16 +2378,7 @@ void DSQ::doModSelect()
|
|||
|
||||
void DSQ::createModSelector()
|
||||
{
|
||||
blackout = new Quad;
|
||||
blackout->color = 0;
|
||||
blackout->autoWidth = AUTO_VIRTUALWIDTH;
|
||||
blackout->autoHeight = AUTO_VIRTUALHEIGHT;
|
||||
blackout->followCamera = 1;
|
||||
blackout->position = Vector(400,300);
|
||||
blackout->alphaMod = 0.75f;
|
||||
blackout->alpha = 0;
|
||||
blackout->alpha.interpolateTo(1, 0.2f);
|
||||
addRenderObject(blackout, LR_MENU);
|
||||
|
||||
modSelectorScr = new ModSelectorScreen();
|
||||
modSelectorScr->position = Vector(400,300);
|
||||
|
@ -2434,13 +2447,7 @@ void DSQ::unloadMods()
|
|||
|
||||
void DSQ::clearModSelector()
|
||||
{
|
||||
if (blackout)
|
||||
{
|
||||
blackout->setLife(1);
|
||||
blackout->setDecayRate(2);
|
||||
blackout->fadeAlphaWithLife = 1;
|
||||
blackout = 0;
|
||||
}
|
||||
blackout->alpha.interpolateTo(0, 0.5f);
|
||||
|
||||
if(modSelectorScr)
|
||||
{
|
||||
|
@ -2481,18 +2488,7 @@ void DSQ::createSaveSlots(SaveSlotMode ssm)
|
|||
|
||||
float t = 0.3f;
|
||||
|
||||
|
||||
blackout = new Quad;
|
||||
blackout->color = 0;
|
||||
blackout->autoWidth = AUTO_VIRTUALWIDTH;
|
||||
blackout->autoHeight = AUTO_VIRTUALHEIGHT;
|
||||
blackout->followCamera = 1;
|
||||
blackout->position = Vector(400,300);
|
||||
blackout->alphaMod = 0.75f;
|
||||
blackout->alpha = 0;
|
||||
blackout->alpha.interpolateTo(1, 0.5f);
|
||||
addRenderObject(blackout, LR_MENU);
|
||||
|
||||
|
||||
menu[1] = new Quad("gui/save-menu", Vector(400,300));
|
||||
menu[1]->alpha = 0;
|
||||
|
@ -2659,8 +2655,7 @@ void DSQ::hideSaveSlotCrap()
|
|||
{
|
||||
clearMenu();
|
||||
|
||||
if (blackout)
|
||||
blackout->alpha = 0;
|
||||
blackout->alpha = 0;
|
||||
|
||||
if (saveSlotPageCount)
|
||||
saveSlotPageCount->alpha = 0;
|
||||
|
@ -2673,23 +2668,8 @@ void DSQ::clearSaveSlots(bool trans)
|
|||
sound->playSfx("menu-close");
|
||||
}
|
||||
float t = 0.3f;
|
||||
if (blackout)
|
||||
{
|
||||
if (!trans)
|
||||
{
|
||||
blackout->setLife(1);
|
||||
blackout->setDecayRate(10);
|
||||
if (blackout->alpha.x > 0)
|
||||
blackout->fadeAlphaWithLife = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
blackout->setLife(1);
|
||||
blackout->setDecayRate(1);
|
||||
if (blackout->alpha.x > 0)
|
||||
blackout->fadeAlphaWithLife = 1;
|
||||
}
|
||||
}
|
||||
blackout->alpha.interpolateTo(0, trans ? 1.0f : 0.1f);
|
||||
|
||||
if (saveSlotPageCount)
|
||||
{
|
||||
saveSlotPageCount->setLife(1);
|
||||
|
|
|
@ -146,8 +146,8 @@ public:
|
|||
void setCursor(CursorType type);
|
||||
|
||||
Quad *cursor, *cursorGlow, *cursorBlinker;
|
||||
Quad *overlay, *tfader, *overlay2, *overlay3, *overlayRed;
|
||||
Quad *sceneColorOverlay;
|
||||
PauseQuad *overlay, *tfader, *overlay2, *overlay3, *overlayRed;
|
||||
PauseQuad *sceneColorOverlay;
|
||||
Quad *bar_left, *bar_right, *bar_up, *bar_down;
|
||||
Quad *barFade_left, *barFade_right;
|
||||
|
||||
|
@ -344,7 +344,7 @@ public:
|
|||
Quad *achievement_box;
|
||||
|
||||
BitmapText *subtext;
|
||||
Quad *subbox;
|
||||
PauseQuad *subbox;
|
||||
|
||||
BmpFont font, smallFont, subsFont, goldFont, smallFontRed;
|
||||
TTFFont fontArialSmall, fontArialBig, fontArialSmallest;
|
||||
|
@ -390,7 +390,7 @@ public:
|
|||
|
||||
protected:
|
||||
|
||||
Quad *cutscene_bg;
|
||||
PauseQuad *cutscene_bg;
|
||||
BitmapText *cutscene_text;
|
||||
BitmapText *cutscene_text2;
|
||||
|
||||
|
@ -424,7 +424,7 @@ protected:
|
|||
void onStopVoice();
|
||||
|
||||
Entity **iter;
|
||||
Quad *blackout;
|
||||
PauseQuad *blackout;
|
||||
void updatepecue(float dt);
|
||||
std::vector<PECue> pecue;
|
||||
|
||||
|
|
|
@ -2546,8 +2546,9 @@ void Game::applyState()
|
|||
dsq->clearEntities();
|
||||
dsq->tilemgr.clearTiles();
|
||||
|
||||
damageSprite = new Quad;
|
||||
damageSprite = new PauseQuad;
|
||||
{
|
||||
damageSprite->pauseLevel = 99;
|
||||
damageSprite->setTexture("damage");
|
||||
damageSprite->alpha = 0;
|
||||
damageSprite->autoWidth = AUTO_VIRTUALWIDTH;
|
||||
|
@ -2560,8 +2561,9 @@ void Game::applyState()
|
|||
|
||||
Vector mousePos(400,490);
|
||||
|
||||
controlHint_bg = new Quad;
|
||||
controlHint_bg = new PauseQuad;
|
||||
{
|
||||
controlHint_bg->pauseLevel = 99;
|
||||
controlHint_bg->followCamera = 1;
|
||||
controlHint_bg->position = Vector(400,500);
|
||||
controlHint_bg->color = 0;
|
||||
|
@ -3416,7 +3418,8 @@ void Game::toggleHelpScreen(bool on, const std::string &label)
|
|||
data += "\n\n" + stringbank.get(2032) + "\n\n";
|
||||
dsq->continuity.statsAndAchievements->appendStringData(data);
|
||||
|
||||
helpBG = new Quad;
|
||||
helpBG = new PauseQuad;
|
||||
helpBG->pauseLevel = 99;
|
||||
//helpBG->color = 0;
|
||||
helpBG->setTexture("brick");
|
||||
helpBG->setRepeatScale(Vector(2, 2));
|
||||
|
@ -3428,7 +3431,8 @@ void Game::toggleHelpScreen(bool on, const std::string &label)
|
|||
helpBG->followCamera = 1;
|
||||
addRenderObject(helpBG, LR_HELP);
|
||||
|
||||
helpBG2 = new Quad;
|
||||
helpBG2 = new PauseQuad;
|
||||
helpBG2->pauseLevel = 99;
|
||||
helpBG2->color = 0;
|
||||
helpBG2->alphaMod = 0.5;
|
||||
helpBG2->setWidth(620);
|
||||
|
@ -4710,7 +4714,8 @@ void Game::removeState()
|
|||
core->cameraPos = Vector(0,0);
|
||||
sceneColor.stop();
|
||||
|
||||
controlHint_mouseLeft = controlHint_mouseRight = controlHint_mouseMiddle = controlHint_mouseBody = controlHint_bg = controlHint_image = 0;
|
||||
controlHint_mouseLeft = controlHint_mouseRight = controlHint_mouseMiddle = controlHint_mouseBody = controlHint_image = 0;
|
||||
controlHint_bg = 0;
|
||||
controlHint_text = 0;
|
||||
|
||||
miniMapRender = 0;
|
||||
|
|
|
@ -293,7 +293,7 @@ public:
|
|||
void warpToSceneFromNode(Path *p);
|
||||
Vector fromPosition;
|
||||
|
||||
Quad *damageSprite;
|
||||
PauseQuad *damageSprite;
|
||||
|
||||
void toggleDamageSprite(bool on);
|
||||
|
||||
|
@ -419,7 +419,7 @@ protected:
|
|||
void onHelpUp();
|
||||
void onHelpDown();
|
||||
bool helpWasPaused;
|
||||
Quad *helpBG, *helpBG2;
|
||||
PauseQuad *helpBG, *helpBG2;
|
||||
AquariaMenuItem *helpUp, *helpDown, *helpCancel;
|
||||
TTFText *helpText;
|
||||
bool inHelpScreen;
|
||||
|
@ -445,8 +445,9 @@ protected:
|
|||
|
||||
void updateCursor(float dt);
|
||||
|
||||
Quad *controlHint_mouseLeft, *controlHint_mouseRight, *controlHint_mouseBody, *controlHint_mouseMiddle, *controlHint_bg, *controlHint_image;
|
||||
Quad *controlHint_mouseLeft, *controlHint_mouseRight, *controlHint_mouseBody, *controlHint_mouseMiddle, *controlHint_image;
|
||||
Quad *controlHint_shine;
|
||||
PauseQuad *controlHint_bg;
|
||||
bool controlHint_ignoreClear;
|
||||
BitmapText *controlHint_text;
|
||||
|
||||
|
|
|
@ -1214,16 +1214,18 @@ void InGameMenu::show(bool ignoreInput, bool optionsOnly, MenuPage menuPage)
|
|||
|
||||
if (optionsOnly)
|
||||
{
|
||||
menu_blackout = new Quad;
|
||||
menu_blackout->color = 0;
|
||||
menu_blackout->autoWidth = AUTO_VIRTUALWIDTH;
|
||||
menu_blackout->autoHeight = AUTO_VIRTUALHEIGHT;
|
||||
menu_blackout->followCamera = 1;
|
||||
menu_blackout->position = Vector(400,300);
|
||||
menu_blackout->alphaMod = 0.75;
|
||||
menu_blackout->alpha = 0;
|
||||
menu_blackout->alpha.interpolateTo(1, 0.5);
|
||||
game->addRenderObject(menu_blackout, LR_AFTER_EFFECTS);
|
||||
PauseQuad *q = new PauseQuad;
|
||||
q->color = 0;
|
||||
q->pauseLevel = 99;
|
||||
q->autoWidth = AUTO_VIRTUALWIDTH;
|
||||
q->autoHeight = AUTO_VIRTUALHEIGHT;
|
||||
q->followCamera = 1;
|
||||
q->position = Vector(400,300);
|
||||
q->alphaMod = 0.75;
|
||||
q->alpha = 0;
|
||||
q->alpha.interpolateTo(1, 0.5);
|
||||
game->addRenderObject(q, LR_AFTER_EFFECTS);
|
||||
menu_blackout = q;
|
||||
|
||||
menuBg2->alpha = 0;
|
||||
}
|
||||
|
|
|
@ -41,13 +41,14 @@ static bool _modname_cmp(const ModIcon *a, const ModIcon *b)
|
|||
}
|
||||
|
||||
ModSelectorScreen::ModSelectorScreen()
|
||||
: Quad()
|
||||
: PauseQuad()
|
||||
, ActionMapper()
|
||||
, dlText(dsq->smallFont)
|
||||
, gotServerList(false)
|
||||
, currentPanel(-1)
|
||||
, subtext(dsq->subsFont)
|
||||
{
|
||||
pauseLevel = 99;
|
||||
followCamera = 1;
|
||||
shareAlphaWithChildren = false;
|
||||
alpha = 1;
|
||||
|
@ -260,6 +261,7 @@ void ModSelectorScreen::init()
|
|||
|
||||
showPanel(0);
|
||||
|
||||
subbox.pauseLevel = 99;
|
||||
subbox.position = Vector(0,260);
|
||||
subbox.alpha = 0;
|
||||
subbox.alphaMod = 0.7f;
|
||||
|
|
|
@ -141,7 +141,7 @@ protected:
|
|||
int x, y;
|
||||
};
|
||||
|
||||
class ModSelectorScreen : public Quad, public ActionMapper
|
||||
class ModSelectorScreen : public PauseQuad, public ActionMapper
|
||||
{
|
||||
public:
|
||||
ModSelectorScreen();
|
||||
|
@ -166,7 +166,7 @@ public:
|
|||
AquariaMenuItem arrowUp, arrowDown;
|
||||
|
||||
void setSubText(const std::string& s);
|
||||
|
||||
|
||||
virtual void action(int actionID, int state, int source, InputDevice device) {}
|
||||
|
||||
protected:
|
||||
|
@ -175,7 +175,7 @@ protected:
|
|||
MenuBasicBar rightbar;
|
||||
size_t currentPanel;
|
||||
BitmapText subtext;
|
||||
Quad subbox;
|
||||
PauseQuad subbox;
|
||||
float subFadeT;
|
||||
};
|
||||
|
||||
|
|
|
@ -49,8 +49,6 @@ void Quad::initQuad()
|
|||
borderAlpha = 0.5;
|
||||
repeatToFillScale = Vector(1,1);
|
||||
|
||||
autoWidth = autoHeight = 0;
|
||||
|
||||
renderBorder = false;
|
||||
renderCenter = true;
|
||||
width = 2; height = 2;
|
||||
|
@ -292,16 +290,6 @@ void Quad::onUpdate(float dt)
|
|||
{
|
||||
RenderObject::onUpdate(dt);
|
||||
|
||||
if (autoWidth == AUTO_VIRTUALWIDTH)
|
||||
width = core->getVirtualWidth();
|
||||
else if (autoWidth == AUTO_VIRTUALHEIGHT)
|
||||
width = core->getVirtualHeight();
|
||||
|
||||
if (autoHeight == AUTO_VIRTUALWIDTH)
|
||||
height = core->getVirtualWidth();
|
||||
else if (autoHeight == AUTO_VIRTUALHEIGHT)
|
||||
height = core->getVirtualHeight();
|
||||
|
||||
if (grid && alpha.x > 0 && alphaMod > 0)
|
||||
{
|
||||
grid->update(dt);
|
||||
|
@ -341,7 +329,7 @@ void Quad::onSetTexture()
|
|||
}
|
||||
}
|
||||
|
||||
PauseQuad::PauseQuad() : Quad(), pauseLevel(0), positionSnapTo(0)
|
||||
PauseQuad::PauseQuad() : Quad(), pauseLevel(0), positionSnapTo(0), autoWidth(0), autoHeight(0)
|
||||
{
|
||||
addType(SCO_PAUSEQUAD);
|
||||
}
|
||||
|
@ -352,6 +340,27 @@ PauseQuad::~PauseQuad()
|
|||
|
||||
void PauseQuad::onUpdate(float dt)
|
||||
{
|
||||
if(autoWidth || autoHeight)
|
||||
{
|
||||
float w = width, h = height;
|
||||
if (autoWidth == AUTO_VIRTUALWIDTH)
|
||||
w = core->getVirtualWidth();
|
||||
else if (autoWidth == AUTO_VIRTUALHEIGHT)
|
||||
w = core->getVirtualHeight();
|
||||
|
||||
if (autoHeight == AUTO_VIRTUALWIDTH)
|
||||
h = core->getVirtualWidth();
|
||||
else if (autoHeight == AUTO_VIRTUALHEIGHT)
|
||||
h = core->getVirtualHeight();
|
||||
|
||||
if(w != width || h != height)
|
||||
{
|
||||
width = w;
|
||||
height = h;
|
||||
updateTexCoords();
|
||||
}
|
||||
}
|
||||
|
||||
if (positionSnapTo)
|
||||
this->position = *positionSnapTo;
|
||||
|
||||
|
|
|
@ -87,7 +87,7 @@ public:
|
|||
TexCoordBox texcoords;
|
||||
|
||||
// TODO: this should be a bitmask
|
||||
char autoWidth, autoHeight;
|
||||
|
||||
bool renderQuad, renderCenter, renderBorder;
|
||||
|
||||
float borderAlpha;
|
||||
|
@ -119,6 +119,7 @@ public:
|
|||
PauseQuad();
|
||||
virtual ~PauseQuad();
|
||||
int pauseLevel;
|
||||
char autoWidth, autoHeight;
|
||||
|
||||
void setPositionSnapTo(InterpolatedVector *positionSnapTo);
|
||||
protected:
|
||||
|
@ -137,7 +138,5 @@ public:
|
|||
float collideRadius;
|
||||
};
|
||||
|
||||
#define QUAD(x) Quad *x = new Quad; addRenderObject(x);
|
||||
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue