Merge branch '#209'

This commit is contained in:
BADIM-PC\Vadim 2018-02-26 14:40:06 +03:00
commit c7666f5ccf
30 changed files with 1675 additions and 274 deletions

12
.gitignore vendored
View File

@ -111,4 +111,14 @@ build/uwp/studio/Release/
build/uwp/studio/Release Pro/
build/uwp/studio/ARM/
build/uwp/studio/x64/
build/windows/studio/x64/
build/windows/sdl-gpu/Debug/
build/windows/sdl-gpu/Debug Pro/
build/windows/sdl-gpu/Release/
build/windows/sdl-gpu/Release Pro/
build/uwp/sdl-gpu-static/Debug/
build/uwp/sdl-gpu-static/Debug Pro/
build/uwp/sdl-gpu-static/Release/
build/uwp/sdl-gpu-static/Release Pro/
build/uwp/sdl-gpu-static/ARM/
build/uwp/sdl-gpu-static/x64/
build/uwp/tic/packages/

@ -1 +1 @@
Subproject commit 709d58eef4f2e34b476d38759705d6420d06c548
Subproject commit f8e31654712e43ee34b5a5601ca71245b3ac8fbe

View File

@ -17,6 +17,7 @@ INCLUDES= \
-I$(3RD_PARTY)/zlib-1.2.8 \
-I$(3RD_PARTY)/giflib-5.1.4/lib \
-I$(3RD_PARTY)/SDL2-2.0.7/include \
-I$(3RD_PARTY)/sdl-gpu/include \
-I$(3RD_PARTY)/wren-0.1.0/src/include \
-I$(3RD_PARTY)/moonscript \
-I$(BLIPBUF_LIB) \
@ -27,10 +28,12 @@ INCLUDES= \
MINGW_LINKER_FLAGS= \
-L$(PRE_BUILT)/mingw \
-lmingw32 \
-lSDL2main \
-lSDL2 \
-lcomdlg32 \
-lws2_32 \
-lsdlgpu \
-lSDL2main \
-lSDL2 \
-lopengl32 \
-mwindows
GTK_INCLUDES= `pkg-config --cflags gtk+-3.0`
@ -43,7 +46,8 @@ LINUX_INCLUDES= \
LINUX_LIBS= \
$(GTK_LIBS) \
`sdl2-config --static-libs` \
-L$(3RD_PARTY)/wren-0.1.0/lib
-L$(3RD_PARTY)/wren-0.1.0/lib \
-L$(3RD_PARTY)/sdl-gpu/build/linux
LINUX64_LIBS= \
$(GTK_LIBS) \
@ -58,6 +62,7 @@ LINUX_ARM_LIBS= \
LINUX_LINKER_LTO_FLAGS= \
-lSDL2 \
-lsdlgpu \
-llua \
-lwren \
-lgif \
@ -65,7 +70,8 @@ LINUX_LINKER_LTO_FLAGS= \
-lm \
-lpthread \
-lrt \
-lz
-lz \
-lGL
LINUX_LINKER_FLAGS= \
-llua5.3 \
@ -74,7 +80,9 @@ LINUX_LINKER_FLAGS= \
-lm \
-lpthread \
-lrt \
-lz
-lz \
-lsdlgpu \
-lGL
MINGW_OUTPUT=$(BIN_NAME).exe
@ -93,7 +101,8 @@ EMS_LINKER_FLAGS= \
-llua \
-lwren \
-lgif \
-lz
-lz \
-lsdlgpu
MACOSX_OPT= \
-mmacosx-version-min=10.6 \
@ -104,13 +113,15 @@ MACOSX_LIBS= \
-L$(PRE_BUILT)/macos \
-L/usr/local/lib \
-lSDL2 -lm -liconv -lobjc -llua -lwren -lz -lgif \
-lsdlgpu \
-Wl,-framework,CoreAudio \
-Wl,-framework,AudioToolbox \
-Wl,-framework,ForceFeedback \
-Wl,-framework,CoreVideo \
-Wl,-framework,Cocoa \
-Wl,-framework,Carbon \
-Wl,-framework,IOKit
-Wl,-framework,IOKit \
-Wl,-framework,OpenGL
SOURCES=\
src/studio.c \
@ -136,7 +147,9 @@ SOURCES=\
src/dialog.c \
src/menu.c \
src/net.c \
src/surf.c \
src/surf.c
SYSTEM=\
src/system.c
SOURCES_EXT= \
@ -244,6 +257,9 @@ bin/surf.o: src/surf.c $(TIC80_H) $(TIC_H)
bin/system.o: src/system.c src/keycodes.c $(TIC80_H) $(TIC_H)
$(CC) $< $(OPT) $(INCLUDES) -c -o $@
bin/chip.o: src/system/chip.c src/keycodes.c $(TIC80_H) $(TIC_H)
$(CC) $< $(OPT) $(INCLUDES) -c -o $@
SDL_NET = \
bin/SDLnet.o \
bin/SDLnetTCP.o \
@ -310,10 +326,10 @@ $(STUDIO_DLL): $(DEMO_ASSETS) $(TIC80_DLL) $(TIC_O) bin/html.o
$(CC) $(TIC_O) bin/html.o $(TIC80_A) $(OPT) -shared $(INCLUDES) -L$(PRE_BUILT)/mingw -llua -lz -lgif -Wl,--out-implib,$(STUDIO_A) -o $@
emscripten:
$(EMS_CC) $(SOURCES) $(TIC80_SRC) $(OPT) $(INCLUDES) $(EMS_OPT) $(EMS_LINKER_FLAGS) -o build/html/tic.js
$(EMS_CC) $(SOURCES) $(SYSTEM) $(TIC80_SRC) $(OPT) $(INCLUDES) $(EMS_OPT) $(EMS_LINKER_FLAGS) -o build/html/tic.js
wasm:
$(EMS_CC) $(SOURCES) $(TIC80_SRC) $(OPT) $(INCLUDES) $(EMS_OPT) -s WASM=1 $(EMS_LINKER_FLAGS) -o build/html/tic.js
$(EMS_CC) $(SOURCES) $(SYSTEM) $(TIC80_SRC) $(OPT) $(INCLUDES) $(EMS_OPT) -s WASM=1 $(EMS_LINKER_FLAGS) -o build/html/tic.js
mingw: $(STUDIO_DLL) $(SDL_NET) $(FILE_DIALOG) bin/system.o bin/res.o
$(CC) bin/system.o bin/res.o $(STUDIO_A) $(SDL_NET) $(FILE_DIALOG) $(OPT) $(INCLUDES) $(MINGW_LINKER_FLAGS) -o $(MINGW_OUTPUT)
@ -326,35 +342,35 @@ run: mingw-pro
$(MINGW_OUTPUT)
linux64-lto:
$(CC) $(GTK_INCLUDES) $(SOURCES) $(TIC80_SRC) $(SOURCES_EXT) $(OPT) $(INCLUDES) $(LINUX64_LIBS) $(LINUX_LINKER_LTO_FLAGS) -flto -o $(BIN_NAME)
$(CC) $(GTK_INCLUDES) $(SOURCES) $(SYSTEM) $(TIC80_SRC) $(SOURCES_EXT) $(OPT) $(INCLUDES) $(LINUX64_LIBS) $(LINUX_LINKER_LTO_FLAGS) -flto -o $(BIN_NAME)
linux64-lto-pro:
$(eval OPT += $(OPT_PRO))
make linux64-lto OPT="$(OPT)"
linux32-lto:
$(CC) $(GTK_INCLUDES) $(SOURCES) $(TIC80_SRC) $(SOURCES_EXT) $(OPT) $(INCLUDES) $(LINUX32_LIBS) $(LINUX_LINKER_LTO_FLAGS) -flto -o $(BIN_NAME)
$(CC) $(GTK_INCLUDES) $(SOURCES) $(SYSTEM) $(TIC80_SRC) $(SOURCES_EXT) $(OPT) $(INCLUDES) $(LINUX32_LIBS) $(LINUX_LINKER_LTO_FLAGS) -flto -o $(BIN_NAME)
linux32-lto-pro:
$(eval OPT += $(OPT_PRO))
make linux32-lto OPT="$(OPT)"
chip-lto:
$(CC) $(LINUX_INCLUDES) $(GTK_INCLUDES) $(SOURCES) $(TIC80_SRC) $(SOURCES_EXT) $(OPT) -D__CHIP__ $(INCLUDES) $(LINUX_ARM_LIBS) $(GTK_LIBS) $(LINUX_LINKER_LTO_FLAGS) -flto -o $(BIN_NAME)
$(CC) $(LINUX_INCLUDES) $(GTK_INCLUDES) $(SOURCES) src/system/chip.c $(TIC80_SRC) $(SOURCES_EXT) $(OPT) -D__CHIP__ $(INCLUDES) $(LINUX_ARM_LIBS) $(GTK_LIBS) $(LINUX_LINKER_LTO_FLAGS) -flto -o $(BIN_NAME)
chip-lto-pro:
$(eval OPT += $(OPT_PRO))
make chip-lto OPT="$(OPT)"
linux:
$(CC) $(LINUX_INCLUDES) $(SOURCES) $(LPEG_SRC) $(GIF_SRC) $(SOURCES_EXT) $(TIC80_SRC) $(OPT) $(INCLUDES) $(LINUX_LIBS) $(LINUX_LINKER_FLAGS) -o $(BIN_NAME)
$(CC) $(LINUX_INCLUDES) $(SOURCES) $(SYSTEM) $(LPEG_SRC) $(GIF_SRC) $(SOURCES_EXT) $(TIC80_SRC) $(OPT) $(INCLUDES) $(LINUX_LIBS) $(LINUX_LINKER_FLAGS) -o $(BIN_NAME)
linux-pro:
$(eval OPT += $(OPT_PRO))
make linux OPT="$(OPT)"
macosx:
$(CC) $(SOURCES) $(TIC80_SRC) $(SOURCES_EXT) src/ext/file_dialog.m $(OPT) $(MACOSX_OPT) $(INCLUDES) $(MACOSX_LIBS) -o $(BIN_NAME)
$(CC) $(SOURCES) $(SYSTEM) $(TIC80_SRC) $(SOURCES_EXT) src/ext/file_dialog.m $(OPT) $(MACOSX_OPT) $(INCLUDES) $(MACOSX_LIBS) -o $(BIN_NAME)
macosx-pro:
$(eval OPT += $(OPT_PRO))

View File

@ -68,9 +68,8 @@ run the following commands in the Terminal
```
sudo apt-get install git build-essential libgtk-3-dev libsdl2-dev lua5.3-dev zlib1g-dev
git clone --recursive https://github.com/nesbox/TIC-80
cd 3rd-party/wren-0.1.0/
make static
cd ../..
make static -C 3rd-party/wren-0.1.0/
make -C 3rd-party/sdl-gpu/build/linux/
make linux
```

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,6 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := sdlgpu
LOCAL_SRC_FILES := ../../../../3rd-party/pre-built/android/sdlgpu/$(TARGET_ARCH_ABI)/libsdlgpu.so
include $(PREBUILT_SHARED_LIBRARY)

View File

@ -17,6 +17,7 @@ LOCAL_C_INCLUDES := \
$(LOCAL_PATH)/$(THIRD_PARTY_PATH)/SDL2_net-2.0.1 \
$(LOCAL_PATH)/$(THIRD_PARTY_PATH)/moonscript \
$(LOCAL_PATH)/$(THIRD_PARTY_PATH)/wren-0.1.0\src\include \
$(LOCAL_PATH)/$(THIRD_PARTY_PATH)/sdl-gpu/include \
$(LOCAL_PATH)/../../../../include
# Add your application source files here...
@ -55,7 +56,7 @@ LOCAL_SRC_FILES := \
$(SRC_PATH)/tic80.c \
$(SRC_PATH)/system.c
LOCAL_SHARED_LIBRARIES := SDL2 lua z gif wren
LOCAL_SHARED_LIBRARIES := SDL2 lua z gif wren sdlgpu
LOCAL_LDLIBS := -lGLESv1_CM -lGLESv2 -llog

View File

