mirror of https://github.com/bjornbytes/lovr.git
Refactor lovr.graphics.getDimensions and friends;
This commit is contained in:
parent
36bc1ad9a2
commit
21aba100a1
|
@ -318,8 +318,16 @@ void lovrGraphicsMatrixTransform(mat4 transform) {
|
|||
mat4_multiply(vec_last(&state.transforms), transform);
|
||||
}
|
||||
|
||||
void lovrGraphicsGetDimensions(int* width, int* height) {
|
||||
glfwGetFramebufferSize(window, width, height);
|
||||
int lovrGraphicsGetWidth() {
|
||||
int width;
|
||||
glfwGetFramebufferSize(window, &width, NULL);
|
||||
return width;
|
||||
}
|
||||
|
||||
int lovrGraphicsGetHeight() {
|
||||
int height;
|
||||
glfwGetFramebufferSize(window, NULL, &height);
|
||||
return height;
|
||||
}
|
||||
|
||||
void lovrGraphicsSetShapeData(float* data, int dataCount, unsigned int* indices, int indicesCount) {
|
||||
|
|
|
@ -92,7 +92,8 @@ void lovrGraphicsRotate(float w, float x, float y, float z);
|
|||
void lovrGraphicsScale(float x, float y, float z);
|
||||
void lovrGraphicsTransform(float tx, float ty, float tz, float sx, float sy, float sz, float angle, float ax, float ay, float az);
|
||||
void lovrGraphicsMatrixTransform(mat4 transform);
|
||||
void lovrGraphicsGetDimensions(int* width, int* height);
|
||||
int lovrGraphicsGetWidth();
|
||||
int lovrGraphicsGetHeight();
|
||||
void lovrGraphicsSetShapeData(float* data, int dataCount, unsigned int* indices, int indicesCount);
|
||||
void lovrGraphicsDrawLinedShape(GLenum mode);
|
||||
void lovrGraphicsDrawFilledShape();
|
||||
|
|
|
@ -421,24 +421,18 @@ int l_lovrGraphicsCube(lua_State* L) {
|
|||
}
|
||||
|
||||
int l_lovrGraphicsGetWidth(lua_State* L) {
|
||||
int width;
|
||||
lovrGraphicsGetDimensions(&width, NULL);
|
||||
lua_pushnumber(L, width);
|
||||
lua_pushnumber(L, lovrGraphicsGetWidth());
|
||||
return 1;
|
||||
}
|
||||
|
||||
int l_lovrGraphicsGetHeight(lua_State* L) {
|
||||
int height;
|
||||
lovrGraphicsGetDimensions(NULL, &height);
|
||||
lua_pushnumber(L, height);
|
||||
lua_pushnumber(L, lovrGraphicsGetHeight());
|
||||
return 1;
|
||||
}
|
||||
|
||||
int l_lovrGraphicsGetDimensions(lua_State* L) {
|
||||
int width, height;
|
||||
lovrGraphicsGetDimensions(&width, &height);
|
||||
lua_pushnumber(L, width);
|
||||
lua_pushnumber(L, height);
|
||||
lua_pushnumber(L, lovrGraphicsGetWidth());
|
||||
lua_pushnumber(L, lovrGraphicsGetHeight());
|
||||
return 2;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue