Skip to content

Commit

Permalink
added BUILD_TOUCH_INPUT option to the CMake, added SDL and SDLGPU builds
Browse files Browse the repository at this point in the history
  • Loading branch information
nesbox committed Oct 3, 2020
1 parent 47b5af9 commit d769029
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 41 deletions.
58 changes: 18 additions & 40 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ env:

jobs:

# === Windows x86 ===
windows-x86:
# === Windows SDL2 ===
windows-sdl:
runs-on: windows-latest

steps:
Expand All @@ -21,17 +21,17 @@ jobs:
shell: cmd
run: |
cd build
cmake -G "Visual Studio 16 2019" -A Win32 -T v141_xp -DCMAKE_BUILD_TYPE=%BUILD_TYPE% ..
cmake -G "Visual Studio 16 2019" -A Win32 -T v141_xp -DBUILD_SDLGPU=Off -DCMAKE_BUILD_TYPE=%BUILD_TYPE% ..
cmake --build . --parallel --config %BUILD_TYPE%
- name: Deploy
uses: actions/upload-artifact@v2
with:
name: 'tic80-windows-x86'
name: 'tic80-windows-sdl'
path: build/bin/tic80.exe

# === Windows x64 ===
windows-x64:
# === Windows SDLGPU ===
windows-sdlgpu:
runs-on: windows-latest

steps:
Expand All @@ -44,17 +44,17 @@ jobs:
shell: cmd
run: |
cd build
cmake -G "Visual Studio 16 2019" -A x64 -T v141_xp -DCMAKE_BUILD_TYPE=%BUILD_TYPE% ..
cmake -G "Visual Studio 16 2019" -A Win32 -T v141_xp -DBUILD_SDLGPU=On -DCMAKE_BUILD_TYPE=%BUILD_TYPE% ..
cmake --build . --parallel --config %BUILD_TYPE%
- name: Deploy
uses: actions/upload-artifact@v2
with:
name: 'tic80-windows-x64'
name: 'tic80-windows-sdlgpu'
path: build/bin/tic80.exe

# === Windows Sokol x86 ===
windows-sokol-x86:
# === Windows Sokol ===
windows-sokol:
runs-on: windows-latest

steps:
Expand All @@ -69,35 +69,13 @@ jobs:
cd build
cmake -G "Visual Studio 16 2019" -A Win32 -DBUILD_SDL=Off -DBUILD_SOKOL=On -DCMAKE_BUILD_TYPE=%BUILD_TYPE% ..
cmake --build . --parallel --config %BUILD_TYPE%
cp bin/tic80-sokol.exe bin/tic80.exe
- name: Deploy
uses: actions/upload-artifact@v2
with:
name: 'tic80-windows-sokol-x86'
path: build/bin/tic80-sokol.exe

# === Windows Sokol x64 ===
windows-sokol-x64:
runs-on: windows-latest

steps:
- uses: actions/checkout@v2
with:
submodules: recursive
fetch-depth: 0

- name: Build
shell: cmd
run: |
cd build
cmake -G "Visual Studio 16 2019" -A x64 -DBUILD_SDL=Off -DBUILD_SOKOL=On -DCMAKE_BUILD_TYPE=%BUILD_TYPE% ..
cmake --build . --parallel --config %BUILD_TYPE%
- name: Deploy
uses: actions/upload-artifact@v2
with:
name: 'tic80-windows-sokol-x64'
path: build/bin/tic80-sokol.exe
name: 'tic80-windows-sokol'
path: build/bin/tic80.exe

# === Ubuntu 16.04 ===
ubuntu-16:
Expand Down Expand Up @@ -178,7 +156,7 @@ jobs:
name: 'tic80-macos'
path: build/tic80.dmg

# === Android arm7 arm8 x86 x86_64 ===
# === Android arm7 arm8 x86 x64 ===
android:
runs-on: ubuntu-latest

Expand All @@ -194,7 +172,7 @@ jobs:
./gradlew assembleRelease
cp app/build/outputs/apk/arm7/release/app-arm7-release.apk tic80_arm7.apk
cp app/build/outputs/apk/arm8/release/app-arm8-release.apk tic80_arm8.apk
cp app/build/outputs/apk/x86_64/release/app-x86_64-release.apk tic80_x86_64.apk
cp app/build/outputs/apk/x86_64/release/app-x86_64-release.apk tic80_x64.apk
cp app/build/outputs/apk/x86/release/app-x86-release.apk tic80_x86.apk
cp app/build/outputs/apk/universal/release/app-universal-release.apk tic80.apk
Expand All @@ -210,11 +188,11 @@ jobs:
name: 'tic80-android-arm8'
path: build/android/tic80_arm8.apk