@ -12,6 +12,7 @@ public class TIC extends SDLActivity
protected String[] getLibraries() {
return new String[] {
"SDL2",
"sdlgpu",
"lua",
"wren",
"z",

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,220 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|ARM">
<Configuration>Debug</Configuration>
<Platform>ARM</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|ARM">
<Configuration>Release</Configuration>
<Platform>ARM</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\..\3rd-party\sdl-gpu\src\externals\stb_image\stb_image.c" />
<ClCompile Include="..\..\..\3rd-party\sdl-gpu\src\externals\stb_image_write\stb_image_write.c" />
<ClCompile Include="..\..\..\3rd-party\sdl-gpu\src\renderer_GLES_2.c" />
<ClCompile Include="..\..\..\3rd-party\sdl-gpu\src\SDL_gpu.c" />
<ClCompile Include="..\..\..\3rd-party\sdl-gpu\src\SDL_gpu_matrix.c" />
<ClCompile Include="..\..\..\3rd-party\sdl-gpu\src\SDL_gpu_renderer.c" />
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{361dfddb-f86e-4c2c-abee-03acf4b8ac33}</ProjectGuid>
<Keyword>StaticLibrary</Keyword>
<RootNamespace>sdl_gpu_static</RootNamespace>
<DefaultLanguage>en-US</DefaultLanguage>
<MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion>
<AppContainerApplication>true</AppContainerApplication>
<ApplicationType>Windows Store</ApplicationType>
<WindowsTargetPlatformVersion>10.0.14393.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformMinVersion>10.0.14393.0</WindowsTargetPlatformMinVersion>
<ApplicationTypeRevision>10.0</ApplicationTypeRevision>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<PlatformToolset>v140</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<PlatformToolset>v140</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<PlatformToolset>v140</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<GenerateManifest>false</GenerateManifest>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<GenerateManifest>false</GenerateManifest>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
<GenerateManifest>false</GenerateManifest>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
<GenerateManifest>false</GenerateManifest>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<GenerateManifest>false</GenerateManifest>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<GenerateManifest>false</GenerateManifest>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<CompileAsWinRT>false</CompileAsWinRT>
<SDLCheck>false</SDLCheck>
<AdditionalIncludeDirectories>..\..\..\3rd-party\SDL2-2.0.7\include;..\..\..\3rd-party\sdl-gpu\include;..\..\..\3rd-party\sdl-gpu\src;..\..\..\3rd-party\sdl-gpu\src\externals\glew;..\..\..\3rd-party\sdl-gpu\src\externals\glew\GL;..\..\..\3rd-party\sdl-gpu\src\externals\stb_image;..\..\..\3rd-party\sdl-gpu\src\externals\stb_image_write;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>SDL_GPU_DISABLE_GLES_1;SDL_GPU_DISABLE_GLES_3;SDL_GPU_DISABLE_OPENGL;GL_GLEXT_PROTOTYPES;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
<GenerateWindowsMetadata>false</GenerateWindowsMetadata>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<CompileAsWinRT>false</CompileAsWinRT>
<SDLCheck>false</SDLCheck>
<AdditionalIncludeDirectories>..\..\..\3rd-party\SDL2-2.0.7\include;..\..\..\3rd-party\sdl-gpu\include;..\..\..\3rd-party\sdl-gpu\src;..\..\..\3rd-party\sdl-gpu\src\externals\glew;..\..\..\3rd-party\sdl-gpu\src\externals\glew\GL;..\..\..\3rd-party\sdl-gpu\src\externals\stb_image;..\..\..\3rd-party\sdl-gpu\src\externals\stb_image_write;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>SDL_GPU_DISABLE_GLES_1;SDL_GPU_DISABLE_GLES_3;SDL_GPU_DISABLE_OPENGL;GL_GLEXT_PROTOTYPES;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
<GenerateWindowsMetadata>false</GenerateWindowsMetadata>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|arm'">
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<CompileAsWinRT>false</CompileAsWinRT>
<SDLCheck>false</SDLCheck>
<AdditionalIncludeDirectories>..\..\..\3rd-party\SDL2-2.0.7\include;..\..\..\3rd-party\sdl-gpu\include;..\..\..\3rd-party\sdl-gpu\src;..\..\..\3rd-party\sdl-gpu\src\externals\glew;..\..\..\3rd-party\sdl-gpu\src\externals\glew\GL;..\..\..\3rd-party\sdl-gpu\src\externals\stb_image;..\..\..\3rd-party\sdl-gpu\src\externals\stb_image_write;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>SDL_GPU_DISABLE_GLES_1;SDL_GPU_DISABLE_GLES_3;SDL_GPU_DISABLE_OPENGL;GL_GLEXT_PROTOTYPES;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
<GenerateWindowsMetadata>false</GenerateWindowsMetadata>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|arm'">
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<CompileAsWinRT>false</CompileAsWinRT>
<SDLCheck>false</SDLCheck>
<AdditionalIncludeDirectories>..\..\..\3rd-party\SDL2-2.0.7\include;..\..\..\3rd-party\sdl-gpu\include;..\..\..\3rd-party\sdl-gpu\src;..\..\..\3rd-party\sdl-gpu\src\externals\glew;..\..\..\3rd-party\sdl-gpu\src\externals\glew\GL;..\..\..\3rd-party\sdl-gpu\src\externals\stb_image;..\..\..\3rd-party\sdl-gpu\src\externals\stb_image_write;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>SDL_GPU_DISABLE_GLES_1;SDL_GPU_DISABLE_GLES_3;SDL_GPU_DISABLE_OPENGL;GL_GLEXT_PROTOTYPES;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
<GenerateWindowsMetadata>false</GenerateWindowsMetadata>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<CompileAsWinRT>false</CompileAsWinRT>
<SDLCheck>false</SDLCheck>
<AdditionalIncludeDirectories>..\..\..\3rd-party\SDL2-2.0.7\include;..\..\..\3rd-party\sdl-gpu\include;..\..\..\3rd-party\sdl-gpu\src;..\..\..\3rd-party\sdl-gpu\src\externals\glew;..\..\..\3rd-party\sdl-gpu\src\externals\glew\GL;..\..\..\3rd-party\sdl-gpu\src\externals\stb_image;..\..\..\3rd-party\sdl-gpu\src\externals\stb_image_write;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>SDL_GPU_DISABLE_GLES_1;SDL_GPU_DISABLE_GLES_3;SDL_GPU_DISABLE_OPENGL;GL_GLEXT_PROTOTYPES;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
<GenerateWindowsMetadata>false</GenerateWindowsMetadata>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<CompileAsWinRT>false</CompileAsWinRT>
<SDLCheck>false</SDLCheck>
<AdditionalIncludeDirectories>..\..\..\3rd-party\SDL2-2.0.7\include;..\..\..\3rd-party\sdl-gpu\include;..\..\..\3rd-party\sdl-gpu\src;..\..\..\3rd-party\sdl-gpu\src\externals\glew;..\..\..\3rd-party\sdl-gpu\src\externals\glew\GL;..\..\..\3rd-party\sdl-gpu\src\externals\stb_image;..\..\..\3rd-party\sdl-gpu\src\externals\stb_image_write;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>SDL_GPU_DISABLE_GLES_1;SDL_GPU_DISABLE_GLES_3;SDL_GPU_DISABLE_OPENGL;GL_GLEXT_PROTOTYPES;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
<GenerateWindowsMetadata>false</GenerateWindowsMetadata>
</Link>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
<Import Project="..\tic\packages\ANGLE.WindowsStore.2.1.13\build\native\ANGLE.WindowsStore.targets" Condition="Exists('..\tic\packages\ANGLE.WindowsStore.2.1.13\build\native\ANGLE.WindowsStore.targets')" />
</ImportGroup>
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\tic\packages\ANGLE.WindowsStore.2.1.13\build\native\ANGLE.WindowsStore.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\tic\packages\ANGLE.WindowsStore.2.1.13\build\native\ANGLE.WindowsStore.targets'))" />
</Target>
</Project>

View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="src">
<UniqueIdentifier>{c3550c01-2588-4878-8d79-ead29ff8053e}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\..\3rd-party\sdl-gpu\src\renderer_GLES_2.c">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\3rd-party\sdl-gpu\src\SDL_gpu.c">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\3rd-party\sdl-gpu\src\SDL_gpu_renderer.c">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\3rd-party\sdl-gpu\src\SDL_gpu_matrix.c">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\3rd-party\sdl-gpu\src\externals\stb_image\stb_image.c">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\3rd-party\sdl-gpu\src\externals\stb_image_write\stb_image_write.c">
<Filter>src</Filter>
</ClCompile>
</ItemGroup>
</Project>

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="ANGLE.WindowsStore" version="2.1.13" targetFramework="native" />
</packages>

View File

@ -19,6 +19,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wren", "..\wren\wren.vcxpro
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "studio", "..\studio\studio.vcxproj", "{6A22403A-6CF5-49F2-A012-EC04C9496306}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sdl-gpu-static", "..\sdl-gpu-static\sdl-gpu-static.vcxproj", "{361DFDDB-F86E-4C2C-ABEE-03ACF4B8AC33}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|ARM = Debug|ARM
@ -131,6 +133,18 @@ Global
{6A22403A-6CF5-49F2-A012-EC04C9496306}.Release|x64.Build.0 = Release|x64
{6A22403A-6CF5-49F2-A012-EC04C9496306}.Release|x86.ActiveCfg = Release|Win32
{6A22403A-6CF5-49F2-A012-EC04C9496306}.Release|x86.Build.0 = Release|Win32
{361DFDDB-F86E-4C2C-ABEE-03ACF4B8AC33}.Debug|ARM.ActiveCfg = Debug|ARM
{361DFDDB-F86E-4C2C-ABEE-03ACF4B8AC33}.Debug|ARM.Build.0 = Debug|ARM
{361DFDDB-F86E-4C2C-ABEE-03ACF4B8AC33}.Debug|x64.ActiveCfg = Debug|x64
{361DFDDB-F86E-4C2C-ABEE-03ACF4B8AC33}.Debug|x64.Build.0 = Debug|x64
{361DFDDB-F86E-4C2C-ABEE-03ACF4B8AC33}.Debug|x86.ActiveCfg = Debug|Win32
{361DFDDB-F86E-4C2C-ABEE-03ACF4B8AC33}.Debug|x86.Build.0 = Debug|Win32
{361DFDDB-F86E-4C2C-ABEE-03ACF4B8AC33}.Release|ARM.ActiveCfg = Release|ARM
{361DFDDB-F86E-4C2C-ABEE-03ACF4B8AC33}.Release|ARM.Build.0 = Release|ARM
{361DFDDB-F86E-4C2C-ABEE-03ACF4B8AC33}.Release|x64.ActiveCfg = Release|x64
{361DFDDB-F86E-4C2C-ABEE-03ACF4B8AC33}.Release|x64.Build.0 = Release|x64
{361DFDDB-F86E-4C2C-ABEE-03ACF4B8AC33}.Release|x86.ActiveCfg = Release|Win32
{361DFDDB-F86E-4C2C-ABEE-03ACF4B8AC33}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@ -109,7 +109,7 @@
<DisableSpecificWarnings>4453;28204</DisableSpecificWarnings>
<CompileAsWinRT>false</CompileAsWinRT>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<AdditionalIncludeDirectories>..\include;..\..\..\include;..\..\..\3rd-party\lua-5.3.1\src;..\..\..\3rd-party\giflib-5.1.4\lib;..\..\..\3rd-party\SDL2-2.0.7\include;..\..\..\3rd-party\zlib-1.2.8;..\..\..\3rd-party\SDL2_net-2.0.1;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>..\include;..\..\..\include;..\..\..\3rd-party\lua-5.3.1\src;..\..\..\3rd-party\giflib-5.1.4\lib;..\..\..\3rd-party\SDL2-2.0.7\include;..\..\..\3rd-party\sdl-gpu\include;..\..\..\3rd-party\zlib-1.2.8;..\..\..\3rd-party\SDL2_net-2.0.1;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<BufferSecurityCheck>
</BufferSecurityCheck>
<PreprocessorDefinitions>_WINSOCK_DEPRECATED_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;LUA_COMPAT_5_2;_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1;%(ClCompile.PreprocessorDefinitions)</PreprocessorDefinitions>
@ -125,7 +125,7 @@
<DisableSpecificWarnings>4453;28204</DisableSpecificWarnings>
<CompileAsWinRT>false</CompileAsWinRT>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<AdditionalIncludeDirectories>..\include;..\..\..\include;..\..\..\3rd-party\lua-5.3.1\src;..\..\..\3rd-party\giflib-5.1.4\lib;..\..\..\3rd-party\SDL2-2.0.7\include;..\..\..\3rd-party\zlib-1.2.8;..\..\..\3rd-party\SDL2_net-2.0.1;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>..\include;..\..\..\include;..\..\..\3rd-party\lua-5.3.1\src;..\..\..\3rd-party\giflib-5.1.4\lib;..\..\..\3rd-party\SDL2-2.0.7\include;..\..\..\3rd-party\sdl-gpu\include;..\..\..\3rd-party\zlib-1.2.8;..\..\..\3rd-party\SDL2_net-2.0.1;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<BufferSecurityCheck>
</BufferSecurityCheck>
<PreprocessorDefinitions>_WINSOCK_DEPRECATED_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;LUA_COMPAT_5_2;_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1;%(ClCompile.PreprocessorDefinitions)</PreprocessorDefinitions>
@ -141,7 +141,7 @@
<DisableSpecificWarnings>4453;28204</DisableSpecificWarnings>
<CompileAsWinRT>false</CompileAsWinRT>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<AdditionalIncludeDirectories>..\include;..\..\..\include;..\..\..\3rd-party\lua-5.3.1\src;..\..\..\3rd-party\giflib-5.1.4\lib;..\..\..\3rd-party\SDL2-2.0.7\include;..\..\..\3rd-party\zlib-1.2.8;..\..\..\3rd-party\SDL2_net-2.0.1;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>..\include;..\..\..\include;..\..\..\3rd-party\lua-5.3.1\src;..\..\..\3rd-party\giflib-5.1.4\lib;..\..\..\3rd-party\SDL2-2.0.7\include;..\..\..\3rd-party\sdl-gpu\include;..\..\..\3rd-party\zlib-1.2.8;..\..\..\3rd-party\SDL2_net-2.0.1;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<BufferSecurityCheck>
</BufferSecurityCheck>
<PreprocessorDefinitions>_WINSOCK_DEPRECATED_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;LUA_COMPAT_5_2;_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@ -157,7 +157,7 @@
<DisableSpecificWarnings>4453;28204</DisableSpecificWarnings>
<CompileAsWinRT>false</CompileAsWinRT>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<AdditionalIncludeDirectories>..\include;..\..\..\include;..\..\..\3rd-party\lua-5.3.1\src;..\..\..\3rd-party\giflib-5.1.4\lib;..\..\..\3rd-party\SDL2-2.0.7\include;..\..\..\3rd-party\zlib-1.2.8;..\..\..\3rd-party\SDL2_net-2.0.1;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>..\include;..\..\..\include;..\..\..\3rd-party\lua-5.3.1\src;..\..\..\3rd-party\giflib-5.1.4\lib;..\..\..\3rd-party\SDL2-2.0.7\include;..\..\..\3rd-party\sdl-gpu\include;..\..\..\3rd-party\zlib-1.2.8;..\..\..\3rd-party\SDL2_net-2.0.1;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<BufferSecurityCheck>
</BufferSecurityCheck>
<PreprocessorDefinitions>_WINSOCK_DEPRECATED_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;LUA_COMPAT_5_2;_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@ -173,7 +173,7 @@
<DisableSpecificWarnings>4453;28204</DisableSpecificWarnings>
<CompileAsWinRT>false</CompileAsWinRT>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<AdditionalIncludeDirectories>..\include;..\..\..\include;..\..\..\3rd-party\lua-5.3.1\src;..\..\..\3rd-party\giflib-5.1.4\lib;..\..\..\3rd-party\SDL2-2.0.7\include;..\..\..\3rd-party\zlib-1.2.8;..\..\..\3rd-party\SDL2_net-2.0.1;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>..\include;..\..\..\include;..\..\..\3rd-party\lua-5.3.1\src;..\..\..\3rd-party\giflib-5.1.4\lib;..\..\..\3rd-party\SDL2-2.0.7\include;..\..\..\3rd-party\sdl-gpu\include;..\..\..\3rd-party\zlib-1.2.8;..\..\..\3rd-party\SDL2_net-2.0.1;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<BufferSecurityCheck>
</BufferSecurityCheck>
<PreprocessorDefinitions>_WINSOCK_DEPRECATED_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;LUA_COMPAT_5_2;_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@ -189,7 +189,7 @@
<DisableSpecificWarnings>4453;28204</DisableSpecificWarnings>
<CompileAsWinRT>false</CompileAsWinRT>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<AdditionalIncludeDirectories>..\include;..\..\..\include;..\..\..\3rd-party\lua-5.3.1\src;..\..\..\3rd-party\giflib-5.1.4\lib;..\..\..\3rd-party\SDL2-2.0.7\include;..\..\..\3rd-party\zlib-1.2.8;..\..\..\3rd-party\SDL2_net-2.0.1;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>..\include;..\..\..\include;..\..\..\3rd-party\lua-5.3.1\src;..\..\..\3rd-party\giflib-5.1.4\lib;..\..\..\3rd-party\SDL2-2.0.7\include;..\..\..\3rd-party\sdl-gpu\include;..\..\..\3rd-party\zlib-1.2.8;..\..\..\3rd-party\SDL2_net-2.0.1;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<BufferSecurityCheck>
</BufferSecurityCheck>
<PreprocessorDefinitions>_WINSOCK_DEPRECATED_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;LUA_COMPAT_5_2;_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@ -203,6 +203,7 @@
<AppxManifest Include="Package.appxmanifest">
<SubType>Designer</SubType>
</AppxManifest>
<None Include="packages.config" />
<None Include="tic_StoreKey.pfx" />
<None Include="tic_TemporaryKey.pfx" />
</ItemGroup>
@ -219,6 +220,9 @@
<ProjectReference Include="..\..\..\3rd-party\SDL2-2.0.7\VisualC-WinRT\UWP_VS2015\SDL-UWP.vcxproj">
<Project>{89e9b32e-a86a-47c3-a948-d2b1622925ce}</Project>
</ProjectReference>
<ProjectReference Include="..\sdl-gpu-static\sdl-gpu-static.vcxproj">
<Project>{361dfddb-f86e-4c2c-abee-03acf4b8ac33}</Project>
</ProjectReference>
<ProjectReference Include="..\studio\studio.vcxproj">
<Project>{6a22403a-6cf5-49f2-a012-ec04c9496306}</Project>
</ProjectReference>
@ -255,5 +259,12 @@
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
<Import Project="packages\ANGLE.WindowsStore.2.1.13\build\native\ANGLE.WindowsStore.targets" Condition="Exists('packages\ANGLE.WindowsStore.2.1.13\build\native\ANGLE.WindowsStore.targets')" />
</ImportGroup>
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('packages\ANGLE.WindowsStore.2.1.13\build\native\ANGLE.WindowsStore.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\ANGLE.WindowsStore.2.1.13\build\native\ANGLE.WindowsStore.targets'))" />
</Target>
</Project>

View File

@ -45,6 +45,7 @@
<None Include="tic_TemporaryKey.pfx" />
<None Include="Package.StoreAssociation.xml" />
<None Include="tic_StoreKey.pfx" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\..\src\ext\file_dialog.cpp">

View File

@ -11,7 +11,7 @@
<DebuggerMachineName>XboxOne</DebuggerMachineName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
<DebuggerFlavor>UWPRemoteDebugger</DebuggerFlavor>
<DebuggerFlavor>WindowsDeviceDebugger</DebuggerFlavor>
<DebuggerMachineName>XboxOne</DebuggerMachineName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">

View File

@ -0,0 +1,157 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\..\..\..\nesbox\research\sdl-gpu\src\externals\glew\glew.c" />
<ClCompile Include="..\..\..\..\..\nesbox\research\sdl-gpu\src\externals\stb_image\stb_image.c" />
<ClCompile Include="..\..\..\..\..\nesbox\research\sdl-gpu\src\externals\stb_image_write\stb_image_write.c" />
<ClCompile Include="..\..\..\3rd-party\sdl-gpu\src\renderer_GLES_1.c" />
<ClCompile Include="..\..\..\3rd-party\sdl-gpu\src\renderer_GLES_2.c" />
<ClCompile Include="..\..\..\3rd-party\sdl-gpu\src\renderer_GLES_3.c" />
<ClCompile Include="..\..\..\3rd-party\sdl-gpu\src\renderer_OpenGL_1.c" />
<ClCompile Include="..\..\..\3rd-party\sdl-gpu\src\renderer_OpenGL_1_BASE.c" />
<ClCompile Include="..\..\..\3rd-party\sdl-gpu\src\renderer_OpenGL_2.c" />
<ClCompile Include="..\..\..\3rd-party\sdl-gpu\src\renderer_OpenGL_3.c" />
<ClCompile Include="..\..\..\3rd-party\sdl-gpu\src\renderer_OpenGL_4.c" />
<ClCompile Include="..\..\..\3rd-party\sdl-gpu\src\SDL_gpu.c" />
<ClCompile Include="..\..\..\3rd-party\sdl-gpu\src\SDL_gpu_matrix.c" />
<ClCompile Include="..\..\..\3rd-party\sdl-gpu\src\SDL_gpu_renderer.c" />
<ClCompile Include="..\..\..\3rd-party\sdl-gpu\src\SDL_gpu_shapes.c" />
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{D0B6AE7F-601B-43F4-AFD3-C40136232595}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>sdlgpu</RootNamespace>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup />
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>GLEW_STATIC;SDL_GPU_DISABLE_GLES;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<AdditionalIncludeDirectories>..\..\..\3rd-party\SDL2-2.0.7\include;..\..\..\3rd-party\sdl-gpu\include;..\..\..\3rd-party\sdl-gpu\src;..\..\..\3rd-party\sdl-gpu\src\externals\glew;..\..\..\3rd-party\sdl-gpu\src\externals\glew\GL;..\..\..\3rd-party\sdl-gpu\src\externals\stb_image;..\..\..\3rd-party\sdl-gpu\src\externals\stb_image_write</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>GLEW_STATIC;SDL_GPU_DISABLE_GLES;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<AdditionalIncludeDirectories>..\..\..\3rd-party\SDL2-2.0.7\include;..\..\..\3rd-party\sdl-gpu\include;..\..\..\3rd-party\sdl-gpu\src;..\..\..\3rd-party\sdl-gpu\src\externals\glew;..\..\..\3rd-party\sdl-gpu\src\externals\glew\GL;..\..\..\3rd-party\sdl-gpu\src\externals\stb_image;..\..\..\3rd-party\sdl-gpu\src\externals\stb_image_write</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>_WINDOWS;GLEW_STATIC;SDL_GPU_DISABLE_GLES;STBI_FAILURE_USERMSG;SDL_GPU_USE_BUFFER_RESET;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<AdditionalIncludeDirectories>..\..\..\3rd-party\SDL2-2.0.7\include;..\..\..\3rd-party\sdl-gpu\include;..\..\..\3rd-party\sdl-gpu\src;..\..\..\3rd-party\sdl-gpu\src\externals\glew;..\..\..\3rd-party\sdl-gpu\src\externals\glew\GL;..\..\..\3rd-party\sdl-gpu\src\externals\stb_image;..\..\..\3rd-party\sdl-gpu\src\externals\stb_image_write</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>_WINDOWS;GLEW_STATIC;SDL_GPU_DISABLE_GLES;STBI_FAILURE_USERMSG;SDL_GPU_USE_BUFFER_RESET;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<AdditionalIncludeDirectories>..\..\..\3rd-party\SDL2-2.0.7\include;..\..\..\3rd-party\sdl-gpu\include;..\..\..\3rd-party\sdl-gpu\src;..\..\..\3rd-party\sdl-gpu\src\externals\glew;..\..\..\3rd-party\sdl-gpu\src\externals\glew\GL;..\..\..\3rd-party\sdl-gpu\src\externals\stb_image;..\..\..\3rd-party\sdl-gpu\src\externals\stb_image_write</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@ -0,0 +1,67 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="src">
<UniqueIdentifier>{5d881051-9638-476c-95f1-3279cce1274e}</UniqueIdentifier>
</Filter>
<Filter Include="src\externals">
<UniqueIdentifier>{d8b8c914-cf54-44de-ad8d-a3107e066f74}</UniqueIdentifier>
</Filter>
<Filter Include="src\externals\glew">
<UniqueIdentifier>{3ace8cd1-b71d-4f36-81a0-11d8bf4a30de}</UniqueIdentifier>
</Filter>
<Filter Include="src\externals\stb_image">
<UniqueIdentifier>{71f11ae7-8fcc-4c68-9624-abfa04c0db5f}</UniqueIdentifier>
</Filter>
<Filter Include="src\externals\stb_image_write">
<UniqueIdentifier>{d04f6c6c-a486-4805-bafb-c0b5bd02058f}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\..\3rd-party\sdl-gpu\src\renderer_GLES_1.c">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\3rd-party\sdl-gpu\src\renderer_GLES_2.c">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\3rd-party\sdl-gpu\src\renderer_GLES_3.c">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\3rd-party\sdl-gpu\src\renderer_OpenGL_1.c">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\3rd-party\sdl-gpu\src\renderer_OpenGL_1_BASE.c">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\3rd-party\sdl-gpu\src\renderer_OpenGL_2.c">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\3rd-party\sdl-gpu\src\renderer_OpenGL_3.c">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\3rd-party\sdl-gpu\src\renderer_OpenGL_4.c">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\3rd-party\sdl-gpu\src\SDL_gpu.c">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\3rd-party\sdl-gpu\src\SDL_gpu_matrix.c">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\3rd-party\sdl-gpu\src\SDL_gpu_renderer.c">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\3rd-party\sdl-gpu\src\SDL_gpu_shapes.c">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\..\nesbox\research\sdl-gpu\src\externals\glew\glew.c">
<Filter>src\externals\glew</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\..\nesbox\research\sdl-gpu\src\externals\stb_image\stb_image.c">
<Filter>src\externals\stb_image</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\..\nesbox\research\sdl-gpu\src\externals\stb_image_write\stb_image_write.c">
<Filter>src\externals\stb_image_write</Filter>
</ClCompile>
</ItemGroup>
</Project>

View File

@ -29,6 +29,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wren_lib", "..\wren\wren_li
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "studio", "..\studio\studio.vcxproj", "{6181F6A6-AA1B-4CD2-B306-E242CFDE9B20}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sdl-gpu", "..\sdl-gpu\sdl-gpu.vcxproj", "{D0B6AE7F-601B-43F4-AFD3-C40136232595}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug Pro|x64 = Debug Pro|x64
@ -201,6 +203,22 @@ Global
{6181F6A6-AA1B-4CD2-B306-E242CFDE9B20}.Release|x64.Build.0 = Release|x64
{6181F6A6-AA1B-4CD2-B306-E242CFDE9B20}.Release|x86.ActiveCfg = Release|Win32
{6181F6A6-AA1B-4CD2-B306-E242CFDE9B20}.Release|x86.Build.0 = Release|Win32
{D0B6AE7F-601B-43F4-AFD3-C40136232595}.Debug Pro|x64.ActiveCfg = Debug|x64
{D0B6AE7F-601B-43F4-AFD3-C40136232595}.Debug Pro|x64.Build.0 = Debug|x64
{D0B6AE7F-601B-43F4-AFD3-C40136232595}.Debug Pro|x86.ActiveCfg = Debug|Win32
{D0B6AE7F-601B-43F4-AFD3-C40136232595}.Debug Pro|x86.Build.0 = Debug|Win32
{D0B6AE7F-601B-43F4-AFD3-C40136232595}.Debug|x64.ActiveCfg = Debug|x64
{D0B6AE7F-601B-43F4-AFD3-C40136232595}.Debug|x64.Build.0 = Debug|x64
{D0B6AE7F-601B-43F4-AFD3-C40136232595}.Debug|x86.ActiveCfg = Debug|Win32
{D0B6AE7F-601B-43F4-AFD3-C40136232595}.Debug|x86.Build.0 = Debug|Win32
{D0B6AE7F-601B-43F4-AFD3-C40136232595}.Release Pro|x64.ActiveCfg = Release|x64
{D0B6AE7F-601B-43F4-AFD3-C40136232595}.Release Pro|x64.Build.0 = Release|x64
{D0B6AE7F-601B-43F4-AFD3-C40136232595}.Release Pro|x86.ActiveCfg = Release|Win32
{D0B6AE7F-601B-43F4-AFD3-C40136232595}.Release Pro|x86.Build.0 = Release|Win32
{D0B6AE7F-601B-43F4-AFD3-C40136232595}.Release|x64.ActiveCfg = Release|x64
{D0B6AE7F-601B-43F4-AFD3-C40136232595}.Release|x64.Build.0 = Release|x64
{D0B6AE7F-601B-43F4-AFD3-C40136232595}.Release|x86.ActiveCfg = Release|Win32
{D0B6AE7F-601B-43F4-AFD3-C40136232595}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@ -41,6 +41,9 @@
<ProjectReference Include="..\..\..\3rd-party\SDL2-2.0.7\VisualC\SDL\SDL.vcxproj">
<Project>{81ce8daf-ebb2-4761-8e45-b71abcca8c68}</Project>
</ProjectReference>
<ProjectReference Include="..\sdl-gpu\sdl-gpu.vcxproj">
<Project>{d0b6ae7f-601b-43f4-afd3-c40136232595}</Project>
</ProjectReference>
<ProjectReference Include="..\studio\studio.vcxproj">
<Project>{6181f6a6-aa1b-4cd2-b306-e242cfde9b20}</Project>
</ProjectReference>
@ -183,12 +186,12 @@
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;LUA_COMPAT_5_2;WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<AdditionalIncludeDirectories>..\include;..\..\..\include;..\..\..\3rd-party\lua-5.3.1\src;..\..\..\3rd-party\giflib-5.1.4\lib;..\..\..\3rd-party\zlib-1.2.8;..\..\..\3rd-party\SDL2-2.0.7\include;..\..\..\3rd-party\SDL2_net-2.0.1;..\..\..\3rd-party\wren-0.1.0\src\include</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>..\include;..\..\..\include;..\..\..\3rd-party\lua-5.3.1\src;..\..\..\3rd-party\giflib-5.1.4\lib;..\..\..\3rd-party\zlib-1.2.8;..\..\..\3rd-party\SDL2-2.0.7\include;..\..\..\3rd-party\SDL2_net-2.0.1;..\..\..\3rd-party\wren-0.1.0\src\include;..\..\..\3rd-party\sdl-gpu\include</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>ws2_32.lib;version.lib;Imm32.lib;Winmm.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>opengl32.lib;ws2_32.lib;version.lib;Imm32.lib;Winmm.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>..\..\..\lib\windows</AdditionalLibraryDirectories>
<OutputFile>$(OutDir)tic80$(TargetExt)</OutputFile>
</Link>
@ -200,12 +203,12 @@
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>TIC80_PRO;_CRT_SECURE_NO_WARNINGS;LUA_COMPAT_5_2;WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<AdditionalIncludeDirectories>..\include;..\..\..\include;..\..\..\3rd-party\lua-5.3.1\src;..\..\..\3rd-party\giflib-5.1.4\lib;..\..\..\3rd-party\zlib-1.2.8;..\..\..\3rd-party\SDL2-2.0.7\include;..\..\..\3rd-party\SDL2_net-2.0.1;..\..\..\3rd-party\wren-0.1.0\src\include</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>..\include;..\..\..\include;..\..\..\3rd-party\lua-5.3.1\src;..\..\..\3rd-party\giflib-5.1.4\lib;..\..\..\3rd-party\zlib-1.2.8;..\..\..\3rd-party\SDL2-2.0.7\include;..\..\..\3rd-party\SDL2_net-2.0.1;..\..\..\3rd-party\wren-0.1.0\src\include;..\..\..\3rd-party\sdl-gpu\include</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>ws2_32.lib;version.lib;Imm32.lib;Winmm.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>opengl32.lib;ws2_32.lib;version.lib;Imm32.lib;Winmm.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>..\..\..\lib\windows</AdditionalLibraryDirectories>
<OutputFile>$(OutDir)tic80$(TargetExt)</OutputFile>
</Link>
@ -217,12 +220,12 @@
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;LUA_COMPAT_5_2;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<AdditionalIncludeDirectories>..\include;..\..\..\include;..\..\..\3rd-party\lua-5.3.1\src;..\..\..\3rd-party\giflib-5.1.4\lib;..\..\..\3rd-party\zlib-1.2.8;..\..\..\3rd-party\SDL2-2.0.7\include;..\..\..\3rd-party\SDL2_net-2.0.1;..\..\..\3rd-party\wren-0.1.0\src\include</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>..\include;..\..\..\include;..\..\..\3rd-party\lua-5.3.1\src;..\..\..\3rd-party\giflib-5.1.4\lib;..\..\..\3rd-party\zlib-1.2.8;..\..\..\3rd-party\SDL2-2.0.7\include;..\..\..\3rd-party\SDL2_net-2.0.1;..\..\..\3rd-party\wren-0.1.0\src\include;..\..\..\3rd-party\sdl-gpu\include</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>ws2_32.lib;version.lib;Imm32.lib;Winmm.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>opengl32.lib;ws2_32.lib;version.lib;Imm32.lib;Winmm.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>..\..\..\lib\windows</AdditionalLibraryDirectories>
<OutputFile>$(OutDir)tic80$(TargetExt)</OutputFile>
</Link>
@ -234,12 +237,12 @@
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>TIC80_PRO;_CRT_SECURE_NO_WARNINGS;LUA_COMPAT_5_2;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<AdditionalIncludeDirectories>..\include;..\..\..\include;..\..\..\3rd-party\lua-5.3.1\src;..\..\..\3rd-party\giflib-5.1.4\lib;..\..\..\3rd-party\zlib-1.2.8;..\..\..\3rd-party\SDL2-2.0.7\include;..\..\..\3rd-party\SDL2_net-2.0.1;..\..\..\3rd-party\wren-0.1.0\src\include</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>..\include;..\..\..\include;..\..\..\3rd-party\lua-5.3.1\src;..\..\..\3rd-party\giflib-5.1.4\lib;..\..\..\3rd-party\zlib-1.2.8;..\..\..\3rd-party\SDL2-2.0.7\include;..\..\..\3rd-party\SDL2_net-2.0.1;..\..\..\3rd-party\wren-0.1.0\src\include;..\..\..\3rd-party\sdl-gpu\include</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>ws2_32.lib;version.lib;Imm32.lib;Winmm.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>opengl32.lib;ws2_32.lib;version.lib;Imm32.lib;Winmm.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>..\..\..\lib\windows</AdditionalLibraryDirectories>
<OutputFile>$(OutDir)tic80$(TargetExt)</OutputFile>
</Link>
@ -253,14 +256,14 @@
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;LUA_COMPAT_5_2;WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<AdditionalIncludeDirectories>..\include;..\..\..\include;..\..\..\3rd-party\lua-5.3.1\src;..\..\..\3rd-party\giflib-5.1.4\lib;..\..\..\3rd-party\zlib-1.2.8;..\..\..\3rd-party\SDL2-2.0.7\include;..\..\..\3rd-party\SDL2_net-2.0.1;..\..\..\3rd-party\wren-0.1.0\src\include</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>..\include;..\..\..\include;..\..\..\3rd-party\lua-5.3.1\src;..\..\..\3rd-party\giflib-5.1.4\lib;..\..\..\3rd-party\zlib-1.2.8;..\..\..\3rd-party\SDL2-2.0.7\include;..\..\..\3rd-party\SDL2_net-2.0.1;..\..\..\3rd-party\wren-0.1.0\src\include;..\..\..\3rd-party\sdl-gpu\include</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>ws2_32.lib;version.lib;Imm32.lib;Winmm.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>opengl32.lib;ws2_32.lib;version.lib;Imm32.lib;Winmm.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>..\..\..\lib\windows</AdditionalLibraryDirectories>
<OutputFile>$(OutDir)tic80$(TargetExt)</OutputFile>
</Link>
@ -274,14 +277,14 @@
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>TIC80_PRO;_CRT_SECURE_NO_WARNINGS;LUA_COMPAT_5_2;WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<AdditionalIncludeDirectories>..\include;..\..\..\include;..\..\..\3rd-party\lua-5.3.1\src;..\..\..\3rd-party\giflib-5.1.4\lib;..\..\..\3rd-party\zlib-1.2.8;..\..\..\3rd-party\SDL2-2.0.7\include;..\..\..\3rd-party\SDL2_net-2.0.1;..\..\..\3rd-party\wren-0.1.0\src\include</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>..\include;..\..\..\include;..\..\..\3rd-party\lua-5.3.1\src;..\..\..\3rd-party\giflib-5.1.4\lib;..\..\..\3rd-party\zlib-1.2.8;..\..\..\3rd-party\SDL2-2.0.7\include;..\..\..\3rd-party\SDL2_net-2.0.1;..\..\..\3rd-party\wren-0.1.0\src\include;..\..\..\3rd-party\sdl-gpu\include</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>ws2_32.lib;version.lib;Imm32.lib;Winmm.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>opengl32.lib;ws2_32.lib;version.lib;Imm32.lib;Winmm.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>..\..\..\lib\windows</AdditionalLibraryDirectories>
<OutputFile>$(OutDir)tic80$(TargetExt)</OutputFile>
</Link>
@ -295,14 +298,14 @@
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;LUA_COMPAT_5_2;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<AdditionalIncludeDirectories>..\include;..\..\..\include;..\..\..\3rd-party\lua-5.3.1\src;..\..\..\3rd-party\giflib-5.1.4\lib;..\..\..\3rd-party\zlib-1.2.8;..\..\..\3rd-party\SDL2-2.0.7\include;..\..\..\3rd-party\SDL2_net-2.0.1;..\..\..\3rd-party\wren-0.1.0\src\include</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>..\include;..\..\..\include;..\..\..\3rd-party\lua-5.3.1\src;..\..\..\3rd-party\giflib-5.1.4\lib;..\..\..\3rd-party\zlib-1.2.8;..\..\..\3rd-party\SDL2-2.0.7\include;..\..\..\3rd-party\SDL2_net-2.0.1;..\..\..\3rd-party\wren-0.1.0\src\include;..\..\..\3rd-party\sdl-gpu\include</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>ws2_32.lib;version.lib;Imm32.lib;Winmm.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>opengl32.lib;ws2_32.lib;version.lib;Imm32.lib;Winmm.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>..\..\..\lib\windows</AdditionalLibraryDirectories>
<OutputFile>$(OutDir)tic80$(TargetExt)</OutputFile>
</Link>
@ -316,14 +319,14 @@
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>TIC80_PRO;_CRT_SECURE_NO_WARNINGS;LUA_COMPAT_5_2;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<AdditionalIncludeDirectories>..\include;..\..\..\include;..\..\..\3rd-party\lua-5.3.1\src;..\..\..\3rd-party\giflib-5.1.4\lib;..\..\..\3rd-party\zlib-1.2.8;..\..\..\3rd-party\SDL2-2.0.7\include;..\..\..\3rd-party\SDL2_net-2.0.1;..\..\..\3rd-party\wren-0.1.0\src\include</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>..\include;..\..\..\include;..\..\..\3rd-party\lua-5.3.1\src;..\..\..\3rd-party\giflib-5.1.4\lib;..\..\..\3rd-party\zlib-1.2.8;..\..\..\3rd-party\SDL2-2.0.7\include;..\..\..\3rd-party\SDL2_net-2.0.1;..\..\..\3rd-party\wren-0.1.0\src\include;..\..\..\3rd-party\sdl-gpu\include</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>ws2_32.lib;version.lib;Imm32.lib;Winmm.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>opengl32.lib;ws2_32.lib;version.lib;Imm32.lib;Winmm.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>..\..\..\lib\windows</AdditionalLibraryDirectories>
<OutputFile>$(OutDir)tic80$(TargetExt)</OutputFile>
</Link>

Binary file not shown.

View File

@ -76,12 +76,27 @@ static void readConfigShowSync(Config* config, lua_State* lua)
lua_pop(lua, 1);
}
static void readConfigUseVsync(Config* config, lua_State* lua)
static void readConfigCrtMonitor(Config* config, lua_State* lua)
{
lua_getglobal(lua, "USE_VSYNC");
lua_getglobal(lua, "CRT_MONITOR");
if(lua_isboolean(lua, -1))
config->data.useVsync = lua_toboolean(lua, -1);
config->data.crtMonitor = lua_toboolean(lua, -1);
lua_pop(lua, 1);
}
static void readConfigCrtShader(Config* config, lua_State* lua)
{
lua_getglobal(lua, "CRT_SHADER");
if(lua_isstring(lua, -1))
{
if(!config->data.crtShader)
config->data.crtShader = calloc(1, sizeof(tic_code));
strcpy((char*)config->data.crtShader, lua_tostring(lua, -1));
}
lua_pop(lua, 1);
}
@ -232,10 +247,15 @@ static void readConfig(Config* config)
readConfigCheckNewVersion(config, lua);
readConfigNoSound(config, lua);
readConfigShowSync(config, lua);
readConfigUseVsync(config, lua);
readConfigCrtMonitor(config, lua);
readTheme(config, lua);
}
if(luaL_loadstring(lua, config->tic->config.bank1.code.data) == LUA_OK && lua_pcall(lua, 0, LUA_MULTRET, 0) == LUA_OK)
{
readConfigCrtShader(config, lua);
}
lua_close(lua);
}
}

