Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ jobs:
- uses: actions/checkout@v7
with:
submodules: 'recursive'
- name: Configure sac2c
run: cp -r /root/.sac2crc $HOME/.sac2crc
- name: Install SDL3
run: apt install -y libsdl3-dev libsdl3-image-dev libsdl3-ttf-dev
- name: Configure sac2c
run: cp -r /root/.sac2crc $HOME/.sac2crc
- name: Setup CMake
run: cmake -DTARGETS="seq;mt_pth" -B build
- name: Build
Expand Down
16 changes: 8 additions & 8 deletions src/src/sdl3.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,11 @@ SDLcontext *SAC_InitDisplay(sac_int height, sac_int width)
SAC_RuntimeError("SDL_Init failed: %s", SDL_GetError());
}

if(!SDL_CreateWindowAndRenderer("SaC SDL3", width, height, 0, &ctx->window, &ctx->renderer)) {
if(!SDL_CreateWindowAndRenderer("SaC SDL3", (int)width, (int)height, 0, &ctx->window, &ctx->renderer)) {
SAC_RuntimeError("SDL_CreateWindowAndRenderer failed: %s", SDL_GetError());
}

ctx->texture = SDL_CreateTexture(ctx->renderer, SDL_PIXELFORMAT_RGB24, SDL_TEXTUREACCESS_STREAMING, width, height);
ctx->texture = SDL_CreateTexture(ctx->renderer, SDL_PIXELFORMAT_RGB24, SDL_TEXTUREACCESS_STREAMING, (int)width, (int)height);
if(ctx->texture == NULL) {
SAC_RuntimeError("SDL_CreateTexture failed: %s", SDL_GetError());
}
Expand Down Expand Up @@ -122,11 +122,11 @@ void SAC_DrawPixelsOffset(SDLcontext *ctx, SACarg *sacPixels, sac_int xOffset, s
SAC_RuntimeError("SDL_LockTexture failed: %s", SDL_GetError());
}

for (size_t y = 0; y < MIN(srcHeight, ctx->height - yOffset); y++) {
for (sac_int y = 0; y < MIN(srcHeight, (sac_int)ctx->height - yOffset); y++) {
const sac_int *srcRow = srcPixels + y * srcWidth * 3;
uint8_t *dstRow = dstPixels + (yOffset + y) * pitch;
uint8_t *dstRow = dstPixels + (yOffset + y) * (sac_int)pitch;

for (size_t x = 0; x < 3 * MIN(srcWidth, ctx->width - xOffset); x += 3) {
for (sac_int x = 0; x < 3 * MIN(srcWidth, (sac_int)ctx->width - xOffset); x += 3) {
dstRow[xOffset + x + 0] = (uint8_t)(srcRow[x + 0]);
dstRow[xOffset + x + 1] = (uint8_t)(srcRow[x + 1]);
dstRow[xOffset + x + 2] = (uint8_t)(srcRow[x + 2]);
Expand Down Expand Up @@ -180,11 +180,11 @@ sac_int SAC_CloseDisplay(SDLcontext *ctx)
}
}

int exitStatus;
SDL_WaitThread(ctx->eventHandler, &exitStatus);
int status;
SDL_WaitThread(ctx->eventHandler, &status);
SDL_Quit();

return (sac_int)exitStatus;
return (sac_int)status;
}

bool SAC_IsRunning(SDLcontext *ctx)
Expand Down
2 changes: 1 addition & 1 deletion src/src/sdl3.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ typedef enum {
typedef struct SDLselection {
SDL_Semaphore *isSelecting;
selmode_t mode;
int coords[4];
sac_int coords[4];
} SDLselection;

typedef struct SDLcontext {
Expand Down