ded

Dramatic EDitor
Index Commits Files Refs README LICENSE
commit 07a927715ac68f83522da4e8dd0c894f1087c896
parent 051d824df0eb26b1ef917447b68d6b5b9697b6e5
Author: rexim <reximkut@gmail.com>
Date:   Fri,  2 Jul 2021 19:07:20 +0700

Merge branch 'master' into cursor

Diffstat:
A.github/workflows/ci.yml | 67+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
M.gitignore | 8++++++--
Abuild_msvc.bat | 8++++++++
Mmain.c | 10+++++++---
4 files changed, 88 insertions(+), 5 deletions(-)
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
@@ -0,0 +1,67 @@
+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
+      - name: Prepare WindowsBinaries artifacts
+        shell: cmd
+        run: |
+          mkdir winbin
+          copy /B *.exe winbin
+          copy /B *.png winbin
+      - name: Upload WindowsBinaries artifacts
+        uses: actions/upload-artifact@v2
+        with:
+          name: WindowsBinaries
+          path: ./winbin/
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
@@ -87,8 +87,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,
         };
@@ -171,13 +171,17 @@ void render_cursor(SDL_Renderer *renderer, const Font *font)
     }
 }
 
+
 // TODO: move the cursor around
 // TODO: Blinking cursor
 // TODO: Multiple lines
 // TODO: Save/Load file
 
-int main(void)
+int main(int argc, char **argv)
 {
+    (void) argc;
+    (void) argv;
+
     scc(SDL_Init(SDL_INIT_VIDEO));
 
     SDL_Window *window =