2013-09-01 14:27:21 +00:00
|
|
|
/*
|
2013-10-09 10:30:33 +00:00
|
|
|
** sharedstate.h
|
2013-09-01 14:27:21 +00:00
|
|
|
**
|
|
|
|
** 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/>.
|
|
|
|
*/
|
|
|
|
|
2013-10-09 10:30:33 +00:00
|
|
|
#ifndef SHAREDSTATE_H
|
|
|
|
#define SHAREDSTATE_H
|
2013-09-01 14:27:21 +00:00
|
|
|
|
2013-12-04 16:48:37 +00:00
|
|
|
#include <sigc++/signal.h>
|
2013-09-01 14:27:21 +00:00
|
|
|
|
2013-10-09 10:30:33 +00:00
|
|
|
#define shState SharedState::instance
|
|
|
|
#define glState shState->_glState()
|
2013-09-01 14:27:21 +00:00
|
|
|
|
2013-10-09 10:30:33 +00:00
|
|
|
struct SharedStatePrivate;
|
2013-09-01 14:27:21 +00:00
|
|
|
struct RGSSThreadData;
|
|
|
|
struct GlobalIBO;
|
|
|
|
struct mrb_state;
|
|
|
|
struct SDL_Window;
|
2013-09-06 10:26:41 +00:00
|
|
|
struct TEXFBO;
|
2013-09-04 17:07:28 +00:00
|
|
|
struct Quad;
|
2013-09-01 14:27:21 +00:00
|
|
|
|
|
|
|
class Scene;
|
|
|
|
class FileSystem;
|
|
|
|
class EventThread;
|
|
|
|
class Graphics;
|
|
|
|
class Input;
|
|
|
|
class Audio;
|
|
|
|
class GLState;
|
2013-09-23 05:15:01 +00:00
|
|
|
class SimpleShader;
|
|
|
|
class SimpleColorShader;
|
|
|
|
class SimpleAlphaShader;
|
|
|
|
class SimpleSpriteShader;
|
2013-09-04 19:03:59 +00:00
|
|
|
class SimpleMatrixShader;
|
2013-09-01 14:27:21 +00:00
|
|
|
class SpriteShader;
|
2013-09-23 05:15:01 +00:00
|
|
|
class PlaneShader;
|
2013-09-23 06:27:28 +00:00
|
|
|
class FlashMapShader;
|
2013-09-01 14:27:21 +00:00
|
|
|
class TransShader;
|
|
|
|
class SimpleTransShader;
|
|
|
|
class HueShader;
|
|
|
|
class BltShader;
|
|
|
|
class TexPool;
|
|
|
|
class FontPool;
|
|
|
|
class Font;
|
2013-10-01 16:10:43 +00:00
|
|
|
struct BlurShader;
|
2013-09-01 14:27:21 +00:00
|
|
|
struct GlobalIBO;
|
|
|
|
struct Config;
|
2013-09-23 05:15:01 +00:00
|
|
|
struct Vec2i;
|
2013-09-01 14:27:21 +00:00
|
|
|
|
2013-10-09 10:30:33 +00:00
|
|
|
struct SharedState
|
2013-09-01 14:27:21 +00:00
|
|
|
{
|
|
|
|
void *bindingData();
|
|
|
|
void setBindingData(void *data);
|
|
|
|
|
|
|
|
SDL_Window *sdlWindow();
|
|
|
|
|
|
|
|
Scene *screen();
|
|
|
|
void setScreen(Scene &screen);
|
|
|
|
|
|
|
|
FileSystem &fileSystem();
|
|
|
|
|
|
|
|
EventThread &eThread();
|
|
|
|
RGSSThreadData &rtData();
|
|
|
|
Config &config();
|
|
|
|
|
|
|
|
Graphics &graphics();
|
|
|
|
Input &input();
|
|
|
|
Audio &audio();
|
|
|
|
|
|
|
|
GLState &_glState();
|
|
|
|
|
2013-09-23 05:15:01 +00:00
|
|
|
SimpleShader &simpleShader();
|
|
|
|
SimpleColorShader &simpleColorShader();
|
|
|
|
SimpleAlphaShader &simpleAlphaShader();
|
|
|
|
SimpleSpriteShader &simpleSpriteShader();
|
2013-09-01 14:27:21 +00:00
|
|
|
SpriteShader &spriteShader();
|
2013-09-23 05:15:01 +00:00
|
|
|
PlaneShader &planeShader();
|
2013-09-23 06:27:28 +00:00
|
|
|
FlashMapShader &flashMapShader();
|
2013-09-01 14:27:21 +00:00
|
|
|
TransShader &transShader();
|
|
|
|
SimpleTransShader &sTransShader();
|
|
|
|
HueShader &hueShader();
|
|
|
|
BltShader &bltShader();
|
|
|
|
|
2013-10-02 20:40:09 +00:00
|
|
|
#ifdef RGSS2
|
|
|
|
SimpleMatrixShader &simpleMatrixShader();
|
|
|
|
BlurShader &blurShader();
|
|
|
|
#endif
|
|
|
|
|
2013-09-01 14:27:21 +00:00
|
|
|
TexPool &texPool();
|
|
|
|
FontPool &fontPool();
|
|
|
|
|
|
|
|
Font &defaultFont();
|
|
|
|
|
|
|
|
sigc::signal<void> prepareDraw;
|
|
|
|
|
|
|
|
unsigned int genTimeStamp();
|
|
|
|
|
|
|
|
/* Returns global quad IBO, and ensures it has indices
|
|
|
|
* for at least minSize quads */
|
|
|
|
void ensureQuadIBO(int minSize);
|
|
|
|
void bindQuadIBO();
|
|
|
|
|
|
|
|
/* Global general purpose texture */
|
|
|
|
void bindTex();
|
2013-09-23 05:15:01 +00:00
|
|
|
void ensureTexSize(int minW, int minH, Vec2i ¤tSizeOut);
|
2013-09-01 14:27:21 +00:00
|
|
|
|
2013-09-06 10:26:41 +00:00
|
|
|
TEXFBO &gpTexFBO(int minW, int minH);
|
2013-09-01 14:27:21 +00:00
|
|
|
|
2013-09-04 17:07:28 +00:00
|
|
|
Quad &gpQuad();
|
|
|
|
|
2013-10-22 04:36:13 +00:00
|
|
|
/* Basically just a simple "TexPool"
|
|
|
|
* replacement for Tilemap atlas use */
|
|
|
|
void requestAtlasTex(int w, int h, TEXFBO &out);
|
|
|
|
void releaseAtlasTex(TEXFBO &tex);
|
|
|
|
|
2013-09-01 14:27:21 +00:00
|
|
|
/* Checks EventThread's shutdown request flag and if set,
|
|
|
|
* requests the binding to terminate. In this case, this
|
|
|
|
* function will most likely not return */
|
|
|
|
void checkShutdown();
|
|
|
|
|
2013-10-09 10:30:33 +00:00
|
|
|
static SharedState *instance;
|
2013-09-01 14:27:21 +00:00
|
|
|
static void initInstance(RGSSThreadData *threadData);
|
|
|
|
static void finiInstance();
|
|
|
|
|
|
|
|
private:
|
2013-10-09 10:30:33 +00:00
|
|
|
SharedState(RGSSThreadData *threadData);
|
|
|
|
~SharedState();
|
2013-09-01 14:27:21 +00:00
|
|
|
|
2013-10-09 10:30:33 +00:00
|
|
|
SharedStatePrivate *p;
|
2013-09-01 14:27:21 +00:00
|
|
|
};
|
|
|
|
|
2013-10-09 10:30:33 +00:00
|
|
|
#endif // SHAREDSTATE_H
|