2014-06-25 16:29:58 +00:00
|
|
|
#include "views/gamelist/IGameListView.h"
|
2017-11-01 22:21:10 +00:00
|
|
|
|
2014-06-25 16:29:58 +00:00
|
|
|
#include "guis/GuiGamelistOptions.h"
|
|
|
|
#include "views/ViewController.h"
|
|
|
|
#include "Sound.h"
|
2017-11-01 22:21:10 +00:00
|
|
|
#include "Window.h"
|
2014-06-25 16:29:58 +00:00
|
|
|
|
|
|
|
bool IGameListView::input(InputConfig* config, Input input)
|
|
|
|
{
|
|
|
|
// select to open GuiGamelistOptions
|
|
|
|
if(config->isMappedTo("select", input) && input.value)
|
|
|
|
{
|
|
|
|
Sound::getFromTheme(mTheme, getName(), "menuOpen")->play();
|
|
|
|
mWindow->pushGui(new GuiGamelistOptions(mWindow, this->mRoot->getSystem()));
|
|
|
|
return true;
|
|
|
|
|
|
|
|
// Ctrl-R to reload a view when debugging
|
|
|
|
}else if(Settings::getInstance()->getBool("Debug") && config->getDeviceId() == DEVICE_KEYBOARD &&
|
|
|
|
(SDL_GetModState() & (KMOD_LCTRL | KMOD_RCTRL)) && input.id == SDLK_r && input.value != 0)
|
|
|
|
{
|
|
|
|
LOG(LogDebug) << "reloading view";
|
|
|
|
ViewController::get()->reloadGameListView(this, true);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return GuiComponent::input(config, input);
|
|
|
|
}
|
|
|
|
|
|
|
|
void IGameListView::setTheme(const std::shared_ptr<ThemeData>& theme)
|
|
|
|
{
|
|
|
|
mTheme = theme;
|
|
|
|
onThemeChanged(theme);
|
|
|
|
}
|
|
|
|
|
|
|
|
HelpStyle IGameListView::getHelpStyle()
|
|
|
|
{
|
|
|
|
HelpStyle style;
|
|
|
|
style.applyTheme(mTheme, getName());
|
|
|
|
return style;
|
|
|
|
}
|
2017-05-31 02:41:41 +00:00
|
|
|
|
2017-10-28 20:24:35 +00:00
|
|
|
void IGameListView::render(const Transform4x4f& parentTrans)
|
2017-05-31 02:41:41 +00:00
|
|
|
{
|
2017-10-28 20:24:35 +00:00
|
|
|
Transform4x4f trans = parentTrans * getTransform();
|
2017-06-02 02:25:02 +00:00
|
|
|
|
2017-10-30 19:43:58 +00:00
|
|
|
float scaleX = trans.r0().x();
|
|
|
|
float scaleY = trans.r1().y();
|
2017-06-02 02:25:02 +00:00
|
|
|
|
2017-10-28 20:24:35 +00:00
|
|
|
Vector2i pos(trans.translation()[0], trans.translation()[1]);
|
|
|
|
Vector2i size(mSize.x() * scaleX, mSize.y() * scaleY);
|
2017-06-02 02:25:02 +00:00
|
|
|
|
|
|
|
Renderer::pushClipRect(pos, size);
|
2017-05-31 02:41:41 +00:00
|
|
|
renderChildren(trans);
|
|
|
|
Renderer::popClipRect();
|
|
|
|
}
|