Closed Scorpox59 closed 4 years ago
Hi, That's true, the sample doesn't take in account true window size, only the framebuffer size. Two functions exist: TLN_GetWindowWidth() and TLN_GetWindowHeight() that return window size after scaling, so you can properly use mouse input. http://www.tilengine.org/doc/group__windowing.html
I just tried Tilengine on OpenBSD. I got it to compile and run, but am having trouble with the mouse, as it thinks the window is 3 times wider and higher than it is.
So in the TestMouse.c static void sdl_callback(SDL_Event* evt) function, I have to do the following so a mouse click finds the entity. Is there a way to fix this?
int div_x = 3; int div_y = 3; /* search clicked entity */ for (c = 0; c < MAX_ENTITIES; c++) { Entity* entity = &entities[c]; if (entity->enabled && mouse->x/div_x >= entity->x && mouse->y/div_y >= entity->y && mouse->x/div_x < entity->x + entity->w && mouse->y/div_y < entity->y + entity->h) {