mouse support, solved some funcs clash on linux, started sprite editor
This commit is contained in:
31
mini.cpp
31
mini.cpp
@@ -58,6 +58,9 @@ int debug_cursor = 0;
|
||||
const Uint8 *keys;
|
||||
Uint8 key_just_pressed = 0;
|
||||
|
||||
int mouse_x, mouse_y;
|
||||
Uint32 mouse_buttons;
|
||||
|
||||
void reinit() {
|
||||
ds::pen_color = 6;
|
||||
ds::cam[0] = ds::cam[1] = 0;
|
||||
@@ -130,7 +133,9 @@ int main(int argc,char*argv[]){
|
||||
}
|
||||
}
|
||||
keys = SDL_GetKeyboardState(NULL);
|
||||
|
||||
mouse_buttons = SDL_GetMouseState(&mouse_x, &mouse_y);
|
||||
mouse_x /= 4; mouse_y /= 4;
|
||||
|
||||
if (lua_is_playing()) {
|
||||
lua_call_update();
|
||||
} else {
|
||||
@@ -595,6 +600,18 @@ bool btnp(uint8_t i) {
|
||||
return key_just_pressed == i;
|
||||
}
|
||||
|
||||
int mouseX() {
|
||||
return mouse_x;
|
||||
}
|
||||
|
||||
int mouseY() {
|
||||
return mouse_y;
|
||||
}
|
||||
|
||||
bool mouseButton(uint8_t i) {
|
||||
return mouse_buttons & SDL_BUTTON(i);
|
||||
}
|
||||
|
||||
float time() {
|
||||
return float(SDL_GetTicks())/1000.0f;
|
||||
}
|
||||
@@ -603,10 +620,6 @@ float time() {
|
||||
return SDL_fabsf(x);
|
||||
}*/
|
||||
|
||||
float ceil(float x) {
|
||||
return SDL_ceilf(x);
|
||||
}
|
||||
|
||||
float flr(float x) {
|
||||
return SDL_floorf(x);
|
||||
}
|
||||
@@ -615,6 +628,12 @@ float sgn(float x) {
|
||||
return x >= 0 ? 1 : -1;
|
||||
}
|
||||
|
||||
#ifndef __LINUX__
|
||||
|
||||
float ceil(float x) {
|
||||
return SDL_ceilf(x);
|
||||
}
|
||||
|
||||
float sin(float x) {
|
||||
return SDL_sinf(x);
|
||||
}
|
||||
@@ -631,6 +650,8 @@ float sqrt(float x) {
|
||||
return SDL_sqrtf(x);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
float max(float x, float y) {
|
||||
return SDL_max(x, y);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user