commit d4751dc2064f6ee02490acd37169a1377d8ffec7
parent caf5195171edfffebab7e3cf3ba0d62421f28e11
Author: Alexey Kutepov <reximkut@gmail.com>
Date: Fri, 2 Jul 2021 11:24:39 +0700
Merge pull request #1 from kolumb/ci
Add CI
Diffstat:
4 files changed, 73 insertions(+), 5 deletions(-)
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
@@ -0,0 +1,56 @@
+name: CI
+on: [push, pull_request]
+
+jobs:
+ build-linux-gcc:
+ runs-on: ubuntu-18.04
+ steps:
+ - uses: actions/checkout@v1
+ - name: install dependencies
+ run: |
+ sudo apt-get update
+ sudo apt-get install -qq libsdl2-dev
+ - name: build te
+ run: |
+ make
+ env:
+ CC: gcc
+ build-linux-clang:
+ runs-on: ubuntu-18.04
+ steps:
+ - uses: actions/checkout@v1
+ - name: install dependencies
+ run: |
+ sudo apt-get update
+ sudo apt-get install -qq libsdl2-dev
+ - name: build te
+ run: |
+ make
+ env:
+ CC: clang
+ build-macos:
+ runs-on: macOS-latest
+ steps:
+ - uses: actions/checkout@v1
+ - name: install dependencies
+ run: brew install sdl2 pkg-config
+ - name: build te
+ run: |
+ make
+ env:
+ CC: clang
+ build-windows-msvc:
+ runs-on: windows-2019
+ steps:
+ - uses: actions/checkout@v1
+ # this runs vcvarsall for us, so we get the MSVC toolchain in PATH.
+ - uses: seanmiddleditch/gha-setup-vsdevenv@master
+ - name: download sdl2
+ run: |
+ curl -fsSL -o SDL2-devel-2.0.14-VC.zip https://www.libsdl.org/release/SDL2-devel-2.0.14-VC.zip
+ tar -xf SDL2-devel-2.0.14-VC.zip
+ mv SDL2-2.0.14 SDL2
+ - name: build te
+ shell: cmd
+ run: |
+ ./build_msvc.bat
diff --git a/.gitignore b/.gitignore
@@ -1 +1,6 @@
-te
-\ No newline at end of file
+te
+SDL2
+*.exe
+*.obj
+*.pdb
+*.ilk
diff --git a/build_msvc.bat b/build_msvc.bat
@@ -0,0 +1,8 @@
+@echo off
+rem launch this from msvc-enabled console
+
+set CFLAGS=/W4 /WX /std:c11 /FC /TC /Zi /nologo
+set INCLUDES=/I SDL2\include
+set LIBS=SDL2\lib\x64\SDL2.lib SDL2\lib\x64\SDL2main.lib Shell32.lib
+
+cl.exe %CFLAGS% %INCLUDES% /Fete main.c la.c /link %LIBS% -SUBSYSTEM:windows
diff --git a/main.c b/main.c
@@ -86,8 +86,8 @@ Font font_load_from_file(SDL_Renderer *renderer, const char *file_path)
const size_t col = index % FONT_COLS;
const size_t row = index / FONT_COLS;
font.glyph_table[index] = (SDL_Rect) {
- .x = col * FONT_CHAR_WIDTH,
- .y = row * FONT_CHAR_HEIGHT,
+ .x = (int) col * FONT_CHAR_WIDTH,
+ .y = (int) row * FONT_CHAR_HEIGHT,
.w = FONT_CHAR_WIDTH,
.h = FONT_CHAR_HEIGHT,
};
@@ -148,7 +148,7 @@ size_t buffer_size = 0;
void render_cursor(SDL_Renderer *renderer, Uint32 color)
{
const SDL_Rect rect = {
- .x = (int) floorf(buffer_cursor * FONT_CHAR_WIDTH * FONT_SCALE),
+ .x = (int) floorf((float) buffer_cursor * FONT_CHAR_WIDTH * FONT_SCALE),
.y = 0,
.w = FONT_CHAR_WIDTH * FONT_SCALE,
.h = FONT_CHAR_HEIGHT * FONT_SCALE,