improve after windows build

This commit is contained in:
Ondřej Novák 2025-02-08 15:44:47 +01:00
parent ba1b2b3907
commit 529b3e8bf8
7 changed files with 24 additions and 13 deletions

View file

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.24)
cmake_minimum_required(VERSION 3.16)
project(skeldal)
# Najít SDL2 knihovnu

View file

@ -2,7 +2,7 @@
#include "advconfig.h"
#include <malloc.h>
#include <stdlib.h>
#include <string.h>

View file

@ -237,7 +237,7 @@ void chveni(int i)
pos=!pos;
}
void objekty_mimo()
void objekty_mimo(THE_TIMER *t)
{
schovej_mysku();
ukaz_kompas(1);

View file

@ -671,7 +671,7 @@ typedef void (*TIMER_PROC)(THE_TIMER *t);
THE_TIMER *add_to_timer(int id,int delay,int maxcall,TIMER_PROC proc);
void delete_from_timer(int id);
THE_TIMER *find_timer(int id);
void objekty_mimo(void);
void objekty_mimo(THE_TIMER *t);
void mouse_set_cursor(int cursor);
#define FONT_TSHADOW 0x10000
#define FONT_TSHADOW_GRAY 0x30000
@ -1006,7 +1006,7 @@ void zmen_skupinu(THUMAN *p);
void add_to_group(int num);
void group_all(void);
const void *build_items_called(const void *p, int32_t *s);
void real_regeneration(void); //regenerace postav behem hry v realu (pouze kondice a mana)
void real_regeneration(THE_TIMER *t); //regenerace postav behem hry v realu (pouze kondice a mana)
char sleep_regenerace(THUMAN *p); //regenerace postav behem spani
char check_jidlo_voda(THUMAN *p);
void prepocitat_postavu(THUMAN *human_selected);

View file

@ -1117,7 +1117,7 @@ char sleep_regenerace(THUMAN *p)
}
void real_regeneration()
void real_regeneration(THE_TIMER *t)
{
int i;
THUMAN *p;

View file

@ -507,7 +507,7 @@ void clrscr(void)
void back_music(void)
void back_music(THE_TIMER *t)
{
mix_back_sound(0);
}
@ -577,7 +577,7 @@ void timming(EVENT_MSG *msg,void **data)
THE_TIMER *z;
z=&timer_tree;while(z->next!=p && z->next!=NULL) z=z->next;
if (z->next==NULL) return NULL;
if (z->next==NULL) return;
}
q=p;
}
@ -639,7 +639,7 @@ void hold_timer(int id,char hld)
SEND_LOG("(TIMER) Timer hold id: %d status: %s",id,hld?"Hold":"Unhold");
}
THE_TIMER *add_to_timer(int id,int delay,int maxcall,void *proc)
THE_TIMER *add_to_timer(int id,int delay,int maxcall,TIMER_PROC proc)
{
THE_TIMER *q;

View file

@ -8,6 +8,7 @@
#include <cmath>
#include <iostream>
#include <stdexcept>
#include <sstream>
void SDLContext::SDL_Deleter::operator ()(SDL_Window* window) {
SDL_DestroyWindow(window);
}
@ -508,7 +509,7 @@ SDL_Rect SDLContext::get_window_aspect_rect() const {
SDL_Rect w;
int ww;
int wh;
SDL_GetWindowSizeInPixels(_window.get(), &ww, &wh);
SDL_GetWindowSize(_window.get(), &ww, &wh);
if (aspect_x && aspect_y) {
int apw = wh * aspect_x / aspect_y;
int aph = ww * aspect_y / aspect_x;
@ -575,7 +576,6 @@ void SDLContext::set_quit_callback(std::function<void()> fn) {
}
SDLContext::AudioInfo SDLContext::init_audio(const AudioConfig &config, SDL_AudioCallback cb, void *cb_ctx) {
char buff[256];
_audio.reset();
SDL_AudioSpec aspec = {};
aspec.callback = cb;
@ -587,8 +587,19 @@ SDLContext::AudioInfo SDLContext::init_audio(const AudioConfig &config, SDL_Audi
SDL_AudioSpec obtaied = {};
auto id = SDL_OpenAudioDevice(config.audioDevice, 0, &aspec, &obtaied, SDL_AUDIO_ALLOW_FREQUENCY_CHANGE|SDL_AUDIO_ALLOW_SAMPLES_CHANGE);
if (id < 1) {
snprintf(buff, sizeof(buff), "SDL Error create audio: %s\n", SDL_GetError());
throw std::runtime_error(buff);
std::ostringstream err;
err << "SDL Error create audio:" << SDL_GetError() << "\n";
int n = SDL_GetNumAudioDevices(0);
if (n == 0) err << "No audio devices are available" << "\n";
else {
err << "Available audio devices:";
char sep = ' ';
for (int i = 0; i < n; ++i) {
err << sep << SDL_GetAudioDeviceName(i, 0);
sep = ',';
}
}
throw std::runtime_error(err.str());
}
_audio.reset(reinterpret_cast<void *>(id));