View File

@ -277,9 +277,9 @@ static bool AddLoop(GifFileType *gif)
static const u8* toColor(const u8* ptr, gif_color* color)
{
color->b = *ptr++;
color->g = *ptr++;
color->r = *ptr++;
color->g = *ptr++;
color->b = *ptr++;
ptr++;
return ptr;

View File

@ -1300,6 +1300,11 @@ static inline bool keyWasPressedOnce(s32 key)
return tic->api.keyp(tic, key, -1, -1);
}
static void switchCrtMonitor()
{
impl.config->data.crtMonitor = !impl.config->data.crtMonitor;
}
static void processShortcuts()
{
tic_mem* tic = impl.studio.tic;
@ -1310,6 +1315,8 @@ static void processShortcuts()
bool alt = tic->api.key(tic, tic_key_alt);
bool ctrl = tic->api.key(tic, tic_key_ctrl);
if(keyWasPressedOnce(tic_key_f6)) switchCrtMonitor();
if(isGameMenu())
{
if(keyWasPressedOnce(tic_key_escape))
@ -1637,8 +1644,9 @@ void studioConfigChanged()
if(code->update)
code->update(code);
// initTouchGamepad();
updateSystemFont();
getSystem()->updateConfig();
}
u32 unzip(u8** dest, const u8* source, size_t size)
@ -1715,7 +1723,7 @@ static void processMouseStates()
}
}
static void studioTick(void* pixels)
static void studioTick()
{
processShortcuts();
processMouseStates();
@ -1755,15 +1763,17 @@ static void studioTick(void* pixels)
}
tic->api.blit(tic, scanline, overlap, data);
memcpy(pixels, tic->screen, sizeof tic->screen);
recordFrame(pixels);
drawDesyncLabel(pixels);
recordFrame(tic->screen);
drawDesyncLabel(tic->screen);
}
}
static void studioClose()
{
free((void*)getConfig()->crtShader);
{
for(s32 i = 0; i < TIC_EDITOR_BANKS; i++)
{

View File

@ -5,14 +5,15 @@
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <SDL.h>
#include <SDL_gpu.h>
#if defined(__EMSCRIPTEN__)
#include <emscripten.h>
#endif
#define STUDIO_UI_SCALE 3
#define STUDIO_PIXEL_FORMAT SDL_PIXELFORMAT_ARGB8888
#define STUDIO_PIXEL_FORMAT GPU_FORMAT_RGBA
#define TEXTURE_SIZE (TIC80_FULLWIDTH)
#define OFFSET_LEFT ((TIC80_FULLWIDTH-TIC80_WIDTH)/2)
#define OFFSET_TOP ((TIC80_FULLHEIGHT-TIC80_HEIGHT)/2)
@ -22,13 +23,19 @@ static struct
Studio* studio;
SDL_Window* window;
SDL_Renderer* renderer;
SDL_Texture* texture;
struct
{
GPU_Target* screen;
GPU_Image* texture;
u32 shader;
GPU_ShaderBlock block;
} gpu;
struct
{
SDL_Joystick* ports[TIC_GAMEPADS];
SDL_Texture* texture;
GPU_Image* texture;
tic80_gamepads touch;
tic80_gamepads joystick;
@ -50,7 +57,7 @@ static struct
struct
{
SDL_Texture* texture;
GPU_Image* texture;
const u8* src;
} mouse;
@ -116,7 +123,7 @@ static void setWindowIcon()
SDL_Surface* surface = SDL_CreateRGBSurfaceFrom(pixels, Size, Size,
sizeof(s32) * BITS_IN_BYTE, Size * sizeof(s32),
0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000);
0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000);
SDL_SetWindowIcon(platform.window, surface);
SDL_FreeSurface(surface);
@ -151,87 +158,110 @@ static void updateGamepadParts()
platform.gamepad.part.y = (SDL_Point){rect.w - 2*tileSize, 0*tileSize + offset};
}
static void transparentBlit(u32* out, s32 pitch)
{
const u8* in = platform.studio->tic->ram.vram.screen.data;
const u8* end = in + sizeof(platform.studio->tic->ram.vram.screen);
const u32* pal = tic_palette_blit(&platform.studio->tic->config.palette);
const u32 Delta = (pitch/sizeof *out - TIC80_WIDTH);
s32 col = 0;
while(in != end)
{
u8 low = *in & 0x0f;
u8 hi = (*in & 0xf0) >> TIC_PALETTE_BPP;
*out++ = low ? (*(pal + low) | 0xff000000) : 0;
*out++ = hi ? (*(pal + hi) | 0xff000000) : 0;
in++;
col += BITS_IN_BYTE / TIC_PALETTE_BPP;
if (col == TIC80_WIDTH)
{
col = 0;
out += Delta;
}
}
}
static void initTouchGamepad()
{
if (!platform.renderer)
return;
platform.studio->tic->api.map(platform.studio->tic, &platform.studio->tic->config.bank0.map, &platform.studio->tic->config.bank0.tiles, 0, 0, TIC_MAP_SCREEN_WIDTH, TIC_MAP_SCREEN_HEIGHT, 0, 0, -1, 1);
if(!platform.gamepad.texture)
{
platform.gamepad.texture = SDL_CreateTexture(platform.renderer, STUDIO_PIXEL_FORMAT, SDL_TEXTUREACCESS_STREAMING, TEXTURE_SIZE, TEXTURE_SIZE);
SDL_SetTextureBlendMode(platform.gamepad.texture, SDL_BLENDMODE_BLEND);
{
platform.gamepad.texture = GPU_CreateImage(TEXTURE_SIZE, TEXTURE_SIZE, STUDIO_PIXEL_FORMAT);
GPU_SetAnchor(platform.gamepad.texture, 0, 0);
GPU_SetImageFilter(platform.gamepad.texture, GPU_FILTER_NEAREST);
}
u32* data = SDL_malloc(TEXTURE_SIZE * TEXTURE_SIZE * sizeof(u32));
if(data)
{
void* pixels = NULL;
s32 pitch = 0;
u32* out = data;
SDL_LockTexture(platform.gamepad.texture, NULL, &pixels, &pitch);
transparentBlit(pixels, pitch);
SDL_UnlockTexture(platform.gamepad.texture);
const u8* in = platform.studio->tic->ram.vram.screen.data;
const u8* end = in + sizeof(platform.studio->tic->ram.vram.screen);
const u32* pal = tic_palette_blit(&platform.studio->tic->config.palette);
const u32 Delta = ((TIC80_FULLWIDTH*sizeof(u32))/sizeof *out - TIC80_WIDTH);
s32 col = 0;
while(in != end)
{
u8 low = *in & 0x0f;
u8 hi = (*in & 0xf0) >> TIC_PALETTE_BPP;
*out++ = low ? *(pal + low) : 0;
*out++ = hi ? *(pal + hi) : 0;
in++;
col += BITS_IN_BYTE / TIC_PALETTE_BPP;
if (col == TIC80_WIDTH)
{
col = 0;
out += Delta;
}
}
GPU_UpdateImageBytes(platform.gamepad.texture, NULL, (const u8*)data, TEXTURE_SIZE * sizeof(u32));
SDL_free(data);
updateGamepadParts();
}
updateGamepadParts();
}
static void calcTextureRect(SDL_Rect* rect)
{
SDL_GetWindowSize(platform.window, &rect->w, &rect->h);
if (rect->w * TIC80_HEIGHT < rect->h * TIC80_WIDTH)
if(platform.studio->config()->crtMonitor)
{
s32 discreteWidth = rect->w - rect->w % TIC80_WIDTH;
s32 discreteHeight = TIC80_HEIGHT * discreteWidth / TIC80_WIDTH;
enum{Width = TIC80_FULLWIDTH, Height = TIC80_FULLHEIGHT};
rect->x = (rect->w - discreteWidth) / 2;
if (rect->w * Height < rect->h * Width)
{
rect->x = 0;
rect->y = 0;
rect->y = rect->w > rect->h
? (rect->h - discreteHeight) / 2
: OFFSET_LEFT*discreteWidth/TIC80_WIDTH;
rect->h = Height * rect->w / Width;
}
else
{
s32 width = Width * rect->h / Height;
rect->w = discreteWidth;
rect->h = discreteHeight;
rect->x = (rect->w - width) / 2;
rect->y = 0;
rect->w = width;
}
}
else
{
s32 discreteHeight = rect->h - rect->h % TIC80_HEIGHT;
s32 discreteWidth = TIC80_WIDTH * discreteHeight / TIC80_HEIGHT;
enum{Width = TIC80_WIDTH, Height = TIC80_HEIGHT};
rect->x = (rect->w - discreteWidth) / 2;
rect->y = (rect->h - discreteHeight) / 2;
if (rect->w * Height < rect->h * Width)
{
s32 discreteWidth = rect->w - rect->w % Width;
s32 discreteHeight = Height * discreteWidth / Width;
rect->w = discreteWidth;
rect->h = discreteHeight;
rect->x = (rect->w - discreteWidth) / 2;
rect->y = rect->w > rect->h
? (rect->h - discreteHeight) / 2
: OFFSET_TOP*discreteWidth/Width;
rect->w = discreteWidth;
rect->h = discreteHeight;
}
else
{
s32 discreteHeight = rect->h - rect->h % Height;
s32 discreteWidth = Width * discreteHeight / Height;
rect->x = (rect->w - discreteWidth) / 2;
rect->y = (rect->h - discreteHeight) / 2;
rect->w = discreteWidth;
rect->h = discreteHeight;
}
}
}
@ -248,8 +278,16 @@ static void processMouse()
SDL_Rect rect = {0, 0, 0, 0};
calcTextureRect(&rect);
if(rect.w) input->mouse.x = (mx - rect.x) * TIC80_WIDTH / rect.w;
if(rect.h) input->mouse.y = (my - rect.y) * TIC80_HEIGHT / rect.h;
if(platform.studio->config()->crtMonitor)
{
if(rect.w) input->mouse.x = (mx - rect.x) * TIC80_FULLWIDTH / rect.w - OFFSET_LEFT;
if(rect.h) input->mouse.y = (my - rect.y) * TIC80_FULLHEIGHT / rect.h - OFFSET_TOP;
}
else
{
if(rect.w) input->mouse.x = (mx - rect.x) * TIC80_WIDTH / rect.w;
if(rect.h) input->mouse.y = (my - rect.y) * TIC80_HEIGHT / rect.h;
}
}
{
@ -300,7 +338,7 @@ static bool checkTouch(const SDL_Rect* rect, s32* x, s32* y)
if (!platform.gamepad.show)
{
platform.gamepad.alpha = platform.studio->config()->theme.gamepad.touch.alpha;
SDL_SetTextureAlphaMod(platform.gamepad.texture, platform.gamepad.alpha);
GPU_SetRGBA(platform.gamepad.texture, 0xff, 0xff, 0xff, platform.gamepad.alpha);
platform.gamepad.show = true;
return false;
}
@ -558,7 +596,14 @@ static void pollEvent()
case SDL_WINDOWEVENT:
switch(event.window.event)
{
case SDL_WINDOWEVENT_RESIZED: updateGamepadParts(); break;
case SDL_WINDOWEVENT_RESIZED:
{
s32 w = 0, h = 0;
SDL_GetWindowSize(platform.window, &w, &h);
GPU_SetWindowResolution(w, h);
updateGamepadParts(); break;
}
case SDL_WINDOWEVENT_FOCUS_GAINED: platform.studio->updateProject(); break;
}
break;
@ -575,56 +620,38 @@ static void pollEvent()
processGamepad();
}
static void blitTexture()
static void blitGpuTexture(GPU_Target* screen, GPU_Image* texture)
{
SDL_Rect rect = {0, 0, 0, 0};
calcTextureRect(&rect);
void* pixels = NULL;
s32 pitch = 0;
SDL_LockTexture(platform.texture, NULL, &pixels, &pitch);
enum {Header = OFFSET_TOP, Top = OFFSET_TOP, Left = OFFSET_LEFT};
platform.studio->tick(pixels);
SDL_UnlockTexture(platform.texture);
s32 width = 0;
SDL_GetWindowSize(platform.window, &width, NULL);
{
enum {Header = OFFSET_TOP};
SDL_Rect srcRect = {0, 0, TIC80_FULLWIDTH, Header};
SDL_Rect dstRect = {0};
SDL_GetWindowSize(platform.window, &dstRect.w, &dstRect.h);
dstRect.h = rect.y;
SDL_RenderCopy(platform.renderer, platform.texture, &srcRect, &dstRect);
GPU_Rect srcRect = {0, 0, TIC80_FULLWIDTH, Header};
GPU_Rect dstRect = {0, 0, width, rect.y};
GPU_BlitScale(texture, &srcRect, screen, dstRect.x, dstRect.y, dstRect.w / srcRect.w, dstRect.h / srcRect.h);
}
{
enum {Header = OFFSET_TOP};
SDL_Rect srcRect = {0, TIC80_FULLHEIGHT - Header, TIC80_FULLWIDTH, Header};
SDL_Rect dstRect = {0};
SDL_GetWindowSize(platform.window, &dstRect.w, &dstRect.h);
dstRect.y = rect.y + rect.h;
dstRect.h = rect.y;
SDL_RenderCopy(platform.renderer, platform.texture, &srcRect, &dstRect);
GPU_Rect srcRect = {0, TIC80_FULLHEIGHT - Header, TIC80_FULLWIDTH, Header};
GPU_Rect dstRect = {0, rect.y + rect.h, width, rect.y};
GPU_BlitScale(texture, &srcRect, screen, dstRect.x, dstRect.y, dstRect.w / srcRect.w, dstRect.h / srcRect.h);
}
{
enum {Header = OFFSET_TOP};
enum {Left = OFFSET_LEFT};
SDL_Rect srcRect = {0, Header, Left, TIC80_HEIGHT};
SDL_Rect dstRect = {0};
SDL_GetWindowSize(platform.window, &dstRect.w, &dstRect.h);
dstRect.y = rect.y;
dstRect.h = rect.h;
SDL_RenderCopy(platform.renderer, platform.texture, &srcRect, &dstRect);
GPU_Rect srcRect = {0, Header, Left, TIC80_HEIGHT};
GPU_Rect dstRect = {0, rect.y, width, rect.h};
GPU_BlitScale(texture, &srcRect, screen, dstRect.x, dstRect.y, dstRect.w / srcRect.w, dstRect.h / srcRect.h);
}
{
enum {Top = OFFSET_TOP};
enum {Left = OFFSET_LEFT};
SDL_Rect srcRect = {Left, Top, TIC80_WIDTH, TIC80_HEIGHT};
SDL_RenderCopy(platform.renderer, platform.texture, &srcRect, &rect);
GPU_Rect srcRect = {Left, Top, TIC80_WIDTH, TIC80_HEIGHT};
GPU_Rect dstRect = {rect.x, rect.y, rect.w, rect.h};
GPU_BlitScale(texture, &srcRect, screen, dstRect.x, dstRect.y, dstRect.w / srcRect.w, dstRect.h / srcRect.h);
}
}
@ -668,10 +695,11 @@ static void renderGamepad()
for(s32 i = 0; i < COUNT_OF(Tiles); i++)
{
const Tile* tile = Tiles + i;
SDL_Rect src = {(tile->press ? ButtonsCount + i : i) * TIC_SPRITESIZE, 0, TIC_SPRITESIZE, TIC_SPRITESIZE};
SDL_Rect dest = {tile->x, tile->y, tileSize, tileSize};
GPU_Rect src = {(tile->press ? ButtonsCount + i : i) * TIC_SPRITESIZE, 0, TIC_SPRITESIZE, TIC_SPRITESIZE};
GPU_Rect dest = {tile->x, tile->y, tileSize, tileSize};
SDL_RenderCopy(platform.renderer, platform.gamepad.texture, &src, &dest);
GPU_BlitScale(platform.gamepad.texture, &src, platform.gpu.screen, dest.x, dest.y,
(float)dest.w / TIC_SPRITESIZE, (float)dest.h / TIC_SPRITESIZE);
}
if(!platform.gamepad.show && platform.gamepad.alpha)
@ -681,7 +709,7 @@ static void renderGamepad()
if(platform.gamepad.alpha - Step >= 0) platform.gamepad.alpha -= Step;
else platform.gamepad.alpha = 0;
SDL_SetTextureAlphaMod(platform.gamepad.texture, platform.gamepad.alpha);
GPU_SetRGBA(platform.gamepad.texture, 0xff, 0xff, 0xff, platform.gamepad.alpha);
}
platform.gamepad.counter = platform.gamepad.touch.data ? 0 : platform.gamepad.counter+1;
@ -695,54 +723,48 @@ static void blitCursor(const u8* in)
{
if(!platform.mouse.texture)
{
platform.mouse.texture = SDL_CreateTexture(platform.renderer, STUDIO_PIXEL_FORMAT, SDL_TEXTUREACCESS_STREAMING, TIC_SPRITESIZE, TIC_SPRITESIZE);
SDL_SetTextureBlendMode(platform.mouse.texture, SDL_BLENDMODE_BLEND);
platform.mouse.texture = GPU_CreateImage(TIC_SPRITESIZE, TIC_SPRITESIZE, STUDIO_PIXEL_FORMAT);
GPU_SetAnchor(platform.mouse.texture, 0, 0);
GPU_SetImageFilter(platform.mouse.texture, GPU_FILTER_NEAREST);
}
if(platform.mouse.src != in)
{
platform.mouse.src = in;
void* pixels = NULL;
s32 pitch = 0;
SDL_LockTexture(platform.mouse.texture, NULL, &pixels, &pitch);
const u8* end = in + sizeof(tic_tile);
const u32* pal = tic_palette_blit(&platform.studio->tic->ram.vram.palette);
static u32 data[TIC_SPRITESIZE*TIC_SPRITESIZE];
u32* out = data;
while(in != end)
{
const u8* end = in + sizeof(tic_tile);
const u32* pal = tic_palette_blit(&platform.studio->tic->ram.vram.palette);
u32* out = pixels;
u8 low = *in & 0x0f;
u8 hi = (*in & 0xf0) >> TIC_PALETTE_BPP;
*out++ = low ? *(pal + low) : 0;
*out++ = hi ? *(pal + hi) : 0;
while(in != end)
{
u8 low = *in & 0x0f;
u8 hi = (*in & 0xf0) >> TIC_PALETTE_BPP;
*out++ = low ? (*(pal + low) | 0xff000000) : 0;
*out++ = hi ? (*(pal + hi) | 0xff000000) : 0;
in++;
}
in++;
}
SDL_UnlockTexture(platform.mouse.texture);
GPU_UpdateImageBytes(platform.mouse.texture, NULL, (const u8*)data, TIC_SPRITESIZE * sizeof(u32));
}
SDL_Rect rect = {0, 0, 0, 0};
calcTextureRect(&rect);
s32 scale = rect.w / TIC80_WIDTH;
SDL_Rect src = {0, 0, TIC_SPRITESIZE, TIC_SPRITESIZE};
SDL_Rect dst = {0, 0, TIC_SPRITESIZE * scale, TIC_SPRITESIZE * scale};
SDL_GetMouseState(&dst.x, &dst.y);
s32 mx, my;
SDL_GetMouseState(&mx, &my);
if(platform.studio->config()->theme.cursor.pixelPerfect)
{
dst.x -= (dst.x - rect.x) % scale;
dst.y -= (dst.y - rect.y) % scale;
mx -= (mx - rect.x) % scale;
my -= (my - rect.y) % scale;
}
if(SDL_GetWindowFlags(platform.window) & SDL_WINDOW_MOUSE_FOCUS)
SDL_RenderCopy(platform.renderer, platform.mouse.texture, &src, &dst);
GPU_BlitScale(platform.mouse.texture, NULL, platform.gpu.screen, mx, my, (float)scale, (float)scale);
}
static void renderCursor()
@ -807,29 +829,6 @@ static void renderCursor()
// }
}
static void tick()
{
pollEvent();
if(platform.studio->quit)
{
#if defined __EMSCRIPTEN__
emscripten_cancel_main_loop();
#endif
return;
}
SDL_RenderClear(platform.renderer);
blitTexture();
renderCursor();
renderGamepad();
SDL_RenderPresent(platform.renderer);
blitSound();
}
static const char* getAppFolder()
{
static char appFolder[FILENAME_MAX];
@ -883,7 +882,7 @@ static u64 getPerformanceFrequency()
static void goFullscreen()
{
SDL_SetWindowFullscreen(platform.window, SDL_GetWindowFlags(platform.window) & SDL_WINDOW_FULLSCREEN_DESKTOP ? 0 : SDL_WINDOW_FULLSCREEN_DESKTOP);
GPU_SetFullscreen(GPU_GetFullscreen() ? false : true, true);
}
static void showMessageBox(const char* title, const char* message)
@ -946,6 +945,73 @@ static void preseed()
#endif
}
static void loadCrtShader()
{
static const char* VertexShader = "#version 100\n\
precision highp float;\n\
precision mediump int;\n\
attribute vec2 gpu_Vertex;\n\
attribute vec2 gpu_TexCoord;\n\
attribute mediump vec4 gpu_Color;\n\
uniform mat4 gpu_ModelViewProjectionMatrix;\n\
varying mediump vec4 color;\n\
varying vec2 texCoord;\n\
void main(void)\n\
{\n\
color = gpu_Color;\n\
texCoord = vec2(gpu_TexCoord);\n\
gl_Position = gpu_ModelViewProjectionMatrix * vec4(gpu_Vertex, 0.0, 1.0);\n\
}";
u32 vertex = GPU_CompileShader(GPU_VERTEX_SHADER, VertexShader);
if(!vertex)
{
char msg[1024];
sprintf(msg, "Failed to load vertex shader: %s\n", GPU_GetShaderMessage());
showMessageBox("Error", msg);
return;
}
u32 fragment = GPU_CompileShader(GPU_PIXEL_SHADER, platform.studio->config()->crtShader);
if(!fragment)
{
char msg[1024];
sprintf(msg, "Failed to load fragment shader: %s\n", GPU_GetShaderMessage());
showMessageBox("Error", msg);
return;
}
if(platform.gpu.shader)
GPU_FreeShaderProgram(platform.gpu.shader);
platform.gpu.shader = GPU_LinkShaders(vertex, fragment);
if(platform.gpu.shader)
{
platform.gpu.block = GPU_LoadShaderBlock(platform.gpu.shader, "gpu_Vertex", "gpu_TexCoord", "gpu_Color", "gpu_ModelViewProjectionMatrix");
GPU_ActivateShaderProgram(platform.gpu.shader, &platform.gpu.block);
}
else
{
char msg[1024];
sprintf(msg, "Failed to link shader program: %s\n", GPU_GetShaderMessage());
showMessageBox("Error", msg);
}
}
static void updateConfig()
{
if(platform.gpu.screen)
{
initTouchGamepad();
if(platform.studio->config()->crtMonitor)
loadCrtShader();
}
}
static System systemInterface =
{
.setClipboardText = setClipboardText,
@ -966,11 +1032,74 @@ static System systemInterface =
.openSystemPath = openSystemPath,
.preseed = preseed,
.poll = pollEvent,
.updateConfig = updateConfig,
};
static void gpuTick()
{
tic_mem* tic = platform.studio->tic;
pollEvent();
if(platform.studio->quit)
{
#if defined __EMSCRIPTEN__
emscripten_cancel_main_loop();
#endif
return;
}
GPU_Clear(platform.gpu.screen);
{
platform.studio->tick();
GPU_UpdateImageBytes(platform.gpu.texture, NULL, (const u8*)tic->screen, TIC80_FULLWIDTH * sizeof(u32));
{
if(platform.studio->config()->crtMonitor && platform.gpu.shader)
{
SDL_Rect rect = {0, 0, 0, 0};
calcTextureRect(&rect);
GPU_ActivateShaderProgram(platform.gpu.shader, &platform.gpu.block);
GPU_SetUniformf(GPU_GetUniformLocation(platform.gpu.shader, "trg_x"), rect.x);
GPU_SetUniformf(GPU_GetUniformLocation(platform.gpu.shader, "trg_y"), rect.y);
GPU_SetUniformf(GPU_GetUniformLocation(platform.gpu.shader, "trg_w"), rect.w);
GPU_SetUniformf(GPU_GetUniformLocation(platform.gpu.shader, "trg_h"), rect.h);
{
s32 w, h;
SDL_GetWindowSize(platform.window, &w, &h);
GPU_SetUniformf(GPU_GetUniformLocation(platform.gpu.shader, "scr_w"), w);
GPU_SetUniformf(GPU_GetUniformLocation(platform.gpu.shader, "scr_h"), h);
}
GPU_BlitScale(platform.gpu.texture, NULL, platform.gpu.screen, rect.x, rect.y,
(float)rect.w / TIC80_FULLWIDTH, (float)rect.h / TIC80_FULLHEIGHT);
GPU_DeactivateShaderProgram();
}
else
{
GPU_DeactivateShaderProgram();
blitGpuTexture(platform.gpu.screen, platform.gpu.texture);
}
}
renderCursor();
renderGamepad();
}
GPU_Flip(platform.gpu.screen);
blitSound();
}
#if defined(__EMSCRIPTEN__)
static void emstick()
static void emsGpuTick()
{
static double nextTick = -1.0;
@ -980,7 +1109,7 @@ static void emstick()
nextTick = emscripten_get_now();
nextTick += 1000.0/TIC_FRAMERATE;
tick();
gpuTick();
double delay = nextTick - emscripten_get_now();
if(delay < 0.0)
@ -996,44 +1125,37 @@ static void emstick()
static s32 start(s32 argc, char **argv, const char* folder)
{
SDL_SetHint(SDL_HINT_WINRT_HANDLE_BACK_BUTTON, "1");
SDL_SetHint(SDL_HINT_ACCELEROMETER_AS_JOYSTICK, "0");
SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_JOYSTICK);
initSound();
platform.net = createNet();
platform.window = SDL_CreateWindow( TIC_TITLE, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
(TIC80_FULLWIDTH) * STUDIO_UI_SCALE,
(TIC80_FULLHEIGHT) * STUDIO_UI_SCALE,
SDL_WINDOW_SHOWN | SDL_WINDOW_RESIZABLE
#if defined(__CHIP__)
| SDL_WINDOW_FULLSCREEN_DESKTOP
#endif
);
platform.studio = studioInit(argc, argv, platform.audio.spec.freq, folder, &systemInterface);
// set the window icon before renderer is created (issues on Linux)
enum{Width = TIC80_FULLWIDTH * STUDIO_UI_SCALE, Height = TIC80_FULLHEIGHT * STUDIO_UI_SCALE};
platform.window = SDL_CreateWindow( TIC_TITLE, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
Width, Height, SDL_WINDOW_SHOWN | SDL_WINDOW_RESIZABLE| SDL_WINDOW_OPENGL);
setWindowIcon();
platform.renderer = SDL_CreateRenderer(platform.window, -1,
#if defined(__CHIP__)
SDL_RENDERER_SOFTWARE
#else
SDL_RENDERER_ACCELERATED | (platform.studio->config()->useVsync ? SDL_RENDERER_PRESENTVSYNC : 0)
#endif
);
GPU_SetInitWindow(SDL_GetWindowID(platform.window));
platform.texture = SDL_CreateTexture(platform.renderer, STUDIO_PIXEL_FORMAT, SDL_TEXTUREACCESS_STREAMING, TEXTURE_SIZE, TEXTURE_SIZE);
platform.gpu.screen = GPU_Init(Width, Height, GPU_INIT_DISABLE_VSYNC);
initTouchGamepad();
platform.gpu.texture = GPU_CreateImage(TIC80_FULLWIDTH, TIC80_FULLHEIGHT, STUDIO_PIXEL_FORMAT);
GPU_SetAnchor(platform.gpu.texture, 0, 0);
GPU_SetImageFilter(platform.gpu.texture, GPU_FILTER_NEAREST);
if(platform.studio->config()->crtMonitor)
loadCrtShader();
#if defined(__EMSCRIPTEN__)
emscripten_set_main_loop(platform.studio->config()->useVsync ? tick : emstick, 0, 1);
emscripten_set_main_loop(emsGpuTick, 0, 1);
#else
{
@ -1045,8 +1167,8 @@ static s32 start(s32 argc, char **argv, const char* folder)
platform.missedFrame = false;
nextTick += Delta;
tick();
gpuTick();
{
s64 delay = nextTick - SDL_GetPerformanceCounter();
@ -1070,17 +1192,22 @@ static s32 start(s32 argc, char **argv, const char* folder)
if(platform.audio.cvt.buf)
SDL_free(platform.audio.cvt.buf);
if(platform.gpu.shader)
GPU_FreeShaderProgram(platform.gpu.shader);
GPU_FreeImage(platform.gpu.texture);
if(platform.gamepad.texture)
GPU_FreeImage(platform.gamepad.texture);
if(platform.mouse.texture)
SDL_DestroyTexture(platform.mouse.texture);
GPU_FreeImage(platform.mouse.texture);
SDL_DestroyTexture(platform.gamepad.texture);
SDL_DestroyTexture(platform.texture);
SDL_DestroyRenderer(platform.renderer);
SDL_DestroyWindow(platform.window);
SDL_CloseAudioDevice(platform.audio.device);
GPU_Quit();
return 0;
}

View File

@ -25,6 +25,8 @@ typedef struct
void (*preseed)();
void (*poll)();
void (*updateConfig)();
} System;
typedef struct
@ -66,8 +68,10 @@ typedef struct
bool checkNewVersion;
bool noSound;
bool useVsync;
bool showSync;
bool crtMonitor;
const char* crtShader;
} StudioConfig;
@ -76,7 +80,7 @@ typedef struct
tic_mem* tic;
bool quit;
void (*tick)(void* pixels);
void (*tick)();
void (*exit)();
void (*close)();
void (*updateProject)();

673
src/system/chip.c Normal file
View File

@ -0,0 +1,673 @@
#include "../system.h"
#include "../net.h"
#include "../tools.h"
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <SDL.h>
#define STUDIO_UI_SCALE 2
#define STUDIO_PIXEL_FORMAT SDL_PIXELFORMAT_ABGR8888
#define TEXTURE_SIZE (TIC80_FULLWIDTH)
#define OFFSET_LEFT ((TIC80_FULLWIDTH-TIC80_WIDTH)/2)
#define OFFSET_TOP ((TIC80_FULLHEIGHT-TIC80_HEIGHT)/2)
static struct
{
Studio* studio;
SDL_Window* window;
SDL_Renderer* renderer;
SDL_Texture* texture;
struct
{
SDL_Joystick* ports[TIC_GAMEPADS];
tic80_gamepads joystick;
} gamepad;
struct
{
SDL_Texture* texture;
const u8* src;
} mouse;
Net* net;
struct
{
SDL_AudioSpec spec;
SDL_AudioDeviceID device;
SDL_AudioCVT cvt;
} audio;
} platform;
static void initSound()
{
SDL_AudioSpec want =
{
.freq = 44100,
.format = AUDIO_S16,
.channels = 1,
.userdata = NULL,
};
platform.audio.device = SDL_OpenAudioDevice(NULL, 0, &want, &platform.audio.spec, SDL_AUDIO_ALLOW_ANY_CHANGE);
SDL_BuildAudioCVT(&platform.audio.cvt, want.format, want.channels, platform.audio.spec.freq, platform.audio.spec.format, platform.audio.spec.channels, platform.audio.spec.freq);
if(platform.audio.cvt.needed)
{
platform.audio.cvt.len = platform.audio.spec.freq * sizeof(s16) / TIC_FRAMERATE;
platform.audio.cvt.buf = SDL_malloc(platform.audio.cvt.len * platform.audio.cvt.len_mult);
}
}
static u8* getSpritePtr(tic_tile* tiles, s32 x, s32 y)
{
enum { SheetCols = (TIC_SPRITESHEET_SIZE / TIC_SPRITESIZE) };
return tiles[x / TIC_SPRITESIZE + y / TIC_SPRITESIZE * SheetCols].data;
}
static u8 getSpritePixel(tic_tile* tiles, s32 x, s32 y)
{
return tic_tool_peek4(getSpritePtr(tiles, x, y), (x % TIC_SPRITESIZE) + (y % TIC_SPRITESIZE) * TIC_SPRITESIZE);
}
static void calcTextureRect(SDL_Rect* rect)
{
SDL_GetWindowSize(platform.window, &rect->w, &rect->h);
{
enum{Width = TIC80_WIDTH, Height = TIC80_HEIGHT};
s32 discreteHeight = rect->h - rect->h % Height;
s32 discreteWidth = Width * discreteHeight / Height;
rect->x = (rect->w - discreteWidth) / 2;
rect->y = (rect->h - discreteHeight) / 2;
rect->w = discreteWidth;
rect->h = discreteHeight;
}
}
static void processMouse()
{
s32 mx = 0, my = 0;
s32 mb = SDL_GetMouseState(&mx, &my);
tic80_input* input = &platform.studio->tic->ram.input;
{
input->mouse.x = input->mouse.y = 0;
SDL_Rect rect = {0, 0, 0, 0};
calcTextureRect(&rect);
if(rect.w) input->mouse.x = (mx - rect.x) * TIC80_WIDTH / rect.w;
if(rect.h) input->mouse.y = (my - rect.y) * TIC80_HEIGHT / rect.h;
}
{
input->mouse.left = mb & SDL_BUTTON_LMASK ? 1 : 0;
input->mouse.middle = mb & SDL_BUTTON_MMASK ? 1 : 0;
input->mouse.right = mb & SDL_BUTTON_RMASK ? 1 : 0;
}
}
static void processKeyboard()
{
static const u8 KeyboardCodes[] =
{
#include "../keycodes.c"
};
tic80_input* input = &platform.studio->tic->ram.input;
input->keyboard.data = 0;
const u8* keyboard = SDL_GetKeyboardState(NULL);
for(s32 i = 0, c = 0; i < COUNT_OF(KeyboardCodes) && c < COUNT_OF(input->keyboard.keys); i++)
if(keyboard[i] && KeyboardCodes[i] > tic_key_unknown)
input->keyboard.keys[c++] = KeyboardCodes[i];
}
static s32 getAxisMask(SDL_Joystick* joystick)
{
s32 mask = 0;
s32 axesCount = SDL_JoystickNumAxes(joystick);
for (s32 a = 0; a < axesCount; a++)
{
s32 axe = SDL_JoystickGetAxis(joystick, a);
if (axe)
{
if (a == 0)
{
if (axe > 16384) mask |= SDL_HAT_RIGHT;
else if(axe < -16384) mask |= SDL_HAT_LEFT;
}
else if (a == 1)
{
if (axe > 16384) mask |= SDL_HAT_DOWN;
else if (axe < -16384) mask |= SDL_HAT_UP;
}
}
}
return mask;
}
static s32 getJoystickHatMask(s32 hat)
{
tic80_gamepads gamepad;
gamepad.data = 0;
gamepad.first.up = hat & SDL_HAT_UP;
gamepad.first.down = hat & SDL_HAT_DOWN;
gamepad.first.left = hat & SDL_HAT_LEFT;
gamepad.first.right = hat & SDL_HAT_RIGHT;
return gamepad.data;
}
static void processJoysticks()
{
platform.gamepad.joystick.data = 0;
s32 index = 0;
for(s32 i = 0; i < COUNT_OF(platform.gamepad.ports); i++)
{
SDL_Joystick* joystick = platform.gamepad.ports[i];
if(joystick && SDL_JoystickGetAttached(joystick))
{
tic80_gamepad* gamepad = NULL;
switch(index)
{
case 0: gamepad = &platform.gamepad.joystick.first; break;
case 1: gamepad = &platform.gamepad.joystick.second; break;
case 2: gamepad = &platform.gamepad.joystick.third; break;
case 3: gamepad = &platform.gamepad.joystick.fourth; break;
}
if(gamepad)
{
gamepad->data |= getJoystickHatMask(getAxisMask(joystick));
for (s32 h = 0; h < SDL_JoystickNumHats(joystick); h++)
gamepad->data |= getJoystickHatMask(SDL_JoystickGetHat(joystick, h));
s32 numButtons = SDL_JoystickNumButtons(joystick);
if(numButtons >= 2)
{
gamepad->a = SDL_JoystickGetButton(joystick, 0);
gamepad->b = SDL_JoystickGetButton(joystick, 1);
if(numButtons >= 4)
{
gamepad->x = SDL_JoystickGetButton(joystick, 2);
gamepad->y = SDL_JoystickGetButton(joystick, 3);
for(s32 i = 5; i < numButtons; i++)
{
s32 back = SDL_JoystickGetButton(joystick, i);
if(back)
{
tic_mem* tic = platform.studio->tic;
for(s32 i = 0; i < TIC80_KEY_BUFFER; i++)
{
if(!tic->ram.input.keyboard.keys[i])
{
tic->ram.input.keyboard.keys[i] = tic_key_escape;
break;
}
}
}
}
}
}
index++;
}
}
}
}
static void processGamepad()
{
processJoysticks();
{
platform.studio->tic->ram.input.gamepads.data = 0;
platform.studio->tic->ram.input.gamepads.data |= platform.gamepad.joystick.data;
}
}
static void pollEvent()
{
tic80_input* input = &platform.studio->tic->ram.input;
{
input->mouse.btns = 0;
}
SDL_Event event;
while(SDL_PollEvent(&event))
{
switch(event.type)
{
case SDL_MOUSEWHEEL:
{
input->mouse.scrollx = event.wheel.x;
input->mouse.scrolly = event.wheel.y;
}
break;
case SDL_JOYDEVICEADDED:
{
s32 id = event.jdevice.which;
if (id < TIC_GAMEPADS)
{
if(platform.gamepad.ports[id])
SDL_JoystickClose(platform.gamepad.ports[id]);
platform.gamepad.ports[id] = SDL_JoystickOpen(id);
}
}
break;
case SDL_JOYDEVICEREMOVED:
{
s32 id = event.jdevice.which;
if (id < TIC_GAMEPADS && platform.gamepad.ports[id])
{
SDL_JoystickClose(platform.gamepad.ports[id]);
platform.gamepad.ports[id] = NULL;
}
}
break;
case SDL_WINDOWEVENT:
switch(event.window.event)
{
case SDL_WINDOWEVENT_FOCUS_GAINED: platform.studio->updateProject(); break;
}
break;
case SDL_QUIT:
platform.studio->exit();
break;
default:
break;
}
}
processMouse();
processKeyboard();
processGamepad();
}
static void blitTexture()
{
tic_mem* tic = platform.studio->tic;
SDL_Rect rect = {0, 0, 0, 0};
calcTextureRect(&rect);
void* pixels = NULL;
s32 pitch = 0;
SDL_LockTexture(platform.texture, NULL, &pixels, &pitch);
platform.studio->tick();
memcpy(pixels, tic->screen, sizeof tic->screen);
SDL_UnlockTexture(platform.texture);
{
enum {Top = OFFSET_TOP};
enum {Left = OFFSET_LEFT};
SDL_Rect srcRect = {Left, Top, TIC80_WIDTH, TIC80_HEIGHT};
SDL_RenderCopy(platform.renderer, platform.texture, &srcRect, &rect);
}
}
static void blitSound()
{
tic_mem* tic = platform.studio->tic;
SDL_PauseAudioDevice(platform.audio.device, 0);
if(platform.audio.cvt.needed)
{
SDL_memcpy(platform.audio.cvt.buf, tic->samples.buffer, tic->samples.size);
SDL_ConvertAudio(&platform.audio.cvt);
SDL_QueueAudio(platform.audio.device, platform.audio.cvt.buf, platform.audio.cvt.len_cvt);
}
else SDL_QueueAudio(platform.audio.device, tic->samples.buffer, tic->samples.size);
}
static void blitCursor(const u8* in)
{
if(!platform.mouse.texture)
{
platform.mouse.texture = SDL_CreateTexture(platform.renderer, STUDIO_PIXEL_FORMAT, SDL_TEXTUREACCESS_STREAMING, TIC_SPRITESIZE, TIC_SPRITESIZE);
SDL_SetTextureBlendMode(platform.mouse.texture, SDL_BLENDMODE_BLEND);
}
if(platform.mouse.src != in)
{
platform.mouse.src = in;
void* pixels = NULL;
s32 pitch = 0;
SDL_LockTexture(platform.mouse.texture, NULL, &pixels, &pitch);
{
const u8* end = in + sizeof(tic_tile);
const u32* pal = tic_palette_blit(&platform.studio->tic->ram.vram.palette);
u32* out = pixels;
while(in != end)
{
u8 low = *in & 0x0f;
u8 hi = (*in & 0xf0) >> TIC_PALETTE_BPP;
*out++ = low ? (*(pal + low) | 0xff000000) : 0;
*out++ = hi ? (*(pal + hi) | 0xff000000) : 0;
in++;
}
}
SDL_UnlockTexture(platform.mouse.texture);
}
SDL_Rect rect = {0, 0, 0, 0};
calcTextureRect(&rect);
s32 scale = rect.w / TIC80_WIDTH;
SDL_Rect src = {0, 0, TIC_SPRITESIZE, TIC_SPRITESIZE};
SDL_Rect dst = {0, 0, TIC_SPRITESIZE * scale, TIC_SPRITESIZE * scale};
SDL_GetMouseState(&dst.x, &dst.y);
if(platform.studio->config()->theme.cursor.pixelPerfect)
{
dst.x -= (dst.x - rect.x) % scale;
dst.y -= (dst.y - rect.y) % scale;
}
if(SDL_GetWindowFlags(platform.window) & SDL_WINDOW_MOUSE_FOCUS)
SDL_RenderCopy(platform.renderer, platform.mouse.texture, &src, &dst);
}
static void renderCursor()
{
if(platform.studio->tic->ram.vram.vars.cursor.system)
{
switch(platform.studio->tic->ram.vram.vars.cursor.sprite)
{
case tic_cursor_hand:
{
if(platform.studio->config()->theme.cursor.hand >= 0)
{
SDL_ShowCursor(SDL_DISABLE);
blitCursor(platform.studio->tic->config.bank0.tiles.data[platform.studio->config()->theme.cursor.hand].data);
}
else
{
SDL_ShowCursor(SDL_ENABLE);
SDL_SetCursor(SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_HAND));
}
}
break;
case tic_cursor_ibeam:
{
if(platform.studio->config()->theme.cursor.ibeam >= 0)
{
SDL_ShowCursor(SDL_DISABLE);
blitCursor(platform.studio->tic->config.bank0.tiles.data[platform.studio->config()->theme.cursor.ibeam].data);
}
else
{
SDL_ShowCursor(SDL_ENABLE);
SDL_SetCursor(SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_IBEAM));
}
}
break;
default:
{
if(platform.studio->config()->theme.cursor.arrow >= 0)
{
SDL_ShowCursor(SDL_DISABLE);
blitCursor(platform.studio->tic->config.bank0.tiles.data[platform.studio->config()->theme.cursor.arrow].data);
}
else
{
SDL_ShowCursor(SDL_ENABLE);
SDL_SetCursor(SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_ARROW));
}
}
}
}
else
{
SDL_ShowCursor(SDL_DISABLE);
blitCursor(platform.studio->tic->ram.sprites.data[platform.studio->tic->ram.vram.vars.cursor.sprite].data);
}
// if(platform.mode == TIC_RUN_MODE && !platform.studio.tic->input.mouse)
// {
// SDL_ShowCursor(SDL_DISABLE);
// return;
// }
}
static void tick()
{
pollEvent();
if(platform.studio->quit)
return;
SDL_RenderClear(platform.renderer);
blitTexture();
renderCursor();
SDL_RenderPresent(platform.renderer);
blitSound();
}
static const char* getAppFolder()
{
static char appFolder[FILENAME_MAX];
char* path = SDL_GetPrefPath(TIC_PACKAGE, TIC_NAME);
strcpy(appFolder, path);
SDL_free(path);
return appFolder;
}
static void setClipboardText(const char* text)
{
SDL_SetClipboardText(text);
}
static bool hasClipboardText()
{
return SDL_HasClipboardText();
}
static char* getClipboardText()
{
return SDL_GetClipboardText();
}
static u64 getPerformanceCounter()
{
return SDL_GetPerformanceCounter();
}
static u64 getPerformanceFrequency()
{
return SDL_GetPerformanceFrequency();
}
static void goFullscreen()
{
SDL_SetWindowFullscreen(platform.window, SDL_GetWindowFlags(platform.window) & SDL_WINDOW_FULLSCREEN_DESKTOP ? 0 : SDL_WINDOW_FULLSCREEN_DESKTOP);
}
static void showMessageBox(const char* title, const char* message)
{
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_WARNING, title, message, NULL);
}
static void setWindowTitle(const char* title)
{
SDL_SetWindowTitle(platform.window, title);
}
#if defined(__WINDOWS__) || defined(__LINUX__) || defined(__MACOSX__)
static void openSystemPath(const char* path)
{
char command[FILENAME_MAX];
#if defined(__WINDOWS__)
sprintf(command, "explorer \"%s\"", path);
wchar_t wcommand[FILENAME_MAX];
mbstowcs(wcommand, command, FILENAME_MAX);
_wsystem(wcommand);
#elif defined(__LINUX__)
sprintf(command, "xdg-open \"%s\"", path);
system(command);
#elif defined(__MACOSX__)
sprintf(command, "open \"%s\"", path);
system(command);
#endif
}
#else
static void openSystemPath(const char* path) {}
#endif
static void* getUrlRequest(const char* url, s32* size)
{
return netGetRequest(platform.net, url, size);
}
static void preseed()
{
#if defined(__MACOSX__)
srandom(time(NULL));
random();
#else
srand(time(NULL));
rand();
#endif
}
static System systemInterface =
{
.setClipboardText = setClipboardText,
.hasClipboardText = hasClipboardText,
.getClipboardText = getClipboardText,
.getPerformanceCounter = getPerformanceCounter,
.getPerformanceFrequency = getPerformanceFrequency,
.getUrlRequest = getUrlRequest,
.fileDialogLoad = file_dialog_load,
.fileDialogSave = file_dialog_save,
.goFullscreen = goFullscreen,
.showMessageBox = showMessageBox,
.setWindowTitle = setWindowTitle,
.openSystemPath = openSystemPath,
.preseed = preseed,
.poll = pollEvent,
};
s32 main(s32 argc, char **argv)
{
const char* folder = getAppFolder();
SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_JOYSTICK);
initSound();
platform.net = createNet();
platform.window = SDL_CreateWindow( TIC_TITLE, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
(TIC80_FULLWIDTH) * STUDIO_UI_SCALE,
(TIC80_FULLHEIGHT) * STUDIO_UI_SCALE,
SDL_WINDOW_SHOWN | SDL_WINDOW_FULLSCREEN_DESKTOP);
platform.studio = studioInit(argc, argv, platform.audio.spec.freq, folder, &systemInterface);
platform.renderer = SDL_CreateRenderer(platform.window, -1, SDL_RENDERER_SOFTWARE);
platform.texture = SDL_CreateTexture(platform.renderer, STUDIO_PIXEL_FORMAT, SDL_TEXTUREACCESS_STREAMING, TEXTURE_SIZE, TEXTURE_SIZE);
{
u64 nextTick = SDL_GetPerformanceCounter();
const u64 Delta = SDL_GetPerformanceFrequency() / TIC_FRAMERATE;
while (!platform.studio->quit)
{
nextTick += Delta;
tick();
{
s64 delay = nextTick - SDL_GetPerformanceCounter();
if(delay < 0) nextTick -= delay;
else SDL_Delay((u32)(delay * 1000 / SDL_GetPerformanceFrequency()));
}
}
}
platform.studio->close();
closeNet(platform.net);
if(platform.audio.cvt.buf)
SDL_free(platform.audio.cvt.buf);
if(platform.mouse.texture)
SDL_DestroyTexture(platform.mouse.texture);
SDL_DestroyTexture(platform.texture);
SDL_DestroyRenderer(platform.renderer);
SDL_DestroyWindow(platform.window);
SDL_CloseAudioDevice(platform.audio.device);
return 0;
}

