mirror of
https://github.com/ondra-novak/gates_of_skeldal.git
synced 2025-07-09 16:10:27 -04:00
improve after windows build
This commit is contained in:
parent
ba1b2b3907
commit
529b3e8bf8
7 changed files with 24 additions and 13 deletions
|
@ -1,4 +1,4 @@
|
||||||
cmake_minimum_required(VERSION 3.24)
|
cmake_minimum_required(VERSION 3.16)
|
||||||
project(skeldal)
|
project(skeldal)
|
||||||
|
|
||||||
# Najít SDL2 knihovnu
|
# Najít SDL2 knihovnu
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#include "advconfig.h"
|
#include "advconfig.h"
|
||||||
|
|
||||||
|
|
||||||
#include <malloc.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -237,7 +237,7 @@ void chveni(int i)
|
||||||
pos=!pos;
|
pos=!pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
void objekty_mimo()
|
void objekty_mimo(THE_TIMER *t)
|
||||||
{
|
{
|
||||||
schovej_mysku();
|
schovej_mysku();
|
||||||
ukaz_kompas(1);
|
ukaz_kompas(1);
|
||||||
|
|
|
@ -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);
|
THE_TIMER *add_to_timer(int id,int delay,int maxcall,TIMER_PROC proc);
|
||||||
void delete_from_timer(int id);
|
void delete_from_timer(int id);
|
||||||
THE_TIMER *find_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);
|
void mouse_set_cursor(int cursor);
|
||||||
#define FONT_TSHADOW 0x10000
|
#define FONT_TSHADOW 0x10000
|
||||||
#define FONT_TSHADOW_GRAY 0x30000
|
#define FONT_TSHADOW_GRAY 0x30000
|
||||||
|
@ -1006,7 +1006,7 @@ void zmen_skupinu(THUMAN *p);
|
||||||
void add_to_group(int num);
|
void add_to_group(int num);
|
||||||
void group_all(void);
|
void group_all(void);
|
||||||
const void *build_items_called(const void *p, int32_t *s);
|
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 sleep_regenerace(THUMAN *p); //regenerace postav behem spani
|
||||||
char check_jidlo_voda(THUMAN *p);
|
char check_jidlo_voda(THUMAN *p);
|
||||||
void prepocitat_postavu(THUMAN *human_selected);
|
void prepocitat_postavu(THUMAN *human_selected);
|
||||||
|
|
|
@ -1117,7 +1117,7 @@ char sleep_regenerace(THUMAN *p)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void real_regeneration()
|
void real_regeneration(THE_TIMER *t)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
THUMAN *p;
|
THUMAN *p;
|
||||||
|
|
|
@ -507,7 +507,7 @@ void clrscr(void)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void back_music(void)
|
void back_music(THE_TIMER *t)
|
||||||
{
|
{
|
||||||
mix_back_sound(0);
|
mix_back_sound(0);
|
||||||
}
|
}
|
||||||
|
@ -577,7 +577,7 @@ void timming(EVENT_MSG *msg,void **data)
|
||||||
THE_TIMER *z;
|
THE_TIMER *z;
|
||||||
|
|
||||||
z=&timer_tree;while(z->next!=p && z->next!=NULL) z=z->next;
|
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;
|
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");
|
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;
|
THE_TIMER *q;
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
#include <sstream>
|
||||||
void SDLContext::SDL_Deleter::operator ()(SDL_Window* window) {
|
void SDLContext::SDL_Deleter::operator ()(SDL_Window* window) {
|
||||||
SDL_DestroyWindow(window);
|
SDL_DestroyWindow(window);
|
||||||
}
|
}
|
||||||
|
@ -508,7 +509,7 @@ SDL_Rect SDLContext::get_window_aspect_rect() const {
|
||||||
SDL_Rect w;
|
SDL_Rect w;
|
||||||
int ww;
|
int ww;
|
||||||
int wh;
|
int wh;
|
||||||
SDL_GetWindowSizeInPixels(_window.get(), &ww, &wh);
|
SDL_GetWindowSize(_window.get(), &ww, &wh);
|
||||||
if (aspect_x && aspect_y) {
|
if (aspect_x && aspect_y) {
|
||||||
int apw = wh * aspect_x / aspect_y;
|
int apw = wh * aspect_x / aspect_y;
|
||||||
int aph = ww * aspect_y / aspect_x;
|
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) {
|
SDLContext::AudioInfo SDLContext::init_audio(const AudioConfig &config, SDL_AudioCallback cb, void *cb_ctx) {
|
||||||
char buff[256];
|
|
||||||
_audio.reset();
|
_audio.reset();
|
||||||
SDL_AudioSpec aspec = {};
|
SDL_AudioSpec aspec = {};
|
||||||
aspec.callback = cb;
|
aspec.callback = cb;
|
||||||
|
@ -587,8 +587,19 @@ SDLContext::AudioInfo SDLContext::init_audio(const AudioConfig &config, SDL_Audi
|
||||||
SDL_AudioSpec obtaied = {};
|
SDL_AudioSpec obtaied = {};
|
||||||
auto id = SDL_OpenAudioDevice(config.audioDevice, 0, &aspec, &obtaied, SDL_AUDIO_ALLOW_FREQUENCY_CHANGE|SDL_AUDIO_ALLOW_SAMPLES_CHANGE);
|
auto id = SDL_OpenAudioDevice(config.audioDevice, 0, &aspec, &obtaied, SDL_AUDIO_ALLOW_FREQUENCY_CHANGE|SDL_AUDIO_ALLOW_SAMPLES_CHANGE);
|
||||||
if (id < 1) {
|
if (id < 1) {
|
||||||
snprintf(buff, sizeof(buff), "SDL Error create audio: %s\n", SDL_GetError());
|
std::ostringstream err;
|
||||||
throw std::runtime_error(buff);
|
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));
|
_audio.reset(reinterpret_cast<void *>(id));
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue