mirror of https://github.com/AxioDL/metaforce.git
SplashScreen update
This commit is contained in:
parent
5d76545bab
commit
6e2347b1de
|
@ -17,232 +17,30 @@ namespace RUDE
|
||||||
#define LINE_WIDTH 2
|
#define LINE_WIDTH 2
|
||||||
#define TEXT_MARGIN 10
|
#define TEXT_MARGIN 10
|
||||||
|
|
||||||
void SplashScreen::setLineVerts(int width, int height, float pf, float t)
|
|
||||||
{
|
|
||||||
std::pair<int,int> margin = m_cornersOutline[0]->queryGlyphDimensions(0);
|
|
||||||
float t1 = Zeus::Math::clamp(0.f, t * 2.f, 1.f);
|
|
||||||
float t2 = Zeus::Math::clamp(0.f, t * 2.f - 1.f, 1.f);
|
|
||||||
|
|
||||||
float lineLeft = 0;
|
|
||||||
float lineRight = pf*LINE_WIDTH;
|
|
||||||
float lineTop = height-margin.second;
|
|
||||||
float lineBottom = margin.second;
|
|
||||||
m_verts.lineVerts[0].m_pos.assign(lineLeft, lineTop, 0);
|
|
||||||
m_verts.lineVerts[1].m_pos = Zeus::CVector3f::lerp({lineLeft, lineTop, 0}, {lineLeft, lineBottom, 0}, t1);
|
|
||||||
m_verts.lineVerts[2].m_pos.assign(lineRight, lineTop, 0);
|
|
||||||
m_verts.lineVerts[3].m_pos = Zeus::CVector3f::lerp({lineRight, lineTop, 0}, {lineRight, lineBottom, 0}, t1);
|
|
||||||
m_verts.lineVerts[4].m_pos = m_verts.lineVerts[3].m_pos;
|
|
||||||
|
|
||||||
lineLeft = margin.first;
|
|
||||||
lineRight = width-margin.first;
|
|
||||||
lineTop = height;
|
|
||||||
lineBottom = height-pf*LINE_WIDTH;
|
|
||||||
m_verts.lineVerts[5].m_pos.assign(lineLeft, lineTop, 0);
|
|
||||||
m_verts.lineVerts[6].m_pos = m_verts.lineVerts[5].m_pos;
|
|
||||||
m_verts.lineVerts[7].m_pos.assign(lineLeft, lineBottom, 0);
|
|
||||||
m_verts.lineVerts[8].m_pos = Zeus::CVector3f::lerp({lineLeft, lineTop, 0}, {lineRight, lineTop, 0}, t1);
|
|
||||||
m_verts.lineVerts[9].m_pos = Zeus::CVector3f::lerp({lineLeft, lineBottom, 0}, {lineRight, lineBottom, 0}, t1);
|
|
||||||
m_verts.lineVerts[10].m_pos = m_verts.lineVerts[9].m_pos;
|
|
||||||
|
|
||||||
lineLeft = width-pf*LINE_WIDTH;
|
|
||||||
lineRight = width;
|
|
||||||
lineTop = height-margin.second;
|
|
||||||
lineBottom = margin.second;
|
|
||||||
m_verts.lineVerts[11].m_pos.assign(lineLeft, lineTop, 0);
|
|
||||||
m_verts.lineVerts[12].m_pos = m_verts.lineVerts[11].m_pos;
|
|
||||||
m_verts.lineVerts[13].m_pos = Zeus::CVector3f::lerp({lineLeft, lineTop, 0}, {lineLeft, lineBottom, 0}, t2);
|
|
||||||
m_verts.lineVerts[14].m_pos.assign(lineRight, lineTop, 0);
|
|
||||||
m_verts.lineVerts[15].m_pos = Zeus::CVector3f::lerp({lineRight, lineTop, 0}, {lineRight, lineBottom, 0}, t2);
|
|
||||||
m_verts.lineVerts[16].m_pos = m_verts.lineVerts[15].m_pos;
|
|
||||||
|
|
||||||
lineLeft = margin.first;
|
|
||||||
lineRight = width-margin.first;
|
|
||||||
lineTop = pf*LINE_WIDTH;
|
|
||||||
lineBottom = 0;
|
|
||||||
m_verts.lineVerts[17].m_pos.assign(lineLeft, lineTop, 0);
|
|
||||||
m_verts.lineVerts[18].m_pos = m_verts.lineVerts[17].m_pos;
|
|
||||||
m_verts.lineVerts[19].m_pos.assign(lineLeft, lineBottom, 0);
|
|
||||||
m_verts.lineVerts[20].m_pos = Zeus::CVector3f::lerp({lineLeft, lineTop, 0}, {lineRight, lineTop, 0}, t2);
|
|
||||||
m_verts.lineVerts[21].m_pos = Zeus::CVector3f::lerp({lineLeft, lineBottom, 0}, {lineRight, lineBottom, 0}, t2);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SplashScreen::setLineColors(float t)
|
|
||||||
{
|
|
||||||
float t1 = Zeus::Math::clamp(0.f, t * 2.f, 1.f);
|
|
||||||
float t2 = Zeus::Math::clamp(0.f, t * 2.f - 1.f, 1.f);
|
|
||||||
float t3 = Zeus::Math::clamp(0.f, t * 2.f - 2.f, 1.f);
|
|
||||||
|
|
||||||
Zeus::CColor c1 = Zeus::CColor::lerp(m_splash1, m_splash2, t1);
|
|
||||||
Zeus::CColor c2 = Zeus::CColor::lerp(m_splash1, m_splash2, t2);
|
|
||||||
Zeus::CColor c3 = Zeus::CColor::lerp(m_splash1, m_splash2, t3);
|
|
||||||
|
|
||||||
m_cornersOutline[0]->colorGlyphs(c1);
|
|
||||||
if (t < 0.5)
|
|
||||||
{
|
|
||||||
m_cornersOutline[1]->colorGlyphs(Zeus::CColor::skClear);
|
|
||||||
m_cornersOutline[2]->colorGlyphs(Zeus::CColor::skClear);
|
|
||||||
m_cornersOutline[3]->colorGlyphs(Zeus::CColor::skClear);
|
|
||||||
}
|
|
||||||
else if (t < 1.0)
|
|
||||||
{
|
|
||||||
m_cornersOutline[1]->colorGlyphs(c2);
|
|
||||||
m_cornersOutline[3]->colorGlyphs(c2);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_cornersOutline[1]->colorGlyphs(c2);
|
|
||||||
m_cornersOutline[2]->colorGlyphs(c3);
|
|
||||||
m_cornersOutline[3]->colorGlyphs(c2);
|
|
||||||
}
|
|
||||||
|
|
||||||
m_verts.lineVerts[0].m_color = c1;
|
|
||||||
m_verts.lineVerts[1].m_color = c2;
|
|
||||||
m_verts.lineVerts[2].m_color = m_verts.lineVerts[0].m_color;
|
|
||||||
m_verts.lineVerts[3].m_color = m_verts.lineVerts[1].m_color;
|
|
||||||
m_verts.lineVerts[4].m_color = m_verts.lineVerts[3].m_color;
|
|
||||||
|
|
||||||
m_verts.lineVerts[5].m_color = c1;
|
|
||||||
m_verts.lineVerts[6].m_color = m_verts.lineVerts[5].m_color;
|
|
||||||
m_verts.lineVerts[7].m_color = m_verts.lineVerts[6].m_color;
|
|
||||||
m_verts.lineVerts[8].m_color = c2;
|
|
||||||
m_verts.lineVerts[9].m_color = m_verts.lineVerts[8].m_color;
|
|
||||||
m_verts.lineVerts[10].m_color = m_verts.lineVerts[9].m_color;
|
|
||||||
|
|
||||||
m_verts.lineVerts[11].m_color = c2;
|
|
||||||
m_verts.lineVerts[12].m_color = m_verts.lineVerts[11].m_color;
|
|
||||||
m_verts.lineVerts[13].m_color = c3;
|
|
||||||
m_verts.lineVerts[14].m_color = m_verts.lineVerts[12].m_color;
|
|
||||||
m_verts.lineVerts[15].m_color = m_verts.lineVerts[13].m_color;
|
|
||||||
m_verts.lineVerts[16].m_color = m_verts.lineVerts[15].m_color;
|
|
||||||
|
|
||||||
m_verts.lineVerts[17].m_color = c2;
|
|
||||||
m_verts.lineVerts[18].m_color = m_verts.lineVerts[17].m_color;
|
|
||||||
m_verts.lineVerts[19].m_color = m_verts.lineVerts[18].m_color;
|
|
||||||
m_verts.lineVerts[20].m_color = c3;
|
|
||||||
m_verts.lineVerts[21].m_color = m_verts.lineVerts[20].m_color;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SplashScreen::setFillVerts(int width, int height, float pf)
|
|
||||||
{
|
|
||||||
std::pair<int,int> margin = m_cornersFilled[0]->queryGlyphDimensions(0);
|
|
||||||
|
|
||||||
float fillLeft = pf*LINE_WIDTH;
|
|
||||||
float fillRight = width-pf*LINE_WIDTH;
|
|
||||||
float fillTop = height-margin.second;
|
|
||||||
float fillBottom = margin.second;
|
|
||||||
m_verts.fillVerts[0].m_pos.assign(fillLeft, fillTop, 0);
|
|
||||||
m_verts.fillVerts[1].m_pos.assign(fillLeft, fillBottom, 0);
|
|
||||||
m_verts.fillVerts[2].m_pos.assign(fillRight, fillTop, 0);
|
|
||||||
m_verts.fillVerts[3].m_pos.assign(fillRight, fillBottom, 0);
|
|
||||||
m_verts.fillVerts[4].m_pos = m_verts.fillVerts[3].m_pos;
|
|
||||||
|
|
||||||
fillLeft = margin.first;
|
|
||||||
fillRight = width-margin.first;
|
|
||||||
fillTop = height-pf*LINE_WIDTH;
|
|
||||||
fillBottom = height-margin.second;
|
|
||||||
m_verts.fillVerts[5].m_pos.assign(fillLeft, fillTop, 0);
|
|
||||||
m_verts.fillVerts[6].m_pos = m_verts.fillVerts[5].m_pos;
|
|
||||||
m_verts.fillVerts[7].m_pos.assign(fillLeft, fillBottom, 0);
|
|
||||||
m_verts.fillVerts[8].m_pos.assign(fillRight, fillTop, 0);
|
|
||||||
m_verts.fillVerts[9].m_pos.assign(fillRight, fillBottom, 0);
|
|
||||||
m_verts.fillVerts[10].m_pos = m_verts.fillVerts[9].m_pos;
|
|
||||||
|
|
||||||
fillLeft = margin.first;
|
|
||||||
fillRight = width-margin.first;
|
|
||||||
fillTop = margin.second;
|
|
||||||
fillBottom = pf*LINE_WIDTH;
|
|
||||||
m_verts.fillVerts[11].m_pos.assign(fillLeft, fillTop, 0);
|
|
||||||
m_verts.fillVerts[12].m_pos = m_verts.fillVerts[11].m_pos;
|
|
||||||
m_verts.fillVerts[13].m_pos.assign(fillLeft, fillBottom, 0);
|
|
||||||
m_verts.fillVerts[14].m_pos.assign(fillRight, fillTop, 0);
|
|
||||||
m_verts.fillVerts[15].m_pos.assign(fillRight, fillBottom, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SplashScreen::setFillColors(float t)
|
|
||||||
{
|
|
||||||
t = Zeus::Math::clamp(0.f, t, 1.f);
|
|
||||||
Zeus::CColor color = Zeus::CColor::lerp(m_splashBgClear, m_splashBg, t);
|
|
||||||
|
|
||||||
for (int i=0 ; i<16 ; ++i)
|
|
||||||
m_verts.fillVerts[i].m_color = color;
|
|
||||||
for (int i=0 ; i<4 ; ++i)
|
|
||||||
m_cornersFilled[i]->colorGlyphs(color);
|
|
||||||
}
|
|
||||||
|
|
||||||
SplashScreen::SplashScreen(ViewManager& vm, Specter::ViewResources& res)
|
SplashScreen::SplashScreen(ViewManager& vm, Specter::ViewResources& res)
|
||||||
: View(res, vm.rootView()), m_vm(vm),
|
: ModalWindow(res, vm.rootView(), SPLASH_WIDTH, SPLASH_HEIGHT), m_vm(vm),
|
||||||
m_splashBg(res.themeData().splashBackground()),
|
|
||||||
m_splashBgClear(m_splashBg),
|
|
||||||
m_splash1(res.themeData().splash1()),
|
|
||||||
m_splash2(res.themeData().splash2()),
|
|
||||||
m_textColor(res.themeData().uiText()),
|
m_textColor(res.themeData().uiText()),
|
||||||
m_textColorClear(m_textColor)
|
m_textColorClear(m_textColor),
|
||||||
|
m_newProjBind(*this),
|
||||||
|
m_openProjBind(*this),
|
||||||
|
m_extractProjBind(*this)
|
||||||
{
|
{
|
||||||
m_splashBgClear[3] = 0.0;
|
|
||||||
m_textColorClear[3] = 0.0;
|
m_textColorClear[3] = 0.0;
|
||||||
m_viewBlockBuf = res.m_factory->newDynamicBuffer(boo::BufferUse::Uniform, sizeof(ViewBlock), 1);
|
|
||||||
m_vertsBuf = res.m_factory->newDynamicBuffer(boo::BufferUse::Vertex, sizeof(SolidShaderVert), 38);
|
|
||||||
|
|
||||||
if (!res.m_viewRes.m_solidVtxFmt)
|
|
||||||
{
|
|
||||||
boo::VertexElementDescriptor vdescs[] =
|
|
||||||
{
|
|
||||||
{m_vertsBuf, nullptr, boo::VertexSemantic::Position4},
|
|
||||||
{m_vertsBuf, nullptr, boo::VertexSemantic::Color}
|
|
||||||
};
|
|
||||||
m_vertsVtxFmt = res.m_factory->newVertexFormat(2, vdescs);
|
|
||||||
boo::IGraphicsBuffer* bufs[] = {m_viewBlockBuf};
|
|
||||||
m_vertsShaderBinding = res.m_factory->newShaderDataBinding(res.m_viewRes.m_solidShader,
|
|
||||||
m_vertsVtxFmt, m_vertsBuf, nullptr,
|
|
||||||
nullptr, 1, bufs, 0, nullptr);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
boo::IGraphicsBuffer* bufs[] = {m_viewBlockBuf};
|
|
||||||
m_vertsShaderBinding = res.m_factory->newShaderDataBinding(res.m_viewRes.m_solidShader,
|
|
||||||
res.m_viewRes.m_solidVtxFmt,
|
|
||||||
m_vertsBuf, nullptr,
|
|
||||||
nullptr, 1, bufs, 0, nullptr);
|
|
||||||
}
|
|
||||||
commitResources(res);
|
commitResources(res);
|
||||||
|
|
||||||
for (int i=0 ; i<4 ; ++i)
|
|
||||||
{
|
|
||||||
m_cornersOutline[i].reset(new Specter::TextView(res, *this, res.m_curveFont, Specter::TextView::Alignment::Left, 1));
|
|
||||||
m_cornersFilled[i].reset(new Specter::TextView(res, *this, res.m_curveFont, Specter::TextView::Alignment::Left, 1));
|
|
||||||
}
|
|
||||||
m_cornersOutline[0]->typesetGlyphs(L"\xF4F0");
|
|
||||||
m_cornersFilled[0]->typesetGlyphs(L"\xF4F1", res.themeData().splashBackground());
|
|
||||||
m_cornersOutline[1]->typesetGlyphs(L"\xF4F2");
|
|
||||||
m_cornersFilled[1]->typesetGlyphs(L"\xF4F3", res.themeData().splashBackground());
|
|
||||||
m_cornersOutline[2]->typesetGlyphs(L"\xF4F4");
|
|
||||||
m_cornersFilled[2]->typesetGlyphs(L"\xF4F5", res.themeData().splashBackground());
|
|
||||||
m_cornersOutline[3]->typesetGlyphs(L"\xF4F6");
|
|
||||||
m_cornersFilled[3]->typesetGlyphs(L"\xF4F7", res.themeData().splashBackground());
|
|
||||||
|
|
||||||
float pf = res.pixelFactor();
|
|
||||||
setLineVerts(SPLASH_WIDTH * pf, SPLASH_HEIGHT * pf, pf, 0.0);
|
|
||||||
setFillVerts(SPLASH_WIDTH * pf, SPLASH_HEIGHT * pf, pf);
|
|
||||||
setLineColors(0.0);
|
|
||||||
setFillColors(0.0);
|
|
||||||
|
|
||||||
m_vertsBuf->load(&m_verts, sizeof(m_verts));
|
|
||||||
}
|
|
||||||
|
|
||||||
static float CubicEase(float t)
|
|
||||||
{
|
|
||||||
t *= 2.f;
|
|
||||||
if (t < 1) return 1.f/2.f*t*t*t;
|
|
||||||
t -= 2.f;
|
|
||||||
return 1.f/2.f*(t*t*t + 2.f);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SplashScreen::think()
|
void SplashScreen::think()
|
||||||
{
|
{
|
||||||
Specter::ViewResources& res = rootView().viewRes();
|
ModalWindow::think();
|
||||||
float pf = res.pixelFactor();
|
if (m_fileBrowser.m_view)
|
||||||
|
m_fileBrowser.m_view->think();
|
||||||
|
}
|
||||||
|
|
||||||
if (!m_title && res.m_fcacheReady)
|
void SplashScreen::updateContentOpacity(float opacity)
|
||||||
|
{
|
||||||
|
Specter::ViewResources& res = rootView().viewRes();
|
||||||
|
|
||||||
|
if (!m_title && res.fontCacheReady())
|
||||||
{
|
{
|
||||||
m_title.reset(new Specter::TextView(res, *this, res.m_titleFont));
|
m_title.reset(new Specter::TextView(res, *this, res.m_titleFont));
|
||||||
Zeus::CColor clearColor = res.themeData().uiText();
|
Zeus::CColor clearColor = res.themeData().uiText();
|
||||||
|
@ -254,96 +52,93 @@ void SplashScreen::think()
|
||||||
GIT_BRANCH, GIT_COMMIT_HASH, GIT_COMMIT_DATE),
|
GIT_BRANCH, GIT_COMMIT_HASH, GIT_COMMIT_DATE),
|
||||||
clearColor);
|
clearColor);
|
||||||
|
|
||||||
m_newButt.m_button.reset(new Specter::Button(res, *this, &m_newProjBind, "New Project", Specter::Button::Style::Text));
|
m_newButt.m_view.reset(new Specter::Button(res, *this, &m_newProjBind, "New Project", Specter::Button::Style::Text));
|
||||||
m_openButt.m_button.reset(new Specter::Button(res, *this, &m_openProjBind, "Open Project", Specter::Button::Style::Text));
|
m_openButt.m_view.reset(new Specter::Button(res, *this, &m_openProjBind, "Open Project", Specter::Button::Style::Text));
|
||||||
m_extractButt.m_button.reset(new Specter::Button(res, *this, &m_extractProjBind, "Extract Game", Specter::Button::Style::Text));
|
m_extractButt.m_view.reset(new Specter::Button(res, *this, &m_extractProjBind, "Extract Game", Specter::Button::Style::Text));
|
||||||
|
|
||||||
updateSize();
|
updateSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool loadVerts = false;
|
|
||||||
if (m_frame > WIRE_START)
|
|
||||||
{
|
|
||||||
float wt = (m_frame-WIRE_START) / float(WIRE_FRAMES);
|
|
||||||
wt = Zeus::Math::clamp(0.f, wt, 2.f);
|
|
||||||
setLineVerts(SPLASH_WIDTH * pf, SPLASH_HEIGHT * pf, pf, CubicEase(wt));
|
|
||||||
setLineColors(wt);
|
|
||||||
loadVerts = true;
|
|
||||||
}
|
|
||||||
if (m_frame > SOLID_START)
|
|
||||||
{
|
|
||||||
float ft = (m_frame-SOLID_START) / float(SOLID_FRAMES);
|
|
||||||
ft = Zeus::Math::clamp(0.f, ft, 2.f);
|
|
||||||
setFillColors(ft);
|
|
||||||
loadVerts = true;
|
|
||||||
}
|
|
||||||
if (m_title && m_frame > TEXT_START)
|
|
||||||
{
|
|
||||||
if (!m_textStartFrame)
|
|
||||||
m_textStartFrame = m_frame;
|
|
||||||
float tt = (m_frame-m_textStartFrame) / float(TEXT_FRAMES);
|
|
||||||
tt = Zeus::Math::clamp(0.f, tt, 1.f);
|
|
||||||
Zeus::CColor clearColor = res.themeData().uiText();
|
Zeus::CColor clearColor = res.themeData().uiText();
|
||||||
clearColor[3] = 0.0;
|
clearColor[3] = 0.0;
|
||||||
Zeus::CColor color = Zeus::CColor::lerp(clearColor, res.themeData().uiText(), tt);
|
Zeus::CColor color = Zeus::CColor::lerp(clearColor, res.themeData().uiText(), opacity);
|
||||||
m_title->colorGlyphs(color);
|
m_title->colorGlyphs(color);
|
||||||
m_buildInfo->colorGlyphs(color);
|
m_buildInfo->colorGlyphs(color);
|
||||||
m_newButt.m_button->colorGlyphs(color);
|
m_newButt.m_view->colorGlyphs(color);
|
||||||
m_openButt.m_button->colorGlyphs(color);
|
m_openButt.m_view->colorGlyphs(color);
|
||||||
m_extractButt.m_button->colorGlyphs(color);
|
m_extractButt.m_view->colorGlyphs(color);
|
||||||
}
|
|
||||||
|
|
||||||
if (loadVerts)
|
|
||||||
m_vertsBuf->load(&m_verts, sizeof(m_verts));
|
|
||||||
|
|
||||||
++m_frame;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SplashScreen::mouseDown(const boo::SWindowCoord& coord, boo::EMouseButton button, boo::EModifierKey mod)
|
void SplashScreen::mouseDown(const boo::SWindowCoord& coord, boo::EMouseButton button, boo::EModifierKey mod)
|
||||||
{
|
{
|
||||||
|
if (skipBuildInAnimation())
|
||||||
|
return;
|
||||||
|
if (m_fileBrowser.m_view)
|
||||||
|
m_fileBrowser.m_view->mouseDown(coord, button, mod);
|
||||||
|
else
|
||||||
|
{
|
||||||
m_newButt.mouseDown(coord, button, mod);
|
m_newButt.mouseDown(coord, button, mod);
|
||||||
m_openButt.mouseDown(coord, button, mod);
|
m_openButt.mouseDown(coord, button, mod);
|
||||||
m_extractButt.mouseDown(coord, button, mod);
|
m_extractButt.mouseDown(coord, button, mod);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SplashScreen::mouseUp(const boo::SWindowCoord& coord, boo::EMouseButton button, boo::EModifierKey mod)
|
void SplashScreen::mouseUp(const boo::SWindowCoord& coord, boo::EMouseButton button, boo::EModifierKey mod)
|
||||||
{
|
{
|
||||||
|
if (m_fileBrowser.m_view)
|
||||||
|
m_fileBrowser.m_view->mouseUp(coord, button, mod);
|
||||||
|
else
|
||||||
|
{
|
||||||
m_newButt.mouseUp(coord, button, mod);
|
m_newButt.mouseUp(coord, button, mod);
|
||||||
m_openButt.mouseUp(coord, button, mod);
|
m_openButt.mouseUp(coord, button, mod);
|
||||||
m_extractButt.mouseUp(coord, button, mod);
|
m_extractButt.mouseUp(coord, button, mod);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SplashScreen::mouseMove(const boo::SWindowCoord& coord)
|
void SplashScreen::mouseMove(const boo::SWindowCoord& coord)
|
||||||
{
|
{
|
||||||
|
if (m_fileBrowser.m_view)
|
||||||
|
m_fileBrowser.m_view->mouseMove(coord);
|
||||||
|
else
|
||||||
|
{
|
||||||
m_newButt.mouseMove(coord);
|
m_newButt.mouseMove(coord);
|
||||||
m_openButt.mouseMove(coord);
|
m_openButt.mouseMove(coord);
|
||||||
m_extractButt.mouseMove(coord);
|
m_extractButt.mouseMove(coord);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SplashScreen::mouseEnter(const boo::SWindowCoord& coord)
|
void SplashScreen::mouseEnter(const boo::SWindowCoord& coord)
|
||||||
{
|
{
|
||||||
|
if (m_fileBrowser.m_view)
|
||||||
|
m_fileBrowser.m_view->mouseEnter(coord);
|
||||||
|
else
|
||||||
|
{
|
||||||
m_newButt.mouseEnter(coord);
|
m_newButt.mouseEnter(coord);
|
||||||
m_openButt.mouseEnter(coord);
|
m_openButt.mouseEnter(coord);
|
||||||
m_extractButt.mouseEnter(coord);
|
m_extractButt.mouseEnter(coord);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SplashScreen::mouseLeave(const boo::SWindowCoord& coord)
|
void SplashScreen::mouseLeave(const boo::SWindowCoord& coord)
|
||||||
{
|
{
|
||||||
|
if (m_fileBrowser.m_view)
|
||||||
|
m_fileBrowser.m_view->mouseLeave(coord);
|
||||||
|
else
|
||||||
|
{
|
||||||
m_newButt.mouseLeave(coord);
|
m_newButt.mouseLeave(coord);
|
||||||
m_openButt.mouseLeave(coord);
|
m_openButt.mouseLeave(coord);
|
||||||
m_extractButt.mouseLeave(coord);
|
m_extractButt.mouseLeave(coord);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SplashScreen::resized(const boo::SWindowRect& root, const boo::SWindowRect& sub)
|
void SplashScreen::resized(const boo::SWindowRect& root, const boo::SWindowRect& sub)
|
||||||
{
|
{
|
||||||
|
ModalWindow::resized(root, sub);
|
||||||
float pf = rootView().viewRes().pixelFactor();
|
float pf = rootView().viewRes().pixelFactor();
|
||||||
|
|
||||||
boo::SWindowRect centerRect = sub;
|
boo::SWindowRect centerRect = subRect();
|
||||||
centerRect.location[0] = root.size[0] / 2 - (SPLASH_WIDTH * pf / 2.0);
|
centerRect.location[0] = root.size[0] / 2 - (SPLASH_WIDTH * pf / 2.0);
|
||||||
centerRect.location[1] = root.size[1] / 2 - (SPLASH_HEIGHT * pf / 2.0);
|
centerRect.location[1] = root.size[1] / 2 - (SPLASH_HEIGHT * pf / 2.0);
|
||||||
View::resized(root, centerRect);
|
|
||||||
m_viewBlock.setViewRect(root, centerRect);
|
|
||||||
m_viewBlockBuf->load(&m_viewBlock, sizeof(m_viewBlock));
|
|
||||||
|
|
||||||
boo::SWindowRect textRect = centerRect;
|
boo::SWindowRect textRect = centerRect;
|
||||||
textRect.location[0] += TEXT_MARGIN * pf;
|
textRect.location[0] += TEXT_MARGIN * pf;
|
||||||
|
@ -355,68 +150,44 @@ void SplashScreen::resized(const boo::SWindowRect& root, const boo::SWindowRect&
|
||||||
textRect.location[1] -= 5 * pf;
|
textRect.location[1] -= 5 * pf;
|
||||||
m_buildInfo->resized(root, textRect);
|
m_buildInfo->resized(root, textRect);
|
||||||
|
|
||||||
textRect.size[0] = m_newButt.m_button->nominalWidth();
|
textRect.size[0] = m_newButt.m_view->nominalWidth();
|
||||||
textRect.size[1] = m_newButt.m_button->nominalHeight();
|
textRect.size[1] = m_newButt.m_view->nominalHeight();
|
||||||
textRect.location[1] = centerRect.location[1] + 20 * pf;
|
textRect.location[1] = centerRect.location[1] + 20 * pf;
|
||||||
textRect.location[0] = centerRect.location[0] + SPLASH_WIDTH / 4 * pf - m_newButt.m_button->nominalWidth() / 2;
|
textRect.location[0] = centerRect.location[0] + SPLASH_WIDTH / 4 * pf - m_newButt.m_view->nominalWidth() / 2;
|
||||||
m_newButt.m_button->resized(root, textRect);
|
m_newButt.m_view->resized(root, textRect);
|
||||||
|
|
||||||
textRect.size[0] = m_openButt.m_button->nominalWidth();
|
textRect.size[0] = m_openButt.m_view->nominalWidth();
|
||||||
textRect.size[1] = m_openButt.m_button->nominalHeight();
|
textRect.size[1] = m_openButt.m_view->nominalHeight();
|
||||||
textRect.location[1] = centerRect.location[1] + 20 * pf;
|
textRect.location[1] = centerRect.location[1] + 20 * pf;
|
||||||
textRect.location[0] = centerRect.location[0] + SPLASH_WIDTH * 2 / 4 * pf - m_openButt.m_button->nominalWidth() / 2;
|
textRect.location[0] = centerRect.location[0] + SPLASH_WIDTH * 2 / 4 * pf - m_openButt.m_view->nominalWidth() / 2;
|
||||||
m_openButt.m_button->resized(root, textRect);
|
m_openButt.m_view->resized(root, textRect);
|
||||||
|
|
||||||
textRect.size[0] = m_extractButt.m_button->nominalWidth();
|
textRect.size[0] = m_extractButt.m_view->nominalWidth();
|
||||||
textRect.size[1] = m_extractButt.m_button->nominalHeight();
|
textRect.size[1] = m_extractButt.m_view->nominalHeight();
|
||||||
textRect.location[1] = centerRect.location[1] + 20 * pf;
|
textRect.location[1] = centerRect.location[1] + 20 * pf;
|
||||||
textRect.location[0] = centerRect.location[0] + SPLASH_WIDTH * 3 / 4 * pf - m_extractButt.m_button->nominalWidth() / 2;
|
textRect.location[0] = centerRect.location[0] + SPLASH_WIDTH * 3 / 4 * pf - m_extractButt.m_view->nominalWidth() / 2;
|
||||||
m_extractButt.m_button->resized(root, textRect);
|
m_extractButt.m_view->resized(root, textRect);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_fileBrowser.m_view)
|
||||||
boo::SWindowRect cornerRect = centerRect;
|
m_fileBrowser.m_view->resized(root, root);
|
||||||
cornerRect.size[0] = cornerRect.size[1] = 8 * pf;
|
|
||||||
cornerRect.location[1] = centerRect.location[1] + (SPLASH_HEIGHT - 8) * pf;
|
|
||||||
m_cornersOutline[0]->resized(root, cornerRect);
|
|
||||||
m_cornersFilled[0]->resized(root, cornerRect);
|
|
||||||
cornerRect.location[0] = centerRect.location[0] + (SPLASH_WIDTH - 8) * pf;
|
|
||||||
m_cornersOutline[1]->resized(root, cornerRect);
|
|
||||||
m_cornersFilled[1]->resized(root, cornerRect);
|
|
||||||
cornerRect.location[1] = centerRect.location[1];
|
|
||||||
m_cornersOutline[2]->resized(root, cornerRect);
|
|
||||||
m_cornersFilled[2]->resized(root, cornerRect);
|
|
||||||
cornerRect.location[0] = centerRect.location[0];
|
|
||||||
m_cornersOutline[3]->resized(root, cornerRect);
|
|
||||||
m_cornersFilled[3]->resized(root, cornerRect);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SplashScreen::draw(boo::IGraphicsCommandQueue* gfxQ)
|
void SplashScreen::draw(boo::IGraphicsCommandQueue* gfxQ)
|
||||||
{
|
{
|
||||||
gfxQ->setShaderDataBinding(m_vertsShaderBinding);
|
ModalWindow::draw(gfxQ);
|
||||||
gfxQ->setDrawPrimitive(boo::Primitive::TriStrips);
|
|
||||||
if (m_frame > WIRE_START)
|
if (m_title)
|
||||||
gfxQ->draw(0, 22);
|
|
||||||
if (m_frame > SOLID_START)
|
|
||||||
gfxQ->draw(22, 16);
|
|
||||||
if (m_title && m_textStartFrame && m_frame > m_textStartFrame)
|
|
||||||
{
|
{
|
||||||
m_title->draw(gfxQ);
|
m_title->draw(gfxQ);
|
||||||
m_buildInfo->draw(gfxQ);
|
m_buildInfo->draw(gfxQ);
|
||||||
m_newButt.m_button->draw(gfxQ);
|
m_newButt.m_view->draw(gfxQ);
|
||||||
m_openButt.m_button->draw(gfxQ);
|
m_openButt.m_view->draw(gfxQ);
|
||||||
m_extractButt.m_button->draw(gfxQ);
|
m_extractButt.m_view->draw(gfxQ);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_cornersFilled[0]->draw(gfxQ);
|
if (m_fileBrowser.m_view)
|
||||||
m_cornersFilled[1]->draw(gfxQ);
|
m_fileBrowser.m_view->draw(gfxQ);
|
||||||
m_cornersFilled[2]->draw(gfxQ);
|
|
||||||
m_cornersFilled[3]->draw(gfxQ);
|
|
||||||
|
|
||||||
m_cornersOutline[0]->draw(gfxQ);
|
|
||||||
m_cornersOutline[1]->draw(gfxQ);
|
|
||||||
m_cornersOutline[2]->draw(gfxQ);
|
|
||||||
m_cornersOutline[3]->draw(gfxQ);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,152 +2,75 @@
|
||||||
#define RUDE_SPLASH_SCREEN_HPP
|
#define RUDE_SPLASH_SCREEN_HPP
|
||||||
|
|
||||||
#include <Specter/View.hpp>
|
#include <Specter/View.hpp>
|
||||||
|
#include <Specter/ModalWindow.hpp>
|
||||||
#include <Specter/MultiLineTextView.hpp>
|
#include <Specter/MultiLineTextView.hpp>
|
||||||
|
#include <Specter/FileBrowser.hpp>
|
||||||
#include "ViewManager.hpp"
|
#include "ViewManager.hpp"
|
||||||
|
|
||||||
namespace RUDE
|
namespace RUDE
|
||||||
{
|
{
|
||||||
class SplashScreen : public Specter::View
|
class SplashScreen : public Specter::ModalWindow
|
||||||
{
|
{
|
||||||
ViewManager& m_vm;
|
ViewManager& m_vm;
|
||||||
unsigned m_frame = 0;
|
|
||||||
unsigned m_textStartFrame = 0;
|
|
||||||
|
|
||||||
Zeus::CColor m_splashBg;
|
|
||||||
Zeus::CColor m_splashBgClear;
|
|
||||||
Zeus::CColor m_splash1;
|
|
||||||
Zeus::CColor m_splash2;
|
|
||||||
Zeus::CColor m_textColor;
|
Zeus::CColor m_textColor;
|
||||||
Zeus::CColor m_textColorClear;
|
Zeus::CColor m_textColorClear;
|
||||||
|
|
||||||
ViewBlock m_viewBlock;
|
|
||||||
boo::IGraphicsBufferD* m_viewBlockBuf;
|
|
||||||
struct
|
|
||||||
{
|
|
||||||
SolidShaderVert lineVerts[22];
|
|
||||||
SolidShaderVert fillVerts[16];
|
|
||||||
} m_verts;
|
|
||||||
|
|
||||||
void setLineVerts(int width, int height, float pf, float t);
|
|
||||||
void setLineColors(float t);
|
|
||||||
void setFillVerts(int width, int height, float pf);
|
|
||||||
void setFillColors(float t);
|
|
||||||
|
|
||||||
boo::IGraphicsBufferD* m_vertsBuf;
|
|
||||||
boo::IVertexFormat* m_vertsVtxFmt; /* OpenGL only */
|
|
||||||
boo::IShaderDataBinding* m_vertsShaderBinding;
|
|
||||||
|
|
||||||
std::unique_ptr<Specter::TextView> m_title;
|
std::unique_ptr<Specter::TextView> m_title;
|
||||||
std::unique_ptr<Specter::MultiLineTextView> m_buildInfo;
|
std::unique_ptr<Specter::MultiLineTextView> m_buildInfo;
|
||||||
|
|
||||||
struct Child
|
Specter::ViewChild<Specter::Button> m_newButt;
|
||||||
{
|
Specter::ViewChild<Specter::Button> m_openButt;
|
||||||
std::unique_ptr<Specter::Button> m_button;
|
Specter::ViewChild<Specter::Button> m_extractButt;
|
||||||
bool m_mouseIn = false;
|
|
||||||
bool m_mouseDown = false;
|
|
||||||
|
|
||||||
void mouseDown(const boo::SWindowCoord& coord, boo::EMouseButton button, boo::EModifierKey mod)
|
Specter::ViewChild<Specter::FileBrowser> m_fileBrowser;
|
||||||
{
|
|
||||||
if (!m_button)
|
|
||||||
return;
|
|
||||||
if (m_button->subRect().coordInRect(coord))
|
|
||||||
{
|
|
||||||
if (!m_mouseDown)
|
|
||||||
{
|
|
||||||
m_button->mouseDown(coord, button, mod);
|
|
||||||
m_mouseDown = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void mouseUp(const boo::SWindowCoord& coord, boo::EMouseButton button, boo::EModifierKey mod)
|
|
||||||
{
|
|
||||||
if (!m_button)
|
|
||||||
return;
|
|
||||||
if (m_mouseDown)
|
|
||||||
{
|
|
||||||
m_button->mouseUp(coord, button, mod);
|
|
||||||
m_mouseDown = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void mouseMove(const boo::SWindowCoord& coord)
|
|
||||||
{
|
|
||||||
if (!m_button)
|
|
||||||
return;
|
|
||||||
if (m_button->subRect().coordInRect(coord))
|
|
||||||
{
|
|
||||||
if (!m_mouseIn)
|
|
||||||
{
|
|
||||||
m_button->mouseEnter(coord);
|
|
||||||
m_mouseIn = true;
|
|
||||||
}
|
|
||||||
m_button->mouseMove(coord);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (m_mouseIn)
|
|
||||||
{
|
|
||||||
m_button->mouseLeave(coord);
|
|
||||||
m_mouseIn = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void mouseEnter(const boo::SWindowCoord& coord)
|
|
||||||
{
|
|
||||||
if (!m_button)
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
void mouseLeave(const boo::SWindowCoord& coord)
|
|
||||||
{
|
|
||||||
if (!m_button)
|
|
||||||
return;
|
|
||||||
if (m_mouseIn)
|
|
||||||
{
|
|
||||||
m_button->mouseLeave(coord);
|
|
||||||
m_mouseIn = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
Child m_newButt;
|
|
||||||
Child m_openButt;
|
|
||||||
Child m_extractButt;
|
|
||||||
|
|
||||||
std::unique_ptr<Specter::TextView> m_cornersOutline[4];
|
|
||||||
std::unique_ptr<Specter::TextView> m_cornersFilled[4];
|
|
||||||
|
|
||||||
struct NewProjBinding : Specter::IButtonBinding
|
struct NewProjBinding : Specter::IButtonBinding
|
||||||
{
|
{
|
||||||
|
SplashScreen& m_splash;
|
||||||
|
NewProjBinding(SplashScreen& splash) : m_splash(splash) {}
|
||||||
const char* name() const {return "New Project";}
|
const char* name() const {return "New Project";}
|
||||||
const char* help() const {return "Creates an empty project at selected path";}
|
const char* help() const {return "Creates an empty project at selected path";}
|
||||||
void activated(const boo::SWindowCoord& coord)
|
void activated(const boo::SWindowCoord& coord)
|
||||||
{
|
{
|
||||||
|
m_splash.m_fileBrowser.m_view.reset(new Specter::FileBrowser(m_splash.rootView().viewRes(), m_splash));
|
||||||
|
m_splash.updateSize();
|
||||||
|
m_splash.m_newButt.mouseLeave(coord);
|
||||||
}
|
}
|
||||||
} m_newProjBind;
|
} m_newProjBind;
|
||||||
|
|
||||||
struct OpenProjBinding : Specter::IButtonBinding
|
struct OpenProjBinding : Specter::IButtonBinding
|
||||||
{
|
{
|
||||||
|
SplashScreen& m_splash;
|
||||||
|
OpenProjBinding(SplashScreen& splash) : m_splash(splash) {}
|
||||||
const char* name() const {return "Open Project";}
|
const char* name() const {return "Open Project";}
|
||||||
const char* help() const {return "Opens an existing project at selected path";}
|
const char* help() const {return "Opens an existing project at selected path";}
|
||||||
void activated(const boo::SWindowCoord& coord)
|
void activated(const boo::SWindowCoord& coord)
|
||||||
{
|
{
|
||||||
|
m_splash.m_fileBrowser.m_view.reset(new Specter::FileBrowser(m_splash.rootView().viewRes(), m_splash));
|
||||||
|
m_splash.updateSize();
|
||||||
|
m_splash.m_openButt.mouseLeave(coord);
|
||||||
}
|
}
|
||||||
} m_openProjBind;
|
} m_openProjBind;
|
||||||
|
|
||||||
struct ExtractProjBinding : Specter::IButtonBinding
|
struct ExtractProjBinding : Specter::IButtonBinding
|
||||||
{
|
{
|
||||||
|
SplashScreen& m_splash;
|
||||||
|
ExtractProjBinding(SplashScreen& splash) : m_splash(splash) {}
|
||||||
const char* name() const {return "Extract Game";}
|
const char* name() const {return "Extract Game";}
|
||||||
const char* help() const {return "Extracts game image as project at selected path";}
|
const char* help() const {return "Extracts game image as project at selected path";}
|
||||||
void activated(const boo::SWindowCoord& coord)
|
void activated(const boo::SWindowCoord& coord)
|
||||||
{
|
{
|
||||||
|
m_splash.m_fileBrowser.m_view.reset(new Specter::FileBrowser(m_splash.rootView().viewRes(), m_splash));
|
||||||
|
m_splash.updateSize();
|
||||||
|
m_splash.m_extractButt.mouseLeave(coord);
|
||||||
}
|
}
|
||||||
} m_extractProjBind;
|
} m_extractProjBind;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SplashScreen(ViewManager& vm, Specter::ViewResources& res);
|
SplashScreen(ViewManager& vm, Specter::ViewResources& res);
|
||||||
void think();
|
void think();
|
||||||
|
void updateContentOpacity(float opacity);
|
||||||
|
|
||||||
void mouseDown(const boo::SWindowCoord&, boo::EMouseButton, boo::EModifierKey);
|
void mouseDown(const boo::SWindowCoord&, boo::EMouseButton, boo::EModifierKey);
|
||||||
void mouseUp(const boo::SWindowCoord&, boo::EMouseButton, boo::EModifierKey);
|
void mouseUp(const boo::SWindowCoord&, boo::EMouseButton, boo::EModifierKey);
|
||||||
|
|
2
hecl
2
hecl
|
@ -1 +1 @@
|
||||||
Subproject commit 3bbe5b63ce2041d47caea11dd820cdc993ce027f
|
Subproject commit 4ebed628de9346a964e30f58aafe673f8599faaf
|
|
@ -1 +1 @@
|
||||||
Subproject commit 3a626196f46ec8ffec840e101b6ca9aa3e253e06
|
Subproject commit 6bfea926eebe07d00a2c92b481d5e581f8dffeee
|
Loading…
Reference in New Issue