Rename 'GlobalState' to 'SharedState' to avoid confusion with GLState

This was particularly nasty with the shorthand macros
'gState' and 'glState'. The former is now 'shState'.
This commit is contained in:
Jonas Kulla 2013-10-09 12:30:33 +02:00
parent 807bee5748
commit cb6f73f7df
32 changed files with 222 additions and 222 deletions

View File

@ -20,7 +20,7 @@
*/ */
#include "audio.h" #include "audio.h"
#include "globalstate.h" #include "sharedstate.h"
#include "binding-util.h" #include "binding-util.h"
#include "exception.h" #include "exception.h"
@ -32,13 +32,13 @@
int volume = 100; \ int volume = 100; \
int pitch = 100; \ int pitch = 100; \
rb_get_args(argc, argv, "z|ii", &filename, &volume, &pitch, RB_ARG_END); \ rb_get_args(argc, argv, "z|ii", &filename, &volume, &pitch, RB_ARG_END); \
GUARD_EXC( gState->audio().entity##Play(filename, volume, pitch); ) \ GUARD_EXC( shState->audio().entity##Play(filename, volume, pitch); ) \
return Qnil; \ return Qnil; \
} \ } \
RB_METHOD(audio_##entity##Stop) \ RB_METHOD(audio_##entity##Stop) \
{ \ { \
RB_UNUSED_PARAM; \ RB_UNUSED_PARAM; \
gState->audio().entity##Stop(); \ shState->audio().entity##Stop(); \
return Qnil; \ return Qnil; \
} }
@ -48,7 +48,7 @@ RB_METHOD(audio_##entity##Fade) \
RB_UNUSED_PARAM; \ RB_UNUSED_PARAM; \
int time; \ int time; \
rb_get_args(argc, argv, "i", &time, RB_ARG_END); \ rb_get_args(argc, argv, "i", &time, RB_ARG_END); \
gState->audio().bgmFade(time); \ shState->audio().bgmFade(time); \
return Qnil; \ return Qnil; \
} }

View File

