linux release build, cleanup repository

This commit is contained in:
Ondřej Novák 2025-02-08 19:27:47 +01:00
parent 529b3e8bf8
commit 3d8ee275e4
441 changed files with 280 additions and 65861 deletions

View file

@ -29,7 +29,6 @@ if(WIN32)
target_compile_definitions(skeldal_platform PRIVATE PLATFORM_WINDOWS)
message(STATUS "Building for Windows")
elseif(UNIX AND NOT APPLE)
target_sources(skeldal_platform PRIVATE
linux/save_folder.cpp
@ -40,6 +39,11 @@ elseif(UNIX AND NOT APPLE)
linux/app_start.cpp
)
target_compile_definitions(skeldal_platform PRIVATE PLATFORM_LINUX)
add_custom_command(
TARGET skeldal POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_CURRENT_LIST_DIR}/linux/skeldal.sh
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/skeldal.sh)
message(STATUS "Building for Linux")
elseif(APPLE)

View file

@ -103,3 +103,13 @@ int imatch(const char *text, const char *hledany) {
return 1; // Všechny části byly nalezeny ve správném pořadí
}
const char *strcopy_n(char *target, const char *source, int target_size) {
const char *ret = target;
while (target_size>1 && *source) {
*target++ = *source++;
--target_size;
}
*target = 0;
return ret;
}

26
platform/linux/skeldal.sh Executable file
View file

@ -0,0 +1,26 @@
#!/bin/bash
temp_file=$(mktemp /tmp/skeldal.XXXXXX.log)
./skeldal > "$temp_file" 2>&1
exit_code=$?
if [ $exit_code -ne 0 ]; then
error_message=$(cat "$temp_file")
if command -v zenity > /dev/null; then
zenity --warning --title="Skeldal ERROR" --text="$error_message"
elif command -v kdialog > /dev/null; then
kdialog --title "Skeldal ERROR" --error "$error_message"
elif command -v xmessage > /dev/null; then
xmessage -center -file $temp_file
elif command -v xdg-open > /dev/null; then
xdg-open "$temp_file"
sleep 5;
else
cat "$temp_file"
fi
fi
#rm $temp_file
exit $exit_code

View file

@ -16,8 +16,8 @@
#pragma warning(disable: 4456)
#pragma warning(disable: 4457)
#pragma warning(disable: 4702)
#define CASE_FALLTHROUGH
#else
#define CASE_FALLTHROUGH
#else
#define CASE_FALLTHROUGH [[fallthrough]]
#endif
@ -88,6 +88,7 @@ const char *file_icase_find(const char *pathname);
int istrcmp(const char *a, const char *b);
int imatch(const char *haystack, const char *needle);
const char *strcopy_n(char *target, const char *source, int target_size);
#define MIN(a, b) ((a)<(b)?(a):(b))
#define MAX(a, b) ((a)>(b)?(a):(b))
void strupper(char *c);

View file

@ -225,3 +225,8 @@ char game_display_is_quit_requested() {
void game_display_cancel_quit_request() {
return get_sdl_global_context().cancel_quit_request();
}
void game_display_set_icon(const void *icon_data, size_t icon_size) {
auto &sdl = get_sdl_global_context();
sdl.set_window_icon(icon_data, icon_size);
}

View file

@ -1,6 +1,7 @@
#include <stdint.h>
#include "../config.h"
#include <stddef.h>
#ifndef __BGRAPH_DX_WRAPPER_
#define __BGRAPH_DX_WRAPPER_
@ -23,6 +24,7 @@ void game_display_close(void);
void game_display_update_rect(unsigned short x,unsigned short y,unsigned short xs,unsigned short ys);
char game_display_is_quit_requested();
void game_display_cancel_quit_request();
void game_display_set_icon(const void *icon_data, size_t icon_size);
void *DxPrepareWalk(int ypos);
void DxZoomWalk(void *handle, int ypos, int *points,float phase, void *lodka);

View file

@ -7,6 +7,7 @@
#include <cmath>
#include <iostream>
#include <fstream>
#include <stdexcept>
#include <sstream>
void SDLContext::SDL_Deleter::operator ()(SDL_Window* window) {
@ -613,3 +614,17 @@ void SDLContext::pause_audio(bool pause) {
void SDLContext::close_audio() {
_audio.reset();
}
void SDLContext::set_window_icon(const void *icon_data, size_t icon_size) {
SDL_Surface *surface = SDL_LoadBMP_RW(SDL_RWFromConstMem(icon_data, icon_size), 1);
if (surface == 0) {
char buff[256];
snprintf(buff,sizeof(buff),"Can't load icon: %s", SDL_GetError());
display_error(buff);
std::ofstream x("test.dat", std::ios::out|std::ios::binary|std::ios::trunc);
x.write(reinterpret_cast<const char *>(icon_data), icon_size);
} else {
SDL_SetWindowIcon(_window.get(), surface);
}
}

View file

@ -47,6 +47,8 @@ public:
void init_video(const VideoConfig &config, const char *title);
void set_window_icon(const void *icon_data, size_t icon_size);
void close_video();
AudioInfo init_audio(const AudioConfig &config, SDL_AudioCallback cb, void *cb_ctx);