View File

@ -340,7 +340,18 @@ typedef struct
{
union
{
tic_bank bank0;
struct
{
tic_bank bank0;
tic_bank bank1;
tic_bank bank2;
tic_bank bank3;
tic_bank bank4;
tic_bank bank5;
tic_bank bank6;
tic_bank bank7;
};
tic_bank banks[TIC_BANKS];
};

View File

@ -88,20 +88,20 @@ u32 tic_tool_find_closest_color(const tic_rgb* palette, const tic_rgb* color)
u32* tic_palette_blit(const tic_palette* srcpal)
{
static u32 pal[TIC_PALETTE_SIZE] = {0};
const u8* src = srcpal->data;
memset(pal, 0xff, sizeof pal);
static u32 pal[TIC_PALETTE_SIZE];
const tic_rgb* src = srcpal->colors;
const tic_rgb* end = src + TIC_PALETTE_SIZE;
u8* dst = (u8*)pal;
const u8* end = src + sizeof(tic_palette);
enum{RGB = sizeof(tic_rgb)};
for(; src != end; dst++, src+=RGB)
for(s32 j = 0; j < RGB; j++)
*dst++ = *(src+(RGB-1)-j);
while(src != end)
{
*dst++ = src->r;
*dst++ = src->g;
*dst++ = src->b;
*dst++ = 0xff;
src++;
}
return pal;
}
}