[BUG]Mouse coordinates where incorrect
This commit is contained in:
@@ -165,7 +165,8 @@ int main(int argc,char*argv[]) {
|
||||
}
|
||||
keys = SDL_GetKeyboardState(NULL);
|
||||
mouse_buttons = SDL_GetMouseState(&mouse_x, &mouse_y);
|
||||
mouse_x /= 4; mouse_y /= 4;
|
||||
mouse_x = (mouse_x-40) / (640/screen_width);
|
||||
mouse_y = (mouse_y-40) / (480/screen_height);
|
||||
|
||||
if (lua_is_playing()) {
|
||||
lua_call_update();
|
||||
@@ -266,10 +267,14 @@ void print(const char *str, int x, int y) {
|
||||
if (y >= 0) cursor_y = min(y, screen_height-1);
|
||||
int len = SDL_strlen(str);
|
||||
if ((cursor_x+len) > screen_width) len -= ((cursor_x+len) - screen_width);
|
||||
//int offset = x+y*screen_width;
|
||||
for (int i=0; i < len; ++i) {
|
||||
CHRSCR(cursor_x+i, cursor_y) = str[i];
|
||||
if (current_mode != 0) COLSCR(cursor_x+i, cursor_y) = current_color;
|
||||
//char_screen[offset+i] = str[i];
|
||||
//if (current_mode != 0) color_screen[offset+i] = current_color;
|
||||
}
|
||||
cursor_x += len;
|
||||
}
|
||||
|
||||
bool btn(uint8_t i) {
|
||||
|
||||
1
lua.cpp
1
lua.cpp
@@ -279,6 +279,7 @@ void lua_init(const char* filename, const bool start_playing) {
|
||||
lua_pushcfunction(L,cpp_max); lua_setglobal(L, "max");
|
||||
lua_pushcfunction(L,cpp_mid); lua_setglobal(L, "mid");
|
||||
lua_pushcfunction(L,cpp_min); lua_setglobal(L, "min");
|
||||
|
||||
lua_pushcfunction(L,cpp_rnd); lua_setglobal(L, "rnd");
|
||||
lua_pushcfunction(L,cpp_srand); lua_setglobal(L, "srand");
|
||||
lua_pushcfunction(L,cpp_tostr); lua_setglobal(L, "tostr");
|
||||
|
||||
Reference in New Issue
Block a user