Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 92b4e4472f | |||
| d362eef8bf | |||
| 57852bd3ae | |||
| 6fb31a3ae5 | |||
| 89496fb8fb |
2
Makefile
2
Makefile
@@ -3,7 +3,7 @@ source = *.cpp ./lua/*.c
|
||||
|
||||
windows:
|
||||
@echo off
|
||||
g++ $(source) icon.res -Wall -Os -ffunction-sections -fdata-sections -Wl,--gc-sections -lmingw32 -lSDL3 -lopengl32 -mwindows -o "$(executable).exe"
|
||||
g++ $(source) icon.res -Wall -Os -ffunction-sections -fdata-sections -Wl,--gc-sections -lmingw32 -lSDL3 -lopengl32 -static-libstdc++ -static-libgcc -lpthread -mwindows -o "$(executable).exe"
|
||||
strip -s -R .comment -R .gnu.version --strip-unneeded "$(executable).exe"
|
||||
|
||||
windows_debug:
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -16,12 +16,18 @@ make windows_debug || exit /b 1
|
||||
|
||||
echo Creando paquetes...
|
||||
|
||||
copy bin\SDL3.dll .
|
||||
copy bin\libwinpthread-1.dll .
|
||||
|
||||
REM Crear ZIP release con mini.exe + DLLs
|
||||
tar -a -c -f mini_%PARAM%_windows_release.zip mini.exe bin\*.dll || exit /b 1
|
||||
tar -a -c -f mini_%PARAM%_win32-x64_release.zip mini.exe *.dll || exit /b 1
|
||||
|
||||
REM Crear ZIP debug solo con mini_debug.exe
|
||||
tar -a -c -f mini_%PARAM%_windows_debug.zip mini_debug.exe bin\*.dll || exit /b 1
|
||||
tar -a -c -f mini_%PARAM%_win32-x64_debug.zip mini_debug.exe *.dll || exit /b 1
|
||||
|
||||
del SDL3.dll
|
||||
del libwinpthread-1.dll
|
||||
|
||||
echo Paquetes generados:
|
||||
echo mini_%PARAM%_windows_release.zip
|
||||
echo mini_%PARAM%_windows_debug.zip
|
||||
echo mini_%PARAM%_win32-x64_release.zip
|
||||
echo mini_%PARAM%_win32-x64_debug.zip
|
||||
|
||||
@@ -14,7 +14,7 @@ echo "Versión detectada: $VERSION"
|
||||
|
||||
# Datos Windows
|
||||
WIN_USER="raimon"
|
||||
WIN_HOST="192.168.1.51"
|
||||
WIN_HOST="tonlab19"
|
||||
WIN_PATH_SSH="C:\Users\raimon\dev\mini"
|
||||
WIN_PATH_SCP="C:/Users/Raimon/dev/mini"
|
||||
|
||||
|
||||
59
mini.cpp
59
mini.cpp
@@ -15,6 +15,10 @@
|
||||
#define MAX_SURFACES 100
|
||||
#define MAX_FONTS 5
|
||||
|
||||
#define SURF_NOTHING 0
|
||||
#define SURF_EXTERNAL 1
|
||||
#define SURF_GENERATED 2
|
||||
|
||||
#ifdef MACOS_BUNDLE
|
||||
#include <libgen.h>
|
||||
#endif
|
||||
@@ -28,6 +32,7 @@ struct surface_t {
|
||||
uint8_t *p {nullptr};
|
||||
uint16_t w, h;
|
||||
uint32_t size;
|
||||
uint8_t flags {SURF_NOTHING};
|
||||
};
|
||||
|
||||
struct char_t {
|
||||
@@ -282,6 +287,7 @@ uint8_t newsurf(int w, int h) {
|
||||
surfaces[i].h = h;
|
||||
surfaces[i].size = w*h;
|
||||
surfaces[i].p = (uint8_t*)calloc(surfaces[i].size,1);
|
||||
surfaces[i].flags = SURF_GENERATED;
|
||||
log_msg(LOG_INFO, "Surface %i creada.\n", i);
|
||||
return i;
|
||||
}
|
||||
@@ -315,11 +321,13 @@ uint8_t loadsurf(const char* filename, const bool external) {
|
||||
while (i<MAX_SURFACES && surfaces[i].p != NULL) ++i;
|
||||
if (i==MAX_SURFACES) return 255;
|
||||
|
||||
surfaces[i].flags = SURF_NOTHING;
|
||||
// Carregar l'arxiu de disc
|
||||
int size;
|
||||
uint8_t *buffer;
|
||||
if (external) {
|
||||
buffer = (uint8_t*)file_getfilebufferex(filename, size);
|
||||
surfaces[i].flags |= SURF_EXTERNAL;
|
||||
} else {
|
||||
buffer = (uint8_t*)file_getfilebuffer(filename, size);
|
||||
}
|
||||
@@ -341,6 +349,36 @@ uint8_t loadsurf(const char* filename, const bool external) {
|
||||
return i;
|
||||
}
|
||||
|
||||
void reloadsurfs() {
|
||||
for (unsigned int i=0; i<MAX_SURFACES; ++i)
|
||||
if (surfaces[i].name) {
|
||||
if (surfaces[i].flags & SURF_GENERATED) {
|
||||
log_msg(LOG_INFO, "Ignorant surface generada %i.\n", i);
|
||||
} else {
|
||||
log_msg(LOG_INFO, "Recarregant de disc surface %i:'%s'.\n", i, surfaces[i].name);
|
||||
|
||||
int size;
|
||||
uint8_t *buffer;
|
||||
if (surfaces[i].flags & SURF_EXTERNAL) {
|
||||
buffer = (uint8_t*)file_getfilebufferex(surfaces[i].name, size);
|
||||
} else {
|
||||
buffer = (uint8_t*)file_getfilebuffer(surfaces[i].name, size);
|
||||
}
|
||||
|
||||
// Si no s'ha pogut, petar
|
||||
if (!buffer) {
|
||||
log_msg(LOG_FAIL, "Error al intentar obrir l'arxiu '%s'\n", surfaces[i].name);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
surfaces[i].p = LoadGif(buffer, &surfaces[i].w, &surfaces[i].h);
|
||||
surfaces[i].size = surfaces[i].w*surfaces[i].h;
|
||||
free(buffer);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void savesurf(uint8_t surface, const char* filename, uint8_t *pal, uint8_t colors)
|
||||
{
|
||||
gif::write_gif(filename, surfaces[surface].p, surfaces[surface].w, surfaces[surface].h, pal, colors);
|
||||
@@ -354,6 +392,7 @@ void freesurf(uint8_t surface) {
|
||||
log_msg(LOG_INFO, "Surface %i alliberada.\n", surface);
|
||||
}
|
||||
surfaces[surface].p = NULL;
|
||||
surfaces[surface].flags = SURF_NOTHING;
|
||||
}
|
||||
|
||||
int surfw(uint8_t surface) {
|
||||
@@ -435,6 +474,7 @@ uint8_t loadfont_from_buffer(const char* buffer, uint8_t index, const char* name
|
||||
memcpy(line, ptr, len);
|
||||
line[len] = '\0';
|
||||
ptr += (ptr[len] == '\n') ? len + 1 : len; // Advance pointer
|
||||
if (len > 0 && line[len - 1] == '\r') line[len - 1] = '\0';
|
||||
|
||||
if (strncmp(line, "bitmap=", 7) != 0) return false; // Parse first line
|
||||
|
||||
@@ -453,6 +493,7 @@ uint8_t loadfont_from_buffer(const char* buffer, uint8_t index, const char* name
|
||||
memcpy(line, ptr, len);
|
||||
line[len] = '\0';
|
||||
ptr += (ptr[len] == '\n') ? len + 1 : len; // Advance pointer
|
||||
if (len > 0 && line[len - 1] == '\r') line[len - 1] = '\0';
|
||||
|
||||
// Remove comments
|
||||
char* hash = strchr(line, '#');
|
||||
@@ -664,7 +705,8 @@ int main(int argc,char*argv[]){
|
||||
reinit();
|
||||
initaudio();
|
||||
|
||||
loadsurf(default_font_gif, "default_font");
|
||||
uint8_t font_surf = loadsurf(default_font_gif, "default_font");
|
||||
surfaces[font_surf].flags |= SURF_GENERATED;
|
||||
loadfont_from_buffer((const char*)default_font_fnt, 0, "default_font");
|
||||
current_font = &fonts[0];
|
||||
|
||||
@@ -690,13 +732,14 @@ int main(int argc,char*argv[]){
|
||||
if (mini_eve.type == SDL_EVENT_KEY_DOWN) {
|
||||
#ifdef DEBUG
|
||||
if (mini_eve.key.scancode == SDL_SCANCODE_F12) {
|
||||
if (lua_is_playing()) {
|
||||
lua_quit();
|
||||
quitaudio();
|
||||
reinit();
|
||||
} else {
|
||||
should_exit=true;
|
||||
}
|
||||
reloadsurfs();
|
||||
//if (lua_is_playing()) {
|
||||
// lua_quit();
|
||||
// quitaudio();
|
||||
// reinit();
|
||||
//} else {
|
||||
// should_exit=true;
|
||||
//}
|
||||
} else if (mini_eve.key.scancode == SDL_SCANCODE_F5) {
|
||||
should_exit=true;
|
||||
} else {
|
||||
|
||||
@@ -42,10 +42,10 @@ echo "Release creado con ID: $RELEASE_ID"
|
||||
|
||||
echo "=== Subiendo artefactos ==="
|
||||
|
||||
for f in mini_${VERSION}_linux_release.tar.gz \
|
||||
mini_${VERSION}_linux_debug.tar.gz \
|
||||
mini_${VERSION}_windows_release.zip \
|
||||
mini_${VERSION}_windows_debug.zip
|
||||
for f in mini_v${VERSION}_linux_release.tar.gz \
|
||||
mini_v${VERSION}_linux_debug.tar.gz \
|
||||
mini_v${VERSION}_win32-x64_release.zip \
|
||||
mini_v${VERSION}_win32-x64_debug.zip
|
||||
do
|
||||
echo "Subiendo $f..."
|
||||
curl -s -X POST \
|
||||
|
||||
Reference in New Issue
Block a user