mirror of https://github.com/bjornbytes/lovr.git
Rename setWindow back to createWindow;
I'm not sure why this was changed. It doesn't make very much sense because setWindow can't be called multiple times, and it can't be called with nil/NULL.
This commit is contained in:
parent
8f9d24c51f
commit
5deae0a103
|
@ -283,12 +283,7 @@ static int l_lovrGraphicsPresent(lua_State* L) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int l_lovrGraphicsSetWindow(lua_State* L) {
|
||||
if (lua_isnoneornil(L, 1)) {
|
||||
lovrGraphicsSetWindow(NULL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int l_lovrGraphicsCreateWindow(lua_State* L) {
|
||||
WindowFlags flags = { 0 };
|
||||
luaL_checktype(L, 1, LUA_TTABLE);
|
||||
|
||||
|
@ -322,7 +317,7 @@ static int l_lovrGraphicsSetWindow(lua_State* L) {
|
|||
}
|
||||
lua_pop(L, 1);
|
||||
|
||||
lovrGraphicsSetWindow(&flags);
|
||||
lovrGraphicsCreateWindow(&flags);
|
||||
luax_atexit(L, lovrGraphicsDestroy); // The lua_State that creates the window shall be the one to destroy it
|
||||
lovrRelease(textureData);
|
||||
return 0;
|
||||
|
@ -1360,7 +1355,7 @@ static const luaL_Reg lovrGraphics[] = {
|
|||
|
||||
// Base
|
||||
{ "present", l_lovrGraphicsPresent },
|
||||
{ "setWindow", l_lovrGraphicsSetWindow },
|
||||
{ "createWindow", l_lovrGraphicsCreateWindow },
|
||||
{ "getWidth", l_lovrGraphicsGetWidth },
|
||||
{ "getHeight", l_lovrGraphicsGetHeight },
|
||||
{ "getDimensions", l_lovrGraphicsGetDimensions },
|
||||
|
@ -1469,7 +1464,7 @@ int luaopen_lovr_graphics(lua_State* L) {
|
|||
|
||||
lovrGraphicsInit(gammaCorrect);
|
||||
|
||||
lua_pushcfunction(L, l_lovrGraphicsSetWindow);
|
||||
lua_pushcfunction(L, l_lovrGraphicsCreateWindow);
|
||||
lua_getfield(L, -2, "window");
|
||||
lua_call(L, 1, 0);
|
||||
|
||||
|
|
|
@ -187,19 +187,15 @@ void lovrGraphicsPresent() {
|
|||
lovrGpuPresent();
|
||||
}
|
||||
|
||||
void lovrGraphicsSetWindow(WindowFlags* flags) {
|
||||
void lovrGraphicsCreateWindow(WindowFlags* flags) {
|
||||
lovrAssert(!state.initialized, "Window is already created");
|
||||
|
||||
if (flags) {
|
||||
flags->srgb = state.gammaCorrect;
|
||||
flags->srgb = state.gammaCorrect;
|
||||
#ifdef EMSCRIPTEN
|
||||
flags->vsync = 1;
|
||||
flags->vsync = 1;
|
||||
#else
|
||||
flags->vsync = 0;
|
||||
flags->vsync = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
lovrAssert(lovrPlatformSetWindow(flags), "Could not create window");
|
||||
lovrAssert(lovrPlatformCreateWindow(flags), "Could not create window");
|
||||
lovrPlatformOnWindowClose(onCloseWindow);
|
||||
lovrPlatformOnWindowResize(onResizeWindow);
|
||||
lovrPlatformGetFramebufferSize(&state.width, &state.height);
|
||||
|
|
|
@ -196,7 +196,7 @@ typedef struct {
|
|||
bool lovrGraphicsInit(bool gammaCorrect);
|
||||
void lovrGraphicsDestroy();
|
||||
void lovrGraphicsPresent();
|
||||
void lovrGraphicsSetWindow(WindowFlags* flags);
|
||||
void lovrGraphicsCreateWindow(WindowFlags* flags);
|
||||
int lovrGraphicsGetWidth();
|
||||
int lovrGraphicsGetHeight();
|
||||
void lovrGraphicsSetCamera(Camera* camera, bool clear);
|
||||
|
|
|
@ -74,7 +74,7 @@ void lovrPlatformDestroy();
|
|||
void lovrPlatformPollEvents();
|
||||
double lovrPlatformGetTime();
|
||||
void lovrPlatformSetTime(double t);
|
||||
bool lovrPlatformSetWindow(WindowFlags* flags);
|
||||
bool lovrPlatformCreateWindow(WindowFlags* flags);
|
||||
void lovrPlatformGetWindowSize(int* width, int* height);
|
||||
void lovrPlatformGetFramebufferSize(int* width, int* height);
|
||||
void lovrPlatformSwapBuffers();
|
||||
|
|
|
@ -24,7 +24,7 @@ void lovrPlatformSetTime(double t) {
|
|||
}
|
||||
*/
|
||||
|
||||
bool lovrPlatformSetWindow(WindowFlags* flags) {
|
||||
bool lovrPlatformCreateWindow(WindowFlags* flags) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -81,7 +81,7 @@ void lovrPlatformSetTime(double t) {
|
|||
glfwSetTime(t);
|
||||
}
|
||||
|
||||
bool lovrPlatformSetWindow(WindowFlags* flags) {
|
||||
bool lovrPlatformCreateWindow(WindowFlags* flags) {
|
||||
if (state.window) {
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue