- [FIX] Non-turbo mode was buggy
This commit is contained in:
@@ -5,21 +5,13 @@ function _init()
|
|||||||
keyRight = tonumber(getconf("keyright")) or KEY_RIGHT
|
keyRight = tonumber(getconf("keyright")) or KEY_RIGHT
|
||||||
keyLeft = tonumber(getconf("keyleft")) or KEY_LEFT
|
keyLeft = tonumber(getconf("keyleft")) or KEY_LEFT
|
||||||
_update=normal_update
|
_update=normal_update
|
||||||
|
turbo(false)
|
||||||
end
|
end
|
||||||
|
|
||||||
function _update()
|
function _update()
|
||||||
end
|
end
|
||||||
|
|
||||||
function normal_update()
|
function normal_update()
|
||||||
view()
|
|
||||||
|
|
||||||
cls(20)
|
|
||||||
view(10,10,140,100)
|
|
||||||
cls(3)
|
|
||||||
prnt("HOLA",0,0)
|
|
||||||
origin(70,50)
|
|
||||||
prnt("ORIGIN",0,0)
|
|
||||||
prnt(text,x,10)
|
|
||||||
if btnp(keyRight) then x=x+1 end
|
if btnp(keyRight) then x=x+1 end
|
||||||
if btnp(keyLeft) then x=x-1 end
|
if btnp(keyLeft) then x=x-1 end
|
||||||
if btnp(KEY_SPACE) then
|
if btnp(KEY_SPACE) then
|
||||||
@@ -38,6 +30,15 @@ function normal_update()
|
|||||||
end
|
end
|
||||||
|
|
||||||
if x>160 then x=-strlen(text)*4 end
|
if x>160 then x=-strlen(text)*4 end
|
||||||
|
|
||||||
|
view()
|
||||||
|
cls(20)
|
||||||
|
view(10,10,140,100)
|
||||||
|
cls(3)
|
||||||
|
prnt("HOLA",0,0)
|
||||||
|
origin(70,50)
|
||||||
|
prnt("ORIGIN",0,0)
|
||||||
|
prnt(text,x,10)
|
||||||
end
|
end
|
||||||
|
|
||||||
redefinekeys = {
|
redefinekeys = {
|
||||||
|
|||||||
8
mini.cpp
8
mini.cpp
@@ -9,7 +9,7 @@
|
|||||||
#include <libgen.h>
|
#include <libgen.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
DECLSPEC int SDLCALL (*event_handler_ptr)(SDL_Event*) = &SDL_PollEvent;
|
//DECLSPEC int SDLCALL (*event_handler_ptr)(SDL_Event*) = &SDL_PollEvent;
|
||||||
|
|
||||||
#pragma pack(1)
|
#pragma pack(1)
|
||||||
|
|
||||||
@@ -58,6 +58,7 @@ namespace ds {
|
|||||||
bool fill_trans = false;
|
bool fill_trans = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool turbo_mode = true;
|
||||||
bool should_exit = false;
|
bool should_exit = false;
|
||||||
bool should_quit = false;
|
bool should_quit = false;
|
||||||
SDL_Window *mini_win;
|
SDL_Window *mini_win;
|
||||||
@@ -288,7 +289,8 @@ int main(int argc,char*argv[]){
|
|||||||
mouse_just_pressed = 0;
|
mouse_just_pressed = 0;
|
||||||
while(!should_exit) {
|
while(!should_exit) {
|
||||||
mouse_wheel = 0;
|
mouse_wheel = 0;
|
||||||
while(event_handler_ptr(&mini_eve)) {
|
if (!turbo_mode) SDL_WaitEvent(NULL);
|
||||||
|
while(SDL_PollEvent(&mini_eve)) {
|
||||||
if (mini_eve.type == SDL_QUIT) { should_exit=true; should_quit=true; break; }
|
if (mini_eve.type == SDL_QUIT) { should_exit=true; should_quit=true; break; }
|
||||||
if (mini_eve.type == SDL_KEYDOWN) {
|
if (mini_eve.type == SDL_KEYDOWN) {
|
||||||
/*
|
/*
|
||||||
@@ -1256,7 +1258,7 @@ const char *configfolder() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void setturbo(const bool value) {
|
void setturbo(const bool value) {
|
||||||
event_handler_ptr = value ? &SDL_PollEvent : &SDL_WaitEvent;
|
turbo_mode = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void exit() {
|
void exit() {
|
||||||
|
|||||||
Reference in New Issue
Block a user