2013-09-01 14:27:21 +00:00
|
|
|
/*
|
|
|
|
** window.cpp
|
|
|
|
**
|
|
|
|
** This file is part of mkxp.
|
|
|
|
**
|
|
|
|
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
|
|
|
**
|
|
|
|
** mkxp is free software: you can redistribute it and/or modify
|
|
|
|
** it under the terms of the GNU General Public License as published by
|
|
|
|
** the Free Software Foundation, either version 2 of the License, or
|
|
|
|
** (at your option) any later version.
|
|
|
|
**
|
|
|
|
** mkxp is distributed in the hope that it will be useful,
|
|
|
|
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
** GNU General Public License for more details.
|
|
|
|
**
|
|
|
|
** You should have received a copy of the GNU General Public License
|
|
|
|
** along with mkxp. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "window.h"
|
|
|
|
|
|
|
|
#include "viewport.h"
|
2013-10-09 10:30:33 +00:00
|
|
|
#include "sharedstate.h"
|
2013-09-01 14:27:21 +00:00
|
|
|
#include "bitmap.h"
|
|
|
|
#include "etc.h"
|
|
|
|
#include "etc-internal.h"
|
|
|
|
#include "tilequad.h"
|
|
|
|
|
|
|
|
#include "gl-util.h"
|
|
|
|
#include "quad.h"
|
|
|
|
#include "quadarray.h"
|
|
|
|
#include "texpool.h"
|
|
|
|
#include "glstate.h"
|
|
|
|
|
2013-12-04 16:48:37 +00:00
|
|
|
#include <sigc++/connection.h>
|
2013-09-01 14:27:21 +00:00
|
|
|
|
|
|
|
template<typename T>
|
|
|
|
struct Sides
|
|
|
|
{
|
|
|
|
T l, r, t, b;
|
|
|
|
};
|
|
|
|
|
|
|
|
template<typename T>
|
|
|
|
struct Corners
|
|
|
|
{
|
|
|
|
T tl, tr, bl, br;
|
|
|
|
};
|
|
|
|
|
2014-08-12 17:38:31 +00:00
|
|
|
static const IntRect backgroundSrc(0, 0, 128, 128);
|
2013-09-01 14:27:21 +00:00
|
|
|
|
2014-08-12 17:38:31 +00:00
|
|
|
static const IntRect cursorSrc(128, 64, 32, 32);
|
2013-09-01 14:27:21 +00:00
|
|
|
|
2014-08-12 17:38:31 +00:00
|
|
|
static const IntRect pauseAniSrc[] =
|
2013-09-01 14:27:21 +00:00
|
|
|
{
|
|
|
|
IntRect(160, 64, 16, 16),
|
|
|
|
IntRect(176, 64, 16, 16),
|
|
|
|
IntRect(160, 80, 16, 16),
|
|
|
|
IntRect(176, 80, 16, 16)
|
|
|
|
};
|
|
|
|
|
2014-08-12 17:38:31 +00:00
|
|
|
static const Sides<IntRect> bordersSrc =
|
2013-09-01 14:27:21 +00:00
|
|
|
{
|
|
|
|
IntRect(128, 16, 16, 32),
|
|
|
|
IntRect(176, 16, 16, 32),
|
|
|
|
IntRect(144, 0, 32, 16),
|
|
|
|
IntRect(144, 48, 32, 16)
|
|
|
|
};
|
|
|
|
|
2014-08-12 17:38:31 +00:00
|
|
|
static const Corners<IntRect> cornersSrc =
|
2013-09-01 14:27:21 +00:00
|
|
|
{
|
|
|
|
IntRect(128, 0, 16, 16),
|
|
|
|
IntRect(176, 0, 16, 16),
|
|
|
|
IntRect(128, 48, 16, 16),
|
|
|
|
IntRect(176, 48, 16, 16)
|
|
|
|
};
|
|
|
|
|
2014-08-12 17:38:31 +00:00
|
|
|
static const Sides<IntRect> scrollArrowSrc =
|
2013-09-01 14:27:21 +00:00
|
|
|
{
|
|
|
|
IntRect(144, 24, 8, 16),
|
|
|
|
IntRect(168, 24, 8, 16),
|
|
|
|
IntRect(152, 16, 16, 8),
|
|
|
|
IntRect(152, 40, 16, 8)
|
|
|
|
};
|
|
|
|
|
2013-09-03 12:51:55 +00:00
|
|
|
/* Cycling */
|
2014-08-12 17:38:31 +00:00
|
|
|
static const uint8_t cursorAniAlpha[] =
|
2013-09-01 14:27:21 +00:00
|
|
|
{
|
2014-01-05 15:09:00 +00:00
|
|
|
/* Fade out */
|
2013-09-01 14:27:21 +00:00
|
|
|
0xFF, 0xF7, 0xEF, 0xE7, 0xDF, 0xD7, 0xCF, 0xC7,
|
|
|
|
0xBF, 0xB7, 0xAF, 0xA7, 0x9F, 0x97, 0x8F, 0x87,
|
|
|
|
/* Fade in */
|
|
|
|
0x7F, 0x87, 0x8F, 0x97, 0x9F, 0xA7, 0xAF, 0xB7,
|
2014-01-05 15:09:00 +00:00
|
|
|
0xBF, 0xC7, 0xCF, 0xD7, 0xDF, 0xE7, 0xEF, 0xF7
|
2013-09-01 14:27:21 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static elementsN(cursorAniAlpha);
|
|
|
|
|
|
|
|
/* Cycling */
|
2014-08-12 17:38:31 +00:00
|
|
|
static const uint8_t pauseAniQuad[] =
|
2013-09-01 14:27:21 +00:00
|
|
|
{
|
2014-01-05 15:09:00 +00:00
|
|
|
0, 0, 0, 0, 0, 0, 0, 0,
|
|
|
|
1, 1, 1, 1, 1, 1, 1, 1,
|
|
|
|
2, 2, 2, 2, 2, 2, 2, 2,
|
|
|
|
3, 3, 3, 3, 3, 3, 3, 3
|
2013-09-01 14:27:21 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static elementsN(pauseAniQuad);
|
|
|
|
|
|
|
|
/* No cycle */
|
2014-08-12 17:38:31 +00:00
|
|
|
static const uint8_t pauseAniAlpha[] =
|
2013-09-01 14:27:21 +00:00
|
|
|
{
|
2014-01-05 15:09:00 +00:00
|
|
|
0x00, 0x20, 0x40, 0x60,
|
|
|
|
0x80, 0xA0, 0xC0, 0xE0,
|
|
|
|
0xFF
|
2013-09-01 14:27:21 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static elementsN(pauseAniAlpha);
|
|
|
|
|
|
|
|
/* Points to an array of quads which it doesn't own.
|
|
|
|
* Useful for setting alpha of quads stored inside
|
|
|
|
* bigger arrays */
|
|
|
|
struct QuadChunk
|
|
|
|
{
|
|
|
|
Vertex *vert;
|
|
|
|
int count; /* In quads */
|
|
|
|
|
|
|
|
QuadChunk()
|
|
|
|
: vert(0), count(0)
|
|
|
|
{}
|
|
|
|
|
|
|
|
void setAlpha(float value)
|
|
|
|
{
|
|
|
|
for (int i = 0; i < count*4; ++i)
|
|
|
|
vert[i].color.w = value;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Vocabulary:
|
|
|
|
*
|
2013-09-03 12:51:55 +00:00
|
|
|
* Base: 'Base' layer of window; includes background and borders.
|
2013-09-01 14:27:21 +00:00
|
|
|
* Drawn at z+0.
|
|
|
|
*
|
2013-09-03 12:51:55 +00:00
|
|
|
* Controls: 'Controls' layer of window; includes scroll arrows,
|
2013-09-01 14:27:21 +00:00
|
|
|
* pause animation, cursor rectangle and contents bitmap.
|
|
|
|
* Drawn at z+2.
|
|
|
|
*
|
|
|
|
* Scroll arrows: Arrows that appear automatically when a part of
|
|
|
|
* the contents bitmap is not visible in either upper, lower, left
|
|
|
|
* or right direction.
|
|
|
|
*
|
|
|
|
* Pause: Animation that displays an animating icon in the bottom
|
|
|
|
* center of the window, usually indicating user input is awaited,
|
|
|
|
* such as when text is displayed.
|
|
|
|
*
|
|
|
|
* Cursor: Blinking rectangle that usually displays a selection to
|
|
|
|
* the user.
|
|
|
|
*
|
|
|
|
* Contents: User settable bitmap that is drawn inside the window,
|
|
|
|
* clipped to a 16 pixel smaller rectangle. Position is adjusted
|
|
|
|
* with OX/OY.
|
|
|
|
*
|
|
|
|
* BaseTex: If the window has an opacity <255, we have to prerender
|
|
|
|
* the base to a texture and draw that. Otherwise, we can draw the
|
|
|
|
* quad array directly to the screen.
|
|
|
|
*/
|
|
|
|
|
|
|
|
struct WindowPrivate
|
|
|
|
{
|
|
|
|
Bitmap *windowskin;
|
2014-08-09 16:35:01 +00:00
|
|
|
|
2013-09-01 14:27:21 +00:00
|
|
|
Bitmap *contents;
|
2014-08-09 16:35:01 +00:00
|
|
|
|
2013-09-01 14:27:21 +00:00
|
|
|
bool bgStretch;
|
|
|
|
Rect *cursorRect;
|
|
|
|
bool active;
|
|
|
|
bool pause;
|
|
|
|
|
|
|
|
sigc::connection cursorRectCon;
|
|
|
|
|
|
|
|
Vec2i sceneOffset;
|
|
|
|
|
|
|
|
Vec2i position;
|
|
|
|
Vec2i size;
|
|
|
|
Vec2i contentsOffset;
|
|
|
|
|
|
|
|
NormValue opacity;
|
|
|
|
NormValue backOpacity;
|
|
|
|
NormValue contentsOpacity;
|
|
|
|
|
|
|
|
bool baseVertDirty;
|
|
|
|
bool opacityDirty;
|
|
|
|
bool baseTexDirty;
|
|
|
|
|
|
|
|
ColorQuadArray baseQuadArray;
|
|
|
|
|
|
|
|
/* Used when opacity < 255 */
|
2013-09-06 10:26:41 +00:00
|
|
|
TEXFBO baseTex;
|
2013-09-01 14:27:21 +00:00
|
|
|
bool useBaseTex;
|
|
|
|
|
|
|
|
QuadChunk backgroundVert;
|
|
|
|
|
|
|
|
Quad baseTexQuad;
|
|
|
|
|
|
|
|
struct WindowControls : public ViewportElement
|
|
|
|
{
|
|
|
|
WindowPrivate *p;
|
|
|
|
|
|
|
|
WindowControls(WindowPrivate *p,
|
|
|
|
Viewport *viewport = 0)
|
|
|
|
: ViewportElement(viewport),
|
|
|
|
p(p)
|
|
|
|
{
|
|
|
|
setZ(2);
|
|
|
|
}
|
|
|
|
|
|
|
|
void draw()
|
|
|
|
{
|
|
|
|
p->drawControls();
|
|
|
|
}
|
|
|
|
|
|
|
|
void release()
|
|
|
|
{
|
|
|
|
unlink();
|
|
|
|
}
|
2014-09-23 19:12:58 +00:00
|
|
|
|
|
|
|
ABOUT_TO_ACCESS_NOOP
|
2013-09-01 14:27:21 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
WindowControls controlsElement;
|
|
|
|
|
|
|
|
ColorQuadArray controlsQuadArray;
|
|
|
|
int controlsQuadCount;
|
|
|
|
|
|
|
|
Quad contentsQuad;
|
|
|
|
|
|
|
|
QuadChunk pauseAniVert;
|
|
|
|
QuadChunk cursorVert;
|
|
|
|
|
2014-08-12 17:38:31 +00:00
|
|
|
uint8_t cursorAniAlphaIdx;
|
|
|
|
uint8_t pauseAniAlphaIdx;
|
|
|
|
uint8_t pauseAniQuadIdx;
|
2013-09-01 14:27:21 +00:00
|
|
|
|
|
|
|
bool controlsVertDirty;
|
|
|
|
|
|
|
|
EtcTemps tmp;
|
|
|
|
|
|
|
|
sigc::connection prepareCon;
|
|
|
|
|
|
|
|
WindowPrivate(Viewport *viewport = 0)
|
|
|
|
: windowskin(0),
|
|
|
|
contents(0),
|
|
|
|
bgStretch(true),
|
|
|
|
cursorRect(&tmp.rect),
|
|
|
|
active(true),
|
|
|
|
pause(false),
|
|
|
|
opacity(255),
|
|
|
|
backOpacity(255),
|
|
|
|
contentsOpacity(255),
|
|
|
|
baseVertDirty(true),
|
|
|
|
opacityDirty(true),
|
|
|
|
baseTexDirty(true),
|
|
|
|
controlsElement(this, viewport),
|
|
|
|
cursorAniAlphaIdx(0),
|
|
|
|
pauseAniAlphaIdx(0),
|
|
|
|
pauseAniQuadIdx(0),
|
|
|
|
controlsVertDirty(true)
|
|
|
|
{
|
|
|
|
refreshCursorRectCon();
|
|
|
|
|
|
|
|
controlsQuadArray.resize(14);
|
|
|
|
cursorVert.count = 9;
|
|
|
|
pauseAniVert.count = 1;
|
|
|
|
|
2013-10-09 10:30:33 +00:00
|
|
|
prepareCon = shState->prepareDraw.connect
|
2013-09-01 14:27:21 +00:00
|
|
|
(sigc::mem_fun(this, &WindowPrivate::prepare));
|
|
|
|
}
|
|
|
|
|
|
|
|
~WindowPrivate()
|
|
|
|
{
|
2013-10-09 10:30:33 +00:00
|
|
|
shState->texPool().release(baseTex);
|
2013-09-01 14:27:21 +00:00
|
|
|
cursorRectCon.disconnect();
|
|
|
|
prepareCon.disconnect();
|
|
|
|
}
|
|
|
|
|
2014-08-09 16:35:01 +00:00
|
|
|
void markControlVertDirty()
|
2013-09-01 14:27:21 +00:00
|
|
|
{
|
|
|
|
controlsVertDirty = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void refreshCursorRectCon()
|
|
|
|
{
|
|
|
|
cursorRectCon.disconnect();
|
|
|
|
cursorRectCon = cursorRect->valueChanged.connect
|
2014-08-09 16:35:01 +00:00
|
|
|
(sigc::mem_fun(this, &WindowPrivate::markControlVertDirty));
|
2013-09-01 14:27:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void buildBaseVert()
|
|
|
|
{
|
|
|
|
int w = size.x;
|
|
|
|
int h = size.y;
|
|
|
|
|
|
|
|
IntRect bgRect(2, 2, w - 4, h - 4);
|
|
|
|
|
|
|
|
Sides<IntRect> borderRects;
|
|
|
|
borderRects.l = IntRect(0, 8, 16, h-16);
|
|
|
|
borderRects.r = IntRect(w-16, 8, 16, h-16);
|
|
|
|
borderRects.t = IntRect(8, 0, w-16, 16 );
|
|
|
|
borderRects.b = IntRect(8, h-16, w-16, 16 );
|
|
|
|
|
|
|
|
Corners<IntRect> cornerRects;
|
|
|
|
cornerRects.tl = IntRect(0, 0, 16, 16);
|
|
|
|
cornerRects.tr = IntRect(w-16, 0, 16, 16);
|
|
|
|
cornerRects.bl = IntRect(0, h-16, 16, 16);
|
|
|
|
cornerRects.br = IntRect(w-16, h-16, 16, 16);
|
|
|
|
|
|
|
|
/* Required quad count */
|
|
|
|
int count = 0;
|
|
|
|
|
|
|
|
/* Background */
|
|
|
|
if (bgStretch)
|
|
|
|
backgroundVert.count = 1;
|
|
|
|
else
|
|
|
|
backgroundVert.count =
|
|
|
|
TileQuads::twoDimCount(128, 128, bgRect.w, bgRect.h);
|
|
|
|
|
|
|
|
count += backgroundVert.count;
|
|
|
|
|
|
|
|
/* Borders (sides) */
|
|
|
|
count += TileQuads::oneDimCount(32, w-16) * 2;
|
|
|
|
count += TileQuads::oneDimCount(32, h-16) * 2;
|
|
|
|
|
|
|
|
/* Corners */
|
|
|
|
count += 4;
|
|
|
|
|
|
|
|
/* Our vertex array */
|
|
|
|
baseQuadArray.resize(count);
|
|
|
|
Vertex *vert = baseQuadArray.vertices.data();
|
|
|
|
|
|
|
|
int i = 0;
|
|
|
|
backgroundVert.vert = &vert[i];
|
|
|
|
|
|
|
|
/* Background */
|
|
|
|
if (bgStretch)
|
|
|
|
{
|
|
|
|
Quad::setTexRect(&vert[i*4], backgroundSrc);
|
|
|
|
Quad::setPosRect(&vert[i*4], bgRect);
|
|
|
|
i += 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
i += TileQuads::build(backgroundSrc, bgRect, &vert[i*4]);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Borders */
|
|
|
|
i += TileQuads::buildH(bordersSrc.t, w-16, 8, 0, &vert[i*4]);
|
|
|
|
i += TileQuads::buildH(bordersSrc.b, w-16, 8, h-16, &vert[i*4]);
|
|
|
|
i += TileQuads::buildV(bordersSrc.l, h-16, 0, 8, &vert[i*4]);
|
|
|
|
i += TileQuads::buildV(bordersSrc.r, h-16, w-16, 8, &vert[i*4]);
|
|
|
|
|
|
|
|
/* Corners */
|
|
|
|
i += Quad::setTexPosRect(&vert[i*4], cornersSrc.tl, cornerRects.tl);
|
|
|
|
i += Quad::setTexPosRect(&vert[i*4], cornersSrc.tr, cornerRects.tr);
|
|
|
|
i += Quad::setTexPosRect(&vert[i*4], cornersSrc.bl, cornerRects.bl);
|
|
|
|
i += Quad::setTexPosRect(&vert[i*4], cornersSrc.br, cornerRects.br);
|
|
|
|
|
|
|
|
for (int j = 0; j < count*4; ++j)
|
|
|
|
vert[j].color = Vec4(1, 1, 1, 1);
|
|
|
|
|
|
|
|
|
|
|
|
FloatRect texRect = FloatRect(0, 0, size.x, size.y);
|
|
|
|
baseTexQuad.setTexPosRect(texRect, texRect);
|
|
|
|
|
2013-09-27 02:37:56 +00:00
|
|
|
opacityDirty = true;
|
2013-09-01 14:27:21 +00:00
|
|
|
baseTexDirty = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void updateBaseAlpha()
|
|
|
|
{
|
|
|
|
/* This is always applied unconditionally */
|
|
|
|
backgroundVert.setAlpha(backOpacity.norm);
|
|
|
|
|
|
|
|
baseTexQuad.setColor(Vec4(1, 1, 1, opacity.norm));
|
|
|
|
|
|
|
|
baseTexDirty = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ensureBaseTexReady()
|
|
|
|
{
|
|
|
|
/* Make sure texture is big enough */
|
|
|
|
int newW = baseTex.width;
|
|
|
|
int newH = baseTex.height;
|
|
|
|
bool resizeNeeded = false;
|
|
|
|
|
|
|
|
if (size.x > baseTex.width)
|
|
|
|
{
|
|
|
|
newW = findNextPow2(size.x);
|
|
|
|
resizeNeeded = true;
|
|
|
|
}
|
|
|
|
if (size.y > baseTex.height)
|
|
|
|
{
|
|
|
|
newH = findNextPow2(size.y);
|
|
|
|
resizeNeeded = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!resizeNeeded)
|
|
|
|
return;
|
|
|
|
|
2013-10-09 10:30:33 +00:00
|
|
|
shState->texPool().release(baseTex);
|
|
|
|
baseTex = shState->texPool().request(newW, newH);
|
2013-09-01 14:27:21 +00:00
|
|
|
|
|
|
|
baseTexDirty = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void redrawBaseTex()
|
|
|
|
{
|
|
|
|
/* Discard old buffer */
|
2013-09-06 10:26:41 +00:00
|
|
|
TEX::bind(baseTex.tex);
|
|
|
|
TEX::allocEmpty(baseTex.width, baseTex.height);
|
|
|
|
TEX::unbind();
|
2013-09-01 14:27:21 +00:00
|
|
|
|
2014-07-16 03:22:43 +00:00
|
|
|
FBO::bind(baseTex.fbo);
|
2013-09-23 05:15:01 +00:00
|
|
|
glState.viewport.pushSet(IntRect(0, 0, baseTex.width, baseTex.height));
|
2013-09-01 14:27:21 +00:00
|
|
|
glState.clearColor.pushSet(Vec4());
|
|
|
|
|
2013-12-11 04:22:13 +00:00
|
|
|
SimpleAlphaShader &shader = shState->shaders().simpleAlpha;
|
2013-09-23 05:15:01 +00:00
|
|
|
shader.bind();
|
|
|
|
shader.applyViewportProj();
|
|
|
|
shader.setTranslation(Vec2i());
|
|
|
|
|
2013-09-01 14:27:21 +00:00
|
|
|
/* Clear texture */
|
2013-10-01 11:10:14 +00:00
|
|
|
FBO::clear();
|
2013-09-01 14:27:21 +00:00
|
|
|
|
|
|
|
/* Repaint base */
|
2013-09-23 05:15:01 +00:00
|
|
|
windowskin->bindTex(shader);
|
2013-09-06 10:26:41 +00:00
|
|
|
TEX::setSmooth(true);
|
2013-09-01 14:27:21 +00:00
|
|
|
|
|
|
|
/* We need to blit the background without blending,
|
|
|
|
* because we want to retain its correct alpha value.
|
|
|
|
* Otherwise it would be mutliplied by the backgrounds 0 alpha */
|
2014-07-20 11:17:12 +00:00
|
|
|
glState.blend.pushSet(false);
|
2013-09-01 14:27:21 +00:00
|
|
|
|
|
|
|
baseQuadArray.draw(0, backgroundVert.count);
|
|
|
|
|
|
|
|
/* Now draw the rest (ie. the frame) with blending */
|
2014-07-20 11:17:12 +00:00
|
|
|
glState.blend.pop();
|
|
|
|
glState.blendMode.pushSet(BlendNormal);
|
2013-09-01 14:27:21 +00:00
|
|
|
|
|
|
|
baseQuadArray.draw(backgroundVert.count, baseQuadArray.count()-backgroundVert.count);
|
|
|
|
|
2013-09-23 05:15:01 +00:00
|
|
|
glState.clearColor.pop();
|
2013-09-01 14:27:21 +00:00
|
|
|
glState.blendMode.pop();
|
2013-09-23 05:15:01 +00:00
|
|
|
glState.viewport.pop();
|
2013-09-06 10:26:41 +00:00
|
|
|
TEX::setSmooth(false);
|
2013-09-01 14:27:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void buildControlsVert()
|
|
|
|
{
|
|
|
|
int i = 0;
|
|
|
|
Vertex *vert = controlsQuadArray.vertices.data();
|
|
|
|
|
|
|
|
/* Cursor */
|
|
|
|
if (!cursorRect->isEmpty())
|
|
|
|
{
|
|
|
|
/* Effective cursor rect has 16 xy offset to window */
|
|
|
|
IntRect effectRect(cursorRect->x+16, cursorRect->y+16,
|
|
|
|
cursorRect->width, cursorRect->height);
|
|
|
|
cursorVert.vert = &vert[i*4];
|
2013-09-30 17:32:24 +00:00
|
|
|
TileQuads::buildFrameSource(cursorSrc, cursorVert.vert);
|
|
|
|
i += TileQuads::buildFrame(effectRect, cursorVert.vert);
|
2013-09-01 14:27:21 +00:00
|
|
|
}
|
|
|
|
|
2015-02-10 15:42:32 +00:00
|
|
|
/* Scroll arrow position: Top Bottom X, Left Right Y */
|
|
|
|
const Vec2i scroll = (size - Vec2i(16)) / 2;
|
2013-09-01 14:27:21 +00:00
|
|
|
|
|
|
|
Sides<IntRect> scrollArrows;
|
|
|
|
|
2015-02-10 15:42:32 +00:00
|
|
|
scrollArrows.l = IntRect(4, scroll.y, 8, 16);
|
|
|
|
scrollArrows.r = IntRect(size.x - 12, scroll.y, 8, 16);
|
|
|
|
scrollArrows.t = IntRect(scroll.x, 4, 16, 8);
|
|
|
|
scrollArrows.b = IntRect(scroll.x, size.y - 12, 16, 8);
|
2013-09-01 14:27:21 +00:00
|
|
|
|
|
|
|
if (contents)
|
|
|
|
{
|
|
|
|
if (contentsOffset.x > 0)
|
|
|
|
i += Quad::setTexPosRect(&vert[i*4], scrollArrowSrc.l, scrollArrows.l);
|
|
|
|
|
|
|
|
if (contentsOffset.y > 0)
|
|
|
|
i += Quad::setTexPosRect(&vert[i*4], scrollArrowSrc.t, scrollArrows.t);
|
|
|
|
|
|
|
|
if ((size.x - 32) < (contents->width() - contentsOffset.x))
|
|
|
|
i += Quad::setTexPosRect(&vert[i*4], scrollArrowSrc.r, scrollArrows.r);
|
|
|
|
|
|
|
|
if ((size.y - 32) < (contents->height() - contentsOffset.y))
|
|
|
|
i += Quad::setTexPosRect(&vert[i*4], scrollArrowSrc.b, scrollArrows.b);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Pause animation */
|
|
|
|
if (pause)
|
|
|
|
{
|
|
|
|
pauseAniVert.vert = &vert[i*4];
|
|
|
|
i += Quad::setTexPosRect(&vert[i*4], pauseAniSrc[pauseAniQuad[pauseAniQuadIdx]],
|
2014-01-05 15:09:00 +00:00
|
|
|
FloatRect((size.x - 16) / 2, size.y - 16, 16, 16));
|
2013-09-01 14:27:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
controlsQuadArray.commit();
|
|
|
|
controlsQuadCount = i;
|
|
|
|
}
|
|
|
|
|
|
|
|
void prepare()
|
|
|
|
{
|
2014-10-15 04:26:46 +00:00
|
|
|
if (size.x <= 0 || size.y <= 0)
|
|
|
|
return;
|
|
|
|
|
2013-09-01 14:27:21 +00:00
|
|
|
bool updateBaseQuadArray = false;
|
|
|
|
|
|
|
|
if (baseVertDirty)
|
|
|
|
{
|
|
|
|
buildBaseVert();
|
|
|
|
baseVertDirty = false;
|
|
|
|
updateBaseQuadArray = true;
|
|
|
|
}
|
2013-09-27 02:37:56 +00:00
|
|
|
|
2013-09-01 14:27:21 +00:00
|
|
|
if (opacityDirty)
|
|
|
|
{
|
|
|
|
updateBaseAlpha();
|
|
|
|
opacityDirty = false;
|
|
|
|
updateBaseQuadArray = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (updateBaseQuadArray)
|
|
|
|
baseQuadArray.commit();
|
|
|
|
|
|
|
|
/* If opacity has effect, we must prerender to a texture
|
|
|
|
* and then draw this texture instead of the quad array */
|
|
|
|
useBaseTex = opacity < 255;
|
|
|
|
|
|
|
|
if (useBaseTex)
|
|
|
|
{
|
|
|
|
ensureBaseTexReady();
|
|
|
|
|
|
|
|
if (baseTexDirty)
|
|
|
|
{
|
|
|
|
redrawBaseTex();
|
|
|
|
baseTexDirty = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void drawBase()
|
|
|
|
{
|
2014-09-23 19:12:58 +00:00
|
|
|
if (nullOrDisposed(windowskin))
|
2013-09-01 14:27:21 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
if (size == Vec2i(0, 0))
|
|
|
|
return;
|
|
|
|
|
2013-12-11 04:22:13 +00:00
|
|
|
SimpleAlphaShader &shader = shState->shaders().simpleAlpha;
|
2013-09-23 05:15:01 +00:00
|
|
|
shader.bind();
|
|
|
|
shader.applyViewportProj();
|
2015-02-10 15:42:32 +00:00
|
|
|
shader.setTranslation(position + sceneOffset);
|
2013-09-01 14:27:21 +00:00
|
|
|
|
|
|
|
if (useBaseTex)
|
|
|
|
{
|
2013-09-23 05:15:01 +00:00
|
|
|
shader.setTexSize(Vec2i(baseTex.width, baseTex.height));
|
|
|
|
|
|
|
|
TEX::bind(baseTex.tex);
|
2013-09-01 14:27:21 +00:00
|
|
|
baseTexQuad.draw();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-09-23 05:15:01 +00:00
|
|
|
windowskin->bindTex(shader);
|
2013-09-06 10:26:41 +00:00
|
|
|
TEX::setSmooth(true);
|
2013-09-01 14:27:21 +00:00
|
|
|
|
|
|
|
baseQuadArray.draw();
|
|
|
|
|
2013-09-06 10:26:41 +00:00
|
|
|
TEX::setSmooth(false);
|
2013-09-01 14:27:21 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void drawControls()
|
|
|
|
{
|
2014-09-23 19:12:58 +00:00
|
|
|
if (nullOrDisposed(windowskin) && nullOrDisposed(contents))
|
2013-09-01 14:27:21 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
if (size == Vec2i(0, 0))
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (controlsVertDirty)
|
|
|
|
{
|
|
|
|
buildControlsVert();
|
|
|
|
updateControls();
|
|
|
|
controlsVertDirty = false;
|
|
|
|
}
|
|
|
|
|
2015-02-10 15:42:32 +00:00
|
|
|
/* Effective on screen coordinates */
|
|
|
|
const Vec2i efPos = position + sceneOffset;
|
2013-09-01 14:27:21 +00:00
|
|
|
|
2015-02-10 15:42:32 +00:00
|
|
|
const IntRect windowRect(efPos, size);
|
|
|
|
const IntRect contentsRect(efPos + Vec2i(16), size - Vec2i(32));
|
2013-09-01 14:27:21 +00:00
|
|
|
|
|
|
|
glState.scissorTest.pushSet(true);
|
|
|
|
glState.scissorBox.push();
|
|
|
|
glState.scissorBox.setIntersect(windowRect);
|
|
|
|
|
2013-12-11 04:22:13 +00:00
|
|
|
SimpleAlphaShader &shader = shState->shaders().simpleAlpha;
|
2013-09-23 05:15:01 +00:00
|
|
|
shader.bind();
|
|
|
|
shader.applyViewportProj();
|
|
|
|
|
2014-09-23 19:12:58 +00:00
|
|
|
if (!nullOrDisposed(windowskin))
|
2014-07-09 00:47:32 +00:00
|
|
|
{
|
2015-02-10 15:42:32 +00:00
|
|
|
shader.setTranslation(efPos);
|
2014-07-09 00:47:32 +00:00
|
|
|
|
|
|
|
/* Draw arrows / cursors */
|
|
|
|
windowskin->bindTex(shader);
|
|
|
|
TEX::setSmooth(true);
|
2014-07-03 12:32:03 +00:00
|
|
|
|
2014-07-09 00:47:32 +00:00
|
|
|
controlsQuadArray.draw(0, controlsQuadCount);
|
2013-09-01 14:27:21 +00:00
|
|
|
|
2014-07-09 00:47:32 +00:00
|
|
|
TEX::setSmooth(false);
|
|
|
|
}
|
2014-07-03 12:32:03 +00:00
|
|
|
|
2014-09-23 19:12:58 +00:00
|
|
|
if (!nullOrDisposed(contents))
|
2013-09-01 14:27:21 +00:00
|
|
|
{
|
|
|
|
/* Draw contents bitmap */
|
|
|
|
glState.scissorBox.setIntersect(contentsRect);
|
|
|
|
|
2015-02-10 15:42:32 +00:00
|
|
|
shader.setTranslation(efPos + (Vec2i(16) - contentsOffset));
|
2013-09-23 05:15:01 +00:00
|
|
|
|
|
|
|
contents->bindTex(shader);
|
2013-09-01 14:27:21 +00:00
|
|
|
contentsQuad.draw();
|
|
|
|
}
|
|
|
|
|
|
|
|
glState.scissorBox.pop();
|
|
|
|
glState.scissorTest.pop();
|
|
|
|
}
|
|
|
|
|
|
|
|
void updateControls()
|
|
|
|
{
|
|
|
|
bool updateArray = false;
|
|
|
|
|
|
|
|
if (active && cursorVert.vert)
|
|
|
|
{
|
2015-07-14 16:20:31 +00:00
|
|
|
float alpha = cursorAniAlpha[cursorAniAlphaIdx] / 255.0f;
|
2013-09-01 14:27:21 +00:00
|
|
|
|
|
|
|
cursorVert.setAlpha(alpha);
|
|
|
|
|
|
|
|
updateArray = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pause && pauseAniVert.vert)
|
|
|
|
{
|
2015-07-14 16:20:31 +00:00
|
|
|
float alpha = pauseAniAlpha[pauseAniAlphaIdx] / 255.0f;
|
2013-09-01 14:27:21 +00:00
|
|
|
FloatRect frameRect = pauseAniSrc[pauseAniQuad[pauseAniQuadIdx]];
|
|
|
|
|
|
|
|
pauseAniVert.setAlpha(alpha);
|
|
|
|
Quad::setTexRect(pauseAniVert.vert, frameRect);
|
|
|
|
|
|
|
|
updateArray = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (updateArray)
|
|
|
|
controlsQuadArray.commit();
|
|
|
|
}
|
|
|
|
|
|
|
|
void stepAnimations()
|
|
|
|
{
|
|
|
|
if (++cursorAniAlphaIdx == cursorAniAlphaN)
|
|
|
|
cursorAniAlphaIdx = 0;
|
|
|
|
|
|
|
|
if (pauseAniAlphaIdx < pauseAniAlphaN-1)
|
|
|
|
++pauseAniAlphaIdx;
|
|
|
|
|
|
|
|
if (++pauseAniQuadIdx == pauseAniQuadN)
|
|
|
|
pauseAniQuadIdx = 0;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
Window::Window(Viewport *viewport)
|
|
|
|
: ViewportElement(viewport)
|
|
|
|
{
|
|
|
|
p = new WindowPrivate(viewport);
|
|
|
|
onGeometryChange(scene->getGeometry());
|
|
|
|
}
|
|
|
|
|
|
|
|
Window::~Window()
|
|
|
|
{
|
2014-09-23 19:12:58 +00:00
|
|
|
dispose();
|
2013-09-01 14:27:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Window::update()
|
|
|
|
{
|
2014-09-23 19:12:58 +00:00
|
|
|
guardDisposed();
|
|
|
|
|
2013-09-01 14:27:21 +00:00
|
|
|
p->updateControls();
|
|
|
|
p->stepAnimations();
|
|
|
|
}
|
|
|
|
|
|
|
|
DEF_ATTR_SIMPLE(Window, X, int, p->position.x)
|
|
|
|
DEF_ATTR_SIMPLE(Window, Y, int, p->position.y)
|
2014-10-25 21:33:41 +00:00
|
|
|
DEF_ATTR_SIMPLE(Window, CursorRect, Rect&, *p->cursorRect)
|
2013-09-01 14:27:21 +00:00
|
|
|
|
Implement a new tileset atlas layout to allow for bigger tilesets
The atlas packing algorithm has been reworked to pack autotiles
and tileset very efficiently into a texture, splitting the tileset
in multiple ways and eliminating the previous duplication of image
data in the atlas across "frames". Animation, which these frames
were designed for, is now done via duplicated buffer frames,
ie. each animation frame has its own VBO and IBO data. This was
not done to save on VRAM (hardly less memory is used), but to
make place for the new atlas layout.
Thanks to this new layout, even with a max texture size of 2048,
one can use tilesets with up to 15000 height. Of course, such
a tileset couldn't be stored in a regular Bitmap to begin with,
which is why I also introduced a hack called "mega surfaces":
software surfaces stored in RAM and wrapped inside a Bitmap,
whose sole purpose is to be passed to a Tilemap as tilesets.
Various other minor changes and fixes are included.
2013-09-23 20:21:58 +00:00
|
|
|
DEF_ATTR_RD_SIMPLE(Window, Windowskin, Bitmap*, p->windowskin)
|
2013-09-01 14:27:21 +00:00
|
|
|
DEF_ATTR_RD_SIMPLE(Window, Contents, Bitmap*, p->contents)
|
|
|
|
DEF_ATTR_RD_SIMPLE(Window, Stretch, bool, p->bgStretch)
|
|
|
|
DEF_ATTR_RD_SIMPLE(Window, Active, bool, p->active)
|
|
|
|
DEF_ATTR_RD_SIMPLE(Window, Pause, bool, p->pause)
|
|
|
|
DEF_ATTR_RD_SIMPLE(Window, Width, int, p->size.x)
|
|
|
|
DEF_ATTR_RD_SIMPLE(Window, Height, int, p->size.y)
|
|
|
|
DEF_ATTR_RD_SIMPLE(Window, OX, int, p->contentsOffset.x)
|
|
|
|
DEF_ATTR_RD_SIMPLE(Window, OY, int, p->contentsOffset.y)
|
|
|
|
DEF_ATTR_RD_SIMPLE(Window, Opacity, int, p->opacity)
|
|
|
|
DEF_ATTR_RD_SIMPLE(Window, BackOpacity, int, p->backOpacity)
|
|
|
|
DEF_ATTR_RD_SIMPLE(Window, ContentsOpacity, int, p->contentsOpacity)
|
|
|
|
|
Implement a new tileset atlas layout to allow for bigger tilesets
The atlas packing algorithm has been reworked to pack autotiles
and tileset very efficiently into a texture, splitting the tileset
in multiple ways and eliminating the previous duplication of image
data in the atlas across "frames". Animation, which these frames
were designed for, is now done via duplicated buffer frames,
ie. each animation frame has its own VBO and IBO data. This was
not done to save on VRAM (hardly less memory is used), but to
make place for the new atlas layout.
Thanks to this new layout, even with a max texture size of 2048,
one can use tilesets with up to 15000 height. Of course, such
a tileset couldn't be stored in a regular Bitmap to begin with,
which is why I also introduced a hack called "mega surfaces":
software surfaces stored in RAM and wrapped inside a Bitmap,
whose sole purpose is to be passed to a Tilemap as tilesets.
Various other minor changes and fixes are included.
2013-09-23 20:21:58 +00:00
|
|
|
void Window::setWindowskin(Bitmap *value)
|
|
|
|
{
|
2014-09-23 19:12:58 +00:00
|
|
|
guardDisposed();
|
|
|
|
|
Implement a new tileset atlas layout to allow for bigger tilesets
The atlas packing algorithm has been reworked to pack autotiles
and tileset very efficiently into a texture, splitting the tileset
in multiple ways and eliminating the previous duplication of image
data in the atlas across "frames". Animation, which these frames
were designed for, is now done via duplicated buffer frames,
ie. each animation frame has its own VBO and IBO data. This was
not done to save on VRAM (hardly less memory is used), but to
make place for the new atlas layout.
Thanks to this new layout, even with a max texture size of 2048,
one can use tilesets with up to 15000 height. Of course, such
a tileset couldn't be stored in a regular Bitmap to begin with,
which is why I also introduced a hack called "mega surfaces":
software surfaces stored in RAM and wrapped inside a Bitmap,
whose sole purpose is to be passed to a Tilemap as tilesets.
Various other minor changes and fixes are included.
2013-09-23 20:21:58 +00:00
|
|
|
p->windowskin = value;
|
2013-09-28 19:48:02 +00:00
|
|
|
|
2014-12-22 07:22:45 +00:00
|
|
|
if (nullOrDisposed(value))
|
2013-09-28 19:48:02 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
value->ensureNonMega();
|
Implement a new tileset atlas layout to allow for bigger tilesets
The atlas packing algorithm has been reworked to pack autotiles
and tileset very efficiently into a texture, splitting the tileset
in multiple ways and eliminating the previous duplication of image
data in the atlas across "frames". Animation, which these frames
were designed for, is now done via duplicated buffer frames,
ie. each animation frame has its own VBO and IBO data. This was
not done to save on VRAM (hardly less memory is used), but to
make place for the new atlas layout.
Thanks to this new layout, even with a max texture size of 2048,
one can use tilesets with up to 15000 height. Of course, such
a tileset couldn't be stored in a regular Bitmap to begin with,
which is why I also introduced a hack called "mega surfaces":
software surfaces stored in RAM and wrapped inside a Bitmap,
whose sole purpose is to be passed to a Tilemap as tilesets.
Various other minor changes and fixes are included.
2013-09-23 20:21:58 +00:00
|
|
|
}
|
|
|
|
|
2013-09-01 14:27:21 +00:00
|
|
|
void Window::setContents(Bitmap *value)
|
|
|
|
{
|
2014-09-23 19:12:58 +00:00
|
|
|
guardDisposed();
|
|
|
|
|
2013-09-28 19:48:02 +00:00
|
|
|
if (p->contents == value)
|
|
|
|
return;
|
2013-09-01 14:27:21 +00:00
|
|
|
|
|
|
|
p->contents = value;
|
|
|
|
p->controlsVertDirty = true;
|
|
|
|
|
2014-12-22 07:22:45 +00:00
|
|
|
if (nullOrDisposed(value))
|
2013-09-28 19:48:02 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
value->ensureNonMega();
|
|
|
|
p->contentsQuad.setTexPosRect(value->rect(), value->rect());
|
2013-09-01 14:27:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Window::setStretch(bool value)
|
|
|
|
{
|
2014-09-23 19:12:58 +00:00
|
|
|
guardDisposed();
|
|
|
|
|
2013-09-01 14:27:21 +00:00
|
|
|
if (value == p->bgStretch)
|
|
|
|
return;
|
|
|
|
|
|
|
|
p->bgStretch = value;
|
|
|
|
p->baseVertDirty = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Window::setActive(bool value)
|
|
|
|
{
|
2014-09-23 19:12:58 +00:00
|
|
|
guardDisposed();
|
|
|
|
|
2013-09-01 14:27:21 +00:00
|
|
|
if (p->active == value)
|
|
|
|
return;
|
|
|
|
|
|
|
|
p->active = value;
|
|
|
|
p->cursorAniAlphaIdx = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Window::setPause(bool value)
|
|
|
|
{
|
2014-09-23 19:12:58 +00:00
|
|
|
guardDisposed();
|
|
|
|
|
2013-09-01 14:27:21 +00:00
|
|
|
if (p->pause == value)
|
|
|
|
return;
|
|
|
|
|
|
|
|
p->pause = value;
|
|
|
|
p->pauseAniAlphaIdx = 0;
|
|
|
|
p->pauseAniQuadIdx = 0;
|
|
|
|
p->controlsVertDirty = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Window::setWidth(int value)
|
|
|
|
{
|
2014-09-23 19:12:58 +00:00
|
|
|
guardDisposed();
|
|
|
|
|
2013-09-01 14:27:21 +00:00
|
|
|
if (p->size.x == value)
|
|
|
|
return;
|
|
|
|
|
|
|
|
p->size.x = value;
|
|
|
|
p->baseVertDirty = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Window::setHeight(int value)
|
|
|
|
{
|
2014-09-23 19:12:58 +00:00
|
|
|
guardDisposed();
|
|
|
|
|
2013-09-01 14:27:21 +00:00
|
|
|
if (p->size.y == value)
|
|
|
|
return;
|
|
|
|
|
|
|
|
p->size.y = value;
|
|
|
|
p->baseVertDirty = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Window::setOX(int value)
|
|
|
|
{
|
2014-09-23 19:12:58 +00:00
|
|
|
guardDisposed();
|
|
|
|
|
2013-09-01 14:27:21 +00:00
|
|
|
if (p->contentsOffset.x == value)
|
|
|
|
return;
|
|
|
|
|
|
|
|
p->contentsOffset.x = value;
|
|
|
|
p->controlsVertDirty = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Window::setOY(int value)
|
|
|
|
{
|
2014-09-23 19:12:58 +00:00
|
|
|
guardDisposed();
|
|
|
|
|
2013-09-01 14:27:21 +00:00
|
|
|
if (p->contentsOffset.y == value)
|
|
|
|
return;
|
|
|
|
|
|
|
|
p->contentsOffset.y = value;
|
|
|
|
p->controlsVertDirty = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Window::setOpacity(int value)
|
|
|
|
{
|
2014-09-23 19:12:58 +00:00
|
|
|
guardDisposed();
|
|
|
|
|
2013-09-01 14:27:21 +00:00
|
|
|
if (p->opacity == value)
|
|
|
|
return;
|
|
|
|
|
|
|
|
p->opacity = value;
|
|
|
|
p->opacityDirty = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Window::setBackOpacity(int value)
|
|
|
|
{
|
2014-09-23 19:12:58 +00:00
|
|
|
guardDisposed();
|
|
|
|
|
2013-09-01 14:27:21 +00:00
|
|
|
if (p->backOpacity == value)
|
|
|
|
return;
|
|
|
|
|
|
|
|
p->backOpacity = value;
|
|
|
|
p->opacityDirty = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Window::setContentsOpacity(int value)
|
|
|
|
{
|
2014-09-23 19:12:58 +00:00
|
|
|
guardDisposed();
|
|
|
|
|
2013-09-01 14:27:21 +00:00
|
|
|
if (p->contentsOpacity == value)
|
|
|
|
return;
|
|
|
|
|
|
|
|
p->contentsOpacity = value;
|
|
|
|
p->contentsQuad.setColor(Vec4(1, 1, 1, p->contentsOpacity.norm));
|
|
|
|
}
|
|
|
|
|
2014-09-04 23:26:03 +00:00
|
|
|
void Window::initDynAttribs()
|
|
|
|
{
|
|
|
|
p->cursorRect = new Rect;
|
|
|
|
|
|
|
|
p->refreshCursorRectCon();
|
|
|
|
}
|
|
|
|
|
2013-09-01 14:27:21 +00:00
|
|
|
void Window::draw()
|
|
|
|
{
|
|
|
|
p->drawBase();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Window::onGeometryChange(const Scene::Geometry &geo)
|
|
|
|
{
|
2015-02-10 15:42:32 +00:00
|
|
|
p->sceneOffset = geo.offset();
|
2013-09-01 14:27:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Window::setZ(int value)
|
|
|
|
{
|
|
|
|
ViewportElement::setZ(value);
|
|
|
|
|
|
|
|
p->controlsElement.setZ(value + 2);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Window::setVisible(bool value)
|
|
|
|
{
|
|
|
|
ViewportElement::setVisible(value);
|
|
|
|
|
|
|
|
p->controlsElement.setVisible(value);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Window::onViewportChange()
|
|
|
|
{
|
|
|
|
p->controlsElement.setScene(*this->scene);
|
|
|
|
}
|
2014-09-23 19:12:58 +00:00
|
|
|
|
|
|
|
void Window::releaseResources()
|
|
|
|
{
|
|
|
|
p->controlsElement.release();
|
|
|
|
|
|
|
|
unlink();
|
|
|
|
|
|
|
|
delete p;
|
|
|
|
}
|