metaforce/Editor/SplashScreen/SplashScreen.hpp

165 lines
4.6 KiB
C++
Raw Normal View History

2015-12-13 02:27:34 +00:00
#ifndef RUDE_SPLASH_SCREEN_HPP
#define RUDE_SPLASH_SCREEN_HPP
#include <Specter/View.hpp>
#include <Specter/MultiLineTextView.hpp>
#include "ViewManager.hpp"
namespace RUDE
{
class SplashScreen : public Specter::View
{
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_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;
2015-12-13 21:01:32 +00:00
std::unique_ptr<Specter::MultiLineTextView> m_buildInfo;
struct Child
{
std::unique_ptr<Specter::Button> m_button;
bool m_mouseIn = false;
bool m_mouseDown = false;
void mouseDown(const boo::SWindowCoord& coord, boo::EMouseButton button, boo::EModifierKey mod)
{
2015-12-13 21:03:26 +00:00
if (!m_button)
return;
2015-12-13 21:01:32 +00:00
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)
{
2015-12-13 21:03:26 +00:00
if (!m_button)
return;
2015-12-13 21:01:32 +00:00
if (m_mouseDown)
{
m_button->mouseUp(coord, button, mod);
m_mouseDown = false;
}
}
void mouseMove(const boo::SWindowCoord& coord)
{
2015-12-13 21:03:26 +00:00
if (!m_button)
return;
2015-12-13 21:01:32 +00:00
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)
{
2015-12-13 21:03:26 +00:00
if (!m_button)
return;
2015-12-13 21:01:32 +00:00
}
void mouseLeave(const boo::SWindowCoord& coord)
{
2015-12-13 21:03:26 +00:00
if (!m_button)
return;
2015-12-13 21:01:32 +00:00
if (m_mouseIn)
{
m_button->mouseLeave(coord);
m_mouseIn = false;
}
}
};
Child m_newButt;
Child m_openButt;
Child m_extractButt;
2015-12-13 02:27:34 +00:00
std::unique_ptr<Specter::TextView> m_cornersOutline[4];
std::unique_ptr<Specter::TextView> m_cornersFilled[4];
2015-12-13 21:01:32 +00:00
struct NewProjBinding : Specter::IButtonBinding
{
const char* name() const {return "New Project";}
const char* help() const {return "Creates an empty project at selected path";}
2015-12-14 04:56:25 +00:00
void activated(const boo::SWindowCoord& coord)
2015-12-13 21:01:32 +00:00
{
}
} m_newProjBind;
struct OpenProjBinding : Specter::IButtonBinding
{
const char* name() const {return "Open Project";}
const char* help() const {return "Opens an existing project at selected path";}
2015-12-14 04:56:25 +00:00
void activated(const boo::SWindowCoord& coord)
2015-12-13 21:01:32 +00:00
{
}
} m_openProjBind;
struct ExtractProjBinding : Specter::IButtonBinding
{
const char* name() const {return "Extract Game";}
const char* help() const {return "Extracts game image as project at selected path";}
2015-12-14 04:56:25 +00:00
void activated(const boo::SWindowCoord& coord)
2015-12-13 21:01:32 +00:00
{
}
} m_extractProjBind;
2015-12-13 02:27:34 +00:00
public:
SplashScreen(ViewManager& vm, Specter::ViewResources& res);
void think();
2015-12-13 21:01:32 +00:00
void mouseDown(const boo::SWindowCoord&, boo::EMouseButton, boo::EModifierKey);
void mouseUp(const boo::SWindowCoord&, boo::EMouseButton, boo::EModifierKey);
void mouseMove(const boo::SWindowCoord&);
void mouseEnter(const boo::SWindowCoord&);
void mouseLeave(const boo::SWindowCoord&);
2015-12-13 02:27:34 +00:00
void resized(const boo::SWindowRect& root, const boo::SWindowRect& sub);
void draw(boo::IGraphicsCommandQueue* gfxQ);
};
}
#endif // RUDE_SPLASH_SCREEN_HPP