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:
parent
807bee5748
commit
cb6f73f7df
|
@ -20,7 +20,7 @@
|
|||
*/
|
||||
|
||||
#include "audio.h"
|
||||
#include "globalstate.h"
|
||||
#include "sharedstate.h"
|
||||
#include "binding-util.h"
|
||||
#include "exception.h"
|
||||
|
||||
|
@ -32,13 +32,13 @@
|
|||
int volume = 100; \
|
||||
int pitch = 100; \
|
||||
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; \
|
||||
} \
|
||||
RB_METHOD(audio_##entity##Stop) \
|
||||
{ \
|
||||
RB_UNUSED_PARAM; \
|
||||
gState->audio().entity##Stop(); \
|
||||
shState->audio().entity##Stop(); \
|
||||
return Qnil; \
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,7 @@ RB_METHOD(audio_##entity##Fade) \
|
|||
RB_UNUSED_PARAM; \
|
||||
int time; \
|
||||
rb_get_args(argc, argv, "i", &time, RB_ARG_END); \
|
||||
gState->audio().bgmFade(time); \
|
||||
shState->audio().bgmFade(time); \
|
||||
return Qnil; \
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
#include "binding.h"
|
||||
#include "binding-util.h"
|
||||
#include "globalstate.h"
|
||||
#include "sharedstate.h"
|
||||
#include "eventthread.h"
|
||||
#include "filesystem.h"
|
||||
|
||||
|
@ -101,7 +101,7 @@ static void mriBindingInit()
|
|||
static void
|
||||
showMsg(const QByteArray &msg)
|
||||
{
|
||||
gState->eThread().showMessageBox(msg.constData());
|
||||
shState->eThread().showMessageBox(msg.constData());
|
||||
}
|
||||
|
||||
static void printP(int argc, VALUE *argv,
|
||||
|
@ -185,7 +185,7 @@ struct Script
|
|||
|
||||
static void runRMXPScripts()
|
||||
{
|
||||
const QByteArray &scriptPack = gState->rtData().config.game.scripts;
|
||||
const QByteArray &scriptPack = shState->rtData().config.game.scripts;
|
||||
|
||||
if (scriptPack.isEmpty())
|
||||
{
|
||||
|
@ -193,7 +193,7 @@ static void runRMXPScripts()
|
|||
return;
|
||||
}
|
||||
|
||||
if (!gState->fileSystem().exists(scriptPack.constData()))
|
||||
if (!shState->fileSystem().exists(scriptPack.constData()))
|
||||
{
|
||||
showMsg("Unable to open '" + scriptPack + "'");
|
||||
return;
|
||||
|
@ -290,11 +290,11 @@ static void mriBindingExecute()
|
|||
ruby_setup();
|
||||
|
||||
RbData rbData;
|
||||
gState->setBindingData(&rbData);
|
||||
shState->setBindingData(&rbData);
|
||||
|
||||
mriBindingInit();
|
||||
|
||||
QByteArray &customScript = gState->rtData().config.customScript;
|
||||
QByteArray &customScript = shState->rtData().config.customScript;
|
||||
if (!customScript.isEmpty())
|
||||
runCustomScript(customScript.constData());
|
||||
else
|
||||
|
@ -315,7 +315,7 @@ static void mriBindingExecute()
|
|||
|
||||
ruby_cleanup(0);
|
||||
|
||||
gState->rtData().rqTermAck = true;
|
||||
shState->rtData().rqTermAck = true;
|
||||
}
|
||||
|
||||
static void mriBindingTerminate()
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
#include "binding-util.h"
|
||||
|
||||
#include "globalstate.h"
|
||||
#include "sharedstate.h"
|
||||
#include "exception.h"
|
||||
#include "util.h"
|
||||
|
||||
|
@ -44,7 +44,7 @@ void initType(rb_data_type_struct &type,
|
|||
|
||||
RbData *getRbData()
|
||||
{
|
||||
return static_cast<RbData*>(gState->bindingData());
|
||||
return static_cast<RbData*>(shState->bindingData());
|
||||
}
|
||||
|
||||
struct
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
#include "binding-util.h"
|
||||
|
||||
#include "globalstate.h"
|
||||
#include "sharedstate.h"
|
||||
#include "filesystem.h"
|
||||
|
||||
#include <QDebug>
|
||||
|
@ -32,7 +32,7 @@ static VALUE
|
|||
fileIntForPath(const char *path)
|
||||
{
|
||||
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"));
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
*/
|
||||
|
||||
#include "graphics.h"
|
||||
#include "globalstate.h"
|
||||
#include "sharedstate.h"
|
||||
#include "binding-util.h"
|
||||
#include "exception.h"
|
||||
|
||||
|
@ -28,7 +28,7 @@ RB_METHOD(graphicsUpdate)
|
|||
{
|
||||
RB_UNUSED_PARAM;
|
||||
|
||||
gState->graphics().update();
|
||||
shState->graphics().update();
|
||||
|
||||
return Qnil;
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ RB_METHOD(graphicsFreeze)
|
|||
{
|
||||
RB_UNUSED_PARAM;
|
||||
|
||||
gState->graphics().freeze();
|
||||
shState->graphics().freeze();
|
||||
|
||||
return Qnil;
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ RB_METHOD(graphicsTransition)
|
|||
|
||||
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;
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ RB_METHOD(graphicsFrameReset)
|
|||
{
|
||||
RB_UNUSED_PARAM;
|
||||
|
||||
gState->graphics().frameReset();
|
||||
shState->graphics().frameReset();
|
||||
|
||||
return Qnil;
|
||||
}
|
||||
|
@ -70,14 +70,14 @@ RB_METHOD(graphicsFrameReset)
|
|||
RB_METHOD(graphics##Get##PropName) \
|
||||
{ \
|
||||
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_UNUSED_PARAM; \
|
||||
int value; \
|
||||
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); \
|
||||
}
|
||||
|
||||
|
@ -85,14 +85,14 @@ RB_METHOD(graphicsFrameReset)
|
|||
RB_METHOD(graphics##Get##PropName) \
|
||||
{ \
|
||||
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_UNUSED_PARAM; \
|
||||
bool value; \
|
||||
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); \
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
*/
|
||||
|
||||
#include "input.h"
|
||||
#include "globalstate.h"
|
||||
#include "sharedstate.h"
|
||||
#include "exception.h"
|
||||
#include "binding-util.h"
|
||||
|
||||
|
@ -28,7 +28,7 @@ RB_METHOD(inputUpdate)
|
|||
{
|
||||
RB_UNUSED_PARAM;
|
||||
|
||||
gState->input().update();
|
||||
shState->input().update();
|
||||
|
||||
return Qnil;
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ RB_METHOD(inputPress)
|
|||
|
||||
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)
|
||||
|
@ -54,7 +54,7 @@ RB_METHOD(inputTrigger)
|
|||
|
||||
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)
|
||||
|
@ -66,21 +66,21 @@ RB_METHOD(inputRepeat)
|
|||
|
||||
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_UNUSED_PARAM;
|
||||
|
||||
return rb_fix_new(gState->input().dir4Value());
|
||||
return rb_fix_new(shState->input().dir4Value());
|
||||
}
|
||||
|
||||
RB_METHOD(inputDir8)
|
||||
{
|
||||
RB_UNUSED_PARAM;
|
||||
|
||||
return rb_fix_new(gState->input().dir8Value());
|
||||
return rb_fix_new(shState->input().dir8Value());
|
||||
}
|
||||
|
||||
/* Non-standard extensions */
|
||||
|
@ -88,14 +88,14 @@ RB_METHOD(inputMouseX)
|
|||
{
|
||||
RB_UNUSED_PARAM;
|
||||
|
||||
return rb_fix_new(gState->input().mouseX());
|
||||
return rb_fix_new(shState->input().mouseX());
|
||||
}
|
||||
|
||||
RB_METHOD(inputMouseY)
|
||||
{
|
||||
RB_UNUSED_PARAM;
|
||||
|
||||
return rb_fix_new(gState->input().mouseY());
|
||||
return rb_fix_new(shState->input().mouseY());
|
||||
}
|
||||
|
||||
#define DEF_CONST_I(name, value) \
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
*/
|
||||
|
||||
#include "audio.h"
|
||||
#include "globalstate.h"
|
||||
#include "sharedstate.h"
|
||||
#include "binding-util.h"
|
||||
#include "exception.h"
|
||||
|
||||
|
@ -31,13 +31,13 @@
|
|||
mrb_int volume = 100; \
|
||||
mrb_int pitch = 100; \
|
||||
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(); \
|
||||
} \
|
||||
MRB_FUNCTION(audio_##entity##Stop) \
|
||||
{ \
|
||||
MRB_FUN_UNUSED_PARAM; \
|
||||
gState->audio().entity##Stop(); \
|
||||
shState->audio().entity##Stop(); \
|
||||
return mrb_nil_value(); \
|
||||
}
|
||||
|
||||
|
@ -46,7 +46,7 @@ MRB_FUNCTION(audio_##entity##Fade) \
|
|||
{ \
|
||||
mrb_int time; \
|
||||
mrb_get_args(mrb, "i", &time); \
|
||||
gState->audio().entity##Fade(time); \
|
||||
shState->audio().entity##Fade(time); \
|
||||
return mrb_nil_value(); \
|
||||
}
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
#include "SDL2/SDL_rwops.h"
|
||||
#include "SDL2/SDL_timer.h"
|
||||
|
||||
#include "globalstate.h"
|
||||
#include "sharedstate.h"
|
||||
#include "texpool.h"
|
||||
#include "eventthread.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",
|
||||
mrbValueString(file), mrb_fixnum(line), excClass, mrbValueString(mesg));
|
||||
|
||||
gState->eThread().showMessageBox(msgBoxText, SDL_MESSAGEBOX_ERROR);
|
||||
shState->eThread().showMessageBox(msgBoxText, SDL_MESSAGEBOX_ERROR);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -182,7 +182,7 @@ checkException(mrb_state *mrb)
|
|||
static void
|
||||
showError(const QByteArray &msg)
|
||||
{
|
||||
gState->eThread().showMessageBox(msg.constData());
|
||||
shState->eThread().showMessageBox(msg.constData());
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -244,7 +244,7 @@ runMrbFile(mrb_state *mrb, const char *filename)
|
|||
static void
|
||||
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())
|
||||
{
|
||||
|
@ -252,7 +252,7 @@ runRMXPScripts(mrb_state *mrb, mrbc_context *ctx)
|
|||
return;
|
||||
}
|
||||
|
||||
if (!gState->fileSystem().exists(scriptPack.constData()))
|
||||
if (!shState->fileSystem().exists(scriptPack.constData()))
|
||||
{
|
||||
showError("Unable to open '" + scriptPack + "'");
|
||||
return;
|
||||
|
@ -262,7 +262,7 @@ runRMXPScripts(mrb_state *mrb, mrbc_context *ctx)
|
|||
mrb_state *scriptMrb = mrb_open();
|
||||
SDL_RWops ops;
|
||||
|
||||
gState->fileSystem().openRead(ops, scriptPack.constData());
|
||||
shState->fileSystem().openRead(ops, scriptPack.constData());
|
||||
|
||||
mrb_value scriptArray = mrb_nil_value();
|
||||
QByteArray readError;
|
||||
|
@ -356,7 +356,7 @@ static void mrbBindingExecute()
|
|||
{
|
||||
mrb_state *mrb = mrb_open();
|
||||
|
||||
gState->setBindingData(mrb);
|
||||
shState->setBindingData(mrb);
|
||||
|
||||
MrbData mrbData(mrb);
|
||||
mrb->ud = &mrbData;
|
||||
|
@ -369,7 +369,7 @@ static void mrbBindingExecute()
|
|||
mrbc_context *ctx = mrbc_context_new(mrb);
|
||||
ctx->capture_errors = 1;
|
||||
|
||||
Config &conf = gState->rtData().config;
|
||||
Config &conf = shState->rtData().config;
|
||||
QByteArray &customScript = conf.customScript;
|
||||
QByteArray mrbFile = conf.bindingConf.value("mrbFile").toByteArray();
|
||||
|
||||
|
@ -382,8 +382,8 @@ static void mrbBindingExecute()
|
|||
|
||||
checkException(mrb);
|
||||
|
||||
gState->rtData().rqTermAck = true;
|
||||
gState->texPool().disable();
|
||||
shState->rtData().rqTermAck = true;
|
||||
shState->texPool().disable();
|
||||
|
||||
mrbc_context_free(mrb, ctx);
|
||||
mrb_close(mrb);
|
||||
|
@ -391,7 +391,7 @@ static void mrbBindingExecute()
|
|||
|
||||
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);
|
||||
|
||||
mrb_raise(mrb, data->exc[Shutdown], "");
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
*/
|
||||
|
||||
#include "graphics.h"
|
||||
#include "globalstate.h"
|
||||
#include "sharedstate.h"
|
||||
#include "mruby.h"
|
||||
#include "binding-util.h"
|
||||
#include "exception.h"
|
||||
|
@ -29,7 +29,7 @@ MRB_FUNCTION(graphicsUpdate)
|
|||
{
|
||||
MRB_FUN_UNUSED_PARAM;
|
||||
|
||||
gState->graphics().update();
|
||||
shState->graphics().update();
|
||||
|
||||
return mrb_nil_value();
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ MRB_FUNCTION(graphicsFreeze)
|
|||
{
|
||||
MRB_FUN_UNUSED_PARAM;
|
||||
|
||||
gState->graphics().freeze();
|
||||
shState->graphics().freeze();
|
||||
|
||||
return mrb_nil_value();
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ MRB_FUNCTION(graphicsTransition)
|
|||
|
||||
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();
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ MRB_FUNCTION(graphicsFrameReset)
|
|||
{
|
||||
MRB_FUN_UNUSED_PARAM;
|
||||
|
||||
gState->graphics().frameReset();
|
||||
shState->graphics().frameReset();
|
||||
|
||||
return mrb_nil_value();
|
||||
}
|
||||
|
@ -69,13 +69,13 @@ MRB_FUNCTION(graphicsFrameReset)
|
|||
MRB_FUNCTION(graphics##Get##PropName) \
|
||||
{ \
|
||||
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_int value; \
|
||||
mrb_get_args(mrb, "i", &value); \
|
||||
gState->graphics().set##PropName(value); \
|
||||
shState->graphics().set##PropName(value); \
|
||||
return mrb_fixnum_value(value); \
|
||||
}
|
||||
|
||||
|
@ -83,13 +83,13 @@ MRB_FUNCTION(graphicsFrameReset)
|
|||
MRB_FUNCTION(graphics##Get##PropName) \
|
||||
{ \
|
||||
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_bool value; \
|
||||
mrb_get_args(mrb, "b", &value); \
|
||||
gState->graphics().set##PropName(value); \
|
||||
shState->graphics().set##PropName(value); \
|
||||
return mrb_bool_value(value); \
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
*/
|
||||
|
||||
#include "input.h"
|
||||
#include "globalstate.h"
|
||||
#include "sharedstate.h"
|
||||
#include "exception.h"
|
||||
#include "binding-util.h"
|
||||
|
||||
|
@ -28,7 +28,7 @@ MRB_FUNCTION(inputUpdate)
|
|||
{
|
||||
MRB_FUN_UNUSED_PARAM;
|
||||
|
||||
gState->input().update();
|
||||
shState->input().update();
|
||||
|
||||
return mrb_nil_value();
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ MRB_FUNCTION(inputPress)
|
|||
|
||||
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)
|
||||
|
@ -50,7 +50,7 @@ MRB_FUNCTION(inputTrigger)
|
|||
|
||||
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)
|
||||
|
@ -60,21 +60,21 @@ MRB_FUNCTION(inputRepeat)
|
|||
|
||||
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_FUN_UNUSED_PARAM;
|
||||
|
||||
return mrb_fixnum_value(gState->input().dir4Value());
|
||||
return mrb_fixnum_value(shState->input().dir4Value());
|
||||
}
|
||||
|
||||
MRB_FUNCTION(inputDir8)
|
||||
{
|
||||
MRB_FUN_UNUSED_PARAM;
|
||||
|
||||
return mrb_fixnum_value(gState->input().dir8Value());
|
||||
return mrb_fixnum_value(shState->input().dir8Value());
|
||||
}
|
||||
|
||||
/* Non-standard extensions */
|
||||
|
@ -82,14 +82,14 @@ MRB_FUNCTION(inputMouseX)
|
|||
{
|
||||
MRB_FUN_UNUSED_PARAM;
|
||||
|
||||
return mrb_fixnum_value(gState->input().mouseX());
|
||||
return mrb_fixnum_value(shState->input().mouseX());
|
||||
}
|
||||
|
||||
MRB_FUNCTION(inputMouseY)
|
||||
{
|
||||
MRB_FUN_UNUSED_PARAM;
|
||||
|
||||
return mrb_fixnum_value(gState->input().mouseY());
|
||||
return mrb_fixnum_value(shState->input().mouseY());
|
||||
}
|
||||
|
||||
#define DEF_CONST_I(name, value) \
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
|
||||
#include "../binding-util.h"
|
||||
#include "marshal.h"
|
||||
#include "globalstate.h"
|
||||
#include "sharedstate.h"
|
||||
#include "eventthread.h"
|
||||
#include "exception.h"
|
||||
#include "filesystem.h"
|
||||
|
@ -70,7 +70,7 @@ static void printP(mrb_state *mrb,
|
|||
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)
|
||||
|
@ -174,7 +174,7 @@ MRB_FUNCTION(kernelLoadData)
|
|||
mrb_get_args(mrb, "z", &filename);
|
||||
|
||||
SDL_RWops ops;
|
||||
GUARD_EXC( gState->fileSystem().openRead(ops, filename); )
|
||||
GUARD_EXC( shState->fileSystem().openRead(ops, filename); )
|
||||
|
||||
mrb_value obj;
|
||||
try { obj = marshalLoadInt(mrb, &ops); }
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
*/
|
||||
|
||||
#include "binding.h"
|
||||
#include "globalstate.h"
|
||||
#include "sharedstate.h"
|
||||
#include "eventthread.h"
|
||||
|
||||
#include <QDebug>
|
||||
|
@ -28,7 +28,7 @@
|
|||
static void nullBindingExecute()
|
||||
{
|
||||
qDebug() << "The null binding doesn't do anything, so we're done!";
|
||||
gState->rtData().rqTermAck = true;
|
||||
shState->rtData().rqTermAck = true;
|
||||
}
|
||||
|
||||
static void nullBindingTerminate()
|
||||
|
|
8
mkxp.pro
8
mkxp.pro
|
@ -34,7 +34,6 @@ HEADERS += \
|
|||
src/eventthread.h \
|
||||
src/flashable.h \
|
||||
src/font.h \
|
||||
src/globalstate.h \
|
||||
src/input.h \
|
||||
src/plane.h \
|
||||
src/scene.h \
|
||||
|
@ -62,7 +61,8 @@ HEADERS += \
|
|||
src/util.h \
|
||||
src/config.h \
|
||||
src/tileatlas.h \
|
||||
src/perftimer.h
|
||||
src/perftimer.h \
|
||||
src/sharedstate.h
|
||||
|
||||
SOURCES += \
|
||||
src/main.cpp \
|
||||
|
@ -71,7 +71,6 @@ SOURCES += \
|
|||
src/eventthread.cpp \
|
||||
src/filesystem.cpp \
|
||||
src/font.cpp \
|
||||
src/globalstate.cpp \
|
||||
src/input.cpp \
|
||||
src/plane.cpp \
|
||||
src/scene.cpp \
|
||||
|
@ -90,7 +89,8 @@ SOURCES += \
|
|||
src/etc.cpp \
|
||||
src/config.cpp \
|
||||
src/tileatlas.cpp \
|
||||
src/perftimer.cpp
|
||||
src/perftimer.cpp \
|
||||
src/sharedstate.cpp
|
||||
|
||||
EMBED = shader/transSimple.frag \
|
||||
shader/trans.frag \
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
#include "audio.h"
|
||||
|
||||
#include "globalstate.h"
|
||||
#include "sharedstate.h"
|
||||
#include "util.h"
|
||||
#include "intrulist.h"
|
||||
#include "filesystem.h"
|
||||
|
@ -123,7 +123,7 @@ struct MusicEntity
|
|||
currentData.close();
|
||||
|
||||
currentData =
|
||||
gState->fileSystem().openRead(filename.constData(), FileSystem::Audio);
|
||||
shState->fileSystem().openRead(filename.constData(), FileSystem::Audio);
|
||||
|
||||
if (!this->music.openFromStream(currentData))
|
||||
return;
|
||||
|
@ -319,7 +319,7 @@ private:
|
|||
// {
|
||||
// /* Buffer not in cashe, needs to be loaded */
|
||||
// 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);
|
||||
|
||||
|
@ -435,7 +435,7 @@ private:
|
|||
/* Buffer not in cashe, needs to be loaded */
|
||||
|
||||
FileStream data =
|
||||
gState->fileSystem().openRead(filename, FileSystem::Audio);
|
||||
shState->fileSystem().openRead(filename, FileSystem::Audio);
|
||||
|
||||
buffer = new SoundBuffer;
|
||||
buffer->sfBuffer.loadFromStream(data);
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
#include "transform.h"
|
||||
#include "exception.h"
|
||||
|
||||
#include "globalstate.h"
|
||||
#include "sharedstate.h"
|
||||
#include "glstate.h"
|
||||
#include "texpool.h"
|
||||
#include "shader.h"
|
||||
|
@ -78,7 +78,7 @@ struct BitmapPrivate
|
|||
BitmapPrivate()
|
||||
: megaSurface(0)
|
||||
{
|
||||
font = &gState->defaultFont();
|
||||
font = &shState->defaultFont();
|
||||
pixman_region_init(&tainted);
|
||||
}
|
||||
|
||||
|
@ -159,7 +159,7 @@ struct BitmapPrivate
|
|||
if (pointArray.count() == 0)
|
||||
return;
|
||||
|
||||
SimpleColorShader &shader = gState->simpleColorShader();
|
||||
SimpleColorShader &shader = shState->simpleColorShader();
|
||||
shader.bind();
|
||||
shader.setTranslation(Vec2i());
|
||||
|
||||
|
@ -207,7 +207,7 @@ struct BitmapPrivate
|
|||
Bitmap::Bitmap(const char *filename)
|
||||
{
|
||||
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);
|
||||
|
||||
if (!imgSurf)
|
||||
|
@ -228,7 +228,7 @@ Bitmap::Bitmap(const char *filename)
|
|||
TEXFBO tex;
|
||||
try
|
||||
{
|
||||
tex = gState->texPool().request(imgSurf->w, imgSurf->h);
|
||||
tex = shState->texPool().request(imgSurf->w, imgSurf->h);
|
||||
}
|
||||
catch (const Exception &e)
|
||||
{
|
||||
|
@ -253,7 +253,7 @@ Bitmap::Bitmap(int width, int height)
|
|||
if (width <= 0 || height <= 0)
|
||||
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->gl = tex;
|
||||
|
@ -265,7 +265,7 @@ Bitmap::Bitmap(const Bitmap &other)
|
|||
{
|
||||
p = new BitmapPrivate;
|
||||
|
||||
p->gl = gState->texPool().request(other.width(), other.height());
|
||||
p->gl = shState->texPool().request(other.width(), other.height());
|
||||
|
||||
other.flush();
|
||||
blt(0, 0, other, rect());
|
||||
|
@ -379,7 +379,7 @@ void Bitmap::stretchBlt(const IntRect &destRect,
|
|||
|
||||
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(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.height() / sourceRect.h) * ((float) destRect.h / gpTex.height));
|
||||
|
||||
BltShader &shader = gState->bltShader();
|
||||
BltShader &shader = shState->bltShader();
|
||||
shader.bind();
|
||||
shader.setDestination(gpTex.tex);
|
||||
shader.setSubRect(bltSubRect);
|
||||
shader.setOpacity(normOpacity);
|
||||
|
||||
Quad &quad = gState->gpQuad();
|
||||
Quad &quad = shState->gpQuad();
|
||||
quad.setTexPosRect(sourceRect, destRect);
|
||||
quad.setColor(Vec4(1, 1, 1, normOpacity));
|
||||
|
||||
|
@ -459,11 +459,11 @@ void Bitmap::gradientFillRect(const IntRect &rect,
|
|||
|
||||
flush();
|
||||
|
||||
SimpleColorShader &shader = gState->simpleColorShader();
|
||||
SimpleColorShader &shader = shState->simpleColorShader();
|
||||
shader.bind();
|
||||
shader.setTranslation(Vec2i());
|
||||
|
||||
Quad &quad = gState->gpQuad();
|
||||
Quad &quad = shState->gpQuad();
|
||||
|
||||
if (vertical)
|
||||
{
|
||||
|
@ -518,13 +518,13 @@ void Bitmap::blur()
|
|||
|
||||
flush();
|
||||
|
||||
Quad &quad = gState->gpQuad();
|
||||
Quad &quad = shState->gpQuad();
|
||||
FloatRect rect(0, 0, width(), height());
|
||||
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::VPass &pass2 = shader.pass2;
|
||||
|
||||
|
@ -552,7 +552,7 @@ void Bitmap::blur()
|
|||
glState.viewport.pop();
|
||||
glState.blendMode.pop();
|
||||
|
||||
gState->texPool().release(auxTex);
|
||||
shState->texPool().release(auxTex);
|
||||
|
||||
modified();
|
||||
}
|
||||
|
@ -613,7 +613,7 @@ void Bitmap::radialBlur(int angle, int divisions)
|
|||
|
||||
qArray.commit();
|
||||
|
||||
TEXFBO newTex = gState->texPool().request(_width, _height);
|
||||
TEXFBO newTex = shState->texPool().request(_width, _height);
|
||||
|
||||
FBO::bind(newTex.fbo, FBO::Draw);
|
||||
|
||||
|
@ -626,7 +626,7 @@ void Bitmap::radialBlur(int angle, int divisions)
|
|||
|
||||
glState.blendMode.pushSet(BlendAddition);
|
||||
|
||||
SimpleMatrixShader &shader = gState->simpleMatrixShader();
|
||||
SimpleMatrixShader &shader = shState->simpleMatrixShader();
|
||||
shader.bind();
|
||||
|
||||
p->bindTexture(shader);
|
||||
|
@ -648,7 +648,7 @@ void Bitmap::radialBlur(int angle, int divisions)
|
|||
glState.blendMode.pop();
|
||||
glState.clearColor.pop();
|
||||
|
||||
gState->texPool().release(p->tex);
|
||||
shState->texPool().release(p->tex);
|
||||
p->tex = newTex;
|
||||
|
||||
modified();
|
||||
|
@ -722,11 +722,11 @@ void Bitmap::hueChange(int hue)
|
|||
|
||||
flush();
|
||||
|
||||
TEXFBO newTex = gState->texPool().request(width(), height());
|
||||
TEXFBO newTex = shState->texPool().request(width(), height());
|
||||
|
||||
FloatRect texRect(rect());
|
||||
|
||||
Quad &quad = gState->gpQuad();
|
||||
Quad &quad = shState->gpQuad();
|
||||
quad.setTexPosRect(texRect, texRect);
|
||||
quad.setColor(Vec4(1, 1, 1, 1));
|
||||
|
||||
|
@ -734,7 +734,7 @@ void Bitmap::hueChange(int hue)
|
|||
hue = wrapRange(hue, 0, 359);
|
||||
float hueAdj = -((M_PI * 2) / 360) * hue;
|
||||
|
||||
HueShader &shader = gState->hueShader();
|
||||
HueShader &shader = shState->hueShader();
|
||||
shader.bind();
|
||||
shader.setHueAdjust(hueAdj);
|
||||
|
||||
|
@ -750,7 +750,7 @@ void Bitmap::hueChange(int hue)
|
|||
|
||||
TEX::unbind();
|
||||
|
||||
gState->texPool().release(p->gl);
|
||||
shState->texPool().release(p->gl);
|
||||
p->gl = newTex;
|
||||
|
||||
modified();
|
||||
|
@ -787,7 +787,7 @@ void Bitmap::drawText(const IntRect &rect, const char *str, int align)
|
|||
|
||||
SDL_Surface *txtSurf;
|
||||
|
||||
if (gState->rtData().config.solidFonts)
|
||||
if (shState->rtData().config.solidFonts)
|
||||
txtSurf = TTF_RenderUTF8_Solid(font, str, c);
|
||||
else
|
||||
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);
|
||||
|
||||
Vec2i gpTexSize;
|
||||
gState->ensureTexSize(txtSurf->w, txtSurf->h, gpTexSize);
|
||||
shState->ensureTexSize(txtSurf->w, txtSurf->h, gpTexSize);
|
||||
|
||||
bool fastBlit = !p->touchesTaintedArea(posRect) && txtAlpha == 1.0;
|
||||
|
||||
|
@ -888,7 +888,7 @@ void Bitmap::drawText(const IntRect &rect, const char *str, int align)
|
|||
else
|
||||
{
|
||||
/* 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::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
|
||||
* 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(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.y / gpTex2.height);
|
||||
|
||||
BltShader &shader = gState->bltShader();
|
||||
BltShader &shader = shState->bltShader();
|
||||
shader.bind();
|
||||
shader.setTexSize(gpTexSize);
|
||||
shader.setSource();
|
||||
|
@ -923,11 +923,11 @@ void Bitmap::drawText(const IntRect &rect, const char *str, int align)
|
|||
shader.setSubRect(bltRect);
|
||||
shader.setOpacity(txtAlpha);
|
||||
|
||||
gState->bindTex();
|
||||
shState->bindTex();
|
||||
TEX::uploadSubImage(0, 0, txtSurf->w, txtSurf->h, txtSurf->pixels, GL_BGRA_EXT);
|
||||
TEX::setSmooth(true);
|
||||
|
||||
Quad &quad = gState->gpQuad();
|
||||
Quad &quad = shState->gpQuad();
|
||||
quad.setTexRect(FloatRect(0, 0, txtSurf->w, txtSurf->h));
|
||||
quad.setPosRect(posRect);
|
||||
|
||||
|
@ -1006,7 +1006,7 @@ void Bitmap::releaseResources()
|
|||
if (p->megaSurface)
|
||||
SDL_FreeSurface(p->megaSurface);
|
||||
else
|
||||
gState->texPool().release(p->gl);
|
||||
shState->texPool().release(p->gl);
|
||||
|
||||
delete p;
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#include "SDL2/SDL_timer.h"
|
||||
#include "SDL2/SDL_thread.h"
|
||||
|
||||
#include "globalstate.h"
|
||||
#include "sharedstate.h"
|
||||
#include "graphics.h"
|
||||
|
||||
#include "string.h"
|
||||
|
@ -361,7 +361,7 @@ void EventThread::showMessageBox(const char *body, int flags)
|
|||
SDL_PushEvent(&event);
|
||||
|
||||
/* Keep repainting screen while box is open */
|
||||
gState->graphics().repaintWait(&msgBoxDone);
|
||||
shState->graphics().repaintWait(&msgBoxDone);
|
||||
/* Prevent endless loops */
|
||||
resetInputStates();
|
||||
}
|
||||
|
|
12
src/font.cpp
12
src/font.cpp
|
@ -21,7 +21,7 @@
|
|||
|
||||
#include "font.h"
|
||||
|
||||
#include "globalstate.h"
|
||||
#include "sharedstate.h"
|
||||
#include "filesystem.h"
|
||||
#include "exception.h"
|
||||
|
||||
|
@ -79,7 +79,7 @@ _TTF_Font *FontPool::request(const char *filename,
|
|||
|
||||
bool useBundled = false;
|
||||
QByteArray path = QByteArray("Fonts/") + nameKey;
|
||||
if (!gState->fileSystem().exists(path.constData(), FileSystem::Font))
|
||||
if (!shState->fileSystem().exists(path.constData(), FileSystem::Font))
|
||||
{
|
||||
useBundled = true;
|
||||
nameKey = " bundled";
|
||||
|
@ -107,7 +107,7 @@ _TTF_Font *FontPool::request(const char *filename,
|
|||
else
|
||||
{
|
||||
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
|
||||
|
@ -151,7 +151,7 @@ struct FontPrivate
|
|||
color(&colorTmp),
|
||||
colorTmp(*defaultColor)
|
||||
{
|
||||
sdlFont = gState->fontPool().request(this->name.constData(),
|
||||
sdlFont = shState->fontPool().request(this->name.constData(),
|
||||
this->size);
|
||||
}
|
||||
};
|
||||
|
@ -168,7 +168,7 @@ bool Font::doesExist(const char *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,
|
||||
|
@ -198,7 +198,7 @@ void Font::setSize(int value)
|
|||
return;
|
||||
|
||||
p->size = value;
|
||||
p->sdlFont = gState->fontPool().request(p->name.constData(), value);
|
||||
p->sdlFont = shState->fontPool().request(p->name.constData(), value);
|
||||
}
|
||||
|
||||
#undef CHK_DISP
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
#include "util.h"
|
||||
#include "gl-util.h"
|
||||
#include "globalstate.h"
|
||||
#include "sharedstate.h"
|
||||
#include "glstate.h"
|
||||
#include "shader.h"
|
||||
#include "scene.h"
|
||||
|
@ -145,7 +145,7 @@ public:
|
|||
const int w = geometry.rect.w;
|
||||
const int h = geometry.rect.h;
|
||||
|
||||
gState->prepareDraw();
|
||||
shState->prepareDraw();
|
||||
|
||||
pp.startRender();
|
||||
|
||||
|
@ -158,7 +158,7 @@ public:
|
|||
#ifdef RGSS2
|
||||
if (brightEffect)
|
||||
{
|
||||
SimpleColorShader &shader = gState->simpleColorShader();
|
||||
SimpleColorShader &shader = shState->simpleColorShader();
|
||||
shader.bind();
|
||||
shader.applyViewportProj();
|
||||
shader.setTranslation(Vec2i());
|
||||
|
@ -175,7 +175,7 @@ public:
|
|||
pp.swapRender();
|
||||
pp.blitFBOs();
|
||||
|
||||
PlaneShader &shader = gState->planeShader();
|
||||
PlaneShader &shader = shState->planeShader();
|
||||
shader.bind();
|
||||
shader.setColor(c);
|
||||
shader.setFlash(f);
|
||||
|
@ -358,11 +358,11 @@ struct GraphicsPrivate
|
|||
|
||||
void updateScreenResoRatio()
|
||||
{
|
||||
Vec2 &ratio = gState->rtData().sizeResoRatio;
|
||||
Vec2 &ratio = shState->rtData().sizeResoRatio;
|
||||
ratio.x = (float) scRes.x / scSize.x;
|
||||
ratio.y = (float) scRes.y / scSize.y;
|
||||
|
||||
gState->rtData().screenOffset = scOffset;
|
||||
shState->rtData().screenOffset = scOffset;
|
||||
}
|
||||
|
||||
/* Enforces fixed aspect ratio, if desired */
|
||||
|
@ -401,7 +401,7 @@ struct GraphicsPrivate
|
|||
void shutdown()
|
||||
{
|
||||
threadData->rqTermAck = true;
|
||||
gState->texPool().disable();
|
||||
shState->texPool().disable();
|
||||
|
||||
scriptBinding->terminate();
|
||||
}
|
||||
|
@ -460,7 +460,7 @@ Graphics::~Graphics()
|
|||
|
||||
void Graphics::update()
|
||||
{
|
||||
gState->checkShutdown();
|
||||
shState->checkShutdown();
|
||||
|
||||
// p->cpuTimer->endTiming();
|
||||
// p->gpuTimer->startTiming();
|
||||
|
@ -479,7 +479,7 @@ void Graphics::freeze()
|
|||
{
|
||||
p->frozen = true;
|
||||
|
||||
gState->checkShutdown();
|
||||
shState->checkShutdown();
|
||||
p->checkResize();
|
||||
|
||||
/* Capture scene into frozen buffer */
|
||||
|
@ -504,7 +504,7 @@ void Graphics::transition(int duration,
|
|||
* we can use a simplified shader */
|
||||
if (transMap)
|
||||
{
|
||||
TransShader &shader = gState->transShader();
|
||||
TransShader &shader = shState->transShader();
|
||||
shader.bind();
|
||||
shader.applyViewportProj();
|
||||
shader.setFrozenScene(p->frozenScene.tex);
|
||||
|
@ -515,7 +515,7 @@ void Graphics::transition(int duration,
|
|||
}
|
||||
else
|
||||
{
|
||||
SimpleTransShader &shader = gState->sTransShader();
|
||||
SimpleTransShader &shader = shState->sTransShader();
|
||||
shader.bind();
|
||||
shader.applyViewportProj();
|
||||
shader.setFrozenScene(p->frozenScene.tex);
|
||||
|
@ -536,9 +536,9 @@ void Graphics::transition(int duration,
|
|||
const float prog = i * (1.0 / duration);
|
||||
|
||||
if (transMap)
|
||||
gState->transShader().setProg(prog);
|
||||
shState->transShader().setProg(prog);
|
||||
else
|
||||
gState->sTransShader().setProg(prog);
|
||||
shState->sTransShader().setProg(prog);
|
||||
|
||||
/* Draw the composed frame to a buffer first
|
||||
* (we need this because we're skipping PingPong) */
|
||||
|
@ -589,7 +589,7 @@ void Graphics::wait(int duration)
|
|||
{
|
||||
for (int i = 0; i < duration; ++i)
|
||||
{
|
||||
gState->checkShutdown();
|
||||
shState->checkShutdown();
|
||||
p->checkResize();
|
||||
p->redrawScreen();
|
||||
}
|
||||
|
@ -666,7 +666,7 @@ void Graphics::resizeScreen(int width, int height)
|
|||
if (p->scRes == size)
|
||||
return;
|
||||
|
||||
gState->eThread().requestWindowResize(width, height);
|
||||
shState->eThread().requestWindowResize(width, height);
|
||||
|
||||
p->scRes = size;
|
||||
|
||||
|
@ -737,7 +737,7 @@ void Graphics::repaintWait(volatile bool *exitCond)
|
|||
|
||||
while (!*exitCond)
|
||||
{
|
||||
gState->checkShutdown();
|
||||
shState->checkShutdown();
|
||||
|
||||
FBO::clear();
|
||||
p->blitBufferFlippedScaled();
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
*/
|
||||
|
||||
#include "input.h"
|
||||
#include "globalstate.h"
|
||||
#include "sharedstate.h"
|
||||
#include "eventthread.h"
|
||||
#include "exception.h"
|
||||
#include "util.h"
|
||||
|
@ -552,7 +552,7 @@ Input::Input()
|
|||
|
||||
void Input::update()
|
||||
{
|
||||
gState->checkShutdown();
|
||||
shState->checkShutdown();
|
||||
|
||||
p->swapBuffers();
|
||||
p->clearBuffer();
|
||||
|
@ -614,13 +614,13 @@ int Input::dir8Value()
|
|||
|
||||
int Input::mouseX()
|
||||
{
|
||||
RGSSThreadData &rtData = gState->rtData();
|
||||
RGSSThreadData &rtData = shState->rtData();
|
||||
return (EventThread::mouseState.x - rtData.screenOffset.x) * rtData.sizeResoRatio.x;
|
||||
}
|
||||
|
||||
int Input::mouseY()
|
||||
{
|
||||
RGSSThreadData &rtData = gState->rtData();
|
||||
RGSSThreadData &rtData = shState->rtData();
|
||||
return (EventThread::mouseState.y - rtData.screenOffset.y) * rtData.sizeResoRatio.y;
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#include "SDL2/SDL_image.h"
|
||||
#include "SDL2/SDL_ttf.h"
|
||||
|
||||
#include "globalstate.h"
|
||||
#include "sharedstate.h"
|
||||
#include "eventthread.h"
|
||||
#include "debuglogger.h"
|
||||
|
||||
|
@ -100,7 +100,7 @@ int rgssThreadFun(void *userdata)
|
|||
|
||||
DebugLogger dLogger;
|
||||
|
||||
GlobalState::initInstance(threadData);
|
||||
SharedState::initInstance(threadData);
|
||||
|
||||
/* Start script execution */
|
||||
scriptBinding->execute();
|
||||
|
@ -108,7 +108,7 @@ int rgssThreadFun(void *userdata)
|
|||
threadData->rqTermAck = true;
|
||||
threadData->ethread->requestTerminate();
|
||||
|
||||
GlobalState::finiInstance();
|
||||
SharedState::finiInstance();
|
||||
|
||||
SDL_GL_DeleteContext(ctx);
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
#include "plane.h"
|
||||
|
||||
#include "globalstate.h"
|
||||
#include "sharedstate.h"
|
||||
#include "bitmap.h"
|
||||
#include "etc.h"
|
||||
#include "util.h"
|
||||
|
@ -186,7 +186,7 @@ void Plane::draw()
|
|||
|
||||
if (p->color->hasEffect() || p->tone->hasEffect() || p->opacity != 255)
|
||||
{
|
||||
PlaneShader &shader = gState->planeShader();
|
||||
PlaneShader &shader = shState->planeShader();
|
||||
|
||||
shader.bind();
|
||||
shader.applyViewportProj();
|
||||
|
@ -199,7 +199,7 @@ void Plane::draw()
|
|||
}
|
||||
else
|
||||
{
|
||||
SimpleShader &shader = gState->simpleShader();
|
||||
SimpleShader &shader = shState->simpleShader();
|
||||
|
||||
shader.bind();
|
||||
shader.applyViewportProj();
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#include "GL/glew.h"
|
||||
#include "etc-internal.h"
|
||||
#include "gl-util.h"
|
||||
#include "globalstate.h"
|
||||
#include "sharedstate.h"
|
||||
#include "global-ibo.h"
|
||||
#include "shader.h"
|
||||
|
||||
|
@ -110,7 +110,7 @@ struct Quad
|
|||
{
|
||||
VAO::bind(vao);
|
||||
VBO::bind(vbo);
|
||||
gState->bindQuadIBO();
|
||||
shState->bindQuadIBO();
|
||||
|
||||
glEnableVertexAttribArray(Shader::Color);
|
||||
glEnableVertexAttribArray(Shader::Position);
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
#include <QtGlobal>
|
||||
#include "gl-util.h"
|
||||
#include "globalstate.h"
|
||||
#include "sharedstate.h"
|
||||
#include "global-ibo.h"
|
||||
#include "shader.h"
|
||||
|
||||
|
@ -48,7 +48,7 @@ struct ColorQuadArray
|
|||
|
||||
VAO::bind(vao);
|
||||
VBO::bind(vbo);
|
||||
gState->bindQuadIBO();
|
||||
shState->bindQuadIBO();
|
||||
|
||||
glEnableVertexAttribArray(Shader::Color);
|
||||
glEnableVertexAttribArray(Shader::Position);
|
||||
|
@ -83,7 +83,7 @@ struct ColorQuadArray
|
|||
VBO::uploadData(vertices.size() * sizeof(Vertex), vertices.constData(), GL_DYNAMIC_DRAW);
|
||||
VBO::unbind();
|
||||
|
||||
gState->ensureQuadIBO(quadCount);
|
||||
shState->ensureQuadIBO(quadCount);
|
||||
}
|
||||
|
||||
void draw(uint offset, uint count)
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
*/
|
||||
|
||||
#include "scene.h"
|
||||
#include "globalstate.h"
|
||||
#include "sharedstate.h"
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
|
@ -91,7 +91,7 @@ void Scene::composite()
|
|||
|
||||
SceneElement::SceneElement(Scene &scene, int z)
|
||||
: link(this),
|
||||
creationStamp(gState->genTimeStamp()),
|
||||
creationStamp(shState->genTimeStamp()),
|
||||
z(z),
|
||||
visible(true),
|
||||
scene(&scene)
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
*/
|
||||
|
||||
#include "shader.h"
|
||||
#include "globalstate.h"
|
||||
#include "sharedstate.h"
|
||||
#include "glstate.h"
|
||||
|
||||
#include "GL/glew.h"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
** globalstate.cpp
|
||||
** sharedstate.cpp
|
||||
**
|
||||
** This file is part of mkxp.
|
||||
**
|
||||
|
@ -19,7 +19,7 @@
|
|||
** along with mkxp. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "globalstate.h"
|
||||
#include "sharedstate.h"
|
||||
|
||||
#include "util.h"
|
||||
#include "filesystem.h"
|
||||
|
@ -42,12 +42,12 @@
|
|||
|
||||
#include <QDebug>
|
||||
|
||||
GlobalState *GlobalState::instance = 0;
|
||||
SharedState *SharedState::instance = 0;
|
||||
static GlobalIBO *globalIBO = 0;
|
||||
|
||||
#define GAME_ARCHIVE "Game.rgssad"
|
||||
|
||||
struct GlobalStatePrivate
|
||||
struct SharedStatePrivate
|
||||
{
|
||||
void *bindingData;
|
||||
SDL_Window *sdlWindow;
|
||||
|
@ -96,7 +96,7 @@ struct GlobalStatePrivate
|
|||
|
||||
unsigned int stampCounter;
|
||||
|
||||
GlobalStatePrivate(RGSSThreadData *threadData)
|
||||
SharedStatePrivate(RGSSThreadData *threadData)
|
||||
: bindingData(0),
|
||||
sdlWindow(threadData->window),
|
||||
fileSystem(threadData->argv0),
|
||||
|
@ -139,41 +139,41 @@ struct GlobalStatePrivate
|
|||
TEXFBO::linkFBO(gpTexFBO);
|
||||
}
|
||||
|
||||
~GlobalStatePrivate()
|
||||
~SharedStatePrivate()
|
||||
{
|
||||
TEX::del(globalTex);
|
||||
TEXFBO::fini(gpTexFBO);
|
||||
}
|
||||
};
|
||||
|
||||
void GlobalState::initInstance(RGSSThreadData *threadData)
|
||||
void SharedState::initInstance(RGSSThreadData *threadData)
|
||||
{
|
||||
globalIBO = new GlobalIBO();
|
||||
globalIBO->ensureSize(1);
|
||||
|
||||
GlobalState *state = new GlobalState(threadData);
|
||||
SharedState *state = new SharedState(threadData);
|
||||
|
||||
GlobalState::instance = state;
|
||||
SharedState::instance = state;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
void GlobalState::setScreen(Scene &screen)
|
||||
void SharedState::setScreen(Scene &screen)
|
||||
{
|
||||
p->screen = &screen;
|
||||
}
|
||||
|
||||
#define GSATT(type, lower) \
|
||||
type GlobalState :: lower() \
|
||||
type SharedState :: lower() \
|
||||
{ \
|
||||
return p->lower; \
|
||||
}
|
||||
|
@ -209,28 +209,28 @@ GSATT(SimpleMatrixShader&, simpleMatrixShader)
|
|||
GSATT(BlurShader&, blurShader)
|
||||
#endif
|
||||
|
||||
void GlobalState::setBindingData(void *data)
|
||||
void SharedState::setBindingData(void *data)
|
||||
{
|
||||
p->bindingData = data;
|
||||
}
|
||||
|
||||
void GlobalState::ensureQuadIBO(int minSize)
|
||||
void SharedState::ensureQuadIBO(int minSize)
|
||||
{
|
||||
globalIBO->ensureSize(minSize);
|
||||
}
|
||||
|
||||
void GlobalState::bindQuadIBO()
|
||||
void SharedState::bindQuadIBO()
|
||||
{
|
||||
IBO::bind(globalIBO->ibo);
|
||||
}
|
||||
|
||||
void GlobalState::bindTex()
|
||||
void SharedState::bindTex()
|
||||
{
|
||||
TEX::bind(p->globalTex);
|
||||
TEX::allocEmpty(p->globalTexW, p->globalTexH);
|
||||
}
|
||||
|
||||
void GlobalState::ensureTexSize(int minW, int minH, Vec2i ¤tSizeOut)
|
||||
void SharedState::ensureTexSize(int minW, int minH, Vec2i ¤tSizeOut)
|
||||
{
|
||||
if (minW > p->globalTexW)
|
||||
p->globalTexW = findNextPow2(minW);
|
||||
|
@ -241,7 +241,7 @@ void GlobalState::ensureTexSize(int minW, int minH, Vec2i ¤tSizeOut)
|
|||
currentSizeOut = Vec2i(p->globalTexW, p->globalTexH);
|
||||
}
|
||||
|
||||
TEXFBO &GlobalState::gpTexFBO(int minW, int minH)
|
||||
TEXFBO &SharedState::gpTexFBO(int minW, int minH)
|
||||
{
|
||||
bool needResize = false;
|
||||
|
||||
|
@ -266,7 +266,7 @@ TEXFBO &GlobalState::gpTexFBO(int minW, int minH)
|
|||
return p->gpTexFBO;
|
||||
}
|
||||
|
||||
void GlobalState::checkShutdown()
|
||||
void SharedState::checkShutdown()
|
||||
{
|
||||
if (!p->rtData.rqTerm)
|
||||
return;
|
||||
|
@ -276,23 +276,23 @@ void GlobalState::checkShutdown()
|
|||
scriptBinding->terminate();
|
||||
}
|
||||
|
||||
Font &GlobalState::defaultFont()
|
||||
Font &SharedState::defaultFont()
|
||||
{
|
||||
return *p->defaultFont;
|
||||
}
|
||||
|
||||
unsigned int GlobalState::genTimeStamp()
|
||||
unsigned int SharedState::genTimeStamp()
|
||||
{
|
||||
return p->stampCounter++;
|
||||
}
|
||||
|
||||
GlobalState::GlobalState(RGSSThreadData *threadData)
|
||||
SharedState::SharedState(RGSSThreadData *threadData)
|
||||
{
|
||||
p = new GlobalStatePrivate(threadData);
|
||||
p = new SharedStatePrivate(threadData);
|
||||
p->screen = p->graphics.getScreen();
|
||||
}
|
||||
|
||||
GlobalState::~GlobalState()
|
||||
SharedState::~SharedState()
|
||||
{
|
||||
delete p;
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
** globalstate.h
|
||||
** sharedstate.h
|
||||
**
|
||||
** This file is part of mkxp.
|
||||
**
|
||||
|
@ -19,15 +19,15 @@
|
|||
** along with mkxp. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef GLOBALSTATE_H
|
||||
#define GLOBALSTATE_H
|
||||
#ifndef SHAREDSTATE_H
|
||||
#define SHAREDSTATE_H
|
||||
|
||||
#include "sigc++/signal.h"
|
||||
|
||||
#define gState GlobalState::instance
|
||||
#define glState gState->_glState()
|
||||
#define shState SharedState::instance
|
||||
#define glState shState->_glState()
|
||||
|
||||
struct GlobalStatePrivate;
|
||||
struct SharedStatePrivate;
|
||||
struct RGSSThreadData;
|
||||
struct GlobalIBO;
|
||||
struct mrb_state;
|
||||
|
@ -62,7 +62,7 @@ struct GlobalIBO;
|
|||
struct Config;
|
||||
struct Vec2i;
|
||||
|
||||
struct GlobalState
|
||||
struct SharedState
|
||||
{
|
||||
void *bindingData();
|
||||
void setBindingData(void *data);
|
||||
|
@ -128,15 +128,15 @@ struct GlobalState
|
|||
* function will most likely not return */
|
||||
void checkShutdown();
|
||||
|
||||
static GlobalState *instance;
|
||||
static SharedState *instance;
|
||||
static void initInstance(RGSSThreadData *threadData);
|
||||
static void finiInstance();
|
||||
|
||||
private:
|
||||
GlobalState(RGSSThreadData *threadData);
|
||||
~GlobalState();
|
||||
SharedState(RGSSThreadData *threadData);
|
||||
~SharedState();
|
||||
|
||||
GlobalStatePrivate *p;
|
||||
SharedStatePrivate *p;
|
||||
};
|
||||
|
||||
#endif // GLOBALSTATE_H
|
||||
#endif // SHAREDSTATE_H
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
#include "sprite.h"
|
||||
|
||||
#include "globalstate.h"
|
||||
#include "sharedstate.h"
|
||||
#include "bitmap.h"
|
||||
#include "etc.h"
|
||||
#include "etc-internal.h"
|
||||
|
@ -325,7 +325,7 @@ void Sprite::draw()
|
|||
|
||||
if (renderEffect)
|
||||
{
|
||||
SpriteShader &shader = gState->spriteShader();
|
||||
SpriteShader &shader = shState->spriteShader();
|
||||
|
||||
shader.bind();
|
||||
shader.applyViewportProj();
|
||||
|
@ -347,7 +347,7 @@ void Sprite::draw()
|
|||
}
|
||||
else
|
||||
{
|
||||
SimpleSpriteShader &shader = gState->simpleSpriteShader();
|
||||
SimpleSpriteShader &shader = shState->simpleSpriteShader();
|
||||
shader.bind();
|
||||
|
||||
shader.setSpriteMat(p->trans.getMatrix());
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
#include "texpool.h"
|
||||
#include "exception.h"
|
||||
#include "globalstate.h"
|
||||
#include "sharedstate.h"
|
||||
#include "glstate.h"
|
||||
|
||||
#include <QHash>
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#include "bitmap.h"
|
||||
#include "table.h"
|
||||
|
||||
#include "globalstate.h"
|
||||
#include "sharedstate.h"
|
||||
#include "glstate.h"
|
||||
#include "gl-util.h"
|
||||
#include "etc-internal.h"
|
||||
|
@ -389,7 +389,7 @@ struct TilemapPrivate
|
|||
glEnableVertexAttribArray(Shader::TexCoord);
|
||||
|
||||
VBO::bind(tiles.vbo);
|
||||
gState->bindQuadIBO();
|
||||
shState->bindQuadIBO();
|
||||
|
||||
glVertexAttribPointer(Shader::Position, 2, GL_FLOAT, GL_FALSE, sizeof(SVertex), SVertex::posOffset());
|
||||
glVertexAttribPointer(Shader::TexCoord, 2, GL_FLOAT, GL_FALSE, sizeof(SVertex), SVertex::texPosOffset());
|
||||
|
@ -410,7 +410,7 @@ struct TilemapPrivate
|
|||
glEnableVertexAttribArray(Shader::Position);
|
||||
|
||||
VBO::bind(flash.vbo);
|
||||
gState->bindQuadIBO();
|
||||
shState->bindQuadIBO();
|
||||
|
||||
glVertexAttribPointer(Shader::Color, 4, GL_FLOAT, GL_FALSE, sizeof(CVertex), CVertex::colorOffset());
|
||||
glVertexAttribPointer(Shader::Position, 2, GL_FLOAT, GL_FALSE, sizeof(CVertex), CVertex::posOffset());
|
||||
|
@ -421,10 +421,10 @@ struct TilemapPrivate
|
|||
|
||||
elem.ground = 0;
|
||||
|
||||
elem.groundStamp = gState->genTimeStamp();
|
||||
elem.scanrowStamp = gState->genTimeStamp();
|
||||
elem.groundStamp = shState->genTimeStamp();
|
||||
elem.scanrowStamp = shState->genTimeStamp();
|
||||
|
||||
prepareCon = gState->prepareDraw.connect
|
||||
prepareCon = shState->prepareDraw.connect
|
||||
(sigc::mem_fun(this, &TilemapPrivate::prepare));
|
||||
}
|
||||
|
||||
|
@ -432,7 +432,7 @@ struct TilemapPrivate
|
|||
{
|
||||
destroyElements();
|
||||
|
||||
gState->texPool().release(atlas.gl);
|
||||
shState->texPool().release(atlas.gl);
|
||||
VAO::del(tiles.vao);
|
||||
VBO::del(tiles.vbo);
|
||||
|
||||
|
@ -596,8 +596,8 @@ struct TilemapPrivate
|
|||
updateAtlasInfo();
|
||||
|
||||
/* Aquire atlas tex */
|
||||
gState->texPool().release(atlas.gl);
|
||||
atlas.gl = gState->texPool().request(atlas.size.x, atlas.size.y);
|
||||
shState->texPool().release(atlas.gl);
|
||||
atlas.gl = shState->texPool().request(atlas.size.x, atlas.size.y);
|
||||
|
||||
atlasDirty = true;
|
||||
}
|
||||
|
@ -877,7 +877,7 @@ struct TilemapPrivate
|
|||
VBO::unbind();
|
||||
|
||||
/* Ensure global IBO size */
|
||||
gState->ensureQuadIBO(quadCount*bufferCount());
|
||||
shState->ensureQuadIBO(quadCount*bufferCount());
|
||||
}
|
||||
|
||||
void bindAtlas(SimpleShader &shader)
|
||||
|
@ -962,7 +962,7 @@ struct TilemapPrivate
|
|||
VBO::unbind();
|
||||
|
||||
/* Ensure global IBO size */
|
||||
gState->ensureQuadIBO(flash.quadCount);
|
||||
shState->ensureQuadIBO(flash.quadCount);
|
||||
}
|
||||
|
||||
void destroyElements()
|
||||
|
@ -1066,7 +1066,7 @@ GroundLayer::GroundLayer(TilemapPrivate *p, Viewport *viewport)
|
|||
|
||||
void GroundLayer::draw()
|
||||
{
|
||||
SimpleShader &shader = gState->simpleShader();
|
||||
SimpleShader &shader = shState->simpleShader();
|
||||
shader.bind();
|
||||
shader.applyViewportProj();
|
||||
|
||||
|
@ -1094,7 +1094,7 @@ void GroundLayer::draw()
|
|||
glState.blendMode.pushSet(BlendAddition);
|
||||
glState.texture2D.pushSet(false);
|
||||
|
||||
FlashMapShader &shader = gState->flashMapShader();
|
||||
FlashMapShader &shader = shState->flashMapShader();
|
||||
shader.bind();
|
||||
shader.applyViewportProj();
|
||||
shader.setAlpha(flashAlpha[p->flash.alphaIdx] / 255.f);
|
||||
|
@ -1147,7 +1147,7 @@ ScanRow::ScanRow(TilemapPrivate *p, Viewport *viewport, int index)
|
|||
|
||||
void ScanRow::draw()
|
||||
{
|
||||
SimpleShader &shader = gState->simpleShader();
|
||||
SimpleShader &shader = shState->simpleShader();
|
||||
shader.bind();
|
||||
shader.applyViewportProj();
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
#include "viewport.h"
|
||||
|
||||
#include "globalstate.h"
|
||||
#include "sharedstate.h"
|
||||
#include "etc.h"
|
||||
#include "util.h"
|
||||
#include "quad.h"
|
||||
|
@ -101,14 +101,14 @@ struct ViewportPrivate
|
|||
};
|
||||
|
||||
Viewport::Viewport(int x, int y, int width, int height)
|
||||
: SceneElement(*gState->screen()),
|
||||
: SceneElement(*shState->screen()),
|
||||
sceneLink(this)
|
||||
{
|
||||
initViewport(x, y, width, height);
|
||||
}
|
||||
|
||||
Viewport::Viewport(Rect *rect)
|
||||
: SceneElement(*gState->screen()),
|
||||
: SceneElement(*shState->screen()),
|
||||
sceneLink(this)
|
||||
{
|
||||
initViewport(rect->x, rect->y, rect->width, rect->height);
|
||||
|
@ -227,12 +227,12 @@ void Viewport::releaseResources()
|
|||
|
||||
|
||||
ViewportElement::ViewportElement(Viewport *viewport, int z)
|
||||
: SceneElement(viewport ? *viewport : *gState->screen(), z),
|
||||
: SceneElement(viewport ? *viewport : *shState->screen(), z),
|
||||
m_viewport(viewport)
|
||||
{}
|
||||
|
||||
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
|
||||
|
@ -245,7 +245,7 @@ Viewport *ViewportElement::getViewport() const
|
|||
void ViewportElement::setViewport(Viewport *viewport)
|
||||
{
|
||||
m_viewport = viewport;
|
||||
setScene(viewport ? *viewport : *gState->screen());
|
||||
setScene(viewport ? *viewport : *shState->screen());
|
||||
onViewportChange();
|
||||
onGeometryChange(scene->getGeometry());
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#include "window.h"
|
||||
|
||||
#include "viewport.h"
|
||||
#include "globalstate.h"
|
||||
#include "sharedstate.h"
|
||||
#include "bitmap.h"
|
||||
#include "etc.h"
|
||||
#include "etc-internal.h"
|
||||
|
@ -271,13 +271,13 @@ struct WindowPrivate
|
|||
cursorVert.count = 9;
|
||||
pauseAniVert.count = 1;
|
||||
|
||||
prepareCon = gState->prepareDraw.connect
|
||||
prepareCon = shState->prepareDraw.connect
|
||||
(sigc::mem_fun(this, &WindowPrivate::prepare));
|
||||
}
|
||||
|
||||
~WindowPrivate()
|
||||
{
|
||||
gState->texPool().release(baseTex);
|
||||
shState->texPool().release(baseTex);
|
||||
cursorRectCon.disconnect();
|
||||
prepareCon.disconnect();
|
||||
}
|
||||
|
@ -405,8 +405,8 @@ struct WindowPrivate
|
|||
if (!resizeNeeded)
|
||||
return;
|
||||
|
||||
gState->texPool().release(baseTex);
|
||||
baseTex = gState->texPool().request(newW, newH);
|
||||
shState->texPool().release(baseTex);
|
||||
baseTex = shState->texPool().request(newW, newH);
|
||||
|
||||
baseTexDirty = true;
|
||||
}
|
||||
|
@ -422,7 +422,7 @@ struct WindowPrivate
|
|||
glState.viewport.pushSet(IntRect(0, 0, baseTex.width, baseTex.height));
|
||||
glState.clearColor.pushSet(Vec4());
|
||||
|
||||
SimpleAlphaShader &shader = gState->simpleAlphaShader();
|
||||
SimpleAlphaShader &shader = shState->simpleAlphaShader();
|
||||
shader.bind();
|
||||
shader.applyViewportProj();
|
||||
shader.setTranslation(Vec2i());
|
||||
|
@ -560,7 +560,7 @@ struct WindowPrivate
|
|||
Vec2i trans(position.x + sceneOffset.x,
|
||||
position.y + sceneOffset.y);
|
||||
|
||||
SimpleAlphaShader &shader = gState->simpleAlphaShader();
|
||||
SimpleAlphaShader &shader = shState->simpleAlphaShader();
|
||||
shader.bind();
|
||||
shader.applyViewportProj();
|
||||
shader.setTranslation(trans);
|
||||
|
@ -609,7 +609,7 @@ struct WindowPrivate
|
|||
glState.scissorBox.push();
|
||||
glState.scissorBox.setIntersect(windowRect);
|
||||
|
||||
SimpleAlphaShader &shader = gState->simpleAlphaShader();
|
||||
SimpleAlphaShader &shader = shState->simpleAlphaShader();
|
||||
shader.bind();
|
||||
shader.applyViewportProj();
|
||||
shader.setTranslation(Vec2i(effectX, effectY));
|
||||
|
|
Loading…
Reference in New Issue