This commit is contained in:
2025-02-18 14:00:42 +01:00
parent 99a29cf2e0
commit 6c9221cd20
5 changed files with 776 additions and 48 deletions

View File

@@ -68,7 +68,9 @@ namespace ds {
uint8_t draw_palette[256];
}
bool turbo_mode = true;
int update_mode = UPDATE_ALWAYS;
int timeout = 0;
bool should_exit = false;
bool should_quit = false;
SDL_Window *mini_win;
@@ -390,7 +392,8 @@ int main(int argc,char*argv[]){
mouse_just_pressed = 0;
while(!should_exit) {
mouse_wheel = 0;
if (!turbo_mode) SDL_WaitEvent(NULL);
if (update_mode==UPDATE_WAIT) SDL_WaitEvent(NULL);
else if (update_mode==UPDATE_TIMEOUT) SDL_WaitEventTimeout(NULL, timeout);
while(SDL_PollEvent(&mini_eve)) {
if (mini_eve.type == SDL_QUIT) { should_exit=true; should_quit=true; break; }
if (mini_eve.type == SDL_KEYDOWN) {
@@ -1028,10 +1031,14 @@ void mset(int celx, int cely, uint8_t snum) {
TILES(celx, cely) = snum;
}
void map(int celx, int cely, int sx, int sy, uint8_t celw, uint8_t celh, uint8_t layer) {
void map() { //int celx, int cely, int sx, int sy, uint8_t celw, uint8_t celh, uint8_t layer) {
if (map_surface==NULL) return;
uint8_t celw = map_surface->w >> 3;
uint8_t celh = map_surface->h >> 3;
int celx = 0;
int cely = 0;
//if (celw <= 0 || celh <= 0 || celw >= TILES_WIDTH || celh >= TILES_HEIGHT) return;
sx -= ds::origin[0]; sy -= ds::origin[1];
int sx = -ds::origin[0]; int sy = -ds::origin[1];
if (sx+celw*8 < ds::clip[0] || sx > ds::clip[2] || sy+celh*8 < ds::clip[1] || sy > ds::clip[3]) return;
if (sx<0) {
int diff = -sx/8;
@@ -1240,8 +1247,9 @@ const char *configfolder() {
return file_getconfigfolder();
}
void setturbo(const bool value) {
turbo_mode = value;
void setupdatemode(const int value, const int t) {
update_mode = value;
timeout = t;
}
void exit() {