@ -21,7 +21,7 @@
#include "binding.h" #include "binding.h"
#include "binding-util.h" #include "binding-util.h"
#include "globalstate.h" #include "sharedstate.h"
#include "eventthread.h" #include "eventthread.h"
#include "filesystem.h" #include "filesystem.h"
@ -101,7 +101,7 @@ static void mriBindingInit()
static void static void
showMsg(const QByteArray &msg) showMsg(const QByteArray &msg)
{ {
gState->eThread().showMessageBox(msg.constData()); shState->eThread().showMessageBox(msg.constData());
} }
static void printP(int argc, VALUE *argv, static void printP(int argc, VALUE *argv,
@ -185,7 +185,7 @@ struct Script
static void runRMXPScripts() static void runRMXPScripts()
{ {
const QByteArray &scriptPack = gState->rtData().config.game.scripts; const QByteArray &scriptPack = shState->rtData().config.game.scripts;
if (scriptPack.isEmpty()) if (scriptPack.isEmpty())
{ {
@ -193,7 +193,7 @@ static void runRMXPScripts()
return; return;
} }
if (!gState->fileSystem().exists(scriptPack.constData())) if (!shState->fileSystem().exists(scriptPack.constData()))
{ {
showMsg("Unable to open '" + scriptPack + "'"); showMsg("Unable to open '" + scriptPack + "'");
return; return;
@ -290,11 +290,11 @@ static void mriBindingExecute()
ruby_setup(); ruby_setup();
RbData rbData; RbData rbData;
gState->setBindingData(&rbData); shState->setBindingData(&rbData);
mriBindingInit(); mriBindingInit();
QByteArray &customScript = gState->rtData().config.customScript; QByteArray &customScript = shState->rtData().config.customScript;
if (!customScript.isEmpty()) if (!customScript.isEmpty())
runCustomScript(customScript.constData()); runCustomScript(customScript.constData());
else else
@ -315,7 +315,7 @@ static void mriBindingExecute()
ruby_cleanup(0); ruby_cleanup(0);
gState->rtData().rqTermAck = true; shState->rtData().rqTermAck = true;
} }
static void mriBindingTerminate() static void mriBindingTerminate()

View File

@ -21,7 +21,7 @@
#include "binding-util.h" #include "binding-util.h"
#include "globalstate.h" #include "sharedstate.h"
#include "exception.h" #include "exception.h"
#include "util.h" #include "util.h"
@ -44,7 +44,7 @@ void initType(rb_data_type_struct &type,
RbData *getRbData() RbData *getRbData()
{ {
return static_cast<RbData*>(gState->bindingData()); return static_cast<RbData*>(shState->bindingData());
} }
struct struct

View File

@ -21,7 +21,7 @@
#include "binding-util.h" #include "binding-util.h"
#include "globalstate.h" #include "sharedstate.h"
#include "filesystem.h" #include "filesystem.h"
#include <QDebug> #include <QDebug>
@ -32,7 +32,7 @@ static VALUE
fileIntForPath(const char *path) fileIntForPath(const char *path)
{ {
SDL_RWops *ops = SDL_AllocRW(); SDL_RWops *ops = SDL_AllocRW();
gState->fileSystem().openRead(*ops, path); shState->fileSystem().openRead(*ops, path);
VALUE klass = rb_const_get(rb_cObject, rb_intern("FileInt")); VALUE klass = rb_const_get(rb_cObject, rb_intern("FileInt"));

View File

@ -20,7 +20,7 @@
*/ */
#include "graphics.h" #include "graphics.h"
#include "globalstate.h" #include "sharedstate.h"
#include "binding-util.h" #include "binding-util.h"
#include "exception.h" #include "exception.h"
@ -28,7 +28,7 @@ RB_METHOD(graphicsUpdate)
{ {
RB_UNUSED_PARAM; RB_UNUSED_PARAM;
gState->graphics().update(); shState->graphics().update();
return Qnil; return Qnil;
} }
@ -37,7 +37,7 @@ RB_METHOD(graphicsFreeze)
{ {
RB_UNUSED_PARAM; RB_UNUSED_PARAM;
gState->graphics().freeze(); shState->graphics().freeze();
return Qnil; return Qnil;
} }
@ -52,7 +52,7 @@ RB_METHOD(graphicsTransition)
rb_get_args(argc, argv, "|izi", &duration, &filename, &vague, RB_ARG_END); rb_get_args(argc, argv, "|izi", &duration, &filename, &vague, RB_ARG_END);
GUARD_EXC( gState->graphics().transition(duration, filename, vague); ) GUARD_EXC( shState->graphics().transition(duration, filename, vague); )
return Qnil; return Qnil;
} }
@ -61,7 +61,7 @@ RB_METHOD(graphicsFrameReset)
{ {
RB_UNUSED_PARAM; RB_UNUSED_PARAM;
gState->graphics().frameReset(); shState->graphics().frameReset();
return Qnil; return Qnil;
} }
@ -70,14 +70,14 @@ RB_METHOD(graphicsFrameReset)
RB_METHOD(graphics##Get##PropName) \ RB_METHOD(graphics##Get##PropName) \
{ \ { \
RB_UNUSED_PARAM; \ RB_UNUSED_PARAM; \
return rb_fix_new(gState->graphics().get##PropName()); \ return rb_fix_new(shState->graphics().get##PropName()); \
} \ } \
RB_METHOD(graphics##Set##PropName) \ RB_METHOD(graphics##Set##PropName) \
{ \ { \
RB_UNUSED_PARAM; \ RB_UNUSED_PARAM; \
int value; \ int value; \
rb_get_args(argc, argv, "i", &value, RB_ARG_END); \ rb_get_args(argc, argv, "i", &value, RB_ARG_END); \
gState->graphics().set##PropName(value); \ shState->graphics().set##PropName(value); \
return rb_fix_new(value); \ return rb_fix_new(value); \
} }
@ -85,14 +85,14 @@ RB_METHOD(graphicsFrameReset)
RB_METHOD(graphics##Get##PropName) \ RB_METHOD(graphics##Get##PropName) \
{ \ { \
RB_UNUSED_PARAM; \ RB_UNUSED_PARAM; \
return rb_bool_new(gState->graphics().get##PropName()); \ return rb_bool_new(shState->graphics().get##PropName()); \
} \ } \
RB_METHOD(graphics##Set##PropName) \ RB_METHOD(graphics##Set##PropName) \
{ \ { \
RB_UNUSED_PARAM; \ RB_UNUSED_PARAM; \
bool value; \ bool value; \
rb_get_args(argc, argv, "b", &value, RB_ARG_END); \ rb_get_args(argc, argv, "b", &value, RB_ARG_END); \
gState->graphics().set##PropName(value); \ shState->graphics().set##PropName(value); \
return rb_bool_new(value); \ return rb_bool_new(value); \
} }

View File

@ -20,7 +20,7 @@
*/ */
#include "input.h" #include "input.h"
#include "globalstate.h" #include "sharedstate.h"
#include "exception.h" #include "exception.h"
#include "binding-util.h" #include "binding-util.h"
@ -28,7 +28,7 @@ RB_METHOD(inputUpdate)
{ {
RB_UNUSED_PARAM; RB_UNUSED_PARAM;
gState->input().update(); shState->input().update();
return Qnil; return Qnil;
} }
@ -42,7 +42,7 @@ RB_METHOD(inputPress)
Input::ButtonCode bc = (Input::ButtonCode) num; Input::ButtonCode bc = (Input::ButtonCode) num;
return rb_bool_new(gState->input().isPressed(bc)); return rb_bool_new(shState->input().isPressed(bc));
} }
RB_METHOD(inputTrigger) RB_METHOD(inputTrigger)
@ -54,7 +54,7 @@ RB_METHOD(inputTrigger)
Input::ButtonCode bc = (Input::ButtonCode) num; Input::ButtonCode bc = (Input::ButtonCode) num;
return rb_bool_new(gState->input().isTriggered(bc)); return rb_bool_new(shState->input().isTriggered(bc));
} }
RB_METHOD(inputRepeat) RB_METHOD(inputRepeat)
@ -66,21 +66,21 @@ RB_METHOD(inputRepeat)
Input::ButtonCode bc = (Input::ButtonCode) num; Input::ButtonCode bc = (Input::ButtonCode) num;
return rb_bool_new(gState->input().isRepeated(bc)); return rb_bool_new(shState->input().isRepeated(bc));
} }
RB_METHOD(inputDir4) RB_METHOD(inputDir4)
{ {
RB_UNUSED_PARAM; RB_UNUSED_PARAM;
return rb_fix_new(gState->input().dir4Value()); return rb_fix_new(shState->input().dir4Value());
} }
RB_METHOD(inputDir8) RB_METHOD(inputDir8)
{ {
RB_UNUSED_PARAM; RB_UNUSED_PARAM;
return rb_fix_new(gState->input().dir8Value()); return rb_fix_new(shState->input().dir8Value());
} }
/* Non-standard extensions */ /* Non-standard extensions */
@ -88,14 +88,14 @@ RB_METHOD(inputMouseX)
{ {
RB_UNUSED_PARAM; RB_UNUSED_PARAM;
return rb_fix_new(gState->input().mouseX()); return rb_fix_new(shState->input().mouseX());
} }
RB_METHOD(inputMouseY) RB_METHOD(inputMouseY)
{ {
RB_UNUSED_PARAM; RB_UNUSED_PARAM;
return rb_fix_new(gState->input().mouseY()); return rb_fix_new(shState->input().mouseY());
} }
#define DEF_CONST_I(name, value) \ #define DEF_CONST_I(name, value) \

View File

@ -20,7 +20,7 @@
*/ */
#include "audio.h" #include "audio.h"
#include "globalstate.h" #include "sharedstate.h"
#include "binding-util.h" #include "binding-util.h"
#include "exception.h" #include "exception.h"
@ -31,13 +31,13 @@
mrb_int volume = 100; \ mrb_int volume = 100; \
mrb_int pitch = 100; \ mrb_int pitch = 100; \
mrb_get_args(mrb, "z|ii", &filename, &volume, &pitch); \ mrb_get_args(mrb, "z|ii", &filename, &volume, &pitch); \
GUARD_EXC( gState->audio().entity##Play(filename, volume, pitch); ) \ GUARD_EXC( shState->audio().entity##Play(filename, volume, pitch); ) \
return mrb_nil_value(); \ return mrb_nil_value(); \
} \ } \
MRB_FUNCTION(audio_##entity##Stop) \ MRB_FUNCTION(audio_##entity##Stop) \
{ \ { \
MRB_FUN_UNUSED_PARAM; \ MRB_FUN_UNUSED_PARAM; \
gState->audio().entity##Stop(); \ shState->audio().entity##Stop(); \
return mrb_nil_value(); \ return mrb_nil_value(); \
} }
@ -46,7 +46,7 @@ MRB_FUNCTION(audio_##entity##Fade) \
{ \ { \
mrb_int time; \ mrb_int time; \
mrb_get_args(mrb, "i", &time); \ mrb_get_args(mrb, "i", &time); \
gState->audio().entity##Fade(time); \ shState->audio().entity##Fade(time); \
return mrb_nil_value(); \ return mrb_nil_value(); \
} }

View File

@ -39,7 +39,7 @@
#include "SDL2/SDL_rwops.h" #include "SDL2/SDL_rwops.h"
#include "SDL2/SDL_timer.h" #include "SDL2/SDL_timer.h"
#include "globalstate.h" #include "sharedstate.h"
#include "texpool.h" #include "texpool.h"
#include "eventthread.h" #include "eventthread.h"
#include "filesystem.h" #include "filesystem.h"
@ -161,7 +161,7 @@ showExcMessageBox(mrb_state *mrb, mrb_value exc)
snprintf(msgBoxText, 512, "Script '%s' line %d: %s occured.\n\n%s", snprintf(msgBoxText, 512, "Script '%s' line %d: %s occured.\n\n%s",
mrbValueString(file), mrb_fixnum(line), excClass, mrbValueString(mesg)); mrbValueString(file), mrb_fixnum(line), excClass, mrbValueString(mesg));
gState->eThread().showMessageBox(msgBoxText, SDL_MESSAGEBOX_ERROR); shState->eThread().showMessageBox(msgBoxText, SDL_MESSAGEBOX_ERROR);
} }
static void static void
@ -182,7 +182,7 @@ checkException(mrb_state *mrb)
static void static void
showError(const QByteArray &msg) showError(const QByteArray &msg)
{ {
gState->eThread().showMessageBox(msg.constData()); shState->eThread().showMessageBox(msg.constData());
} }
static void static void
@ -244,7 +244,7 @@ runMrbFile(mrb_state *mrb, const char *filename)
static void static void
runRMXPScripts(mrb_state *mrb, mrbc_context *ctx) runRMXPScripts(mrb_state *mrb, mrbc_context *ctx)
{ {
const QByteArray &scriptPack = gState->rtData().config.game.scripts; const QByteArray &scriptPack = shState->rtData().config.game.scripts;
if (scriptPack.isEmpty()) if (scriptPack.isEmpty())
{ {
@ -252,7 +252,7 @@ runRMXPScripts(mrb_state *mrb, mrbc_context *ctx)
return; return;
} }
if (!gState->fileSystem().exists(scriptPack.constData())) if (!shState->fileSystem().exists(scriptPack.constData()))
{ {
showError("Unable to open '" + scriptPack + "'"); showError("Unable to open '" + scriptPack + "'");
return; return;
@ -262,7 +262,7 @@ runRMXPScripts(mrb_state *mrb, mrbc_context *ctx)
mrb_state *scriptMrb = mrb_open(); mrb_state *scriptMrb = mrb_open();
SDL_RWops ops; SDL_RWops ops;
gState->fileSystem().openRead(ops, scriptPack.constData()); shState->fileSystem().openRead(ops, scriptPack.constData());
mrb_value scriptArray = mrb_nil_value(); mrb_value scriptArray = mrb_nil_value();
QByteArray readError; QByteArray readError;
@ -356,7 +356,7 @@ static void mrbBindingExecute()
{ {
mrb_state *mrb = mrb_open(); mrb_state *mrb = mrb_open();
gState->setBindingData(mrb); shState->setBindingData(mrb);
MrbData mrbData(mrb); MrbData mrbData(mrb);
mrb->ud = &mrbData; mrb->ud = &mrbData;
@ -369,7 +369,7 @@ static void mrbBindingExecute()
mrbc_context *ctx = mrbc_context_new(mrb); mrbc_context *ctx = mrbc_context_new(mrb);
ctx->capture_errors = 1; ctx->capture_errors = 1;
Config &conf = gState->rtData().config; Config &conf = shState->rtData().config;
QByteArray &customScript = conf.customScript; QByteArray &customScript = conf.customScript;
QByteArray mrbFile = conf.bindingConf.value("mrbFile").toByteArray(); QByteArray mrbFile = conf.bindingConf.value("mrbFile").toByteArray();
@ -382,8 +382,8 @@ static void mrbBindingExecute()
checkException(mrb); checkException(mrb);
gState->rtData().rqTermAck = true; shState->rtData().rqTermAck = true;
gState->texPool().disable(); shState->texPool().disable();
mrbc_context_free(mrb, ctx); mrbc_context_free(mrb, ctx);
mrb_close(mrb); mrb_close(mrb);
@ -391,7 +391,7 @@ static void mrbBindingExecute()
static void mrbBindingTerminate() static void mrbBindingTerminate()
{ {
mrb_state *mrb = static_cast<mrb_state*>(gState->bindingData()); mrb_state *mrb = static_cast<mrb_state*>(shState->bindingData());
MrbData *data = static_cast<MrbData*>(mrb->ud); MrbData *data = static_cast<MrbData*>(mrb->ud);
mrb_raise(mrb, data->exc[Shutdown], ""); mrb_raise(mrb, data->exc[Shutdown], "");

View File

@ -20,7 +20,7 @@
*/ */
#include "graphics.h" #include "graphics.h"
#include "globalstate.h" #include "sharedstate.h"
#include "mruby.h" #include "mruby.h"
#include "binding-util.h" #include "binding-util.h"
#include "exception.h" #include "exception.h"
@ -29,7 +29,7 @@ MRB_FUNCTION(graphicsUpdate)
{ {
MRB_FUN_UNUSED_PARAM; MRB_FUN_UNUSED_PARAM;
gState->graphics().update(); shState->graphics().update();
return mrb_nil_value(); return mrb_nil_value();
} }
@ -38,7 +38,7 @@ MRB_FUNCTION(graphicsFreeze)
{ {
MRB_FUN_UNUSED_PARAM; MRB_FUN_UNUSED_PARAM;
gState->graphics().freeze(); shState->graphics().freeze();
return mrb_nil_value(); return mrb_nil_value();
} }
@ -51,7 +51,7 @@ MRB_FUNCTION(graphicsTransition)
mrb_get_args(mrb, "|izi", &duration, &filename, &vague); mrb_get_args(mrb, "|izi", &duration, &filename, &vague);
GUARD_EXC( gState->graphics().transition(duration, filename, vague); ) GUARD_EXC( shState->graphics().transition(duration, filename, vague); )
return mrb_nil_value(); return mrb_nil_value();
} }
@ -60,7 +60,7 @@ MRB_FUNCTION(graphicsFrameReset)
{ {
MRB_FUN_UNUSED_PARAM; MRB_FUN_UNUSED_PARAM;
gState->graphics().frameReset(); shState->graphics().frameReset();
return mrb_nil_value(); return mrb_nil_value();
} }
@ -69,13 +69,13 @@ MRB_FUNCTION(graphicsFrameReset)
MRB_FUNCTION(graphics##Get##PropName) \ MRB_FUNCTION(graphics##Get##PropName) \
{ \ { \
MRB_FUN_UNUSED_PARAM; \ MRB_FUN_UNUSED_PARAM; \
return mrb_fixnum_value(gState->graphics().get##PropName()); \ return mrb_fixnum_value(shState->graphics().get##PropName()); \
} \ } \
MRB_FUNCTION(graphics##Set##PropName) \ MRB_FUNCTION(graphics##Set##PropName) \
{ \ { \
mrb_int value; \ mrb_int value; \
mrb_get_args(mrb, "i", &value); \ mrb_get_args(mrb, "i", &value); \
gState->graphics().set##PropName(value); \ shState->graphics().set##PropName(value); \
return mrb_fixnum_value(value); \ return mrb_fixnum_value(value); \
} }
@ -83,13 +83,13 @@ MRB_FUNCTION(graphicsFrameReset)
MRB_FUNCTION(graphics##Get##PropName) \ MRB_FUNCTION(graphics##Get##PropName) \
{ \ { \
MRB_FUN_UNUSED_PARAM; \ MRB_FUN_UNUSED_PARAM; \
return mrb_bool_value(gState->graphics().get##PropName()); \ return mrb_bool_value(shState->graphics().get##PropName()); \
} \ } \
MRB_FUNCTION(graphics##Set##PropName) \ MRB_FUNCTION(graphics##Set##PropName) \
{ \ { \
mrb_bool value; \ mrb_bool value; \
mrb_get_args(mrb, "b", &value); \ mrb_get_args(mrb, "b", &value); \
gState->graphics().set##PropName(value); \ shState->graphics().set##PropName(value); \
return mrb_bool_value(value); \ return mrb_bool_value(value); \
} }

View File

@ -20,7 +20,7 @@
*/ */
#include "input.h" #include "input.h"
#include "globalstate.h" #include "sharedstate.h"
#include "exception.h" #include "exception.h"
#include "binding-util.h" #include "binding-util.h"
@ -28,7 +28,7 @@ MRB_FUNCTION(inputUpdate)
{ {
MRB_FUN_UNUSED_PARAM; MRB_FUN_UNUSED_PARAM;
gState->input().update(); shState->input().update();
return mrb_nil_value(); return mrb_nil_value();
} }
@ -40,7 +40,7 @@ MRB_FUNCTION(inputPress)
Input::ButtonCode bc = (Input::ButtonCode) num; Input::ButtonCode bc = (Input::ButtonCode) num;
return mrb_bool_value(gState->input().isPressed(bc)); return mrb_bool_value(shState->input().isPressed(bc));
} }
MRB_FUNCTION(inputTrigger) MRB_FUNCTION(inputTrigger)
@ -50,7 +50,7 @@ MRB_FUNCTION(inputTrigger)
Input::ButtonCode bc = (Input::ButtonCode) num; Input::ButtonCode bc = (Input::ButtonCode) num;
return mrb_bool_value(gState->input().isTriggered(bc)); return mrb_bool_value(shState->input().isTriggered(bc));
} }
MRB_FUNCTION(inputRepeat) MRB_FUNCTION(inputRepeat)
@ -60,21 +60,21 @@ MRB_FUNCTION(inputRepeat)
Input::ButtonCode bc = (Input::ButtonCode) num; Input::ButtonCode bc = (Input::ButtonCode) num;
return mrb_bool_value(gState->input().isRepeated(bc)); return mrb_bool_value(shState->input().isRepeated(bc));
} }
MRB_FUNCTION(inputDir4) MRB_FUNCTION(inputDir4)
{ {
MRB_FUN_UNUSED_PARAM; MRB_FUN_UNUSED_PARAM;
return mrb_fixnum_value(gState->input().dir4Value()); return mrb_fixnum_value(shState->input().dir4Value());
} }
MRB_FUNCTION(inputDir8) MRB_FUNCTION(inputDir8)
{ {
MRB_FUN_UNUSED_PARAM; MRB_FUN_UNUSED_PARAM;
return mrb_fixnum_value(gState->input().dir8Value()); return mrb_fixnum_value(shState->input().dir8Value());
} }
/* Non-standard extensions */ /* Non-standard extensions */
@ -82,14 +82,14 @@ MRB_FUNCTION(inputMouseX)
{ {
MRB_FUN_UNUSED_PARAM; MRB_FUN_UNUSED_PARAM;
return mrb_fixnum_value(gState->input().mouseX()); return mrb_fixnum_value(shState->input().mouseX());
} }
MRB_FUNCTION(inputMouseY) MRB_FUNCTION(inputMouseY)
{ {
MRB_FUN_UNUSED_PARAM; MRB_FUN_UNUSED_PARAM;
return mrb_fixnum_value(gState->input().mouseY()); return mrb_fixnum_value(shState->input().mouseY());
} }
#define DEF_CONST_I(name, value) \ #define DEF_CONST_I(name, value) \

View File

@ -30,7 +30,7 @@
#include "../binding-util.h" #include "../binding-util.h"
#include "marshal.h" #include "marshal.h"
#include "globalstate.h" #include "sharedstate.h"
#include "eventthread.h" #include "eventthread.h"
#include "exception.h" #include "exception.h"
#include "filesystem.h" #include "filesystem.h"
@ -70,7 +70,7 @@ static void printP(mrb_state *mrb,
mrb_str_buf_cat(mrb, buffer, sep, strlen(sep)); mrb_str_buf_cat(mrb, buffer, sep, strlen(sep));
} }
gState->eThread().showMessageBox(RSTRING_PTR(buffer), SDL_MESSAGEBOX_INFORMATION); shState->eThread().showMessageBox(RSTRING_PTR(buffer), SDL_MESSAGEBOX_INFORMATION);
} }
MRB_FUNCTION(kernelP) MRB_FUNCTION(kernelP)
@ -174,7 +174,7 @@ MRB_FUNCTION(kernelLoadData)
mrb_get_args(mrb, "z", &filename); mrb_get_args(mrb, "z", &filename);
SDL_RWops ops; SDL_RWops ops;
GUARD_EXC( gState->fileSystem().openRead(ops, filename); ) GUARD_EXC( shState->fileSystem().openRead(ops, filename); )
mrb_value obj; mrb_value obj;
try { obj = marshalLoadInt(mrb, &ops); } try { obj = marshalLoadInt(mrb, &ops); }

View File

@ -20,7 +20,7 @@
*/ */
#include "binding.h" #include "binding.h"
#include "globalstate.h" #include "sharedstate.h"
#include "eventthread.h" #include "eventthread.h"
#include <QDebug> #include <QDebug>
@ -28,7 +28,7 @@
static void nullBindingExecute() static void nullBindingExecute()
{ {
qDebug() << "The null binding doesn't do anything, so we're done!"; qDebug() << "The null binding doesn't do anything, so we're done!";
gState->rtData().rqTermAck = true; shState->rtData().rqTermAck = true;
} }
static void nullBindingTerminate() static void nullBindingTerminate()

View File

@ -34,7 +34,6 @@ HEADERS += \
src/eventthread.h \ src/eventthread.h \
src/flashable.h \ src/flashable.h \
src/font.h \ src/font.h \
src/globalstate.h \
src/input.h \ src/input.h \
src/plane.h \ src/plane.h \
src/scene.h \ src/scene.h \
@ -62,7 +61,8 @@ HEADERS += \
src/util.h \ src/util.h \
src/config.h \ src/config.h \
src/tileatlas.h \ src/tileatlas.h \
src/perftimer.h src/perftimer.h \
src/sharedstate.h
SOURCES += \ SOURCES += \
src/main.cpp \ src/main.cpp \
@ -71,7 +71,6 @@ SOURCES += \
src/eventthread.cpp \ src/eventthread.cpp \
src/filesystem.cpp \ src/filesystem.cpp \
src/font.cpp \ src/font.cpp \
src/globalstate.cpp \
src/input.cpp \ src/input.cpp \
src/plane.cpp \ src/plane.cpp \
src/scene.cpp \ src/scene.cpp \
@ -90,7 +89,8 @@ SOURCES += \
src/etc.cpp \ src/etc.cpp \
src/config.cpp \ src/config.cpp \
src/tileatlas.cpp \ src/tileatlas.cpp \
src/perftimer.cpp src/perftimer.cpp \
src/sharedstate.cpp
EMBED = shader/transSimple.frag \ EMBED = shader/transSimple.frag \
shader/trans.frag \ shader/trans.frag \

View File

@ -21,7 +21,7 @@
#include "audio.h" #include "audio.h"
#include "globalstate.h" #include "sharedstate.h"
#include "util.h" #include "util.h"
#include "intrulist.h" #include "intrulist.h"
#include "filesystem.h" #include "filesystem.h"
@ -123,7 +123,7 @@ struct MusicEntity
currentData.close(); currentData.close();
currentData = currentData =
gState->fileSystem().openRead(filename.constData(), FileSystem::Audio); shState->fileSystem().openRead(filename.constData(), FileSystem::Audio);
if (!this->music.openFromStream(currentData)) if (!this->music.openFromStream(currentData))
return; return;
@ -319,7 +319,7 @@ private:
// { // {
// /* Buffer not in cashe, needs to be loaded */ // /* Buffer not in cashe, needs to be loaded */
// SDL_RWops ops; // SDL_RWops ops;
// gState->fileSystem().openRead(ops, filename, FileSystem::Audio); // shState->fileSystem().openRead(ops, filename, FileSystem::Audio);
// Mix_Chunk *sdlBuffer = Mix_LoadWAV_RW(&ops, 1); // Mix_Chunk *sdlBuffer = Mix_LoadWAV_RW(&ops, 1);
@ -435,7 +435,7 @@ private:
/* Buffer not in cashe, needs to be loaded */ /* Buffer not in cashe, needs to be loaded */
FileStream data = FileStream data =
gState->fileSystem().openRead(filename, FileSystem::Audio); shState->fileSystem().openRead(filename, FileSystem::Audio);
buffer = new SoundBuffer; buffer = new SoundBuffer;
buffer->sfBuffer.loadFromStream(data); buffer->sfBuffer.loadFromStream(data);

View File

@ -34,7 +34,7 @@
#include "transform.h" #include "transform.h"
#include "exception.h" #include "exception.h"
#include "globalstate.h" #include "sharedstate.h"
#include "glstate.h" #include "glstate.h"
#include "texpool.h" #include "texpool.h"
#include "shader.h" #include "shader.h"
@ -78,7 +78,7 @@ struct BitmapPrivate
BitmapPrivate() BitmapPrivate()
: megaSurface(0) : megaSurface(0)
{ {
font = &gState->defaultFont(); font = &shState->defaultFont();
pixman_region_init(&tainted); pixman_region_init(&tainted);
} }
@ -159,7 +159,7 @@ struct BitmapPrivate
if (pointArray.count() == 0) if (pointArray.count() == 0)
return; return;
SimpleColorShader &shader = gState->simpleColorShader(); SimpleColorShader &shader = shState->simpleColorShader();
shader.bind(); shader.bind();
shader.setTranslation(Vec2i()); shader.setTranslation(Vec2i());
@ -207,7 +207,7 @@ struct BitmapPrivate
Bitmap::Bitmap(const char *filename) Bitmap::Bitmap(const char *filename)
{ {
SDL_RWops ops; SDL_RWops ops;
gState->fileSystem().openRead(ops, filename, FileSystem::Image); shState->fileSystem().openRead(ops, filename, FileSystem::Image);
SDL_Surface *imgSurf = IMG_Load_RW(&ops, 1); SDL_Surface *imgSurf = IMG_Load_RW(&ops, 1);
if (!imgSurf) if (!imgSurf)
@ -228,7 +228,7 @@ Bitmap::Bitmap(const char *filename)
TEXFBO tex; TEXFBO tex;
try try
{ {
tex = gState->texPool().request(imgSurf->w, imgSurf->h); tex = shState->texPool().request(imgSurf->w, imgSurf->h);
} }
catch (const Exception &e) catch (const Exception &e)
{ {
@ -253,7 +253,7 @@ Bitmap::Bitmap(int width, int height)
if (width <= 0 || height <= 0) if (width <= 0 || height <= 0)
throw Exception(Exception::RGSSError, "failed to create bitmap"); throw Exception(Exception::RGSSError, "failed to create bitmap");
TEXFBO tex = gState->texPool().request(width, height); TEXFBO tex = shState->texPool().request(width, height);
p = new BitmapPrivate; p = new BitmapPrivate;
p->gl = tex; p->gl = tex;
@ -265,7 +265,7 @@ Bitmap::Bitmap(const Bitmap &other)
{ {
p = new BitmapPrivate; p = new BitmapPrivate;
p->gl = gState->texPool().request(other.width(), other.height()); p->gl = shState->texPool().request(other.width(), other.height());
other.flush(); other.flush();
blt(0, 0, other, rect()); blt(0, 0, other, rect());
@ -379,7 +379,7 @@ void Bitmap::stretchBlt(const IntRect &destRect,
float normOpacity = (float) opacity / 255.0f; float normOpacity = (float) opacity / 255.0f;
TEXFBO &gpTex = gState->gpTexFBO(destRect.w, destRect.h); TEXFBO &gpTex = shState->gpTexFBO(destRect.w, destRect.h);
FBO::bind(gpTex.fbo, FBO::Draw); FBO::bind(gpTex.fbo, FBO::Draw);
FBO::bind(p->gl.fbo, FBO::Read); FBO::bind(p->gl.fbo, FBO::Read);
@ -390,13 +390,13 @@ void Bitmap::stretchBlt(const IntRect &destRect,
((float) source.width() / sourceRect.w) * ((float) destRect.w / gpTex.width), ((float) source.width() / sourceRect.w) * ((float) destRect.w / gpTex.width),
((float) source.height() / sourceRect.h) * ((float) destRect.h / gpTex.height)); ((float) source.height() / sourceRect.h) * ((float) destRect.h / gpTex.height));
BltShader &shader = gState->bltShader(); BltShader &shader = shState->bltShader();
shader.bind(); shader.bind();
shader.setDestination(gpTex.tex); shader.setDestination(gpTex.tex);
shader.setSubRect(bltSubRect); shader.setSubRect(bltSubRect);
shader.setOpacity(normOpacity); shader.setOpacity(normOpacity);
Quad &quad = gState->gpQuad(); Quad &quad = shState->gpQuad();
quad.setTexPosRect(sourceRect, destRect); quad.setTexPosRect(sourceRect, destRect);
quad.setColor(Vec4(1, 1, 1, normOpacity)); quad.setColor(Vec4(1, 1, 1, normOpacity));
@ -459,11 +459,11 @@ void Bitmap::gradientFillRect(const IntRect &rect,
flush(); flush();
SimpleColorShader &shader = gState->simpleColorShader(); SimpleColorShader &shader = shState->simpleColorShader();
shader.bind(); shader.bind();
shader.setTranslation(Vec2i()); shader.setTranslation(Vec2i());
Quad &quad = gState->gpQuad(); Quad &quad = shState->gpQuad();
if (vertical) if (vertical)
{ {
@ -518,13 +518,13 @@ void Bitmap::blur()
flush(); flush();
Quad &quad = gState->gpQuad(); Quad &quad = shState->gpQuad();
FloatRect rect(0, 0, width(), height()); FloatRect rect(0, 0, width(), height());
quad.setTexPosRect(rect, rect); quad.setTexPosRect(rect, rect);
TEXFBO auxTex = gState->texPool().request(width(), height()); TEXFBO auxTex = shState->texPool().request(width(), height());
BlurShader &shader = gState->blurShader(); BlurShader &shader = shState->blurShader();
BlurShader::HPass &pass1 = shader.pass1; BlurShader::HPass &pass1 = shader.pass1;
BlurShader::VPass &pass2 = shader.pass2; BlurShader::VPass &pass2 = shader.pass2;
@ -552,7 +552,7 @@ void Bitmap::blur()
glState.viewport.pop(); glState.viewport.pop();
glState.blendMode.pop(); glState.blendMode.pop();
gState->texPool().release(auxTex); shState->texPool().release(auxTex);
modified(); modified();
} }
@ -613,7 +613,7 @@ void Bitmap::radialBlur(int angle, int divisions)
qArray.commit(); qArray.commit();
TEXFBO newTex = gState->texPool().request(_width, _height); TEXFBO newTex = shState->texPool().request(_width, _height);
FBO::bind(newTex.fbo, FBO::Draw); FBO::bind(newTex.fbo, FBO::Draw);
@ -626,7 +626,7 @@ void Bitmap::radialBlur(int angle, int divisions)
glState.blendMode.pushSet(BlendAddition); glState.blendMode.pushSet(BlendAddition);
SimpleMatrixShader &shader = gState->simpleMatrixShader(); SimpleMatrixShader &shader = shState->simpleMatrixShader();
shader.bind(); shader.bind();
p->bindTexture(shader); p->bindTexture(shader);
@ -648,7 +648,7 @@ void Bitmap::radialBlur(int angle, int divisions)
glState.blendMode.pop(); glState.blendMode.pop();
glState.clearColor.pop(); glState.clearColor.pop();
gState->texPool().release(p->tex); shState->texPool().release(p->tex);
p->tex = newTex; p->tex = newTex;
modified(); modified();
@ -722,11 +722,11 @@ void Bitmap::hueChange(int hue)
flush(); flush();
TEXFBO newTex = gState->texPool().request(width(), height()); TEXFBO newTex = shState->texPool().request(width(), height());
FloatRect texRect(rect()); FloatRect texRect(rect());
Quad &quad = gState->gpQuad(); Quad &quad = shState->gpQuad();
quad.setTexPosRect(texRect, texRect); quad.setTexPosRect(texRect, texRect);
quad.setColor(Vec4(1, 1, 1, 1)); quad.setColor(Vec4(1, 1, 1, 1));
@ -734,7 +734,7 @@ void Bitmap::hueChange(int hue)
hue = wrapRange(hue, 0, 359); hue = wrapRange(hue, 0, 359);
float hueAdj = -((M_PI * 2) / 360) * hue; float hueAdj = -((M_PI * 2) / 360) * hue;
HueShader &shader = gState->hueShader(); HueShader &shader = shState->hueShader();
shader.bind(); shader.bind();
shader.setHueAdjust(hueAdj); shader.setHueAdjust(hueAdj);
@ -750,7 +750,7 @@ void Bitmap::hueChange(int hue)
TEX::unbind(); TEX::unbind();
gState->texPool().release(p->gl); shState->texPool().release(p->gl);
p->gl = newTex; p->gl = newTex;
modified(); modified();
@ -787,7 +787,7 @@ void Bitmap::drawText(const IntRect &rect, const char *str, int align)
SDL_Surface *txtSurf; SDL_Surface *txtSurf;
if (gState->rtData().config.solidFonts) if (shState->rtData().config.solidFonts)
txtSurf = TTF_RenderUTF8_Solid(font, str, c); txtSurf = TTF_RenderUTF8_Solid(font, str, c);
else else
txtSurf = TTF_RenderUTF8_Blended(font, str, c); txtSurf = TTF_RenderUTF8_Blended(font, str, c);
@ -824,7 +824,7 @@ void Bitmap::drawText(const IntRect &rect, const char *str, int align)
FloatRect posRect(alignX, alignY, txtSurf->w * squeeze, txtSurf->h); FloatRect posRect(alignX, alignY, txtSurf->w * squeeze, txtSurf->h);
Vec2i gpTexSize; Vec2i gpTexSize;
gState->ensureTexSize(txtSurf->w, txtSurf->h, gpTexSize); shState->ensureTexSize(txtSurf->w, txtSurf->h, gpTexSize);
bool fastBlit = !p->touchesTaintedArea(posRect) && txtAlpha == 1.0; bool fastBlit = !p->touchesTaintedArea(posRect) && txtAlpha == 1.0;
@ -888,7 +888,7 @@ void Bitmap::drawText(const IntRect &rect, const char *str, int align)
else else
{ {
/* Squeezing involved: need to use intermediary TexFBO */ /* Squeezing involved: need to use intermediary TexFBO */
TEXFBO &gpTF = gState->gpTexFBO(txtSurf->w, txtSurf->h); TEXFBO &gpTF = shState->gpTexFBO(txtSurf->w, txtSurf->h);
TEX::bind(gpTF.tex); TEX::bind(gpTF.tex);
TEX::uploadSubImage(0, 0, txtSurf->w, txtSurf->h, txtSurf->pixels, GL_BGRA_EXT); TEX::uploadSubImage(0, 0, txtSurf->w, txtSurf->h, txtSurf->pixels, GL_BGRA_EXT);
@ -905,7 +905,7 @@ void Bitmap::drawText(const IntRect &rect, const char *str, int align)
{ {
/* Aquire a partial copy of the destination /* Aquire a partial copy of the destination
* buffer we're about to render to */ * buffer we're about to render to */
TEXFBO &gpTex2 = gState->gpTexFBO(posRect.w, posRect.h); TEXFBO &gpTex2 = shState->gpTexFBO(posRect.w, posRect.h);
FBO::bind(gpTex2.fbo, FBO::Draw); FBO::bind(gpTex2.fbo, FBO::Draw);
FBO::bind(p->gl.fbo, FBO::Read); FBO::bind(p->gl.fbo, FBO::Read);
@ -915,7 +915,7 @@ void Bitmap::drawText(const IntRect &rect, const char *str, int align)
(float) gpTexSize.x / gpTex2.width, (float) gpTexSize.x / gpTex2.width,
(float) gpTexSize.y / gpTex2.height); (float) gpTexSize.y / gpTex2.height);
BltShader &shader = gState->bltShader(); BltShader &shader = shState->bltShader();
shader.bind(); shader.bind();
shader.setTexSize(gpTexSize); shader.setTexSize(gpTexSize);
shader.setSource(); shader.setSource();
@ -923,11 +923,11 @@ void Bitmap::drawText(const IntRect &rect, const char *str, int align)
shader.setSubRect(bltRect); shader.setSubRect(bltRect);
shader.setOpacity(txtAlpha); shader.setOpacity(txtAlpha);
gState->bindTex(); shState->bindTex();
TEX::uploadSubImage(0, 0, txtSurf->w, txtSurf->h, txtSurf->pixels, GL_BGRA_EXT); TEX::uploadSubImage(0, 0, txtSurf->w, txtSurf->h, txtSurf->pixels, GL_BGRA_EXT);
TEX::setSmooth(true); TEX::setSmooth(true);
Quad &quad = gState->gpQuad(); Quad &quad = shState->gpQuad();
quad.setTexRect(FloatRect(0, 0, txtSurf->w, txtSurf->h)); quad.setTexRect(FloatRect(0, 0, txtSurf->w, txtSurf->h));
quad.setPosRect(posRect); quad.setPosRect(posRect);
@ -1006,7 +1006,7 @@ void Bitmap::releaseResources()
if (p->megaSurface) if (p->megaSurface)
SDL_FreeSurface(p->megaSurface); SDL_FreeSurface(p->megaSurface);
else else
gState->texPool().release(p->gl); shState->texPool().release(p->gl);
delete p; delete p;
} }

View File

@ -27,7 +27,7 @@
#include "SDL2/SDL_timer.h" #include "SDL2/SDL_timer.h"
#include "SDL2/SDL_thread.h" #include "SDL2/SDL_thread.h"
#include "globalstate.h" #include "sharedstate.h"
#include "graphics.h" #include "graphics.h"
#include "string.h" #include "string.h"
@ -361,7 +361,7 @@ void EventThread::showMessageBox(const char *body, int flags)
SDL_PushEvent(&event); SDL_PushEvent(&event);
/* Keep repainting screen while box is open */ /* Keep repainting screen while box is open */
gState->graphics().repaintWait(&msgBoxDone); shState->graphics().repaintWait(&msgBoxDone);
/* Prevent endless loops */ /* Prevent endless loops */
resetInputStates(); resetInputStates();
} }

View File

@ -21,7 +21,7 @@
#include "font.h" #include "font.h"
#include "globalstate.h" #include "sharedstate.h"
#include "filesystem.h" #include "filesystem.h"
#include "exception.h" #include "exception.h"
@ -79,7 +79,7 @@ _TTF_Font *FontPool::request(const char *filename,
bool useBundled = false; bool useBundled = false;
QByteArray path = QByteArray("Fonts/") + nameKey; QByteArray path = QByteArray("Fonts/") + nameKey;
if (!gState->fileSystem().exists(path.constData(), FileSystem::Font)) if (!shState->fileSystem().exists(path.constData(), FileSystem::Font))
{ {
useBundled = true; useBundled = true;
nameKey = " bundled"; nameKey = " bundled";
@ -107,7 +107,7 @@ _TTF_Font *FontPool::request(const char *filename,
else else
{ {
ops = SDL_AllocRW(); ops = SDL_AllocRW();
gState->fileSystem().openRead(*ops, path.constData(), FileSystem::Font, true); shState->fileSystem().openRead(*ops, path.constData(), FileSystem::Font, true);
} }
// FIXME 0.9 is guesswork at this point // FIXME 0.9 is guesswork at this point
@ -151,7 +151,7 @@ struct FontPrivate
color(&colorTmp), color(&colorTmp),
colorTmp(*defaultColor) colorTmp(*defaultColor)
{ {
sdlFont = gState->fontPool().request(this->name.constData(), sdlFont = shState->fontPool().request(this->name.constData(),
this->size); this->size);
} }
}; };
@ -168,7 +168,7 @@ bool Font::doesExist(const char *name)
{ {
QByteArray path = QByteArray("fonts/") + QByteArray(name); QByteArray path = QByteArray("fonts/") + QByteArray(name);
return gState->fileSystem().exists(path.constData(), FileSystem::Font); return shState->fileSystem().exists(path.constData(), FileSystem::Font);
} }
Font::Font(const char *name, Font::Font(const char *name,
@ -198,7 +198,7 @@ void Font::setSize(int value)
return; return;
p->size = value; p->size = value;
p->sdlFont = gState->fontPool().request(p->name.constData(), value); p->sdlFont = shState->fontPool().request(p->name.constData(), value);
} }
#undef CHK_DISP #undef CHK_DISP

View File

@ -23,7 +23,7 @@
#include "util.h" #include "util.h"
#include "gl-util.h" #include "gl-util.h"
#include "globalstate.h" #include "sharedstate.h"
#include "glstate.h" #include "glstate.h"
#include "shader.h" #include "shader.h"
#include "scene.h" #include "scene.h"
@ -145,7 +145,7 @@ public:
const int w = geometry.rect.w; const int w = geometry.rect.w;
const int h = geometry.rect.h; const int h = geometry.rect.h;
gState->prepareDraw(); shState->prepareDraw();
pp.startRender(); pp.startRender();
@ -158,7 +158,7 @@ public:
#ifdef RGSS2 #ifdef RGSS2
if (brightEffect) if (brightEffect)
{ {
SimpleColorShader &shader = gState->simpleColorShader(); SimpleColorShader &shader = shState->simpleColorShader();
shader.bind(); shader.bind();
shader.applyViewportProj(); shader.applyViewportProj();
shader.setTranslation(Vec2i()); shader.setTranslation(Vec2i());
@ -175,7 +175,7 @@ public:
pp.swapRender(); pp.swapRender();
pp.blitFBOs(); pp.blitFBOs();
PlaneShader &shader = gState->planeShader(); PlaneShader &shader = shState->planeShader();
shader.bind(); shader.bind();
shader.setColor(c); shader.setColor(c);
shader.setFlash(f); shader.setFlash(f);
@ -358,11 +358,11 @@ struct GraphicsPrivate
void updateScreenResoRatio() void updateScreenResoRatio()
{ {
Vec2 &ratio = gState->rtData().sizeResoRatio; Vec2 &ratio = shState->rtData().sizeResoRatio;
ratio.x = (float) scRes.x / scSize.x; ratio.x = (float) scRes.x / scSize.x;
ratio.y = (float) scRes.y / scSize.y; ratio.y = (float) scRes.y / scSize.y;
gState->rtData().screenOffset = scOffset; shState->rtData().screenOffset = scOffset;
} }
/* Enforces fixed aspect ratio, if desired */ /* Enforces fixed aspect ratio, if desired */
@ -401,7 +401,7 @@ struct GraphicsPrivate
void shutdown() void shutdown()
{ {
threadData->rqTermAck = true; threadData->rqTermAck = true;
gState->texPool().disable(); shState->texPool().disable();
scriptBinding->terminate(); scriptBinding->terminate();
} }
@ -460,7 +460,7 @@ Graphics::~Graphics()
void Graphics::update() void Graphics::update()
{ {
gState->checkShutdown(); shState->checkShutdown();
// p->cpuTimer->endTiming(); // p->cpuTimer->endTiming();
// p->gpuTimer->startTiming(); // p->gpuTimer->startTiming();
@ -479,7 +479,7 @@ void Graphics::freeze()
{ {
p->frozen = true; p->frozen = true;
gState->checkShutdown(); shState->checkShutdown();
p->checkResize(); p->checkResize();
/* Capture scene into frozen buffer */ /* Capture scene into frozen buffer */
@ -504,7 +504,7 @@ void Graphics::transition(int duration,
* we can use a simplified shader */ * we can use a simplified shader */
if (transMap) if (transMap)
{ {
TransShader &shader = gState->transShader(); TransShader &shader = shState->transShader();
shader.bind(); shader.bind();
shader.applyViewportProj(); shader.applyViewportProj();
shader.setFrozenScene(p->frozenScene.tex); shader.setFrozenScene(p->frozenScene.tex);
@ -515,7 +515,7 @@ void Graphics::transition(int duration,
} }
else else
{ {
SimpleTransShader &shader = gState->sTransShader(); SimpleTransShader &shader = shState->sTransShader();
shader.bind(); shader.bind();
shader.applyViewportProj(); shader.applyViewportProj();
shader.setFrozenScene(p->frozenScene.tex); shader.setFrozenScene(p->frozenScene.tex);
@ -536,9 +536,9 @@ void Graphics::transition(int duration,
const float prog = i * (1.0 / duration); const float prog = i * (1.0 / duration);
if (transMap) if (transMap)
gState->transShader().setProg(prog); shState->transShader().setProg(prog);
else else
gState->sTransShader().setProg(prog); shState->sTransShader().setProg(prog);
/* Draw the composed frame to a buffer first /* Draw the composed frame to a buffer first
* (we need this because we're skipping PingPong) */ * (we need this because we're skipping PingPong) */
@ -589,7 +589,7 @@ void Graphics::wait(int duration)
{ {
for (int i = 0; i < duration; ++i) for (int i = 0; i < duration; ++i)
{ {
gState->checkShutdown(); shState->checkShutdown();
p->checkResize(); p->checkResize();
p->redrawScreen(); p->redrawScreen();
} }
@ -666,7 +666,7 @@ void Graphics::resizeScreen(int width, int height)
if (p->scRes == size) if (p->scRes == size)
return; return;
gState->eThread().requestWindowResize(width, height); shState->eThread().requestWindowResize(width, height);
p->scRes = size; p->scRes = size;
@ -737,7 +737,7 @@ void Graphics::repaintWait(volatile bool *exitCond)
while (!*exitCond) while (!*exitCond)
{ {
gState->checkShutdown(); shState->checkShutdown();
FBO::clear(); FBO::clear();
p->blitBufferFlippedScaled(); p->blitBufferFlippedScaled();

View File

@ -20,7 +20,7 @@
*/ */
#include "input.h" #include "input.h"
#include "globalstate.h" #include "sharedstate.h"
#include "eventthread.h" #include "eventthread.h"
#include "exception.h" #include "exception.h"
#include "util.h" #include "util.h"
@ -552,7 +552,7 @@ Input::Input()
void Input::update() void Input::update()
{ {
gState->checkShutdown(); shState->checkShutdown();
p->swapBuffers(); p->swapBuffers();
p->clearBuffer(); p->clearBuffer();
@ -614,13 +614,13 @@ int Input::dir8Value()
int Input::mouseX() int Input::mouseX()
{ {
RGSSThreadData &rtData = gState->rtData(); RGSSThreadData &rtData = shState->rtData();
return (EventThread::mouseState.x - rtData.screenOffset.x) * rtData.sizeResoRatio.x; return (EventThread::mouseState.x - rtData.screenOffset.x) * rtData.sizeResoRatio.x;
} }
int Input::mouseY() int Input::mouseY()
{ {
RGSSThreadData &rtData = gState->rtData(); RGSSThreadData &rtData = shState->rtData();
return (EventThread::mouseState.y - rtData.screenOffset.y) * rtData.sizeResoRatio.y; return (EventThread::mouseState.y - rtData.screenOffset.y) * rtData.sizeResoRatio.y;
} }

View File

@ -25,7 +25,7 @@
#include "SDL2/SDL_image.h" #include "SDL2/SDL_image.h"
#include "SDL2/SDL_ttf.h" #include "SDL2/SDL_ttf.h"
#include "globalstate.h" #include "sharedstate.h"
#include "eventthread.h" #include "eventthread.h"
#include "debuglogger.h" #include "debuglogger.h"
@ -100,7 +100,7 @@ int rgssThreadFun(void *userdata)
DebugLogger dLogger; DebugLogger dLogger;
GlobalState::initInstance(threadData); SharedState::initInstance(threadData);
/* Start script execution */ /* Start script execution */
scriptBinding->execute(); scriptBinding->execute();
@ -108,7 +108,7 @@ int rgssThreadFun(void *userdata)
threadData->rqTermAck = true; threadData->rqTermAck = true;
threadData->ethread->requestTerminate(); threadData->ethread->requestTerminate();
GlobalState::finiInstance(); SharedState::finiInstance();
SDL_GL_DeleteContext(ctx); SDL_GL_DeleteContext(ctx);

View File

@ -21,7 +21,7 @@
#include "plane.h" #include "plane.h"
#include "globalstate.h" #include "sharedstate.h"
#include "bitmap.h" #include "bitmap.h"
#include "etc.h" #include "etc.h"
#include "util.h" #include "util.h"
@ -186,7 +186,7 @@ void Plane::draw()
if (p->color->hasEffect() || p->tone->hasEffect() || p->opacity != 255) if (p->color->hasEffect() || p->tone->hasEffect() || p->opacity != 255)
{ {
PlaneShader &shader = gState->planeShader(); PlaneShader &shader = shState->planeShader();
shader.bind(); shader.bind();
shader.applyViewportProj(); shader.applyViewportProj();
@ -199,7 +199,7 @@ void Plane::draw()
} }
else else
{ {
SimpleShader &shader = gState->simpleShader(); SimpleShader &shader = shState->simpleShader();
shader.bind(); shader.bind();
shader.applyViewportProj(); shader.applyViewportProj();

View File

@ -25,7 +25,7 @@
#include "GL/glew.h" #include "GL/glew.h"
#include "etc-internal.h" #include "etc-internal.h"
#include "gl-util.h" #include "gl-util.h"
#include "globalstate.h" #include "sharedstate.h"
#include "global-ibo.h" #include "global-ibo.h"
#include "shader.h" #include "shader.h"
@ -110,7 +110,7 @@ struct Quad
{ {
VAO::bind(vao); VAO::bind(vao);
VBO::bind(vbo); VBO::bind(vbo);
gState->bindQuadIBO(); shState->bindQuadIBO();
glEnableVertexAttribArray(Shader::Color); glEnableVertexAttribArray(Shader::Color);
glEnableVertexAttribArray(Shader::Position); glEnableVertexAttribArray(Shader::Position);

View File

@ -24,7 +24,7 @@
#include <QtGlobal> #include <QtGlobal>
#include "gl-util.h" #include "gl-util.h"
#include "globalstate.h" #include "sharedstate.h"
#include "global-ibo.h" #include "global-ibo.h"
#include "shader.h" #include "shader.h"
@ -48,7 +48,7 @@ struct ColorQuadArray
VAO::bind(vao); VAO::bind(vao);
VBO::bind(vbo); VBO::bind(vbo);
gState->bindQuadIBO(); shState->bindQuadIBO();
glEnableVertexAttribArray(Shader::Color); glEnableVertexAttribArray(Shader::Color);
glEnableVertexAttribArray(Shader::Position); glEnableVertexAttribArray(Shader::Position);
@ -83,7 +83,7 @@ struct ColorQuadArray
VBO::uploadData(vertices.size() * sizeof(Vertex), vertices.constData(), GL_DYNAMIC_DRAW); VBO::uploadData(vertices.size() * sizeof(Vertex), vertices.constData(), GL_DYNAMIC_DRAW);
VBO::unbind(); VBO::unbind();
gState->ensureQuadIBO(quadCount); shState->ensureQuadIBO(quadCount);
} }
void draw(uint offset, uint count) void draw(uint offset, uint count)

View File

@ -20,7 +20,7 @@
*/ */
#include "scene.h" #include "scene.h"
#include "globalstate.h" #include "sharedstate.h"
#include <QDebug> #include <QDebug>
@ -91,7 +91,7 @@ void Scene::composite()
SceneElement::SceneElement(Scene &scene, int z) SceneElement::SceneElement(Scene &scene, int z)
: link(this), : link(this),
creationStamp(gState->genTimeStamp()), creationStamp(shState->genTimeStamp()),
z(z), z(z),
visible(true), visible(true),
scene(&scene) scene(&scene)

View File

@ -20,7 +20,7 @@
*/ */
#include "shader.h" #include "shader.h"
#include "globalstate.h" #include "sharedstate.h"
#include "glstate.h" #include "glstate.h"
#include "GL/glew.h" #include "GL/glew.h"

View File

@ -1,5 +1,5 @@
/* /*
** globalstate.cpp ** sharedstate.cpp
** **
** This file is part of mkxp. ** This file is part of mkxp.
** **
@ -19,7 +19,7 @@
** along with mkxp. If not, see <http://www.gnu.org/licenses/>. ** along with mkxp. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "globalstate.h" #include "sharedstate.h"
#include "util.h" #include "util.h"
#include "filesystem.h" #include "filesystem.h"
@ -42,12 +42,12 @@
#include <QDebug> #include <QDebug>
GlobalState *GlobalState::instance = 0; SharedState *SharedState::instance = 0;
static GlobalIBO *globalIBO = 0; static GlobalIBO *globalIBO = 0;
#define GAME_ARCHIVE "Game.rgssad" #define GAME_ARCHIVE "Game.rgssad"
struct GlobalStatePrivate struct SharedStatePrivate
{ {
void *bindingData; void *bindingData;
SDL_Window *sdlWindow; SDL_Window *sdlWindow;
@ -96,7 +96,7 @@ struct GlobalStatePrivate
unsigned int stampCounter; unsigned int stampCounter;
GlobalStatePrivate(RGSSThreadData *threadData) SharedStatePrivate(RGSSThreadData *threadData)
: bindingData(0), : bindingData(0),
sdlWindow(threadData->window), sdlWindow(threadData->window),
fileSystem(threadData->argv0), fileSystem(threadData->argv0),
@ -139,41 +139,41 @@ struct GlobalStatePrivate
TEXFBO::linkFBO(gpTexFBO); TEXFBO::linkFBO(gpTexFBO);
} }
~GlobalStatePrivate() ~SharedStatePrivate()
{ {
TEX::del(globalTex); TEX::del(globalTex);
TEXFBO::fini(gpTexFBO); TEXFBO::fini(gpTexFBO);
} }
}; };
void GlobalState::initInstance(RGSSThreadData *threadData) void SharedState::initInstance(RGSSThreadData *threadData)
{ {
globalIBO = new GlobalIBO(); globalIBO = new GlobalIBO();
globalIBO->ensureSize(1); globalIBO->ensureSize(1);
GlobalState *state = new GlobalState(threadData); SharedState *state = new SharedState(threadData);
GlobalState::instance = state; SharedState::instance = state;
state->p->defaultFont = new Font(); state->p->defaultFont = new Font();
} }
void GlobalState::finiInstance() void SharedState::finiInstance()
{ {
delete GlobalState::instance->p->defaultFont; delete SharedState::instance->p->defaultFont;
delete GlobalState::instance; delete SharedState::instance;
delete globalIBO; delete globalIBO;
} }
void GlobalState::setScreen(Scene &screen) void SharedState::setScreen(Scene &screen)
{ {
p->screen = &screen; p->screen = &screen;
} }
#define GSATT(type, lower) \ #define GSATT(type, lower) \
type GlobalState :: lower() \ type SharedState :: lower() \
{ \ { \
return p->lower; \ return p->lower; \
} }
@ -209,28 +209,28 @@ GSATT(SimpleMatrixShader&, simpleMatrixShader)
GSATT(BlurShader&, blurShader) GSATT(BlurShader&, blurShader)
#endif #endif
void GlobalState::setBindingData(void *data) void SharedState::setBindingData(void *data)
{ {
p->bindingData = data; p->bindingData = data;
} }
void GlobalState::ensureQuadIBO(int minSize) void SharedState::ensureQuadIBO(int minSize)
{ {
globalIBO->ensureSize(minSize); globalIBO->ensureSize(minSize);
} }
void GlobalState::bindQuadIBO() void SharedState::bindQuadIBO()
{ {
IBO::bind(globalIBO->ibo); IBO::bind(globalIBO->ibo);
} }
void GlobalState::bindTex() void SharedState::bindTex()
{ {
TEX::bind(p->globalTex); TEX::bind(p->globalTex);
TEX::allocEmpty(p->globalTexW, p->globalTexH); TEX::allocEmpty(p->globalTexW, p->globalTexH);
} }
void GlobalState::ensureTexSize(int minW, int minH, Vec2i &currentSizeOut) void SharedState::ensureTexSize(int minW, int minH, Vec2i &currentSizeOut)
{ {
if (minW > p->globalTexW) if (minW > p->globalTexW)
p->globalTexW = findNextPow2(minW); p->globalTexW = findNextPow2(minW);
@ -241,7 +241,7 @@ void GlobalState::ensureTexSize(int minW, int minH, Vec2i &currentSizeOut)
currentSizeOut = Vec2i(p->globalTexW, p->globalTexH); currentSizeOut = Vec2i(p->globalTexW, p->globalTexH);
} }
TEXFBO &GlobalState::gpTexFBO(int minW, int minH) TEXFBO &SharedState::gpTexFBO(int minW, int minH)
{ {
bool needResize = false; bool needResize = false;
@ -266,7 +266,7 @@ TEXFBO &GlobalState::gpTexFBO(int minW, int minH)
return p->gpTexFBO; return p->gpTexFBO;
} }
void GlobalState::checkShutdown() void SharedState::checkShutdown()
{ {
if (!p->rtData.rqTerm) if (!p->rtData.rqTerm)
return; return;
@ -276,23 +276,23 @@ void GlobalState::checkShutdown()
scriptBinding->terminate(); scriptBinding->terminate();
} }
Font &GlobalState::defaultFont() Font &SharedState::defaultFont()
{ {
return *p->defaultFont; return *p->defaultFont;
} }
unsigned int GlobalState::genTimeStamp() unsigned int SharedState::genTimeStamp()
{ {
return p->stampCounter++; return p->stampCounter++;
} }
GlobalState::GlobalState(RGSSThreadData *threadData) SharedState::SharedState(RGSSThreadData *threadData)
{ {
p = new GlobalStatePrivate(threadData); p = new SharedStatePrivate(threadData);
p->screen = p->graphics.getScreen(); p->screen = p->graphics.getScreen();
} }
GlobalState::~GlobalState() SharedState::~SharedState()
{ {
delete p; delete p;
} }

View File

@ -1,5 +1,5 @@
/* /*
** globalstate.h ** sharedstate.h
** **
** This file is part of mkxp. ** This file is part of mkxp.
** **
@ -19,15 +19,15 @@
** along with mkxp. If not, see <http://www.gnu.org/licenses/>. ** along with mkxp. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef GLOBALSTATE_H #ifndef SHAREDSTATE_H
#define GLOBALSTATE_H #define SHAREDSTATE_H
#include "sigc++/signal.h" #include "sigc++/signal.h"
#define gState GlobalState::instance #define shState SharedState::instance
#define glState gState->_glState() #define glState shState->_glState()
struct GlobalStatePrivate; struct SharedStatePrivate;
struct RGSSThreadData; struct RGSSThreadData;
struct GlobalIBO; struct GlobalIBO;
struct mrb_state; struct mrb_state;
@ -62,7 +62,7 @@ struct GlobalIBO;
struct Config; struct Config;
struct Vec2i; struct Vec2i;
struct GlobalState struct SharedState
{ {
void *bindingData(); void *bindingData();
void setBindingData(void *data); void setBindingData(void *data);
@ -128,15 +128,15 @@ struct GlobalState
* function will most likely not return */ * function will most likely not return */
void checkShutdown(); void checkShutdown();
static GlobalState *instance; static SharedState *instance;
static void initInstance(RGSSThreadData *threadData); static void initInstance(RGSSThreadData *threadData);
static void finiInstance(); static void finiInstance();
private: private:
GlobalState(RGSSThreadData *threadData); SharedState(RGSSThreadData *threadData);
~GlobalState(); ~SharedState();
GlobalStatePrivate *p; SharedStatePrivate *p;
}; };
#endif // GLOBALSTATE_H #endif // SHAREDSTATE_H

View File

@ -21,7 +21,7 @@
#include "sprite.h" #include "sprite.h"
#include "globalstate.h" #include "sharedstate.h"
#include "bitmap.h" #include "bitmap.h"
#include "etc.h" #include "etc.h"
#include "etc-internal.h" #include "etc-internal.h"
@ -325,7 +325,7 @@ void Sprite::draw()
if (renderEffect) if (renderEffect)
{ {
SpriteShader &shader = gState->spriteShader(); SpriteShader &shader = shState->spriteShader();
shader.bind(); shader.bind();
shader.applyViewportProj(); shader.applyViewportProj();
@ -347,7 +347,7 @@ void Sprite::draw()
} }
else else
{ {
SimpleSpriteShader &shader = gState->simpleSpriteShader(); SimpleSpriteShader &shader = shState->simpleSpriteShader();
shader.bind(); shader.bind();
shader.setSpriteMat(p->trans.getMatrix()); shader.setSpriteMat(p->trans.getMatrix());

View File

@ -21,7 +21,7 @@
#include "texpool.h" #include "texpool.h"
#include "exception.h" #include "exception.h"
#include "globalstate.h" #include "sharedstate.h"
#include "glstate.h" #include "glstate.h"
#include <QHash> #include <QHash>

View File

@ -25,7 +25,7 @@
#include "bitmap.h" #include "bitmap.h"
#include "table.h" #include "table.h"
#include "globalstate.h" #include "sharedstate.h"
#include "glstate.h" #include "glstate.h"
#include "gl-util.h" #include "gl-util.h"
#include "etc-internal.h" #include "etc-internal.h"
@ -389,7 +389,7 @@ struct TilemapPrivate
glEnableVertexAttribArray(Shader::TexCoord); glEnableVertexAttribArray(Shader::TexCoord);
VBO::bind(tiles.vbo); VBO::bind(tiles.vbo);
gState->bindQuadIBO(); shState->bindQuadIBO();
glVertexAttribPointer(Shader::Position, 2, GL_FLOAT, GL_FALSE, sizeof(SVertex), SVertex::posOffset()); glVertexAttribPointer(Shader::Position, 2, GL_FLOAT, GL_FALSE, sizeof(SVertex), SVertex::posOffset());
glVertexAttribPointer(Shader::TexCoord, 2, GL_FLOAT, GL_FALSE, sizeof(SVertex), SVertex::texPosOffset()); glVertexAttribPointer(Shader::TexCoord, 2, GL_FLOAT, GL_FALSE, sizeof(SVertex), SVertex::texPosOffset());
@ -410,7 +410,7 @@ struct TilemapPrivate
glEnableVertexAttribArray(Shader::Position); glEnableVertexAttribArray(Shader::Position);
VBO::bind(flash.vbo); VBO::bind(flash.vbo);
gState->bindQuadIBO(); shState->bindQuadIBO();
glVertexAttribPointer(Shader::Color, 4, GL_FLOAT, GL_FALSE, sizeof(CVertex), CVertex::colorOffset()); glVertexAttribPointer(Shader::Color, 4, GL_FLOAT, GL_FALSE, sizeof(CVertex), CVertex::colorOffset());
glVertexAttribPointer(Shader::Position, 2, GL_FLOAT, GL_FALSE, sizeof(CVertex), CVertex::posOffset()); glVertexAttribPointer(Shader::Position, 2, GL_FLOAT, GL_FALSE, sizeof(CVertex), CVertex::posOffset());
@ -421,10 +421,10 @@ struct TilemapPrivate
elem.ground = 0; elem.ground = 0;
elem.groundStamp = gState->genTimeStamp(); elem.groundStamp = shState->genTimeStamp();
elem.scanrowStamp = gState->genTimeStamp(); elem.scanrowStamp = shState->genTimeStamp();
prepareCon = gState->prepareDraw.connect prepareCon = shState->prepareDraw.connect
(sigc::mem_fun(this, &TilemapPrivate::prepare)); (sigc::mem_fun(this, &TilemapPrivate::prepare));
} }
@ -432,7 +432,7 @@ struct TilemapPrivate
{ {
destroyElements(); destroyElements();
gState->texPool().release(atlas.gl); shState->texPool().release(atlas.gl);
VAO::del(tiles.vao); VAO::del(tiles.vao);
VBO::del(tiles.vbo); VBO::del(tiles.vbo);
@ -596,8 +596,8 @@ struct TilemapPrivate
updateAtlasInfo(); updateAtlasInfo();
/* Aquire atlas tex */ /* Aquire atlas tex */
gState->texPool().release(atlas.gl); shState->texPool().release(atlas.gl);
atlas.gl = gState->texPool().request(atlas.size.x, atlas.size.y); atlas.gl = shState->texPool().request(atlas.size.x, atlas.size.y);
atlasDirty = true; atlasDirty = true;
} }
@ -877,7 +877,7 @@ struct TilemapPrivate
VBO::unbind(); VBO::unbind();
/* Ensure global IBO size */ /* Ensure global IBO size */
gState->ensureQuadIBO(quadCount*bufferCount()); shState->ensureQuadIBO(quadCount*bufferCount());
} }
void bindAtlas(SimpleShader &shader) void bindAtlas(SimpleShader &shader)
@ -962,7 +962,7 @@ struct TilemapPrivate
VBO::unbind(); VBO::unbind();
/* Ensure global IBO size */ /* Ensure global IBO size */
gState->ensureQuadIBO(flash.quadCount); shState->ensureQuadIBO(flash.quadCount);
} }
void destroyElements() void destroyElements()
@ -1066,7 +1066,7 @@ GroundLayer::GroundLayer(TilemapPrivate *p, Viewport *viewport)
void GroundLayer::draw() void GroundLayer::draw()
{ {
SimpleShader &shader = gState->simpleShader(); SimpleShader &shader = shState->simpleShader();
shader.bind(); shader.bind();
shader.applyViewportProj(); shader.applyViewportProj();
@ -1094,7 +1094,7 @@ void GroundLayer::draw()
glState.blendMode.pushSet(BlendAddition); glState.blendMode.pushSet(BlendAddition);
glState.texture2D.pushSet(false); glState.texture2D.pushSet(false);
FlashMapShader &shader = gState->flashMapShader(); FlashMapShader &shader = shState->flashMapShader();
shader.bind(); shader.bind();
shader.applyViewportProj(); shader.applyViewportProj();
shader.setAlpha(flashAlpha[p->flash.alphaIdx] / 255.f); shader.setAlpha(flashAlpha[p->flash.alphaIdx] / 255.f);
@ -1147,7 +1147,7 @@ ScanRow::ScanRow(TilemapPrivate *p, Viewport *viewport, int index)
void ScanRow::draw() void ScanRow::draw()
{ {
SimpleShader &shader = gState->simpleShader(); SimpleShader &shader = shState->simpleShader();
shader.bind(); shader.bind();
shader.applyViewportProj(); shader.applyViewportProj();

View File

@ -21,7 +21,7 @@
#include "viewport.h" #include "viewport.h"
#include "globalstate.h" #include "sharedstate.h"
#include "etc.h" #include "etc.h"
#include "util.h" #include "util.h"
#include "quad.h" #include "quad.h"
@ -101,14 +101,14 @@ struct ViewportPrivate
}; };
Viewport::Viewport(int x, int y, int width, int height) Viewport::Viewport(int x, int y, int width, int height)
: SceneElement(*gState->screen()), : SceneElement(*shState->screen()),
sceneLink(this) sceneLink(this)
{ {
initViewport(x, y, width, height); initViewport(x, y, width, height);
} }
Viewport::Viewport(Rect *rect) Viewport::Viewport(Rect *rect)
: SceneElement(*gState->screen()), : SceneElement(*shState->screen()),
sceneLink(this) sceneLink(this)
{ {
initViewport(rect->x, rect->y, rect->width, rect->height); initViewport(rect->x, rect->y, rect->width, rect->height);
@ -227,12 +227,12 @@ void Viewport::releaseResources()
ViewportElement::ViewportElement(Viewport *viewport, int z) ViewportElement::ViewportElement(Viewport *viewport, int z)
: SceneElement(viewport ? *viewport : *gState->screen(), z), : SceneElement(viewport ? *viewport : *shState->screen(), z),
m_viewport(viewport) m_viewport(viewport)
{} {}
ViewportElement::ViewportElement(Viewport *viewport, int z, unsigned int cStamp) ViewportElement::ViewportElement(Viewport *viewport, int z, unsigned int cStamp)
: SceneElement(viewport ? *viewport : *gState->screen(), z, cStamp) : SceneElement(viewport ? *viewport : *shState->screen(), z, cStamp)
{} {}
Viewport *ViewportElement::getViewport() const Viewport *ViewportElement::getViewport() const
@ -245,7 +245,7 @@ Viewport *ViewportElement::getViewport() const
void ViewportElement::setViewport(Viewport *viewport) void ViewportElement::setViewport(Viewport *viewport)
{ {
m_viewport = viewport; m_viewport = viewport;
setScene(viewport ? *viewport : *gState->screen()); setScene(viewport ? *viewport : *shState->screen());
onViewportChange(); onViewportChange();
onGeometryChange(scene->getGeometry()); onGeometryChange(scene->getGeometry());
} }

View File

@ -22,7 +22,7 @@
#include "window.h" #include "window.h"
#include "viewport.h" #include "viewport.h"
#include "globalstate.h" #include "sharedstate.h"
#include "bitmap.h" #include "bitmap.h"
#include "etc.h" #include "etc.h"
#include "etc-internal.h" #include "etc-internal.h"
@ -271,13 +271,13 @@ struct WindowPrivate
cursorVert.count = 9; cursorVert.count = 9;
pauseAniVert.count = 1; pauseAniVert.count = 1;
prepareCon = gState->prepareDraw.connect prepareCon = shState->prepareDraw.connect
(sigc::mem_fun(this, &WindowPrivate::prepare)); (sigc::mem_fun(this, &WindowPrivate::prepare));
} }
~WindowPrivate() ~WindowPrivate()
{ {
gState->texPool().release(baseTex); shState->texPool().release(baseTex);
cursorRectCon.disconnect(); cursorRectCon.disconnect();
prepareCon.disconnect(); prepareCon.disconnect();
} }
@ -405,8 +405,8 @@ struct WindowPrivate
if (!resizeNeeded) if (!resizeNeeded)
return; return;
gState->texPool().release(baseTex); shState->texPool().release(baseTex);
baseTex = gState->texPool().request(newW, newH); baseTex = shState->texPool().request(newW, newH);
baseTexDirty = true; baseTexDirty = true;
} }
@ -422,7 +422,7 @@ struct WindowPrivate
glState.viewport.pushSet(IntRect(0, 0, baseTex.width, baseTex.height)); glState.viewport.pushSet(IntRect(0, 0, baseTex.width, baseTex.height));
glState.clearColor.pushSet(Vec4()); glState.clearColor.pushSet(Vec4());
SimpleAlphaShader &shader = gState->simpleAlphaShader(); SimpleAlphaShader &shader = shState->simpleAlphaShader();
shader.bind(); shader.bind();
shader.applyViewportProj(); shader.applyViewportProj();
shader.setTranslation(Vec2i()); shader.setTranslation(Vec2i());
@ -560,7 +560,7 @@ struct WindowPrivate
Vec2i trans(position.x + sceneOffset.x, Vec2i trans(position.x + sceneOffset.x,
position.y + sceneOffset.y); position.y + sceneOffset.y);
SimpleAlphaShader &shader = gState->simpleAlphaShader(); SimpleAlphaShader &shader = shState->simpleAlphaShader();
shader.bind(); shader.bind();
shader.applyViewportProj(); shader.applyViewportProj();
shader.setTranslation(trans); shader.setTranslation(trans);
@ -609,7 +609,7 @@ struct WindowPrivate
glState.scissorBox.push(); glState.scissorBox.push();
glState.scissorBox.setIntersect(windowRect); glState.scissorBox.setIntersect(windowRect);
SimpleAlphaShader &shader = gState->simpleAlphaShader(); SimpleAlphaShader &shader = shState->simpleAlphaShader();
shader.bind(); shader.bind();
shader.applyViewportProj(); shader.applyViewportProj();
shader.setTranslation(Vec2i(effectX, effectY)); shader.setTranslation(Vec2i(effectX, effectY));