1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2025-01-24 17:26:41 +00:00

remove self-refs (core->...) in Core

This commit is contained in:
fgenesis 2023-05-31 17:40:41 +02:00
parent fd1ac85af3
commit dc5d385864
2 changed files with 14 additions and 21 deletions

View file

@ -69,8 +69,8 @@ void CoreWindow::onResize(unsigned w, unsigned h)
void CoreWindow::onQuit() void CoreWindow::onQuit()
{ {
// smooth // smooth
//core->quitNestedMain(); //quitNestedMain();
//core->quit(); //quit();
// instant // instant
SDL_Quit(); SDL_Quit();
@ -95,7 +95,7 @@ ParticleEffect* Core::createParticleEffect(const std::string &name, const Vector
e->start(); e->start();
e->setDie(true); e->setDie(true);
e->rotation.z = rotz; e->rotation.z = rotz;
core->getTopStateData()->addRenderObject(e, layer); getTopStateData()->addRenderObject(e, layer);
return e; return e;
} }
@ -662,7 +662,7 @@ void Core::detectJoysticks()
bool Core::initInputLibrary() bool Core::initInputLibrary()
{ {
core->mouse.position = Vector(getWindowWidth()/2, getWindowHeight()/2); mouse.position = Vector(getWindowWidth()/2, getWindowHeight()/2);
for (int i = 0; i < KEY_MAXARRAY; i++) for (int i = 0; i < KEY_MAXARRAY; i++)
{ {
@ -686,7 +686,7 @@ void Core::onUpdate(float dt)
onMouseInput(); onMouseInput();
globalScale.update(dt); globalScale.update(dt);
core->globalScaleChanged(); globalScaleChanged();
if (afterEffectManager) if (afterEffectManager)
{ {
@ -935,9 +935,9 @@ void Core::enable2D(int pixelScaleX, int pixelScaleY)
glLoadIdentity(); glLoadIdentity();
setupRenderPositionAndScale(); setupRenderPositionAndScale();
float widthFactor = core->width/float(pixelScaleX); float widthFactor = width/float(pixelScaleX);
float heightFactor = core->height/float(pixelScaleY); float heightFactor = height/float(pixelScaleY);
core->globalResolutionScale = Vector(widthFactor,heightFactor,1.0f); globalResolutionScale = Vector(widthFactor,heightFactor,1.0f);
setPixelScale(pixelScaleX, pixelScaleY); setPixelScale(pixelScaleX, pixelScaleY);
} }
@ -1003,8 +1003,8 @@ std::string Core::getEnqueuedJumpState()
return this->enqueuedJumpState; return this->enqueuedJumpState;
} }
int screenshotNum = 0; static int screenshotNum = 0;
std::string getScreenshotFilename(bool png) static std::string getScreenshotFilename(bool png)
{ {
std::string prefix = core->getUserDataFolder() + "/screenshots/screen"; std::string prefix = core->getUserDataFolder() + "/screenshots/screen";
std::string ext = png ? ".png" : ".tga"; std::string ext = png ? ".png" : ".tga";
@ -1014,7 +1014,7 @@ std::string getScreenshotFilename(bool png)
os << prefix << screenshotNum << ext; os << prefix << screenshotNum << ext;
screenshotNum ++; screenshotNum ++;
std::string str(os.str()); std::string str(os.str());
if (!core->exists(str)) // keep going until we hit an unused filename. if (!exists(str)) // keep going until we hit an unused filename.
return str; return str;
} }
} }
@ -1255,7 +1255,7 @@ int Core::getVirtualOffY()
void Core::centerMouse() void Core::centerMouse()
{ {
setMousePosition(Vector((virtualWidth/2) - core->getVirtualOffX(), virtualHeight/2)); setMousePosition(Vector((virtualWidth/2) - getVirtualOffX(), virtualHeight/2));
} }
bool Core::doMouseConstraint() bool Core::doMouseConstraint()
@ -1760,7 +1760,7 @@ void Core::render(int startLayer, int endLayer, bool useFrameBufferIfAvail)
globalScaleChanged(); globalScaleChanged();
if (core->minimized) return; if (minimized) return;
onRender(); onRender();
RenderObject::lastTextureApplied = 0; RenderObject::lastTextureApplied = 0;
@ -1937,11 +1937,6 @@ void Core::shutdown()
//util funcs //util funcs
bool Core::exists(const std::string &filename)
{
return ::exists(filename, false); // defined in Base.cpp
}
CountedPtr<Texture> Core::getTexture(const std::string &name) CountedPtr<Texture> Core::getTexture(const std::string &name)
{ {
return texmgr.getOrLoad(name); return texmgr.getOrLoad(name);
@ -2104,7 +2099,7 @@ unsigned char *Core::grabScreenshot(size_t x, size_t y, size_t w, size_t h)
// Like grabScreenshot(), but grab from the center of the screen. // Like grabScreenshot(), but grab from the center of the screen.
unsigned char *Core::grabCenteredScreenshot(size_t w, size_t h) unsigned char *Core::grabCenteredScreenshot(size_t w, size_t h)
{ {
return grabScreenshot(core->width/2 - w/2, core->height/2 - h/2, w, h); return grabScreenshot(width/2 - w/2, height/2 - h/2, w, h);
} }
// takes a screen shot and saves it to a TGA or PNG image // takes a screen shot and saves it to a TGA or PNG image

View file

@ -249,8 +249,6 @@ public:
virtual void action(int id, int state, int source, InputDevice device){} virtual void action(int id, int state, int source, InputDevice device){}
bool exists(const std::string &file);
void enqueueRenderObjectDeletion(RenderObject *object); void enqueueRenderObjectDeletion(RenderObject *object);
void clearGarbage(); void clearGarbage();