openspades/Sources/Gui/SDLRunner.h

64 lines
1.7 KiB
C
Raw Normal View History

2013-08-29 11:45:22 +09:00
/*
Copyright (c) 2013 yvt
This file is part of OpenSpades.
OpenSpades 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 3 of the License, or
(at your option) any later version.
OpenSpades 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 OpenSpades. If not, see <http://www.gnu.org/licenses/>.
*/
2013-08-18 16:18:06 +09:00
#pragma once
#include <Core/IRunnable.h>
#include <Imports/SDL.h>
2013-08-18 16:18:06 +09:00
#include <string>
#include <Core/ServerAddress.h>
2013-08-18 16:18:06 +09:00
namespace spades {
namespace client{
class IRenderer;
class IAudioDevice;
}
namespace gui {
2013-11-22 22:50:14 +09:00
class View;
class SDLRunner {
bool mActive;
2014-02-07 00:09:26 +09:00
bool m_hasSystemMenu;
2013-08-18 16:18:06 +09:00
protected:
enum class RendererType {
GL,
SW
};
virtual RendererType GetRendererType();
2013-12-09 17:36:05 +09:00
std::string TranslateKey(const SDL_Keysym&);
2013-08-18 16:18:06 +09:00
std::string TranslateButton(Uint8 b);
virtual int GetModState();
void ProcessEvent(SDL_Event& event,
2013-11-22 22:50:14 +09:00
View *);
2013-08-18 16:18:06 +09:00
virtual void RunClientLoop(client::IRenderer *renderer, client::IAudioDevice *dev);
2013-11-22 22:50:14 +09:00
virtual View *CreateView(client::IRenderer *renderer, client::IAudioDevice *dev) = 0;
2013-12-15 21:51:00 +09:00
virtual client::IAudioDevice *CreateAudioDevice();
client::IRenderer *CreateRenderer(SDL_Window *);
2013-08-18 16:18:06 +09:00
public:
2013-11-22 22:50:14 +09:00
SDLRunner();
2013-08-18 16:18:06 +09:00
virtual ~SDLRunner();
void Run(int width, int height);
2014-02-07 00:09:26 +09:00
void SetHasSystemMenu(bool b) { m_hasSystemMenu = b; }
2013-08-18 16:18:06 +09:00
};
}
}