- name: Deploy x86_64
- name: Deploy x64
uses: actions/upload-artifact@v2
with:
name: 'tic80-android-x86_64'
path: build/android/tic80_x86_64.apk
name: 'tic80-android-x64'
path: build/android/tic80_x64.apk

- name: Deploy x86
uses: actions/upload-artifact@v2
Expand Down
8 changes: 8 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,13 @@ if(ANDROID OR EMSCRIPTEN OR N3DS)
set(BUILD_DEMO_CARTS_DEFAULT OFF)
set(BUILD_PLAYER_DEFAULT OFF)
set(BUILD_SDLGPU_DEFAULT OFF)
set(BUILD_TOUCH_INPUT_DEFAULT ON)
else()
set(BUILD_LIBRETRO_DEFAULT ON)
set(BUILD_DEMO_CARTS_DEFAULT ON)
set(BUILD_PLAYER_DEFAULT ON)
set(BUILD_SDLGPU_DEFAULT ON)
set(BUILD_TOUCH_INPUT_DEFAULT OFF)
endif()

option(BUILD_SDL "SDL Enabled" ON)
Expand All @@ -54,12 +56,14 @@ option(BUILD_LIBRETRO "libretro Enabled" ${BUILD_LIBRETRO_DEFAULT})
option(BUILD_DEMO_CARTS "Demo Carts Enabled" ${BUILD_DEMO_CARTS_DEFAULT})
option(BUILD_PRO "Build PRO version" FALSE)
option(BUILD_PLAYER "Build standalone players" ${BUILD_PLAYER_DEFAULT})
option(BUILD_TOUCH_INPUT "Build with touch input support" ${BUILD_TOUCH_INPUT_DEFAULT})

if(NOT BUILD_SDL)
set(BUILD_SDLGPU OFF)
endif()

message("BUILD_SDLGPU: ${BUILD_SDLGPU}")
message("BUILD_TOUCH_INPUT: ${BUILD_TOUCH_INPUT}")

if (N3DS)
set(BUILD_SDL off)
Expand Down Expand Up @@ -822,6 +826,10 @@ if(BUILD_SDL)

target_link_libraries(${TIC80_OUTPUT} ${TIC80_OUTPUT}lib)

if(BUILD_TOUCH_INPUT)
target_compile_definitions(${TIC80_OUTPUT} PRIVATE TOUCH_INPUT_SUPPORT)
endif()

if(BUILD_SDLGPU)
target_link_libraries(${TIC80_OUTPUT} sdlgpu)
target_compile_definitions(${TIC80_OUTPUT} PRIVATE CRT_SHADER_SUPPORT)
Expand Down
6 changes: 5 additions & 1 deletion src/system/sdl/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,13 @@

#if defined(__TIC_ANDROID__)
#include <sys/stat.h>
#define TOUCH_TIMEOUT (10 * TIC80_FRAMERATE)
#define TOUCH_INPUT_SUPPORT
#endif

#if defined(TOUCH_INPUT_SUPPORT)
#define TOUCH_TIMEOUT (10 * TIC80_FRAMERATE)
#endif

typedef enum
{
HandCursor,
Expand Down Expand Up @@ -354,6 +357,7 @@ static void initTouchGamepad()
#else
platform.gamepad.touch.texture = SDL_CreateTexture(platform.gpu.renderer, STUDIO_PIXEL_FORMAT, SDL_TEXTUREACCESS_STREAMING, TEXTURE_SIZE, TEXTURE_SIZE);
SDL_SetTextureBlendMode(platform.gamepad.touch.texture, SDL_BLENDMODE_BLEND);
SDL_SetTextureAlphaMod(platform.gamepad.touch.texture, platform.studio->config()->theme.gamepad.touch.alpha);
updateTextureBytes(platform.gamepad.touch.texture, platform.gamepad.touch.pixels, TEXTURE_SIZE);
#endif
}
Expand Down

0 comments on commit d769029

Please sign in to comment.