Merge branch '#514'

This commit is contained in:
BADIM-PC\Vadim committed 2018-02-15 17:23:36 +03:00
commit fd3f316b1d
58 files changed
+4118 -3621

No files matched your search

+8
View File
@@ -101,3 +101,11 @@ build/uwp/wren/x64/
build/uwp/wren/Release/
build/uwp/wren/ARM/
build/uwp/wren/Debug/
build/windows/studio/Debug/
build/windows/studio/Debug Pro/
build/windows/studio/Release/
build/windows/studio/Release Pro/
build/uwp/studio/Debug/
build/uwp/studio/Debug Pro/
build/uwp/studio/Release/
build/uwp/studio/Release Pro/
+22 -12
View File
@@ -29,10 +29,6 @@ MINGW_LINKER_FLAGS= \
-lmingw32 \
-lSDL2main \
-lSDL2 \
-lz \
-lgif \
-llua \
-lwren \
-lcomdlg32 \
-lws2_32 \
-mwindows
@@ -144,7 +140,8 @@ SOURCES=\
src/dialog.c \
src/menu.c \
src/net.c \
src/surf.c
src/surf.c \
src/system.c
SOURCES_EXT= \
src/html.c
@@ -248,16 +245,24 @@ bin/menu.o: src/menu.c $(TIC80_H) $(TIC_H)
bin/surf.o: src/surf.c $(TIC80_H) $(TIC_H)
$(CC) $< $(OPT) $(INCLUDES) -c -o $@
bin/system.o: src/system.c src/keycodes.c $(TIC80_H) $(TIC_H)
$(CC) $< $(OPT) $(INCLUDES) -c -o $@
SDL_NET = \
bin/SDLnet.o \
bin/SDLnetTCP.o \
bin/SDLnetselect.o \
bin/net.o
FILE_DIALOG = \
bin/file_dialog.o
TIC_O=\
bin/studio.o \
bin/console.o \
bin/run.o \
bin/file_dialog.o \
bin/md5.o \
bin/gif.o \
bin/SDLnet.o \
bin/SDLnetTCP.o \
bin/SDLnetselect.o \
bin/fs.o \
bin/tools.o \
bin/start.o \
@@ -269,7 +274,6 @@ TIC_O=\
bin/world.o \
bin/config.o \
bin/code.o \
bin/net.o \
bin/dialog.o \
bin/menu.o \
bin/surf.o
@@ -300,17 +304,23 @@ TIC80_O = bin/tic80.o bin/tic.o bin/tools.o bin/blip_buf.o bin/jsapi.o bin/luaap
TIC80_A = bin/libtic80.a
TIC80_DLL = bin/tic80.dll
STUDIO_A = bin/libstudio.a
STUDIO_DLL = bin/studio.dll
$(TIC80_DLL): $(TIC80_O)
$(CC) $(OPT) -shared $(TIC80_O) -L$(PRE_BUILT)/mingw -llua -lwren -lgif -Wl,--out-implib,$(TIC80_A) -o $@
$(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
wasm:
$(EMS_CC) $(SOURCES) $(TIC80_SRC) $(OPT) $(INCLUDES) $(EMS_OPT) -s WASM=1 $(EMS_LINKER_FLAGS) -o build/html/tic.js
mingw: $(DEMO_ASSETS) $(TIC80_DLL) $(TIC_O) bin/html.o bin/res.o
$(CC) $(TIC_O) bin/html.o bin/res.o $(TIC80_A) $(OPT) $(INCLUDES) $(MINGW_LINKER_FLAGS) -o $(MINGW_OUTPUT)
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)
mingw-pro:
$(eval OPT += $(OPT_PRO))
+1 -1
View File
@@ -1 +1 @@
0x78, 0xda, 0xed, 0x59, 0x4d, 0x6c, 0x1b, 0xc7, 0x15, 0x1e, 0xf9, 0x27, 0x09, 0xd7, 0xaa, 0x47, 0x04, 0x8a, 0x20, 0x4d, 0xd3, 0x7a, 0xc1, 0xe6, 0x20, 0x03, 0x12, 0x4c, 0x8b, 0x8a, 0x1b, 0x08, 0x60, 0x50, 0x85, 0x5c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 -52,7 +52,8 @@ LOCAL_SRC_FILES := \
$(SRC_PATH)/dialog.c \
$(SRC_PATH)/menu.c \
$(SRC_PATH)/surf.c \
$(SRC_PATH)/tic80.c
$(SRC_PATH)/tic80.c \
$(SRC_PATH)/system.c
LOCAL_SHARED_LIBRARIES := SDL2 lua z gif wren
+247
View File
@@ -0,0 +1,247 @@
<?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="..\..\..\src\code.c" />
<ClCompile Include="..\..\..\src\config.c" />
<ClCompile Include="..\..\..\src\console.c" />
<ClCompile Include="..\..\..\src\dialog.c" />
<ClCompile Include="..\..\..\src\ext\gif.c" />
<ClCompile Include="..\..\..\src\ext\md5.c" />
<ClCompile Include="..\..\..\src\fs.c" />
<ClCompile Include="..\..\..\src\history.c" />
<ClCompile Include="..\..\..\src\html.c" />
<ClCompile Include="..\..\..\src\map.c" />
<ClCompile Include="..\..\..\src\menu.c" />
<ClCompile Include="..\..\..\src\music.c" />
<ClCompile Include="..\..\..\src\run.c" />
<ClCompile Include="..\..\..\src\sfx.c" />
<ClCompile Include="..\..\..\src\sprite.c" />
<ClCompile Include="..\..\..\src\start.c" />
<ClCompile Include="..\..\..\src\studio.c" />
<ClCompile Include="..\..\..\src\surf.c" />
<ClCompile Include="..\..\..\src\tools.c" />
<ClCompile Include="..\..\..\src\world.c" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\3rd-party\zlib-1.2.8\winrt\zlib-uwp\zlib-uwp.vcxproj">
<Project>{978f53db-f959-4cb4-84a7-463af29949be}</Project>
</ProjectReference>
<ProjectReference Include="..\gif\gif.vcxproj">
<Project>{bc1084df-210a-48d6-a077-761d8c16947b}</Project>
</ProjectReference>
<ProjectReference Include="..\lua\lua.vcxproj">
<Project>{53802f21-41da-4ac1-8b62-0dac2ccb8af8}</Project>
</ProjectReference>
<ProjectReference Include="..\tic80\tic80.vcxproj">
<Project>{9c39acf1-5f52-4a2b-a467-9f2805d6174b}</Project>
</ProjectReference>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{6a22403a-6cf5-49f2-a012-ec04c9496306}</ProjectGuid>
<Keyword>DynamicLibrary</Keyword>
<RootNamespace>studio</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>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<PlatformToolset>v140</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<PlatformToolset>v140</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</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>
<IgnoreImportLibrary>false</IgnoreImportLibrary>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<GenerateManifest>false</GenerateManifest>
<IgnoreImportLibrary>false</IgnoreImportLibrary>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
<GenerateManifest>false</GenerateManifest>
<IgnoreImportLibrary>false</IgnoreImportLibrary>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
<GenerateManifest>false</GenerateManifest>
<IgnoreImportLibrary>false</IgnoreImportLibrary>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<GenerateManifest>false</GenerateManifest>
<IgnoreImportLibrary>false</IgnoreImportLibrary>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<GenerateManifest>false</GenerateManifest>
<IgnoreImportLibrary>false</IgnoreImportLibrary>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<CompileAsWinRT>false</CompileAsWinRT>
<PreprocessorDefinitions>TIC80_SHARED;_WINDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..\include;..\..\..\include;..\..\..\3rd-party\lua-5.3.1\src;..\..\..\3rd-party\giflib-5.1.4\lib;..\..\..\3rd-party\zlib-1.2.8;$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<SDLCheck>false</SDLCheck>
</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>
<PreprocessorDefinitions>TIC80_SHARED;_WINDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..\include;..\..\..\include;..\..\..\3rd-party\lua-5.3.1\src;..\..\..\3rd-party\giflib-5.1.4\lib;..\..\..\3rd-party\zlib-1.2.8;$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<SDLCheck>false</SDLCheck>
</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>
<PreprocessorDefinitions>TIC80_SHARED;_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1;%(ClCompile.PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..\include;..\..\..\include;..\..\..\3rd-party\lua-5.3.1\src;..\..\..\3rd-party\giflib-5.1.4\lib;..\..\..\3rd-party\zlib-1.2.8;$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<SDLCheck>false</SDLCheck>
</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>
<PreprocessorDefinitions>TIC80_SHARED;_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1;%(ClCompile.PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..\include;..\..\..\include;..\..\..\3rd-party\lua-5.3.1\src;..\..\..\3rd-party\giflib-5.1.4\lib;..\..\..\3rd-party\zlib-1.2.8;$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<SDLCheck>false</SDLCheck>
</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>
<PreprocessorDefinitions>TIC80_SHARED;_WINDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..\include;..\..\..\include;..\..\..\3rd-party\lua-5.3.1\src;..\..\..\3rd-party\giflib-5.1.4\lib;..\..\..\3rd-party\zlib-1.2.8;$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<SDLCheck>false</SDLCheck>
</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>
<PreprocessorDefinitions>TIC80_SHARED;_WINDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..\include;..\..\..\include;..\..\..\3rd-party\lua-5.3.1\src;..\..\..\3rd-party\giflib-5.1.4\lib;..\..\..\3rd-party\zlib-1.2.8;$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<SDLCheck>false</SDLCheck>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
<GenerateWindowsMetadata>false</GenerateWindowsMetadata>
</Link>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
+73
View File
@@ -0,0 +1,73 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="src">
<UniqueIdentifier>{fd391d6f-58f5-4aba-a1f1-41bf34081296}</UniqueIdentifier>
</Filter>
<Filter Include="src\ext">
<UniqueIdentifier>{cf22f775-8c8b-4047-a23c-fa216fa3b08f}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\..\src\code.c">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\config.c">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\console.c">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\dialog.c">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\fs.c">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\history.c">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\html.c">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\map.c">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\menu.c">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\music.c">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\run.c">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\sfx.c">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\sprite.c">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\start.c">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\studio.c">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\surf.c">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\tools.c">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\world.c">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\ext\gif.c">
<Filter>src\ext</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\ext\md5.c">
<Filter>src\ext</Filter>
</ClCompile>
</ItemGroup>
</Project>
+14
View File
@@ -17,6 +17,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zlib-uwp", "..\..\..\3rd-pa
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wren", "..\wren\wren.vcxproj", "{BBB0D01A-B124-416C-BE26-E6993154A555}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "studio", "..\studio\studio.vcxproj", "{6A22403A-6CF5-49F2-A012-EC04C9496306}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|ARM = Debug|ARM
@@ -117,6 +119,18 @@ Global
{BBB0D01A-B124-416C-BE26-E6993154A555}.Release|x64.Build.0 = Release|x64
{BBB0D01A-B124-416C-BE26-E6993154A555}.Release|x86.ActiveCfg = Release|Win32
{BBB0D01A-B124-416C-BE26-E6993154A555}.Release|x86.Build.0 = Release|Win32
{6A22403A-6CF5-49F2-A012-EC04C9496306}.Debug|ARM.ActiveCfg = Debug|ARM
{6A22403A-6CF5-49F2-A012-EC04C9496306}.Debug|ARM.Build.0 = Debug|ARM
{6A22403A-6CF5-49F2-A012-EC04C9496306}.Debug|x64.ActiveCfg = Debug|x64
{6A22403A-6CF5-49F2-A012-EC04C9496306}.Debug|x64.Build.0 = Debug|x64
{6A22403A-6CF5-49F2-A012-EC04C9496306}.Debug|x86.ActiveCfg = Debug|Win32
{6A22403A-6CF5-49F2-A012-EC04C9496306}.Debug|x86.Build.0 = Debug|Win32
{6A22403A-6CF5-49F2-A012-EC04C9496306}.Release|ARM.ActiveCfg = Release|ARM
{6A22403A-6CF5-49F2-A012-EC04C9496306}.Release|ARM.Build.0 = Release|ARM
{6A22403A-6CF5-49F2-A012-EC04C9496306}.Release|x64.ActiveCfg = Release|x64
{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
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
+3 -30
View File
@@ -219,17 +219,8 @@
<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="..\..\..\3rd-party\zlib-1.2.8\winrt\zlib-uwp\zlib-uwp.vcxproj">
<Project>{978f53db-f959-4cb4-84a7-463af29949be}</Project>
</ProjectReference>
<ProjectReference Include="..\gif\gif.vcxproj">
<Project>{bc1084df-210a-48d6-a077-761d8c16947b}</Project>
</ProjectReference>
<ProjectReference Include="..\lua\lua.vcxproj">
<Project>{53802f21-41da-4ac1-8b62-0dac2ccb8af8}</Project>
</ProjectReference>
<ProjectReference Include="..\tic80\tic80.vcxproj">
<Project>{9c39acf1-5f52-4a2b-a467-9f2805d6174b}</Project>
<ProjectReference Include="..\studio\studio.vcxproj">
<Project>{6a22403a-6cf5-49f2-a012-ec04c9496306}</Project>
</ProjectReference>
</ItemGroup>
<ItemGroup>
@@ -244,10 +235,6 @@
<ClCompile Include="..\..\..\3rd-party\SDL2_net-2.0.1\SDLnet.c" />
<ClCompile Include="..\..\..\3rd-party\SDL2_net-2.0.1\SDLnetselect.c" />
<ClCompile Include="..\..\..\3rd-party\SDL2_net-2.0.1\SDLnetTCP.c" />
<ClCompile Include="..\..\..\src\code.c" />
<ClCompile Include="..\..\..\src\config.c" />
<ClCompile Include="..\..\..\src\console.c" />
<ClCompile Include="..\..\..\src\dialog.c" />
<ClCompile Include="..\..\..\src\ext\file_dialog.cpp">
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</CompileAsWinRT>
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</CompileAsWinRT>
@@ -256,23 +243,9 @@
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</CompileAsWinRT>
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</CompileAsWinRT>
</ClCompile>
<ClCompile Include="..\..\..\src\ext\gif.c" />
<ClCompile Include="..\..\..\src\ext\md5.c" />
<ClCompile Include="..\..\..\src\fs.c" />
<ClCompile Include="..\..\..\src\history.c" />
<ClCompile Include="..\..\..\src\html.c" />
<ClCompile Include="..\..\..\src\map.c" />
<ClCompile Include="..\..\..\src\menu.c" />
<ClCompile Include="..\..\..\src\music.c" />
<ClCompile Include="..\..\..\src\net.c" />
<ClCompile Include="..\..\..\src\run.c" />
<ClCompile Include="..\..\..\src\sfx.c" />
<ClCompile Include="..\..\..\src\sprite.c" />
<ClCompile Include="..\..\..\src\start.c" />
<ClCompile Include="..\..\..\src\studio.c" />
<ClCompile Include="..\..\..\src\surf.c" />
<ClCompile Include="..\..\..\src\system.c" />
<ClCompile Include="..\..\..\src\tools.c" />
<ClCompile Include="..\..\..\src\world.c" />
</ItemGroup>
<ItemGroup>
<None Include="Package.StoreAssociation.xml" />
+6 -60
View File
@@ -47,72 +47,12 @@
<None Include="tic_StoreKey.pfx" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\..\src\console.c">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\fs.c">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\map.c">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\music.c">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\run.c">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\sfx.c">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\sprite.c">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\start.c">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\studio.c">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\ext\file_dialog.cpp">
<Filter>src\ext</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\history.c">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\world.c">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\html.c">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\code.c">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\config.c">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\ext\gif.c">
<Filter>src\ext</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\ext\md5.c">
<Filter>src\ext</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\net.c">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\tools.c">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\dialog.c">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\menu.c">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\surf.c">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\3rd-party\SDL2-2.0.7\src\main\winrt\SDL_winrt_main_NonXAML.cpp" />
<ClCompile Include="..\..\..\3rd-party\SDL2_net-2.0.1\SDLnetTCP.c">
<Filter>src\ext\net</Filter>
@@ -123,6 +63,12 @@
<ClCompile Include="..\..\..\3rd-party\SDL2_net-2.0.1\SDLnetselect.c">
<Filter>src\ext\net</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\system.c">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\net.c">
<Filter>src</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\..\..\3rd-party\SDL2-2.0.7\src\main\winrt\SDL2-WinRTResources.rc" />
+325
View File
@@ -0,0 +1,325 @@
<?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 Pro|Win32">
<Configuration>Debug Pro</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug Pro|x64">
<Configuration>Debug Pro</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release Pro|Win32">
<Configuration>Release Pro</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release Pro|x64">
<Configuration>Release Pro</Configuration>
<Platform>x64</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>
<PropertyGroup Label="Globals">
<ProjectGuid>{6181F6A6-AA1B-4CD2-B306-E242CFDE9B20}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>studio</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_xp</PlatformToolset>
<CharacterSet>NotSet</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug Pro|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140_xp</PlatformToolset>
<CharacterSet>NotSet</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140_xp</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>NotSet</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Pro|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140_xp</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>NotSet</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140_xp</PlatformToolset>
<CharacterSet>NotSet</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug Pro|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140_xp</PlatformToolset>
<CharacterSet>NotSet</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140_xp</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>NotSet</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Pro|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140_xp</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>NotSet</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 Condition="'$(Configuration)|$(Platform)'=='Debug Pro|Win32'" Label="PropertySheets">
<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 Condition="'$(Configuration)|$(Platform)'=='Release Pro|Win32'" Label="PropertySheets">
<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 Condition="'$(Configuration)|$(Platform)'=='Debug Pro|x64'" Label="PropertySheets">
<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>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release Pro|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug Pro|Win32'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug Pro|x64'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Pro|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Pro|x64'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;STUDIO_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<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\wren-0.1.0\src\include</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug Pro|Win32'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;STUDIO_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<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\wren-0.1.0\src\include</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>_DEBUG;_WINDOWS;_USRDLL;STUDIO_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<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\wren-0.1.0\src\include</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug Pro|x64'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>_DEBUG;_WINDOWS;_USRDLL;STUDIO_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<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\wren-0.1.0\src\include</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;STUDIO_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<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\wren-0.1.0\src\include</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Pro|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;STUDIO_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<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\wren-0.1.0\src\include</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>NDEBUG;_WINDOWS;_USRDLL;STUDIO_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<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\wren-0.1.0\src\include</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Pro|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>NDEBUG;_WINDOWS;_USRDLL;STUDIO_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<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\wren-0.1.0\src\include</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\..\..\src\code.c" />
<ClCompile Include="..\..\..\src\config.c" />
<ClCompile Include="..\..\..\src\console.c" />
<ClCompile Include="..\..\..\src\dialog.c" />
<ClCompile Include="..\..\..\src\ext\gif.c" />
<ClCompile Include="..\..\..\src\ext\md5.c" />
<ClCompile Include="..\..\..\src\fs.c" />
<ClCompile Include="..\..\..\src\history.c" />
<ClCompile Include="..\..\..\src\html.c" />
<ClCompile Include="..\..\..\src\map.c" />
<ClCompile Include="..\..\..\src\menu.c" />
<ClCompile Include="..\..\..\src\music.c" />
<ClCompile Include="..\..\..\src\run.c" />
<ClCompile Include="..\..\..\src\sfx.c" />
<ClCompile Include="..\..\..\src\sprite.c" />
<ClCompile Include="..\..\..\src\start.c" />
<ClCompile Include="..\..\..\src\studio.c" />
<ClCompile Include="..\..\..\src\surf.c" />
<ClCompile Include="..\..\..\src\tools.c" />
<ClCompile Include="..\..\..\src\world.c" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\gif\gif.vcxproj">
<Project>{6ea9d998-7557-4aed-abfc-142f9960c9b6}</Project>
</ProjectReference>
<ProjectReference Include="..\lua\lua.vcxproj">
<Project>{57d2471b-3138-495e-af18-6e290d098ffc}</Project>
</ProjectReference>
<ProjectReference Include="..\tic80\tic80.vcxproj">
<Project>{c4d8bc10-ebf6-42bb-9b5d-6712fb428a50}</Project>
</ProjectReference>
<ProjectReference Include="..\zlib\zlib.vcxproj">
<Project>{1dfbdfa2-f204-42ff-b99e-250e4b2eba04}</Project>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
@@ -0,0 +1,73 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="src">
<UniqueIdentifier>{6c183603-0dc2-4093-91e5-1aba3b2b5d08}</UniqueIdentifier>
</Filter>
<Filter Include="src\ext">
<UniqueIdentifier>{1410c434-08eb-4b70-a278-14955c0ecb28}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\..\src\code.c">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\config.c">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\console.c">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\dialog.c">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\fs.c">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\history.c">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\html.c">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\map.c">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\menu.c">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\music.c">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\run.c">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\sfx.c">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\sprite.c">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\start.c">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\studio.c">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\surf.c">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\tools.c">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\world.c">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\ext\md5.c">
<Filter>src\ext</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\ext\gif.c">
<Filter>src\ext</Filter>
</ClCompile>
</ItemGroup>
</Project>
+20 -2
View File
@@ -1,7 +1,7 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27130.2024
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tic", "tic.vcxproj", "{B6ECC66E-26FA-42C2-8F6C-E4338424F38A}"
ProjectSection(ProjectDependencies) = postProject
@@ -27,6 +27,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDL2main", "..\..\..\3rd-pa
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wren_lib", "..\wren\wren_lib.vcxproj", "{D7CC5189-C399-AC94-ECB2-9A3CD8DEE122}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "studio", "..\studio\studio.vcxproj", "{6181F6A6-AA1B-4CD2-B306-E242CFDE9B20}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug Pro|x64 = Debug Pro|x64
@@ -183,6 +185,22 @@ Global
{D7CC5189-C399-AC94-ECB2-9A3CD8DEE122}.Release|x64.Build.0 = Release|x64
{D7CC5189-C399-AC94-ECB2-9A3CD8DEE122}.Release|x86.ActiveCfg = Release|Win32
{D7CC5189-C399-AC94-ECB2-9A3CD8DEE122}.Release|x86.Build.0 = Release|Win32
{6181F6A6-AA1B-4CD2-B306-E242CFDE9B20}.Debug Pro|x64.ActiveCfg = Debug Pro|x64
{6181F6A6-AA1B-4CD2-B306-E242CFDE9B20}.Debug Pro|x64.Build.0 = Debug Pro|x64
{6181F6A6-AA1B-4CD2-B306-E242CFDE9B20}.Debug Pro|x86.ActiveCfg = Debug Pro|Win32
{6181F6A6-AA1B-4CD2-B306-E242CFDE9B20}.Debug Pro|x86.Build.0 = Debug Pro|Win32
{6181F6A6-AA1B-4CD2-B306-E242CFDE9B20}.Debug|x64.ActiveCfg = Debug|x64
{6181F6A6-AA1B-4CD2-B306-E242CFDE9B20}.Debug|x64.Build.0 = Debug|x64
{6181F6A6-AA1B-4CD2-B306-E242CFDE9B20}.Debug|x86.ActiveCfg = Debug|Win32
{6181F6A6-AA1B-4CD2-B306-E242CFDE9B20}.Debug|x86.Build.0 = Debug|Win32
{6181F6A6-AA1B-4CD2-B306-E242CFDE9B20}.Release Pro|x64.ActiveCfg = Release Pro|x64
{6181F6A6-AA1B-4CD2-B306-E242CFDE9B20}.Release Pro|x64.Build.0 = Release Pro|x64
{6181F6A6-AA1B-4CD2-B306-E242CFDE9B20}.Release Pro|x86.ActiveCfg = Release Pro|Win32
{6181F6A6-AA1B-4CD2-B306-E242CFDE9B20}.Release Pro|x86.Build.0 = Release Pro|Win32
{6181F6A6-AA1B-4CD2-B306-E242CFDE9B20}.Release|x64.ActiveCfg = Release|x64
{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
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
+3 -30
View File
@@ -41,45 +41,18 @@
<ProjectReference Include="..\..\..\3rd-party\SDL2-2.0.7\VisualC\SDL\SDL.vcxproj">
<Project>{81ce8daf-ebb2-4761-8e45-b71abcca8c68}</Project>
</ProjectReference>
<ProjectReference Include="..\gif\gif.vcxproj">
<Project>{6ea9d998-7557-4aed-abfc-142f9960c9b6}</Project>
</ProjectReference>
<ProjectReference Include="..\lua\lua.vcxproj">
<Project>{57d2471b-3138-495e-af18-6e290d098ffc}</Project>
</ProjectReference>
<ProjectReference Include="..\tic80\tic80.vcxproj">
<Project>{c4d8bc10-ebf6-42bb-9b5d-6712fb428a50}</Project>
</ProjectReference>
<ProjectReference Include="..\zlib\zlib.vcxproj">
<Project>{1dfbdfa2-f204-42ff-b99e-250e4b2eba04}</Project>
<ProjectReference Include="..\studio\studio.vcxproj">
<Project>{6181f6a6-aa1b-4cd2-b306-e242cfde9b20}</Project>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\..\3rd-party\SDL2_net-2.0.1\SDLnet.c" />
<ClCompile Include="..\..\..\3rd-party\SDL2_net-2.0.1\SDLnetselect.c" />
<ClCompile Include="..\..\..\3rd-party\SDL2_net-2.0.1\SDLnetTCP.c" />
<ClCompile Include="..\..\..\src\code.c" />
<ClCompile Include="..\..\..\src\config.c" />
<ClCompile Include="..\..\..\src\console.c" />
<ClCompile Include="..\..\..\src\dialog.c" />
<ClCompile Include="..\..\..\src\ext\file_dialog.c" />
<ClCompile Include="..\..\..\src\ext\gif.c" />
<ClCompile Include="..\..\..\src\ext\md5.c" />
<ClCompile Include="..\..\..\src\fs.c" />
<ClCompile Include="..\..\..\src\history.c" />
<ClCompile Include="..\..\..\src\html.c" />
<ClCompile Include="..\..\..\src\map.c" />
<ClCompile Include="..\..\..\src\menu.c" />
<ClCompile Include="..\..\..\src\music.c" />
<ClCompile Include="..\..\..\src\net.c" />
<ClCompile Include="..\..\..\src\run.c" />
<ClCompile Include="..\..\..\src\sfx.c" />
<ClCompile Include="..\..\..\src\sprite.c" />
<ClCompile Include="..\..\..\src\start.c" />
<ClCompile Include="..\..\..\src\studio.c" />
<ClCompile Include="..\..\..\src\surf.c" />
<ClCompile Include="..\..\..\src\system.c" />
<ClCompile Include="..\..\..\src\tools.c" />
<ClCompile Include="..\..\..\src\world.c" />
</ItemGroup>
<ItemGroup>
<Image Include="icon.ico" />
+12 -66
View File
@@ -15,72 +15,6 @@
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\..\src\console.c">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\fs.c">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\history.c">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\map.c">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\music.c">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\run.c">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\sfx.c">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\sprite.c">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\start.c">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\studio.c">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\world.c">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\ext\file_dialog.c">
<Filter>src\ext</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\ext\md5.c">
<Filter>src\ext</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\html.c">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\code.c">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\config.c">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\ext\gif.c">
<Filter>src\ext</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\net.c">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\tools.c">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\dialog.c">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\menu.c">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\surf.c">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\3rd-party\SDL2_net-2.0.1\SDLnet.c">
<Filter>src\ext\net</Filter>
</ClCompile>
@@ -90,6 +24,18 @@
<ClCompile Include="..\..\..\3rd-party\SDL2_net-2.0.1\SDLnetTCP.c">
<Filter>src\ext\net</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\net.c">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\ext\file_dialog.c">
<Filter>src\ext</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\system.c">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\tools.c">
<Filter>src</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<Image Include="icon.ico">
BIN
View File
Binary file not shown.
+6 -3
View File
@@ -34,7 +34,7 @@ extern "C" {
#define TIC80_FULLWIDTH_BITS 8
#define TIC80_FULLWIDTH (1 << TIC80_FULLWIDTH_BITS)
#define TIC80_FULLHEIGHT (TIC80_FULLWIDTH*9/16)
#define TIC_KEY_BUFFER 4
#define TIC80_KEY_BUFFER 4
typedef struct
{
@@ -98,7 +98,10 @@ typedef struct
u16 middle:1;
u16 right:1;
u16 scroll:13;
s16 scrollx:6;
s16 scrolly:6;
u16 temp:1;
};
u16 btns;
@@ -109,7 +112,7 @@ typedef u8 tic_key;
typedef union
{
tic_key keys[TIC_KEY_BUFFER];
tic_key keys[TIC80_KEY_BUFFER];
u32 data;
} tic80_keyboard;
+41 -4
View File
@@ -22,11 +22,48 @@
#pragma once
#if (defined(WIN32) || defined(_WIN32) || defined(__MINGW32__))
# undef __TIC_WINDOWS__
# define __TIC_WINDOWS__ 1
#if defined(__APPLE__)
/* lets us know what version of Mac OS X we're compiling on */
#include "AvailabilityMacros.h"
#include "TargetConditionals.h"
#ifndef TARGET_OS_IPHONE
#undef __TIC_MACOSX__
#define __TIC_MACOSX__ 1
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
# error SDL for Mac OS X only supports deploying on 10.6 and above.
#endif /* MAC_OS_X_VERSION_MIN_REQUIRED < 1060 */
#endif /* TARGET_OS_IPHONE */
#endif /* defined(__APPLE__) */
#if defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__) || defined(__MINGW32__)
/* Try to find out if we're compiling for WinRT or non-WinRT */
#if defined(_MSC_VER) && defined(__has_include)
#define HAVE_WINAPIFAMILY_H __has_include(<winapifamily.h>)
/* If _USING_V110_SDK71_ is defined it means we are using the Windows XP toolset. */
#elif defined(_MSC_VER) && (_MSC_VER >= 1700 && !_USING_V110_SDK71_) /* _MSC_VER == 1700 for Visual Studio 2012 */
#define HAVE_WINAPIFAMILY_H 1
#else
#define HAVE_WINAPIFAMILY_H 0
#endif
#if HAVE_WINAPIFAMILY_H
#include <winapifamily.h>
#define WINAPI_FAMILY_WINRT (!WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) && WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP))
#else
#define WINAPI_FAMILY_WINRT 0
#endif /* HAVE_WINAPIFAMILY_H */
#if WINAPI_FAMILY_WINRT
#undef __TIC_WINRT__
#define __TIC_WINRT__ 1
#else
#undef __TIC_WINDOWS__
#define __TIC_WINDOWS__ 1
#endif
#endif
#if (defined(linux) || defined(__linux) || defined(__linux__))
# undef __TIC_LINUX__
# define __TIC_LINUX__ 1
@@ -34,7 +71,7 @@
#ifndef TIC80_API
# if defined(TIC80_SHARED)
# if defined(__TIC_WINDOWS__)
# if defined(__TIC_WINDOWS__) || defined(__TIC_WINRT__)
# define TIC80_API __declspec(dllexport)
# elif defined(__TIC_LINUX__)
# define TIC80_API __attribute__ ((visibility("default")))
+218 -291
View File
@@ -74,8 +74,8 @@ static void drawCode(Code* code, bool withCursor)
u8* colorPointer = code->colorBuffer;
struct { char* start; char* end; } selection = {SDL_min(code->cursor.selection, code->cursor.position),
SDL_max(code->cursor.selection, code->cursor.position)};
struct { char* start; char* end; } selection = {MIN(code->cursor.selection, code->cursor.position),
MAX(code->cursor.selection, code->cursor.position)};
struct { s32 x; s32 y; char symbol; } cursor = {-1, -1, 0};
@@ -425,8 +425,8 @@ static bool replaceSelection(Code* code)
if(sel && sel != pos)
{
char* start = SDL_min(sel, pos);
char* end = SDL_max(sel, pos);
char* start = MIN(sel, pos);
char* end = MAX(sel, pos);
memmove(start, end, strlen(end) + 1);
@@ -525,8 +525,8 @@ static void copyToClipboard(Code* code)
if(sel && sel != pos)
{
start = SDL_min(sel, pos);
size = SDL_max(sel, pos) - start;
start = MIN(sel, pos);
size = MAX(sel, pos) - start;
}
else
{
@@ -534,14 +534,14 @@ static void copyToClipboard(Code* code)
size = getNextLine(code) - start;
}
char* clipboard = (char*)SDL_malloc(size+1);
char* clipboard = (char*)malloc(size+1);
if(clipboard)
{
memcpy(clipboard, start, size);
clipboard[size] = '\0';
SDL_SetClipboardText(clipboard);
SDL_free(clipboard);
getSystem()->setClipboardText(clipboard);
free(clipboard);
}
}
@@ -554,9 +554,9 @@ static void cutToClipboard(Code* code)
static void copyFromClipboard(Code* code)
{
if(SDL_HasClipboardText())
if(getSystem()->hasClipboardText())
{
char* clipboard = SDL_GetClipboardText();
char* clipboard = getSystem()->getClipboardText();
if(clipboard)
{
@@ -590,7 +590,7 @@ static void copyFromClipboard(Code* code)
parseSyntaxColor(code);
}
SDL_free(clipboard);
free(clipboard);
}
}
}
@@ -633,8 +633,8 @@ static void doTab(Code* code, bool shift, bool crtl)
bool changed = false;
if(cursor_selection) {
start = SDL_min(cursor_selection, cursor_position);
end = SDL_max(cursor_selection, cursor_position);
start = MIN(cursor_selection, cursor_position);
end = MAX(cursor_selection, cursor_position);
} else {
start = end = cursor_position;
}
@@ -684,8 +684,8 @@ static void setFindMode(Code* code)
{
if(code->cursor.selection)
{
const char* end = SDL_max(code->cursor.position, code->cursor.selection);
const char* start = SDL_min(code->cursor.position, code->cursor.selection);
const char* end = MAX(code->cursor.position, code->cursor.selection);
const char* start = MIN(code->cursor.position, code->cursor.selection);
size_t len = end - start;
if(len > 0 && len < sizeof code->popup.text - 1)
@@ -709,7 +709,8 @@ static int funcCompare(const void* a, const void* b)
if(item1->pos == NULL) return 1;
if(item2->pos == NULL) return -1;
return SDL_strcasecmp(item1->name, item2->name);
// return SDL_strcasecmp(item1->name, item2->name);
return strcmp(item1->name, item2->name);
}
static void normalizeScroll(Code* code)
@@ -752,6 +753,18 @@ static void updateOutlineCode(Code* code)
updateEditor(code);
}
static char* ticStrlwr(char *string)
{
char *bufp = string;
while (*bufp)
{
*bufp = tolower((u8)*bufp);
++bufp;
}
return string;
}
static void initOutlineMode(Code* code)
{
OutlineItem* out = code->outline.items;
@@ -761,8 +774,9 @@ static void initOutlineMode(Code* code)
char buffer[STUDIO_TEXT_BUFFER_WIDTH] = {0};
char filter[STUDIO_TEXT_BUFFER_WIDTH] = {0};
SDL_strlcpy(filter, code->popup.text, sizeof(filter));
SDL_strlwr(filter);
strncpy(filter, code->popup.text, sizeof(filter));
ticStrlwr(filter);
const tic_script_config* config = tic->api.get_script_config(tic);
@@ -779,12 +793,13 @@ static void initOutlineMode(Code* code)
{
out->pos = code->src + item->pos;
memset(out->name, 0, STUDIO_TEXT_BUFFER_WIDTH);
memcpy(out->name, out->pos, SDL_min(item->size, STUDIO_TEXT_BUFFER_WIDTH-1));
memcpy(out->name, out->pos, MIN(item->size, STUDIO_TEXT_BUFFER_WIDTH-1));
if(*filter)
{
SDL_strlcpy(buffer, out->name, sizeof(buffer));
SDL_strlwr(buffer);
strncpy(buffer, out->name, sizeof(buffer));
ticStrlwr(buffer);
if(strstr(buffer, filter)) out++;
else out->pos = NULL;
@@ -865,20 +880,13 @@ static void commentLine(Code* code)
parseSyntaxColor(code);
}
static void processKeydown(Code* code, SDL_Keycode keycode)
static void processKeyboard(Code* code)
{
switch(keycode)
{
case SDLK_LCTRL:
case SDLK_RCTRL:
case SDLK_LSHIFT:
case SDLK_RSHIFT:
case SDLK_LALT:
case SDLK_RALT:
return;
}
tic_mem* tic = code->tic;
switch(getClipboardEvent(keycode))
if(tic->ram.input.keyboard.data == 0) return;
switch(getClipboardEvent(0))
{
case TIC_CLIPBOARD_CUT: cutToClipboard(code); break;
case TIC_CLIPBOARD_COPY: copyToClipboard(code); break;
@@ -886,118 +894,77 @@ static void processKeydown(Code* code, SDL_Keycode keycode)
default: break;
}
SDL_Keymod keymod = SDL_GetModState();
bool shift = tic->api.key(tic, tic_key_shift);
bool ctrl = tic->api.key(tic, tic_key_ctrl);
bool alt = tic->api.key(tic, tic_key_alt);
switch(keycode)
if(keyWasPressed(tic_key_up)
|| keyWasPressed(tic_key_down)
|| keyWasPressed(tic_key_left)
|| keyWasPressed(tic_key_right)
|| keyWasPressed(tic_key_home)
|| keyWasPressed(tic_key_end)
|| keyWasPressed(tic_key_pageup)
|| keyWasPressed(tic_key_pagedown))
{
case SDLK_UP:
case SDLK_DOWN:
case SDLK_LEFT:
case SDLK_RIGHT:
case SDLK_HOME:
case SDLK_END:
case SDLK_PAGEUP:
case SDLK_PAGEDOWN:
if(!(keymod & KMOD_SHIFT)) code->cursor.selection = NULL;
if(!shift) code->cursor.selection = NULL;
else if(code->cursor.selection == NULL) code->cursor.selection = code->cursor.position;
}
if(keymod & TIC_MOD_CTRL)
if(ctrl)
{
if(keymod & KMOD_CTRL)
if(ctrl)
{
switch(keycode)
{
case SDLK_LEFT: leftWord(code); break;
case SDLK_RIGHT: rightWord(code); break;
case SDLK_TAB: doTab(code, keymod & KMOD_SHIFT, keymod & KMOD_CTRL); break;
}
}
else if(keymod & KMOD_GUI)
{
switch(keycode)
{
case SDLK_LEFT: goHome(code); break;
case SDLK_RIGHT: goEnd(code); break;
}
if(keyWasPressed(tic_key_left)) leftWord(code);
else if(keyWasPressed(tic_key_right)) rightWord(code);
else if(keyWasPressed(tic_key_tab)) doTab(code, shift, ctrl);
}
switch(keycode)
{
case SDLK_a: selectAll(code); break;
case SDLK_z: undo(code); break;
case SDLK_y: redo(code); break;
case SDLK_f: setCodeMode(code, TEXT_FIND_MODE); break;
case SDLK_g: setCodeMode(code, TEXT_GOTO_MODE); break;
case SDLK_o: setCodeMode(code, TEXT_OUTLINE_MODE); break;
case SDLK_SLASH: commentLine(code); break;
case SDLK_HOME: goCodeHome(code); break;
case SDLK_END: goCodeEnd(code); break;
}
if(keyWasPressed(tic_key_a)) selectAll(code);
else if(keyWasPressed(tic_key_z)) undo(code);
else if(keyWasPressed(tic_key_y)) redo(code);
else if(keyWasPressed(tic_key_f)) setCodeMode(code, TEXT_FIND_MODE);
else if(keyWasPressed(tic_key_g)) setCodeMode(code, TEXT_GOTO_MODE);
else if(keyWasPressed(tic_key_o)) setCodeMode(code, TEXT_OUTLINE_MODE);
else if(keyWasPressed(tic_key_slash)) commentLine(code);
else if(keyWasPressed(tic_key_home)) goCodeHome(code);
else if(keyWasPressed(tic_key_end)) goCodeEnd(code);
}
else if(keymod & KMOD_ALT)
else if(alt)
{
switch(keycode)
{
case SDLK_LEFT: leftWord(code); break;
case SDLK_RIGHT: rightWord(code); break;
}
if(keyWasPressed(tic_key_left)) leftWord(code);
else if(keyWasPressed(tic_key_right)) rightWord(code);
}
else
{
switch(keycode)
{
case SDLK_UP: upLine(code); break;
case SDLK_DOWN: downLine(code); break;
case SDLK_LEFT: leftColumn(code); break;
case SDLK_RIGHT: rightColumn(code); break;
case SDLK_HOME: goHome(code); break;
case SDLK_END: goEnd(code); break;
case SDLK_PAGEUP: pageUp(code); break;
case SDLK_PAGEDOWN: pageDown(code); break;
case SDLK_DELETE: deleteChar(code); break;
case SDLK_BACKSPACE: backspaceChar(code); break;
case SDLK_RETURN: newLine(code); break;
case SDLK_TAB: doTab(code, keymod & KMOD_SHIFT, keymod & KMOD_CTRL); break;
}
if(keyWasPressed(tic_key_up)) upLine(code);
else if(keyWasPressed(tic_key_down)) downLine(code);
else if(keyWasPressed(tic_key_left)) leftColumn(code);
else if(keyWasPressed(tic_key_right)) rightColumn(code);
else if(keyWasPressed(tic_key_home)) goHome(code);
else if(keyWasPressed(tic_key_end)) goEnd(code);
else if(keyWasPressed(tic_key_pageup)) pageUp(code);
else if(keyWasPressed(tic_key_pagedown)) pageDown(code);
else if(keyWasPressed(tic_key_delete)) deleteChar(code);
else if(keyWasPressed(tic_key_backspace)) backspaceChar(code);
else if(keyWasPressed(tic_key_return)) newLine(code);
else if(keyWasPressed(tic_key_tab)) doTab(code, shift, ctrl);
}
updateEditor(code);
}
static void processGestures(Code* code)
{
SDL_Point point = {0, 0};
if(getGesturePos(&point))
{
if(code->scroll.gesture)
{
code->scroll.x = (code->scroll.start.x - point.x) / STUDIO_TEXT_WIDTH;
code->scroll.y = (code->scroll.start.y - point.y) / STUDIO_TEXT_HEIGHT;
normalizeScroll(code);
}
else
{
code->scroll.start.x = point.x + code->scroll.x * STUDIO_TEXT_WIDTH;
code->scroll.start.y = point.y + code->scroll.y * STUDIO_TEXT_HEIGHT;
code->scroll.gesture = true;
}
}
else code->scroll.gesture = false;
}
static void processMouse(Code* code)
{
tic_mem* tic = code->tic;
if(checkMousePos(&code->rect))
{
setCursor(SDL_SYSTEM_CURSOR_IBEAM);
setCursor(tic_cursor_ibeam);
if(code->scroll.active)
{
if(checkMouseDown(&code->rect, SDL_BUTTON_RIGHT))
if(checkMouseDown(&code->rect, tic_mouse_right))
{
code->scroll.x = (code->scroll.start.x - getMouseX()) / STUDIO_TEXT_WIDTH;
code->scroll.y = (code->scroll.start.y - getMouseY()) / STUDIO_TEXT_HEIGHT;
@@ -1008,7 +975,7 @@ static void processMouse(Code* code)
}
else
{
if(checkMouseDown(&code->rect, SDL_BUTTON_LEFT))
if(checkMouseDown(&code->rect, tic_mouse_left))
{
s32 mx = getMouseX();
s32 my = getMouseY();
@@ -1019,7 +986,7 @@ static void processMouse(Code* code)
char* position = code->cursor.position;
setCursorPosition(code, x + code->scroll.x, y + code->scroll.y);
if(SDL_GetModState() & KMOD_SHIFT)
if(tic->api.key(tic, tic_key_shift))
{
code->cursor.selection = code->cursor.position;
code->cursor.position = position;
@@ -1038,7 +1005,7 @@ static void processMouse(Code* code)
code->cursor.mouseDownPosition = NULL;
}
if(checkMouseDown(&code->rect, SDL_BUTTON_RIGHT))
if(checkMouseDown(&code->rect, tic_mouse_right))
{
code->scroll.active = true;
@@ -1052,42 +1019,35 @@ static void processMouse(Code* code)
static void textEditTick(Code* code)
{
SDL_Event* event = NULL;
while ((event = pollEvent()))
tic_mem* tic = code->tic;
// process scroll
{
switch(event->type)
tic80_input* input = &code->tic->ram.input;
if(input->mouse.scrolly)
{
case SDL_MOUSEWHEEL:
{
enum{Scroll = 3};
s32 delta = event->wheel.y > 0 ? -Scroll : Scroll;
enum{Scroll = 3};
s32 delta = input->mouse.scrolly > 0 ? -Scroll : Scroll;
code->scroll.y += delta;
code->scroll.y += delta;
normalizeScroll(code);
}
break;
case SDL_KEYDOWN:
processKeydown(code, event->key.keysym.sym);
break;
case SDL_TEXTINPUT:
#if defined(__LINUX__)
if(!(SDL_GetModState() & KMOD_LALT))
#endif
if(strlen(event->text.text) == 1)
{
inputSymbol(code, *event->text.text);
updateEditor(code);
}
break;
normalizeScroll(code);
}
}
processKeyboard(code);
if(!tic->api.key(tic, tic_key_ctrl) && !tic->api.key(tic, tic_key_alt))
{
char sym = getKeyboardText();
if(sym)
{
inputSymbol(code, sym);
updateEditor(code);
}
}
processGestures(code);
processMouse(code);
code->tic->api.clear(code->tic, getConfig()->theme.code.bg);
@@ -1146,52 +1106,39 @@ static char* downStrStr(const char* start, const char* from, const char* substr)
static void textFindTick(Code* code)
{
SDL_Event* event = NULL;
while ((event = pollEvent()))
if(keyWasPressed(tic_key_return)) setCodeMode(code, TEXT_EDIT_MODE);
else if(keyWasPressed(tic_key_up)
|| keyWasPressed(tic_key_down)
|| keyWasPressed(tic_key_left)
|| keyWasPressed(tic_key_right))
{
switch(event->type)
if(*code->popup.text)
{
case SDL_KEYDOWN:
switch(event->key.keysym.sym)
{
case SDLK_RETURN:
setCodeMode(code, TEXT_EDIT_MODE);
break;
case SDLK_UP:
case SDLK_LEFT:
case SDLK_DOWN:
case SDLK_RIGHT:
if(*code->popup.text)
{
SDL_Keycode keycode = event->key.keysym.sym;
bool reverse = keycode == SDLK_UP || keycode == SDLK_LEFT;
char* (*func)(const char*, const char*, const char*) = reverse ? upStrStr : downStrStr;
char* from = reverse ? SDL_min(code->cursor.position, code->cursor.selection) : SDL_max(code->cursor.position, code->cursor.selection);
char* pos = func(code->src, from, code->popup.text);
updateFindCode(code, pos);
}
break;
case SDLK_BACKSPACE:
if(*code->popup.text)
{
code->popup.text[strlen(code->popup.text)-1] = '\0';
updateFindCode(code, strstr(code->src, code->popup.text));
}
break;
default: break;
}
break;
case SDL_TEXTINPUT:
if(strlen(event->text.text) == 1)
{
if(strlen(code->popup.text) + 1 < sizeof code->popup.text)
{
strcat(code->popup.text, event->text.text);
updateFindCode(code, strstr(code->src, code->popup.text));
}
}
break;
default: break;
bool reverse = keyWasPressed(tic_key_up) || keyWasPressed(tic_key_left);
char* (*func)(const char*, const char*, const char*) = reverse ? upStrStr : downStrStr;
char* from = reverse ? MIN(code->cursor.position, code->cursor.selection) : MAX(code->cursor.position, code->cursor.selection);
char* pos = func(code->src, from, code->popup.text);
updateFindCode(code, pos);
}
}
else if(keyWasPressed(tic_key_backspace))
{
if(*code->popup.text)
{
code->popup.text[strlen(code->popup.text)-1] = '\0';
updateFindCode(code, strstr(code->src, code->popup.text));
}
}
char sym = getKeyboardText();
if(sym)
{
if(strlen(code->popup.text) + 1 < sizeof code->popup.text)
{
char str[] = {sym , 0};
strcat(code->popup.text, str);
updateFindCode(code, strstr(code->src, code->popup.text));
}
}
@@ -1223,51 +1170,41 @@ static void updateGotoCode(Code* code)
static void textGoToTick(Code* code)
{
SDL_Event* event = NULL;
while ((event = pollEvent()))
tic_mem* tic = code->tic;
if(keyWasPressed(tic_key_return))
{
switch(event->type)
if(*code->popup.text)
updateGotoCode(code);
setCodeMode(code, TEXT_EDIT_MODE);
}
else if(keyWasPressed(tic_key_backspace))
{
if(*code->popup.text)
{
case SDL_KEYDOWN:
switch(event->key.keysym.sym)
{
case SDLK_RETURN:
if(*code->popup.text)
updateGotoCode(code);
setCodeMode(code, TEXT_EDIT_MODE);
break;
case SDLK_BACKSPACE:
if(*code->popup.text)
{
code->popup.text[strlen(code->popup.text)-1] = '\0';
updateGotoCode(code);
}
break;
default: break;
}
break;
case SDL_TEXTINPUT:
if(strlen(event->text.text) == 1)
{
char sym = *event->text.text;
if(strlen(code->popup.text)+1 < sizeof code->popup.text && sym >= '0' && sym <= '9')
{
strcat(code->popup.text, event->text.text);
updateGotoCode(code);
}
}
break;
default: break;
code->popup.text[strlen(code->popup.text)-1] = '\0';
updateGotoCode(code);
}
}
code->tic->api.clear(code->tic, getConfig()->theme.code.bg);
char sym = getKeyboardText();
if(sym)
{
if(strlen(code->popup.text)+1 < sizeof code->popup.text && sym >= '0' && sym <= '9')
{
char str[] = {sym, 0};
strcat(code->popup.text, str);
updateGotoCode(code);
}
}
tic->api.clear(tic, getConfig()->theme.code.bg);
if(code->jump.line >= 0)
code->tic->api.rect(code->tic, 0, (code->jump.line - code->scroll.y) * TIC_FONT_HEIGHT + TOOLBAR_SIZE + 1,
TIC80_WIDTH, TIC_FONT_HEIGHT+1, getConfig()->theme.code.select);
tic->api.rect(tic, 0, (code->jump.line - code->scroll.y) * (TIC_FONT_HEIGHT+1) + TOOLBAR_SIZE,
TIC80_WIDTH, TIC_FONT_HEIGHT+2, getConfig()->theme.code.select);
drawCode(code, false);
drawPopupBar(code, " GOTO:");
@@ -1276,7 +1213,7 @@ static void textGoToTick(Code* code)
static void drawOutlineBar(Code* code, s32 x, s32 y)
{
SDL_Rect rect = {x, y, TIC80_WIDTH - x, TIC80_HEIGHT - y};
tic_rect rect = {x, y, TIC80_WIDTH - x, TIC80_HEIGHT - y};
if(checkMousePos(&rect))
{
@@ -1285,16 +1222,16 @@ static void drawOutlineBar(Code* code, s32 x, s32 y)
if(mx < OUTLINE_SIZE && code->outline.items[mx].pos)
{
setCursor(SDL_SYSTEM_CURSOR_HAND);
setCursor(tic_cursor_hand);
if(checkMouseDown(&rect, SDL_BUTTON_LEFT))
if(checkMouseDown(&rect, tic_mouse_left))
{
code->outline.index = mx;
updateOutlineCode(code);
}
if(checkMouseClick(&rect, SDL_BUTTON_LEFT))
if(checkMouseClick(&rect, tic_mouse_left))
setCodeMode(code, TEXT_EDIT_MODE);
}
}
@@ -1321,53 +1258,45 @@ static void drawOutlineBar(Code* code, s32 x, s32 y)
static void textOutlineTick(Code* code)
{
SDL_Event* event = NULL;
while ((event = pollEvent()))
if(keyWasPressed(tic_key_up))
{
switch(event->type)
if(code->outline.index > 0)
{
case SDL_KEYDOWN:
switch(event->key.keysym.sym)
{
case SDLK_UP:
if(code->outline.index > 0)
{
code->outline.index--;
updateOutlineCode(code);
}
break;
case SDLK_DOWN:
if(code->outline.index < OUTLINE_SIZE - 1 && code->outline.items[code->outline.index + 1].pos)
{
code->outline.index++;
updateOutlineCode(code);
}
break;
case SDLK_RETURN:
updateOutlineCode(code);
setCodeMode(code, TEXT_EDIT_MODE);
break;
case SDLK_BACKSPACE:
if(*code->popup.text)
{
code->popup.text[strlen(code->popup.text)-1] = '\0';
setOutlineMode(code);
}
break;
default: break;
}
break;
case SDL_TEXTINPUT:
if(strlen(event->text.text) == 1)
{
if(strlen(code->popup.text) + 1 < sizeof code->popup.text)
{
strcat(code->popup.text, event->text.text);
setOutlineMode(code);
}
}
break;
default: break;
code->outline.index--;
updateOutlineCode(code);
}
}
else if(keyWasPressed(tic_key_down))
{
if(code->outline.index < OUTLINE_SIZE - 1 && code->outline.items[code->outline.index + 1].pos)
{
code->outline.index++;
updateOutlineCode(code);
}
}
else if(keyWasPressed(tic_key_return))
{
updateOutlineCode(code);
setCodeMode(code, TEXT_EDIT_MODE);
}
else if(keyWasPressed(tic_key_backspace))
{
if(*code->popup.text)
{
code->popup.text[strlen(code->popup.text)-1] = '\0';
setOutlineMode(code);
}
}
char sym = getKeyboardText();
if(sym)
{
if(strlen(code->popup.text) + 1 < sizeof code->popup.text)
{
char str[] = {sym, 0};
strcat(code->popup.text, str);
setOutlineMode(code);
}
}
@@ -1429,18 +1358,18 @@ static void drawCodeToolbar(Code* code)
for(s32 i = 0; i < Count; i++)
{
SDL_Rect rect = {TIC80_WIDTH + (i - Count) * Size, 0, Size, Size};
tic_rect rect = {TIC80_WIDTH + (i - Count) * Size, 0, Size, Size};
bool over = false;
if(checkMousePos(&rect))
{
setCursor(SDL_SYSTEM_CURSOR_HAND);
setCursor(tic_cursor_hand);
showTooltip(Tips[i]);
over = true;
if(checkMouseClick(&rect, SDL_BUTTON_LEFT))
if(checkMouseClick(&rect, tic_mouse_left))
{
if (i == TEXT_RUN_CODE)
{
@@ -1471,8 +1400,6 @@ static void tick(Code* code)
if(code->cursor.delay)
code->cursor.delay--;
code->cursor.tick++;
switch(code->mode)
{
case TEXT_RUN_CODE: runProject(); break;
@@ -1516,7 +1443,7 @@ static void onStudioEvent(Code* code, StudioEvent event)
void initCode(Code* code, tic_mem* tic, tic_code* src)
{
if(code->outline.items == NULL)
code->outline.items = (OutlineItem*)SDL_malloc(OUTLINE_ITEMS_SIZE);
code->outline.items = (OutlineItem*)malloc(OUTLINE_ITEMS_SIZE);
if(code->history) history_delete(code->history);
if(code->cursorHistory) history_delete(code->cursorHistory);
@@ -1527,7 +1454,7 @@ void initCode(Code* code, tic_mem* tic, tic_code* src)
.src = src->data,
.tick = tick,
.escape = escape,
.cursor = {{src->data, NULL, 0, 0}, NULL, 0},
.cursor = {{src->data, NULL, 0}, NULL, 0},
.rect = {0, TOOLBAR_SIZE + 1, TIC80_WIDTH, TIC80_HEIGHT - TOOLBAR_SIZE - TIC_FONT_HEIGHT - 1},
.scroll = {0, 0, {0, 0}, false},
.tickCounter = 0,
+2 -3
View File
@@ -39,7 +39,6 @@ struct Code
{
char* position;
char* selection;
s32 tick;
s32 column;
};
@@ -47,14 +46,14 @@ struct Code
s32 delay;
} cursor;
SDL_Rect rect;
tic_rect rect;
struct
{
s32 x;
s32 y;
SDL_Point start;
tic_point start;
bool active;
bool gesture;
+31 -9
View File
@@ -93,14 +93,36 @@ static void readCursorTheme(Config* config, lua_State* lua)
if(lua_type(lua, -1) == LUA_TTABLE)
{
{
lua_getfield(lua, -1, "SPRITE");
lua_getfield(lua, -1, "ARROW");
if(lua_isinteger(lua, -1))
{
config->data.theme.cursor.sprite = (s32)lua_tointeger(lua, -1);
config->data.theme.cursor.arrow = (s32)lua_tointeger(lua, -1);
}
lua_pop(lua, 1);
lua_pop(lua, 1);
}
{
lua_getfield(lua, -1, "HAND");
if(lua_isinteger(lua, -1))
{
config->data.theme.cursor.hand = (s32)lua_tointeger(lua, -1);
}
lua_pop(lua, 1);
}
{
lua_getfield(lua, -1, "IBEAM");
if(lua_isinteger(lua, -1))
{
config->data.theme.cursor.ibeam = (s32)lua_tointeger(lua, -1);
}
lua_pop(lua, 1);
}
{
@@ -228,7 +250,7 @@ static void update(Config* config, const u8* buffer, size_t size)
static void setDefault(Config* config)
{
SDL_memset(&config->data, 0, sizeof(StudioConfig));
memset(&config->data, 0, sizeof(StudioConfig));
{
static const u8 DefaultBiosZip[] =
@@ -243,14 +265,14 @@ static void setDefault(Config* config)
{
update(config, embedBios, size);
SDL_free(embedBios);
free(embedBios);
}
}
}
static void saveConfig(Config* config, bool overwrite)
{
u8* buffer = SDL_malloc(sizeof(tic_cartridge));
u8* buffer = malloc(sizeof(tic_cartridge));
if(buffer)
{
@@ -258,7 +280,7 @@ static void saveConfig(Config* config, bool overwrite)
fsSaveRootFile(config->fs, CONFIG_TIC_PATH, buffer, size, overwrite);
SDL_free(buffer);
free(buffer);
}
}
@@ -270,7 +292,7 @@ static void reset(Config* config)
static void save(Config* config)
{
SDL_memcpy(&config->tic->config, &config->tic->cart, sizeof(tic_cartridge));
memcpy(&config->tic->config, &config->tic->cart, sizeof(tic_cartridge));
readConfig(config);
saveConfig(config, true);
@@ -296,7 +318,7 @@ void initConfig(Config* config, tic_mem* tic, FileSystem* fs)
{
update(config, data, size);
SDL_free(data);
free(data);
}
else saveConfig(config, false);
+228 -205
View File
@@ -23,12 +23,21 @@
#include "console.h"
#include "fs.h"
#include "config.h"
#include "net.h"
#include "ext/gif.h"
#include "ext/file_dialog.h"
#include <zlib.h>
#include <ctype.h>
#include <string.h>
#include <stddef.h>
#include <lua.h>
#include <lauxlib.h>
#include <lualib.h>
#if defined(__EMSCRIPTEN__)
#include <emscripten.h>
#endif
#define CONSOLE_CURSOR_COLOR ((tic_color_red))
#define CONSOLE_BACK_TEXT_COLOR ((tic_color_dark_gray))
@@ -49,7 +58,7 @@ typedef enum
WrenScript,
} ScriptLang;
#if defined(__WINDOWS__) || defined(__LINUX__) || defined(__MACOSX__)
#if defined(__TIC_WINDOWS__) || defined(__TIC_LINUX__) || defined(__TIC_MACOSX__)
#define CAN_EXPORT 1
#endif
@@ -67,7 +76,7 @@ typedef struct
#endif
#if defined(__WINDOWS__)
#if defined(__TIC_WINDOWS__)
static const char* ExeExt = ".exe";
#endif
@@ -297,7 +306,7 @@ static void onConsoleExitCommand(Console* console, const char* param)
static s32 writeGifData(const tic_mem* tic, u8* dst, const u8* src, s32 width, s32 height)
{
s32 size = 0;
gif_color* palette = (gif_color*)SDL_malloc(sizeof(gif_color) * TIC_PALETTE_SIZE);
gif_color* palette = (gif_color*)malloc(sizeof(gif_color) * TIC_PALETTE_SIZE);
if(palette)
{
@@ -307,7 +316,7 @@ static s32 writeGifData(const tic_mem* tic, u8* dst, const u8* src, s32 width, s
gif_write_data(dst, &size, width, height, src, palette, TIC_PALETTE_BPP);
SDL_free(palette);
free(palette);
}
return size;
@@ -351,7 +360,7 @@ static bool onConsoleLoadSectionCommand(Console* console, const char* param)
for(s32 i = 0; i < COUNT_OF(Sections); i++)
{
sprintf(buf, "%s %s", CART_EXT, Sections[i]);
char* pos = SDL_strstr(param, buf);
char* pos = strstr(param, buf);
if(pos)
{
@@ -362,7 +371,7 @@ static bool onConsoleLoadSectionCommand(Console* console, const char* param)
if(data)
{
tic_cartridge* cart = (tic_cartridge*)SDL_malloc(sizeof(tic_cartridge));
tic_cartridge* cart = (tic_cartridge*)malloc(sizeof(tic_cartridge));
if(cart)
{
@@ -388,12 +397,12 @@ static bool onConsoleLoadSectionCommand(Console* console, const char* param)
printFront(console, name);
printLine(console);
SDL_free(cart);
free(cart);
result = true;
}
SDL_free(data);
free(data);
}
else printBack(console, "\ncart loading error");
@@ -520,7 +529,7 @@ static void onConsoleLoadDemoCommandConfirmed(Console* console, const char* para
printFront(console, console->romName);
printBack(console, " loaded!\n");
SDL_free(data);
free(data);
}
static void onCartLoaded(Console* console, const char* name)
@@ -703,7 +712,7 @@ static bool loadTextSection(const char* project, const char* comment, char* dst,
char tagstart[16];
sprintf(tagstart, "\n%s <", comment);
const char* ptr = SDL_strstr(project, tagstart);
const char* ptr = strstr(project, tagstart);
if(ptr && ptr < end)
end = ptr;
@@ -711,7 +720,7 @@ static bool loadTextSection(const char* project, const char* comment, char* dst,
if(end > start)
{
SDL_memcpy(dst, start, SDL_min(size, end - start));
memcpy(dst, start, MIN(size, end - start));
done = true;
}
@@ -730,7 +739,7 @@ static bool loadTextSectionBank(const char* project, const char* comment, const
char tagbuf[64];
sprintf(tagbuf, "%s <%s>", comment, tag);
const char* start = SDL_strstr(project, tagbuf);
const char* start = strstr(project, tagbuf);
bool done = false;
if(start)
@@ -739,11 +748,11 @@ static bool loadTextSectionBank(const char* project, const char* comment, const
start = getLineEnd(start);
sprintf(tagbuf, "\n%s </%s>", comment, tag);
const char* end = SDL_strstr(start, tagbuf);
const char* end = strstr(start, tagbuf);
if(end > start)
{
SDL_memcpy(dst, start, SDL_min(size, end - start));
memcpy(dst, start, MIN(size, end - start));
done = true;
}
@@ -757,7 +766,7 @@ static bool loadBinarySection(const char* project, const char* comment, const ch
char tagbuf[64];
sprintf(tagbuf, "%s <%s>", comment, tag);
const char* start = SDL_strstr(project, tagbuf);
const char* start = strstr(project, tagbuf);
bool done = false;
if(start)
@@ -766,7 +775,7 @@ static bool loadBinarySection(const char* project, const char* comment, const ch
start = getLineEnd(start);
sprintf(tagbuf, "\n%s </%s>", comment, tag);
const char* end = SDL_strstr(start, tagbuf);
const char* end = strstr(start, tagbuf);
if(end > start)
{
@@ -779,7 +788,7 @@ static bool loadBinarySection(const char* project, const char* comment, const ch
static char lineStr[] = "999";
memcpy(lineStr, ptr + sizeof("-- ") - 1, sizeof lineStr - 1);
s32 index = SDL_atoi(lineStr);
s32 index = atoi(lineStr);
if(index < count)
{
@@ -809,13 +818,13 @@ static bool loadProject(Console* console, const char* name, const char* data, s3
{
tic_mem* tic = console->tic;
char* project = (char*)SDL_malloc(size+1);
char* project = (char*)malloc(size+1);
bool done = false;
if(project)
{
SDL_memcpy(project, data, size);
memcpy(project, data, size);
project[size] = '\0';
// remove all the '\r' chars
@@ -824,12 +833,12 @@ static bool loadProject(Console* console, const char* name, const char* data, s3
for(s = d = project; (*d = *s); d += (*s++ != '\r'));
}
tic_cartridge* cart = (tic_cartridge*)SDL_malloc(sizeof(tic_cartridge));
tic_cartridge* cart = (tic_cartridge*)malloc(sizeof(tic_cartridge));
if(cart)
{
SDL_memset(cart, 0, sizeof(tic_cartridge));
SDL_memcpy(&cart->palette, &tic->config.palette.data, sizeof(tic_palette));
memset(cart, 0, sizeof(tic_cartridge));
memcpy(&cart->palette, &tic->config.palette.data, sizeof(tic_palette));
const char* comment = projectComment(name);
char tag[16];
@@ -864,12 +873,12 @@ static bool loadProject(Console* console, const char* name, const char* data, s3
if(loadBinarySection(project, comment, "COVER", 1, &cart->cover, -1, true))
done = true;
SDL_memcpy(dst, cart, sizeof(tic_cartridge));
memcpy(dst, cart, sizeof(tic_cartridge));
SDL_free(cart);
free(cart);
}
SDL_free(project);
free(project);
}
return done;
@@ -886,20 +895,20 @@ static void updateProject(Console* console)
if(data)
{
tic_cartridge* cart = SDL_malloc(sizeof(tic_cartridge));
tic_cartridge* cart = malloc(sizeof(tic_cartridge));
if(cart)
{
if(loadProject(console, console->romName, data, size, cart))
{
SDL_memcpy(&tic->cart, cart, sizeof(tic_cartridge));
memcpy(&tic->cart, cart, sizeof(tic_cartridge));
studioRomLoaded();
}
SDL_free(cart);
free(cart);
}
SDL_free(data);
free(data);
}
}
@@ -928,7 +937,7 @@ static void onConsoleLoadCommandConfirmed(Console* console, const char* param)
onCartLoaded(console, name);
SDL_free(data);
free(data);
}
else
{
@@ -951,7 +960,7 @@ static void onConsoleLoadCommandConfirmed(Console* console, const char* param)
loadProject(console, name, data, size, &console->tic->cart);
onCartLoaded(console, name);
SDL_free(data);
free(data);
}
else
{
@@ -988,16 +997,16 @@ static void onConfirm(bool yes, void* data)
else commandDone(confirmData->console);
if(confirmData->param)
SDL_free(confirmData->param);
free(confirmData->param);
SDL_free(confirmData);
free(confirmData);
}
static void confirmCommand(Console* console, const char** text, s32 rows, const char* param, ConfirmCallback callback)
{
CommandConfirmData* data = SDL_malloc(sizeof(CommandConfirmData));
CommandConfirmData* data = malloc(sizeof(CommandConfirmData));
data->console = console;
data->param = param ? SDL_strdup(param) : NULL;
data->param = param ? strdup(param) : NULL;
data->callback = callback;
showDialog(text, rows, onConfirm, data);
@@ -1054,10 +1063,10 @@ static void loadDemo(Console* console, ScriptLang script)
{
loadRom(console->tic, data, size, false);
SDL_free(data);
free(data);
}
SDL_memset(console->romName, 0, sizeof console->romName);
memset(console->romName, 0, sizeof console->romName);
studioRomLoaded();
}
@@ -1217,7 +1226,7 @@ static void installDemoCart(FileSystem* fs, const char* name, const void* cart,
u8* data = NULL;
s32 dataSize = unzip(&data, cart, size);
fsSaveFile(fs, name, data, dataSize, true);
SDL_free(data);
free(data);
}
static void onConsoleInstallDemosCommand(Console* console, const char* param)
@@ -1391,7 +1400,7 @@ static void onImportCover(const char* name, const void* buffer, size_t size, voi
if(size <= sizeof console->tic->cart.cover.data)
{
console->tic->cart.cover.size = size;
SDL_memcpy(console->tic->cart.cover.data, buffer, size);
memcpy(console->tic->cart.cover.data, buffer, size);
printLine(console);
printBack(console, name);
@@ -1434,8 +1443,8 @@ static void onImportSprites(const char* name, const void* buffer, size_t size, v
Height = TIC_SPRITESHEET_SIZE*2,
};
s32 w = SDL_min(Width, image->width);
s32 h = SDL_min(Height, image->height);
s32 w = MIN(Width, image->width);
s32 h = MIN(Height, image->height);
for (s32 y = 0; y < h; y++)
for (s32 x = 0; x < w; x++)
@@ -1467,8 +1476,8 @@ static void injectMap(Console* console, const void* buffer, s32 size)
{
enum {Size = sizeof(tic_map)};
SDL_memset(getBankMap(), 0, Size);
SDL_memcpy(getBankMap(), buffer, SDL_min(size, Size));
memset(getBankMap(), 0, Size);
memcpy(getBankMap(), buffer, MIN(size, Size));
}
static void onImportMap(const char* name, const void* buffer, size_t size, void* data)
@@ -1538,7 +1547,7 @@ static void exportCover(Console* console)
if(cover->size)
{
void* data = SDL_malloc(cover->size);
void* data = malloc(cover->size);
memcpy(data, cover->data, cover->size);
fsGetFileData(onCoverExported, "cover.gif", data, cover->size, DEFAULT_CHMOD, console);
}
@@ -1558,11 +1567,11 @@ static void exportSprites(Console* console)
};
enum{ Size = Width * Height * sizeof(gif_color)};
u8* buffer = (u8*)SDL_malloc(Size);
u8* buffer = (u8*)malloc(Size);
if(buffer)
{
u8* data = (u8*)SDL_malloc(Width * Height);
u8* data = (u8*)malloc(Width * Height);
if(data)
{
@@ -1580,10 +1589,10 @@ static void exportSprites(Console* console)
{
printError(console, "\nsprite export error :(");
commandDone(console);
SDL_free(buffer);
free(buffer);
}
SDL_free(data);
free(data);
}
}
}
@@ -1604,11 +1613,11 @@ static void exportMap(Console* console)
{
enum{Size = sizeof(tic_map)};
void* buffer = SDL_malloc(Size);
void* buffer = malloc(Size);
if(buffer)
{
SDL_memcpy(buffer, getBankMap()->data, Size);
memcpy(buffer, getBankMap()->data, Size);
fsGetFileData(onMapExported, "world.map", buffer, Size, DEFAULT_CHMOD, console);
}
}
@@ -1639,9 +1648,7 @@ static void onConsoleExportCommand(Console* console, const char* param)
#else
#if !defined(__ANDROID__) && !defined(__MACOSX__) && !defined(__LINUX__)
static void *memmem(const void* haystack, size_t hlen, const void* needle, size_t nlen)
static void *ticMemmem(const void* haystack, size_t hlen, const void* needle, size_t nlen)
{
const u8* p = haystack;
size_t plen = hlen;
@@ -1662,8 +1669,6 @@ static void *memmem(const void* haystack, size_t hlen, const void* needle, size_
return NULL;
}
#endif
typedef struct
{
Console* console;
@@ -1717,18 +1722,18 @@ static void onConsoleExportHtmlCommand(Console* console, const char* name)
u8* EmbedTicJs = NULL;
u32 EmbedTicJsSize = unzip(&EmbedTicJs, EmbedTicJsZip, EmbedTicJsZipSize);
u8* ptr = memmem(EmbedIndex, EmbedIndexSize, Placeholder, sizeof(Placeholder)-1);
u8* ptr = ticMemmem(EmbedIndex, EmbedIndexSize, Placeholder, sizeof(Placeholder)-1);
if(ptr)
{
MemoryBuffer output = {(u8*)SDL_malloc(EmbedTicJsSize * 2), 0};
MemoryBuffer output = {(u8*)malloc(EmbedTicJsSize * 2), 0};
if(output.data)
{
writeMemoryData(&output, EmbedIndex, ptr - EmbedIndex);
writeMemoryString(&output, "<script type='text/javascript'>\n");
u8* buffer = (u8*)SDL_malloc(sizeof(tic_cartridge));
u8* buffer = (u8*)malloc(sizeof(tic_cartridge));
if(buffer)
{
@@ -1741,10 +1746,10 @@ static void onConsoleExportHtmlCommand(Console* console, const char* name)
// zip buffer
{
unsigned long outSize = sizeof(tic_cartridge);
u8* output = (u8*)SDL_malloc(outSize);
u8* output = (u8*)malloc(outSize);
compress2(output, &outSize, buffer, size, Z_BEST_COMPRESSION);
SDL_free(buffer);
free(buffer);
buffer = output;
size = outSize;
@@ -1762,7 +1767,7 @@ static void onConsoleExportHtmlCommand(Console* console, const char* name)
}
}
SDL_free(buffer);
free(buffer);
writeMemoryString(&output, "];\n");
@@ -1778,8 +1783,8 @@ static void onConsoleExportHtmlCommand(Console* console, const char* name)
}
}
SDL_free(EmbedIndex);
SDL_free(EmbedTicJs);
free(EmbedIndex);
free(EmbedTicJs);
}
#if defined(CAN_EXPORT)
@@ -1794,7 +1799,7 @@ static void* embedCart(Console* console, s32* size)
if(app)
{
void* cart = SDL_malloc(sizeof(tic_cartridge));
void* cart = malloc(sizeof(tic_cartridge));
if(cart)
{
@@ -1802,7 +1807,7 @@ static void* embedCart(Console* console, s32* size)
{
unsigned long zipSize = sizeof(tic_cartridge);
u8* zip = (u8*)SDL_malloc(zipSize);
u8* zip = (u8*)malloc(zipSize);
if(zip)
{
@@ -1815,29 +1820,29 @@ static void* embedCart(Console* console, s32* size)
.cartSize = zipSize,
};
SDL_memcpy(header.sig, TicCartSig, SIG_SIZE);
memcpy(header.sig, TicCartSig, SIG_SIZE);
s32 finalSize = appSize + sizeof header + header.cartSize;
data = SDL_malloc(finalSize);
data = malloc(finalSize);
if(data)
{
SDL_memcpy(data, app, appSize);
SDL_memcpy(data + appSize, &header, sizeof header);
SDL_memcpy(data + appSize + sizeof header, zip, header.cartSize);
memcpy(data, app, appSize);
memcpy(data + appSize, &header, sizeof header);
memcpy(data + appSize + sizeof header, zip, header.cartSize);
*size = finalSize;
}
}
SDL_free(zip);
free(zip);
}
}
SDL_free(cart);
free(cart);
}
SDL_free(app);
free(app);
}
return data;
@@ -1870,7 +1875,7 @@ static const char* getExportName(Console* console, bool html)
strcat(name, ".html");
else
{
#if defined(__WINDOWS__)
#if defined(__TIC_WINDOWS__)
strcat(name, ExeExt);
#endif
}
@@ -1931,7 +1936,7 @@ static CartSaveResult saveCartName(Console* console, const char* name)
if(name && strlen(name))
{
u8* buffer = (u8*)SDL_malloc(sizeof(tic_cartridge) * 3);
u8* buffer = (u8*)malloc(sizeof(tic_cartridge) * 3);
if(buffer)
{
@@ -1966,7 +1971,7 @@ static CartSaveResult saveCartName(Console* console, const char* name)
}
}
SDL_free(buffer);
free(buffer);
}
}
else if (strlen(console->romName))
@@ -2277,7 +2282,7 @@ static void processConsoleTab(Console* console)
if(strlen(input))
{
char* param = SDL_strchr(input, ' ');
char* param = strchr(input, ' ');
if(param && strlen(++param))
{
@@ -2305,7 +2310,7 @@ static void toUpperStr(char* str)
{
while(*str)
{
*str = SDL_toupper(*str);
*str = toupper(*str);
str++;
}
}
@@ -2358,13 +2363,7 @@ static void onConsoleHelpCommand(Console* console, const char* param)
}
printBack(console, "\npress ");
#if defined(__ANDROID__)
printFront(console, "BACK");
#else
printFront(console, "ESC");
#endif
printBack(console, " to enter UI mode\n");
commandDone(console);
@@ -2375,15 +2374,15 @@ static s32 tic_strcasecmp(const char *str1, const char *str2)
char a = 0;
char b = 0;
while (*str1 && *str2) {
a = SDL_toupper((unsigned char) *str1);
b = SDL_toupper((unsigned char) *str2);
a = toupper((unsigned char) *str1);
b = toupper((unsigned char) *str2);
if (a != b)
break;
++str1;
++str2;
}
a = SDL_toupper(*str1);
b = SDL_toupper(*str2);
a = toupper(*str1);
b = toupper(*str2);
return (int) ((unsigned char) a - (unsigned char) b);
}
@@ -2397,7 +2396,7 @@ static void processCommand(Console* console, const char* command)
while(*end == ' ' && end > command)
*end-- = '\0';
char* param = SDL_strchr(command, ' ');
char* param = strchr(command, ' ');
if(param)
*param++ = '\0';
@@ -2458,8 +2457,8 @@ static void onHistoryDown(Console* console)
static void appendHistory(Console* console, const char* value)
{
HistoryItem* item = (HistoryItem*)SDL_malloc(sizeof(HistoryItem));
item->value = SDL_strdup(value);
HistoryItem* item = (HistoryItem*)malloc(sizeof(HistoryItem));
item->value = strdup(value);
item->next = NULL;
item->prev = NULL;
@@ -2516,122 +2515,146 @@ static void setScroll(Console* console, s32 val)
}
}
static void processGesture(Console* console)
typedef struct
{
SDL_Point point = {0, 0};
s32 major;
s32 minor;
s32 patch;
} NetVersion;
if(getGesturePos(&point))
static lua_State* netLuaInit(u8* buffer, s32 size)
{
if (buffer && size)
{
if(console->scroll.active)
setScroll(console, (console->scroll.start - point.y) / STUDIO_TEXT_HEIGHT);
else
lua_State* lua = luaL_newstate();
if(lua)
{
console->scroll.start = point.y + console->scroll.pos * STUDIO_TEXT_HEIGHT;
console->scroll.active = true;
if(luaL_loadstring(lua, (char*)buffer) == LUA_OK && lua_pcall(lua, 0, LUA_MULTRET, 0) == LUA_OK)
return lua;
else lua_close(lua);
}
}
else console->scroll.active = false;
return NULL;
}
static NetVersion netVersionRequest()
{
NetVersion version =
{
.major = TIC_VERSION_MAJOR,
.minor = TIC_VERSION_MINOR,
.patch = TIC_VERSION_PATCH,
};
s32 size = 0;
void* buffer = getSystem()->getUrlRequest("/api?fn=version", &size);
if(buffer && size)
{
lua_State* lua = netLuaInit(buffer, size);
if(lua)
{
static const char* Fields[] = {"major", "minor", "patch"};
for(s32 i = 0; i < COUNT_OF(Fields); i++)
{
lua_getglobal(lua, Fields[i]);
if(lua_isinteger(lua, -1))
((s32*)&version)[i] = (s32)lua_tointeger(lua, -1);
lua_pop(lua, 1);
}
lua_close(lua);
}
}
return version;
}
static void checkNewVersion(Console* console)
{
Net* net = createNet();
if(net)
NetVersion version = netVersionRequest();
if((version.major > TIC_VERSION_MAJOR) ||
(version.major == TIC_VERSION_MAJOR && version.minor > TIC_VERSION_MINOR) ||
(version.major == TIC_VERSION_MAJOR && version.minor == TIC_VERSION_MINOR && version.patch > TIC_VERSION_PATCH))
{
NetVersion version = netVersionRequest(net);
SDL_free(net);
if((version.major > TIC_VERSION_MAJOR) ||
(version.major == TIC_VERSION_MAJOR && version.minor > TIC_VERSION_MINOR) ||
(version.major == TIC_VERSION_MAJOR && version.minor == TIC_VERSION_MINOR && version.patch > TIC_VERSION_PATCH))
{
char msg[FILENAME_MAX] = {0};
sprintf(msg, "\n A new version %i.%i.%i is available.\n", version.major, version.minor, version.patch);
consolePrint(console, msg, (tic_color_light_green));
}
char msg[FILENAME_MAX] = {0};
sprintf(msg, "\n A new version %i.%i.%i is available.\n", version.major, version.minor, version.patch);
consolePrint(console, msg, (tic_color_light_green));
}
}
static void tick(Console* console)
{
SDL_Event* event = NULL;
while ((event = pollEvent()))
tic_mem* tic = console->tic;
// process scroll
{
switch(event->type)
tic80_input* input = &console->tic->ram.input;
if(input->mouse.scrolly)
{
case SDL_MOUSEWHEEL:
{
enum{Scroll = 3};
s32 delta = event->wheel.y > 0 ? -Scroll : Scroll;
setScroll(console, console->scroll.pos + delta);
}
break;
case SDL_KEYDOWN:
{
switch(event->key.keysym.sym)
{
case SDLK_UP:
onHistoryUp(console);
break;
case SDLK_DOWN:
onHistoryDown(console);
break;
case SDLK_RIGHT:
{
console->inputPosition++;
size_t len = strlen(console->inputBuffer);
if(console->inputPosition > len)
console->inputPosition = len;
}
break;
case SDLK_LEFT:
{
if(console->inputPosition > 0)
console->inputPosition--;
}
break;
case SDLK_RETURN: processConsoleCommand(console); break;
case SDLK_BACKSPACE: processConsoleBackspace(console); break;
case SDLK_DELETE: processConsoleDel(console); break;
case SDLK_HOME: processConsoleHome(console); break;
case SDLK_END: processConsoleEnd(console); break;
case SDLK_TAB: processConsoleTab(console); break;
default: break;
}
scrollConsole(console);
console->cursor.delay = CONSOLE_CURSOR_DELAY;
}
break;
case SDL_TEXTINPUT:
{
const char* symbol = event->text.text;
if(strlen(symbol) == 1)
{
char sym = *symbol;
size_t size = strlen(console->inputBuffer);
if(size < sizeof(console->inputBuffer))
{
char* pos = console->inputBuffer + console->inputPosition;
memmove(pos + 1, pos, strlen(pos));
*(console->inputBuffer + console->inputPosition) = sym;
console->inputPosition++;
}
}
console->cursor.delay = CONSOLE_CURSOR_DELAY;
}
break;
enum{Scroll = 3};
s32 delta = input->mouse.scrolly > 0 ? -Scroll : Scroll;
setScroll(console, console->scroll.pos + delta);
}
}
processGesture(console);
if(tic->ram.input.keyboard.data != 0)
{
if(keyWasPressed(tic_key_up)) onHistoryUp(console);
else if(keyWasPressed(tic_key_down)) onHistoryDown(console);
else if(keyWasPressed(tic_key_left))
{
if(console->inputPosition > 0)
console->inputPosition--;
}
else if(keyWasPressed(tic_key_right))
{
console->inputPosition++;
size_t len = strlen(console->inputBuffer);
if(console->inputPosition > len)
console->inputPosition = len;
}
else if(keyWasPressed(tic_key_return)) processConsoleCommand(console);
else if(keyWasPressed(tic_key_backspace)) processConsoleBackspace(console);
else if(keyWasPressed(tic_key_delete)) processConsoleDel(console);
else if(keyWasPressed(tic_key_home)) processConsoleHome(console);
else if(keyWasPressed(tic_key_end)) processConsoleEnd(console);
else if(keyWasPressed(tic_key_tab)) processConsoleTab(console);
if(anyKeyWasPressed())
{
scrollConsole(console);
console->cursor.delay = CONSOLE_CURSOR_DELAY;
}
char sym = getKeyboardText();
if(sym)
{
size_t size = strlen(console->inputBuffer);
if(size < sizeof(console->inputBuffer))
{
char* pos = console->inputBuffer + console->inputPosition;
memmove(pos + 1, pos, strlen(pos));
*(console->inputBuffer + console->inputPosition) = sym;
console->inputPosition++;
}
console->cursor.delay = CONSOLE_CURSOR_DELAY;
}
}
if(console->tickCounter == 0)
{
@@ -2651,7 +2674,7 @@ static void tick(Console* console)
else printBack(console, "\n loading cart...");
}
console->tic->api.clear(console->tic, TIC_COLOR_BG);
tic->api.clear(tic, TIC_COLOR_BG);
drawConsoleText(console);
if(console->embed.yes)
@@ -2661,13 +2684,13 @@ static void tick(Console* console)
if(!console->skipStart)
console->showGameMenu = true;
memcpy(&console->tic->cart, console->embed.file, sizeof(tic_cartridge));
memcpy(&tic->cart, console->embed.file, sizeof(tic_cartridge));
setStudioMode(TIC_RUN_MODE);
console->embed.yes = false;
console->skipStart = false;
studioRomLoaded();
console->tic->api.reset(console->tic);
tic->api.reset(tic);
printLine(console);
commandDone(console);
@@ -2724,7 +2747,7 @@ static bool cmdLoadCart(Console* console, const char* name)
done = true;
}
SDL_free(data);
free(data);
}
return done;
@@ -2747,8 +2770,8 @@ static bool loadFileIntoBuffer(Console* console, char* buffer, const char* fileN
printError(console, messageBuffer);
}
memcpy(buffer, contents, SDL_min(size, TIC_CODE_SIZE-1));
SDL_free(contents);
memcpy(buffer, contents, MIN(size, TIC_CODE_SIZE-1));
free(contents);
return true;
}
@@ -2812,8 +2835,8 @@ static bool cmdInjectSprites(Console* console, const char* param, const char* na
Height = TIC_SPRITESHEET_SIZE*2,
};
s32 w = SDL_min(Width, image->width);
s32 h = SDL_min(Height, image->height);
s32 w = MIN(Width, image->width);
s32 h = MIN(Height, image->height);
for (s32 y = 0; y < h; y++)
for (s32 x = 0; x < w; x++)
@@ -2829,7 +2852,7 @@ static bool cmdInjectSprites(Console* console, const char* param, const char* na
gif_close(image);
}
SDL_free(sprites);
free(sprites);
console->embed.yes = true;
console->skipStart = true;
@@ -2861,7 +2884,7 @@ static bool cmdInjectMap(Console* console, const char* param, const char* name)
done = true;
}
SDL_free(map);
free(map);
}
}
@@ -2870,9 +2893,9 @@ static bool cmdInjectMap(Console* console, const char* param, const char* name)
void initConsole(Console* console, tic_mem* tic, FileSystem* fs, Config* config, s32 argc, char **argv)
{
if(!console->buffer) console->buffer = SDL_malloc(CONSOLE_BUFFER_SIZE);
if(!console->colorBuffer) console->colorBuffer = SDL_malloc(CONSOLE_BUFFER_SIZE);
if(!console->embed.file) console->embed.file = SDL_malloc(sizeof(tic_cartridge));
if(!console->buffer) console->buffer = malloc(CONSOLE_BUFFER_SIZE);
if(!console->colorBuffer) console->colorBuffer = malloc(CONSOLE_BUFFER_SIZE);
if(!console->embed.file) console->embed.file = malloc(sizeof(tic_cartridge));
*console = (Console)
{
@@ -2931,7 +2954,7 @@ void initConsole(Console* console, tic_mem* tic, FileSystem* fs, Config* config,
{
strcpy(console->appPath, argv[0]);
#if defined(__WINDOWS__)
#if defined(__TIC_WINDOWS__)
if(!strstr(console->appPath, ExeExt))
strcat(console->appPath, ExeExt);
#endif
@@ -3008,7 +3031,7 @@ void initConsole(Console* console, tic_mem* tic, FileSystem* fs, Config* config,
{
char buf[256];
sprintf(buf, "parameter or file not processed: %s\n", argv[i]);
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_WARNING, "Warning", buf, NULL);
getSystem()->showMessageBox("Warning", buf);
}
}
}
@@ -3040,7 +3063,7 @@ void initConsole(Console* console, tic_mem* tic, FileSystem* fs, Config* config,
s32 size = unzip(&data, cartPtr, cartSize);
loadCart(tic, console->embed.file, data, size, true);
SDL_free(data);
free(data);
EM_ASM_({Module._free($0);}, cartPtr);
}
@@ -3061,7 +3084,7 @@ void initConsole(Console* console, tic_mem* tic, FileSystem* fs, Config* config,
while(true)
{
const EmbedHeader* header = (const EmbedHeader*)memmem(ptr, size, TicCartSig, SIG_SIZE);
const EmbedHeader* header = (const EmbedHeader*)ticMemmem(ptr, size, TicCartSig, SIG_SIZE);
if(header)
{
@@ -3075,7 +3098,7 @@ void initConsole(Console* console, tic_mem* tic, FileSystem* fs, Config* config,
loadCart(tic, console->embed.file, data, dataSize, true);
console->embed.yes = true;
SDL_free(data);
free(data);
}
break;
@@ -3089,7 +3112,7 @@ void initConsole(Console* console, tic_mem* tic, FileSystem* fs, Config* config,
else break;
}
SDL_free(app);
free(app);
}
}
+2
View File
@@ -24,3 +24,5 @@
#define COUNT_OF(x) ((sizeof(x)/sizeof(0[x])) / ((size_t)(!(sizeof(x) % sizeof(0[x])))))
#define STATIC_ASSERT(name, condition) typedef char static_assert_dummy_ ## name[(condition) ? 1 : -1]
#define MIN(a,b) ((a) < (b) ? (a) : (b))
#define MAX(a,b) ((a) > (b) ? (a) : (b))
+26 -37
View File
@@ -28,22 +28,22 @@ static void drawButton(Dialog* dlg, const char* label, s32 x, s32 y, u8 color, u
enum {BtnWidth = 20, BtnHeight = 9};
SDL_Rect rect = {x, y, BtnWidth, BtnHeight};
tic_rect rect = {x, y, BtnWidth, BtnHeight};
bool down = false;
bool over = false;
if(checkMousePos(&rect))
{
setCursor(SDL_SYSTEM_CURSOR_HAND);
setCursor(tic_cursor_hand);
over = true;
if(checkMouseDown(&rect, SDL_BUTTON_LEFT))
if(checkMouseDown(&rect, tic_mouse_left))
{
down = true;
dlg->focus = id;
}
if(checkMouseClick(&rect, SDL_BUTTON_LEFT))
if(checkMouseClick(&rect, tic_mouse_left))
callback(dlg);
}
@@ -91,27 +91,25 @@ static void onNo(Dialog* dlg)
hideDialog();
}
static void processKeydown(Dialog* dlg, SDL_Keysym* keysum)
static void processKeyboard(Dialog* dlg)
{
SDL_Scancode scancode = keysum->scancode;
tic_mem* tic = dlg->tic;
if(tic->ram.input.keyboard.data == 0) return;
switch(scancode)
if(keyWasPressed(tic_key_left))
{
case SDL_SCANCODE_LEFT:
dlg->focus = (dlg->focus-1) % 2;
playSystemSfx(2);
break;
case SDL_SCANCODE_RIGHT:
case SDL_SCANCODE_TAB:
}
else if(keyWasPressed(tic_key_right) || keyWasPressed(tic_key_tab))
{
dlg->focus = (dlg->focus+1) % 2;
playSystemSfx(2);
break;
case SDL_SCANCODE_RETURN:
case SDL_SCANCODE_SPACE:
}
else if(keyWasPressed(tic_key_return) || keyWasPressed(tic_key_space))
{
dlg->focus == 0 ? onYes(dlg) : onNo(dlg);
break;
default:
break;
}
}
@@ -121,18 +119,18 @@ static void drawDialog(Dialog* dlg)
tic_mem* tic = dlg->tic;
SDL_Rect rect = {(TIC80_WIDTH - Width)/2, (TIC80_HEIGHT - Height)/2, Width, Height};
tic_rect rect = {(TIC80_WIDTH - Width)/2, (TIC80_HEIGHT - Height)/2, Width, Height};
rect.x -= dlg->pos.x;
rect.y -= dlg->pos.y;
SDL_Rect header = {rect.x, rect.y-(TOOLBAR_SIZE-1), rect.w, TOOLBAR_SIZE};
tic_rect header = {rect.x, rect.y-(TOOLBAR_SIZE-1), rect.w, TOOLBAR_SIZE};
if(checkMousePos(&header))
{
setCursor(SDL_SYSTEM_CURSOR_HAND);
setCursor(tic_cursor_hand);
if(checkMouseDown(&header, SDL_BUTTON_LEFT))
if(checkMouseDown(&header, tic_mouse_left))
{
if(!dlg->drag.active)
{
@@ -146,13 +144,13 @@ static void drawDialog(Dialog* dlg)
if(dlg->drag.active)
{
setCursor(SDL_SYSTEM_CURSOR_HAND);
setCursor(tic_cursor_hand);
dlg->pos.x = dlg->drag.start.x - getMouseX();
dlg->pos.y = dlg->drag.start.y - getMouseY();
SDL_Rect rect = {0, 0, TIC80_WIDTH, TIC80_HEIGHT};
if(!checkMouseDown(&rect, SDL_BUTTON_LEFT))
tic_rect rect = {0, 0, TIC80_WIDTH, TIC80_HEIGHT};
if(!checkMouseDown(&rect, tic_mouse_left))
dlg->drag.active = false;
}
@@ -191,16 +189,7 @@ static void drawDialog(Dialog* dlg)
static void tick(Dialog* dlg)
{
SDL_Event* event = NULL;
while ((event = pollEvent()))
{
switch(event->type)
{
case SDL_KEYDOWN:
processKeydown(dlg, &event->key.keysym);
break;
}
}
processKeyboard(dlg);
if(!dlg->init)
{
@@ -209,7 +198,7 @@ static void tick(Dialog* dlg)
dlg->init = true;
}
SDL_memcpy(dlg->tic->ram.vram.screen.data, dlg->bg, sizeof dlg->tic->ram.vram.screen.data);
memcpy(dlg->tic->ram.vram.screen.data, dlg->bg, sizeof dlg->tic->ram.vram.screen.data);
drawDialog(dlg);
}
@@ -245,8 +234,8 @@ void initDialog(Dialog* dlg, tic_mem* tic, const char** text, s32 rows, DialogCa
enum{Size = sizeof tic->ram.vram.screen.data};
if(!dlg->bg)
dlg->bg = SDL_malloc(Size);
dlg->bg = malloc(Size);
if(dlg->bg)
SDL_memcpy(dlg->bg, tic->ram.vram.screen.data, Size);
memcpy(dlg->bg, tic->ram.vram.screen.data, Size);
}
+2 -2
View File
@@ -39,11 +39,11 @@ struct Dialog
u32 focus;
SDL_Point pos;
tic_point pos;
struct
{
SDL_Point start;
tic_point start;
bool active;
} drag;
-34
View File
@@ -115,40 +115,6 @@ void file_dialog_save(file_dialog_save_callback callback, const char* name, cons
callback(false, data);
}
#include <shlobj.h>
const char* folder_dialog(void* data)
{
BROWSEINFOW bi = { 0 };
bi.lpszTitle = L"Browse for folder...";
bi.ulFlags = BIF_RETURNONLYFSDIRS | BIF_NEWDIALOGSTYLE;
bi.lParam = (LPARAM) NULL;
LPITEMIDLIST pidl = SHBrowseForFolderW ( &bi );
if ( pidl != 0 )
{
wchar_t path[MAX_PATH];
SHGetPathFromIDListW (pidl, path);
LPMALLOC imalloc = NULL;
if ( SUCCEEDED( SHGetMalloc ( &imalloc )) )
{
imalloc->lpVtbl->Free (imalloc, pidl );
imalloc->lpVtbl->Release (imalloc);
}
{
static char result[MAX_PATH];
strcpy(result, StringToUTF8(path));
return result;
}
}
return NULL;
}
#elif defined(__EMSCRIPTEN__)
#include <emscripten.h>
-1
View File
@@ -34,7 +34,6 @@ typedef void(*file_dialog_save_callback)(bool result, void* data);
void file_dialog_load(file_dialog_load_callback callback, void* data);
void file_dialog_save(file_dialog_save_callback callback, const char* name, const u8* buffer, size_t size, void* data, u32 mode);
const char* folder_dialog(void* data);
#ifdef __cplusplus
}
+189 -129
View File
@@ -22,14 +22,17 @@
#include "studio.h"
#include "fs.h"
#include "net.h"
#include "ext/file_dialog.h"
#include <dirent.h>
#include <sys/stat.h>
#include <sys/types.h>
#if defined(__WINRT__) || defined(__WINDOWS__)
#include <lua.h>
#include <lauxlib.h>
#include <lualib.h>
#if defined(__TIC_WINRT__) || defined(__TIC_WINDOWS__)
#include <direct.h>
#include <windows.h>
#else
@@ -49,8 +52,6 @@ struct FileSystem
{
char dir[FILENAME_MAX];
char work[FILENAME_MAX];
Net* net;
};
static const char* getFilePath(FileSystem* fs, const char* name)
@@ -67,7 +68,7 @@ static const char* getFilePath(FileSystem* fs, const char* name)
strcat(path, name);
#if defined(__WINDOWS__)
#if defined(__TIC_WINDOWS__)
char* ptr = path;
while (*ptr)
{
@@ -103,10 +104,28 @@ bool fsIsInPublicDir(FileSystem* fs)
return isPublic(fs);
}
#if defined(__WINDOWS__) || defined(__WINRT__)
#if defined(__TIC_WINDOWS__) || defined(__TIC_WINRT__)
#define UTF8ToString(S) (wchar_t *)SDL_iconv_string("UTF-16LE", "UTF-8", (char *)(S), SDL_strlen(S)+1)
#define StringToUTF8(S) SDL_iconv_string("UTF-8", "UTF-16LE", (char *)(S), (SDL_wcslen(S)+1)*sizeof(wchar_t))
#define __S(x) L ## x
#define _S(x) __S(x)
static const wchar_t* UTF8ToString(const char* str)
{
static wchar_t wstr[FILENAME_MAX];
mbstowcs(wstr, str, FILENAME_MAX);
return wstr;
}
static char* StringToUTF8(const wchar_t* wstr)
{
static char str[FILENAME_MAX];
wcstombs(str, wstr, FILENAME_MAX);
return str;
}
FILE* _wfopen(const wchar_t *, const wchar_t *);
int _wremove(const wchar_t *);
@@ -123,10 +142,11 @@ int _wremove(const wchar_t *);
#define tic_remove _wremove
#define tic_fopen _wfopen
#define tic_mkdir(name) _wmkdir(name)
#define tic_system _wsystem
#else
#define _S(x) (x)
#define UTF8ToString(S) (S)
#define StringToUTF8(S) (S)
@@ -142,7 +162,131 @@ int _wremove(const wchar_t *);
#define tic_remove remove
#define tic_fopen fopen
#define tic_mkdir(name) mkdir(name, 0700)
#define tic_system system
#endif
#if !defined(__EMSCRIPTEN__)
typedef struct
{
ListCallback callback;
void* data;
} NetDirData;
static lua_State* netLuaInit(u8* buffer, s32 size)
{
if (buffer && size)
{
lua_State* lua = luaL_newstate();
if(lua)
{
if(luaL_loadstring(lua, (char*)buffer) == LUA_OK && lua_pcall(lua, 0, LUA_MULTRET, 0) == LUA_OK)
return lua;
else lua_close(lua);
}
}
return NULL;
}
static void onDirResponse(u8* buffer, s32 size, void* data)
{
NetDirData* netDirData = (NetDirData*)data;
lua_State* lua = netLuaInit(buffer, size);
if(lua)
{
{
lua_getglobal(lua, "folders");
if(lua_type(lua, -1) == LUA_TTABLE)
{
s32 count = (s32)lua_rawlen(lua, -1);
for(s32 i = 1; i <= count; i++)
{
lua_geti(lua, -1, i);
{
lua_getfield(lua, -1, "name");
if(lua_isstring(lua, -1))
netDirData->callback(lua_tostring(lua, -1), NULL, 0, netDirData->data, true);
lua_pop(lua, 1);
}
lua_pop(lua, 1);
}
}
lua_pop(lua, 1);
}
{
lua_getglobal(lua, "files");
if(lua_type(lua, -1) == LUA_TTABLE)
{
s32 count = (s32)lua_rawlen(lua, -1);
for(s32 i = 1; i <= count; i++)
{
lua_geti(lua, -1, i);
char hash[FILENAME_MAX] = {0};
char name[FILENAME_MAX] = {0};
{
lua_getfield(lua, -1, "hash");
if(lua_isstring(lua, -1))
strcpy(hash, lua_tostring(lua, -1));
lua_pop(lua, 1);
}
{
lua_getfield(lua, -1, "name");
if(lua_isstring(lua, -1))
strcpy(name, lua_tostring(lua, -1));
lua_pop(lua, 1);
}
{
lua_getfield(lua, -1, "id");
if(lua_isinteger(lua, -1))
netDirData->callback(name, hash, lua_tointeger(lua, -1), netDirData->data, false);
lua_pop(lua, 1);
}
lua_pop(lua, 1);
}
}
lua_pop(lua, 1);
}
lua_close(lua);
}
}
static void netDirRequest(const char* path, ListCallback callback, void* data)
{
char request[FILENAME_MAX] = {'\0'};
sprintf(request, "/api?fn=dir&path=%s", path);
s32 size = 0;
void* buffer = getSystem()->getUrlRequest(request, &size);
NetDirData netDirData = {callback, data};
onDirResponse(buffer, size, &netDirData);
}
#endif
@@ -154,7 +298,7 @@ void fsEnumFiles(FileSystem* fs, ListCallback callback, void* data)
if(isPublic(fs))
{
netDirRequest(fs->net, fs->work + sizeof(TIC_HOST), callback, data);
netDirRequest(fs->work + sizeof(TIC_HOST), callback, data);
return;
}
@@ -194,7 +338,7 @@ void fsEnumFiles(FileSystem* fs, ListCallback callback, void* data)
bool fsDeleteDir(FileSystem* fs, const char* name)
{
#if defined(__WINRT__) || defined(__WINDOWS__)
#if defined(__TIC_WINRT__) || defined(__TIC_WINDOWS__)
const char* path = getFilePath(fs, name);
bool result = tic_rmdir(UTF8ToString(path));
#else
@@ -236,7 +380,7 @@ static void onAddFile(const char* name, const u8* buffer, s32 size, void* data,
{
const char* destname = getFilePath(fs, name);
FILE* file = tic_fopen(UTF8ToString(destname), UTF8ToString("rb"));
FILE* file = tic_fopen(UTF8ToString(destname), _S("rb"));
if(file)
{
fclose(file);
@@ -246,14 +390,14 @@ static void onAddFile(const char* name, const u8* buffer, s32 size, void* data,
else
{
const char* path = getFilePath(fs, name);
FILE* dest = tic_fopen(UTF8ToString(path), UTF8ToString("wb"));
FILE* dest = tic_fopen(UTF8ToString(path), _S("wb"));
if (dest)
{
fwrite(buffer, 1, size, dest);
fclose(dest);
#if !defined(__WINRT__) && !defined(__WINDOWS__)
#if !defined(__TIC_WINRT__) && !defined(__TIC_WINDOWS__)
if(mode)
chmod(path, mode);
#endif
@@ -271,16 +415,16 @@ static void onAddFile(const char* name, const u8* buffer, s32 size, void* data,
addFileData->callback(name, FS_FILE_NOT_ADDED, addFileData->data);
}
SDL_free(addFileData);
free(addFileData);
}
void fsAddFile(FileSystem* fs, AddCallback callback, void* data)
{
AddFileData* addFileData = (AddFileData*)SDL_malloc(sizeof(AddFileData));
AddFileData* addFileData = (AddFileData*)malloc(sizeof(AddFileData));
*addFileData = (AddFileData) { fs, callback, data };
file_dialog_load(&onAddFile, addFileData);
getSystem()->fileDialogLoad(&onAddFile, addFileData);
}
typedef struct
@@ -296,14 +440,14 @@ static void onGetFile(bool result, void* data)
command->callback(result ? FS_FILE_DOWNLOADED : FS_FILE_NOT_DOWNLOADED, command->data);
SDL_free(command->buffer);
SDL_free(command);
free(command->buffer);
free(command);
}
static u32 fsGetMode(FileSystem* fs, const char* name)
{
#if defined(__WINRT__) || defined(__WINDOWS__)
#if defined(__TIC_WINRT__) || defined(__TIC_WINDOWS__)
return 0;
#else
const char* path = getFilePath(fs, name);
@@ -409,10 +553,10 @@ bool fsIsDir(FileSystem* fs, const char* name)
void fsGetFileData(GetCallback callback, const char* name, void* buffer, size_t size, u32 mode, void* data)
{
GetFileData* command = (GetFileData*)SDL_malloc(sizeof(GetFileData));
GetFileData* command = (GetFileData*)malloc(sizeof(GetFileData));
*command = (GetFileData) {callback, data, buffer};
file_dialog_save(onGetFile, name, buffer, size, command, mode);
getSystem()->fileDialogSave(onGetFile, name, buffer, size, command, mode);
}
typedef struct
@@ -427,16 +571,16 @@ static void onOpenFileData(const char* name, const u8* buffer, s32 size, void* d
command->callback(name, buffer, size, command->data);
SDL_free(command);
free(command);
}
void fsOpenFileData(OpenCallback callback, void* data)
{
OpenFileData* command = (OpenFileData*)SDL_malloc(sizeof(OpenFileData));
OpenFileData* command = (OpenFileData*)malloc(sizeof(OpenFileData));
*command = (OpenFileData){callback, data};
file_dialog_load(onOpenFileData, command);
getSystem()->fileDialogLoad(onOpenFileData, command);
}
void fsGetFile(FileSystem* fs, GetCallback callback, const char* name, void* data)
@@ -446,18 +590,18 @@ void fsGetFile(FileSystem* fs, GetCallback callback, const char* name, void* dat
if(buffer)
{
GetFileData* command = (GetFileData*)SDL_malloc(sizeof(GetFileData));
GetFileData* command = (GetFileData*)malloc(sizeof(GetFileData));
*command = (GetFileData) {callback, data, buffer};
s32 mode = fsGetMode(fs, name);
file_dialog_save(onGetFile, name, buffer, size, command, mode);
getSystem()->fileDialogSave(onGetFile, name, buffer, size, command, mode);
}
else callback(FS_FILE_NOT_DOWNLOADED, data);
}
bool fsWriteFile(const char* name, const void* buffer, s32 size)
{
FILE* file = tic_fopen(UTF8ToString(name), UTF8ToString("wb"));
FILE* file = tic_fopen(UTF8ToString(name), _S("wb"));
if(file)
{
@@ -482,14 +626,14 @@ bool fsCopyFile(const char* src, const char* dst)
s32 size = 0;
{
FILE* file = tic_fopen(UTF8ToString(src), UTF8ToString("rb"));
FILE* file = tic_fopen(UTF8ToString(src), _S("rb"));
if(file)
{
fseek(file, 0, SEEK_END);
size = ftell(file);
fseek(file, 0, SEEK_SET);
if((buffer = SDL_malloc(size)) && fread(buffer, size, 1, file)) {}
if((buffer = malloc(size)) && fread(buffer, size, 1, file)) {}
fclose(file);
}
@@ -497,7 +641,7 @@ bool fsCopyFile(const char* src, const char* dst)
if(buffer)
{
FILE* file = tic_fopen(UTF8ToString(dst), UTF8ToString("wb"));
FILE* file = tic_fopen(UTF8ToString(dst), _S("wb"));
if(file)
{
@@ -507,7 +651,7 @@ bool fsCopyFile(const char* src, const char* dst)
done = true;
}
SDL_free(buffer);
free(buffer);
}
return done;
@@ -515,7 +659,7 @@ bool fsCopyFile(const char* src, const char* dst)
void* fsReadFile(const char* path, s32* size)
{
FILE* file = tic_fopen(UTF8ToString(path), UTF8ToString("rb"));
FILE* file = tic_fopen(UTF8ToString(path), _S("rb"));
void* buffer = NULL;
if(file)
@@ -525,7 +669,7 @@ void* fsReadFile(const char* path, s32* size)
*size = ftell(file);
fseek(file, 0, SEEK_SET);
if((buffer = SDL_malloc(*size)) && fread(buffer, *size, 1, file)) {}
if((buffer = malloc(*size)) && fread(buffer, *size, 1, file)) {}
fclose(file);
}
@@ -554,7 +698,7 @@ const char* fsFullname(const char *path)
{
char* result = NULL;
#if defined(__WINDOWS__) || defined(__WINRT__)
#if defined(__TIC_WINDOWS__) || defined(__TIC_WINRT__)
static wchar_t wpath[FILENAME_MAX];
GetFullPathNameW(UTF8ToString(path), sizeof(wpath), wpath, NULL);
@@ -572,7 +716,7 @@ const char* fsBasename(const char *path)
{
char* result = NULL;
#if defined(__WINDOWS__) || defined(__WINRT__)
#if defined(__TIC_WINDOWS__) || defined(__TIC_WINRT__)
#define SEP "\\"
#else
#define SEP "/"
@@ -701,7 +845,7 @@ void* fsLoadFile(FileSystem* fs, const char* name, s32* size)
char path[FILENAME_MAX] = {0};
sprintf(path, "/cart/%s/cart.tic", loadPublicCartData.hash);
void* data = netGetRequest(fs->net, path, size);
void* data = getSystem()->getUrlRequest(path, size);
if(data)
fsSaveRootFile(fs, cachePath, data, *size, false);
@@ -711,7 +855,7 @@ void* fsLoadFile(FileSystem* fs, const char* name, s32* size)
}
else
{
FILE* file = tic_fopen(UTF8ToString(getFilePath(fs, name)), UTF8ToString("rb"));
FILE* file = tic_fopen(UTF8ToString(getFilePath(fs, name)), _S("rb"));
void* ptr = NULL;
if(file)
@@ -720,7 +864,7 @@ void* fsLoadFile(FileSystem* fs, const char* name, s32* size)
*size = ftell(file);
fseek(file, 0, SEEK_SET);
u8* buffer = SDL_malloc(*size);
u8* buffer = malloc(*size);
if(buffer && fread(buffer, *size, 1, file)) ptr = buffer;
@@ -751,38 +895,6 @@ void fsMakeDir(FileSystem* fs, const char* name)
makeDir(getFilePath(fs, name));
}
#if defined(__WINDOWS__) || defined(__LINUX__) || defined(__MACOSX__)
s32 fsOpenSystemPath(FileSystem* fs, const char* path)
{
char command[FILENAME_MAX];
#if defined(__WINDOWS__)
sprintf(command, "explorer \"%s\"", path);
#elif defined(__LINUX__)
sprintf(command, "xdg-open \"%s\"", path);
#elif defined(__MACOSX__)
sprintf(command, "open \"%s\"", path);
#endif
return tic_system(UTF8ToString(command));
}
#else
s32 fsOpenSystemPath(FileSystem* fs, const char* path)
{
return 0;
}
#endif
void fsOpenWorkingFolder(FileSystem* fs)
{
const char* path = getFilePath(fs, "");
@@ -790,67 +902,15 @@ void fsOpenWorkingFolder(FileSystem* fs)
if(isPublic(fs))
path = fs->dir;
fsOpenSystemPath(fs, path);
getSystem()->openSystemPath(path);
}
void createFileSystem(const char* path, void(*callback)(FileSystem*))
FileSystem* createFileSystem(const char* path)
{
FileSystem* fs = (FileSystem*)SDL_malloc(sizeof(FileSystem));
FileSystem* fs = (FileSystem*)malloc(sizeof(FileSystem));
memset(fs, 0, sizeof(FileSystem));
fs->net = createNet();
strcpy(fs->dir, path);
if(path)
{
strcpy(fs->dir, path);
callback(fs);
}
else
{
#if defined(__EMSCRIPTEN__)
strcpy(fs->dir, "/" TIC_PACKAGE "/" TIC_NAME "/");
#elif defined(__ANDROID__)
strcpy(fs->dir, SDL_AndroidGetExternalStoragePath());
const char AppFolder[] = "/" TIC_NAME "/";
strcat(fs->dir, AppFolder);
mkdir(fs->dir, 0700);
#else
char* path = SDL_GetPrefPath(TIC_PACKAGE, TIC_NAME);
strcpy(fs->dir, path);
SDL_free(path);
#endif
#if defined(__EMSCRIPTEN__)
EM_ASM_
(
{
var dir = "";
Module.Pointer_stringify($0).split("/").forEach(function(val)
{
if(val.length)
{
dir += "/" + val;
FS.mkdir(dir);
}
});
FS.mount(IDBFS, {}, dir);
FS.syncfs(true, function(error)
{
if(error) console.log(error);
else Runtime.dynCall('vi', $1, [$2]);
});
}, fs->dir, callback, fs
);
#else
callback(fs);
#endif
}
return fs;
}
+1 -2
View File
@@ -47,7 +47,7 @@ typedef void(*OpenCallback)(const char* name, const void* buffer, size_t size, v
typedef struct FileSystem FileSystem;
void createFileSystem(const char* path, void(*callback)(FileSystem*));
FileSystem* createFileSystem(const char* path);
void fsEnumFiles(FileSystem* fs, ListCallback callback, void* data);
void fsAddFile(FileSystem* fs, AddCallback callback, void* data);
@@ -72,7 +72,6 @@ bool fsCopyFile(const char* src, const char* dst);
void fsGetFileData(GetCallback callback, const char* name, void* buffer, size_t size, u32 mode, void* data);
void fsOpenFileData(OpenCallback callback, void* data);
void fsOpenWorkingFolder(FileSystem* fs);
s32 fsOpenSystemPath(FileSystem* fs, const char* path);
bool fsIsDir(FileSystem* fs, const char* dir);
bool fsIsInPublicDir(FileSystem* fs);
bool fsChangeDir(FileSystem* fs, const char* dir);
+12 -16
View File
@@ -248,13 +248,9 @@ static s32 duk_key(duk_context* duk)
{
tic_key key = duk_to_int(duk, 0);
if(key < tic_keys_count)
if(key < tic_key_escape)
duk_push_boolean(duk, tic->api.key(tic, key));
else
{
duk_error(duk, DUK_ERR_ERROR, "unknown keyboard code\n");
return 0;
}
else return duk_error(duk, DUK_ERR_ERROR, "unknown keyboard code\n");
}
return 1;
@@ -273,10 +269,9 @@ static s32 duk_keyp(duk_context* duk)
{
tic_key key = duk_to_int(duk, 0);
if(key >= tic_keys_count)
if(key >= tic_key_escape)
{
duk_error(duk, DUK_ERR_ERROR, "unknown keyboard code\n");
return 0;
return duk_error(duk, DUK_ERR_ERROR, "unknown keyboard code\n");
}
else
{
@@ -325,8 +320,7 @@ static duk_ret_t duk_sfx(duk_context* duk)
if(!tic_tool_parse_note(noteStr, &note, &octave))
{
duk_error(duk, DUK_ERR_ERROR, "invalid note, should be like C#4\n");
return 0;
return duk_error(duk, DUK_ERR_ERROR, "invalid note, should be like C#4\n");
}
}
else
@@ -340,8 +334,7 @@ static duk_ret_t duk_sfx(duk_context* duk)
}
else
{
duk_error(duk, DUK_ERR_ERROR, "unknown sfx index\n");
return 0;
return duk_error(duk, DUK_ERR_ERROR, "unknown sfx index\n");
}
s32 duration = duk_is_null_or_undefined(duk, 2) ? -1 : duk_to_int(duk, 2);
@@ -356,7 +349,7 @@ static duk_ret_t duk_sfx(duk_context* duk)
memory->api.sfx_stop(memory, channel);
memory->api.sfx_ex(memory, index, note, octave, duration, channel, volume & 0xf, speed);
}
else duk_error(duk, DUK_ERR_ERROR, "unknown channel\n");
else return duk_error(duk, DUK_ERR_ERROR, "unknown channel\n");
return 0;
}
@@ -571,13 +564,16 @@ static duk_ret_t duk_pmem(duk_context* duk)
s32 val = memory->persistent.data[index];
if(!duk_is_null_or_undefined(duk, 1))
{
memory->persistent.data[index] = duk_to_int(duk, 1);
machine->data->syncPMEM = true;
}
duk_push_int(duk, val);
return 1;
}
else duk_error(duk, DUK_ERR_ERROR, "invalid persistent memory index\n");
else return duk_error(duk, DUK_ERR_ERROR, "invalid persistent memory index\n");
return 0;
}
@@ -762,7 +758,7 @@ static duk_ret_t duk_sync(duk_context* duk)
if(bank >= 0 && bank < TIC_BANKS)
memory->api.sync(memory, mask, bank, toCart);
else
duk_error(duk, DUK_ERR_ERROR, "sync() error, invalid bank");
return duk_error(duk, DUK_ERR_ERROR, "sync() error, invalid bank");
return 0;
}
+13 -13
View File
@@ -39,7 +39,7 @@
[SDL_SCANCODE_9] = tic_key_9,
[SDL_SCANCODE_0] = tic_key_0,
[SDL_SCANCODE_RETURN] = tic_key_return,
[SDL_SCANCODE_ESCAPE] = tic_key_unknown,
[SDL_SCANCODE_ESCAPE] = tic_key_escape,
[SDL_SCANCODE_BACKSPACE] = tic_key_backspace,
[SDL_SCANCODE_TAB] = tic_key_tab,
[SDL_SCANCODE_SPACE] = tic_key_space,
@@ -56,18 +56,18 @@
[SDL_SCANCODE_PERIOD] = tic_key_period,
[SDL_SCANCODE_SLASH] = tic_key_slash,
[SDL_SCANCODE_CAPSLOCK] = tic_key_capslock,
[SDL_SCANCODE_F1] = tic_key_unknown,
[SDL_SCANCODE_F2] = tic_key_unknown,
[SDL_SCANCODE_F3] = tic_key_unknown,
[SDL_SCANCODE_F4] = tic_key_unknown,
[SDL_SCANCODE_F5] = tic_key_unknown,
[SDL_SCANCODE_F6] = tic_key_unknown,
[SDL_SCANCODE_F7] = tic_key_unknown,
[SDL_SCANCODE_F8] = tic_key_unknown,
[SDL_SCANCODE_F9] = tic_key_unknown,
[SDL_SCANCODE_F10] = tic_key_unknown,
[SDL_SCANCODE_F11] = tic_key_unknown,
[SDL_SCANCODE_F12] = tic_key_unknown,
[SDL_SCANCODE_F1] = tic_key_f1,
[SDL_SCANCODE_F2] = tic_key_f2,
[SDL_SCANCODE_F3] = tic_key_f3,
[SDL_SCANCODE_F4] = tic_key_f4,
[SDL_SCANCODE_F5] = tic_key_f5,
[SDL_SCANCODE_F6] = tic_key_f6,
[SDL_SCANCODE_F7] = tic_key_f7,
[SDL_SCANCODE_F8] = tic_key_f8,
[SDL_SCANCODE_F9] = tic_key_f9,
[SDL_SCANCODE_F10] = tic_key_f10,
[SDL_SCANCODE_F11] = tic_key_f11,
[SDL_SCANCODE_F12] = tic_key_f12,
[70] = tic_key_unknown,
[71] = tic_key_unknown,
[72] = tic_key_unknown,
+3 -2
View File
@@ -795,7 +795,7 @@ static s32 lua_key(lua_State* lua)
{
tic_key key = getLuaNumber(lua, 1);
if(key < tic_keys_count)
if(key < tic_key_escape)
lua_pushboolean(lua, tic->api.key(tic, key));
else
{
@@ -827,7 +827,7 @@ static s32 lua_keyp(lua_State* lua)
{
tic_key key = getLuaNumber(lua, 1);
if(key >= tic_keys_count)
if(key >= tic_key_escape)
{
luaL_error(lua, "unknown keyboard code\n");
}
@@ -1069,6 +1069,7 @@ static s32 lua_pmem(lua_State *lua)
if(top >= 2)
{
memory->persistent.data[index] = getLuaNumber(lua, 2);
machine->data->syncPMEM = true;
}
lua_pushinteger(lua, val);
+105 -160
View File
@@ -47,14 +47,14 @@ static void normalizeMap(s32* x, s32* y)
while(*y >= MAX_SCROLL_Y) *y -= MAX_SCROLL_Y;
}
static SDL_Point getTileOffset(Map* map)
static tic_point getTileOffset(Map* map)
{
return (SDL_Point){(map->sheet.rect.w - 1)*TIC_SPRITESIZE / 2, (map->sheet.rect.h - 1)*TIC_SPRITESIZE / 2};
return (tic_point){(map->sheet.rect.w - 1)*TIC_SPRITESIZE / 2, (map->sheet.rect.h - 1)*TIC_SPRITESIZE / 2};
}
static void getMouseMap(Map* map, s32* x, s32* y)
{
SDL_Point offset = getTileOffset(map);
tic_point offset = getTileOffset(map);
s32 mx = getMouseX() + map->scroll.x - offset.x;
s32 my = getMouseY() + map->scroll.y - offset.y;
@@ -83,19 +83,19 @@ static s32 drawWorldButton(Map* map, s32 x, s32 y)
x -= Size;
SDL_Rect rect = {x, y, Size, ICON_SIZE};
tic_rect rect = {x, y, Size, ICON_SIZE};
bool over = false;
if(checkMousePos(&rect))
{
setCursor(SDL_SYSTEM_CURSOR_HAND);
setCursor(tic_cursor_hand);
over = true;
showTooltip("WORLD MAP [tab]");
if(checkMouseClick(&rect, SDL_BUTTON_LEFT))
if(checkMouseClick(&rect, tic_mouse_left))
setStudioMode(TIC_WORLD_MODE);
}
@@ -121,19 +121,19 @@ static s32 drawGridButton(Map* map, s32 x, s32 y)
x -= ICON_SIZE;
SDL_Rect rect = {x, y, ICON_SIZE, ICON_SIZE};
tic_rect rect = {x, y, ICON_SIZE, ICON_SIZE};
bool over = false;
if(checkMousePos(&rect))
{
setCursor(SDL_SYSTEM_CURSOR_HAND);
setCursor(tic_cursor_hand);
over = true;
showTooltip("SHOW/HIDE GRID [`]");
if(checkMouseClick(&rect, SDL_BUTTON_LEFT))
if(checkMouseClick(&rect, tic_mouse_left))
map->canvas.grid = !map->canvas.grid;
}
@@ -170,17 +170,17 @@ static s32 drawSheetButton(Map* map, s32 x, s32 y)
x -= ICON_SIZE;
SDL_Rect rect = {x, y, ICON_SIZE, ICON_SIZE};
tic_rect rect = {x, y, ICON_SIZE, ICON_SIZE};
bool over = false;
if(checkMousePos(&rect))
{
setCursor(SDL_SYSTEM_CURSOR_HAND);
setCursor(tic_cursor_hand);
over = true;
showTooltip("SHOW TILES [shift]");
if(checkMouseClick(&rect, SDL_BUTTON_LEFT))
if(checkMouseClick(&rect, tic_mouse_left))
{
map->sheet.show = !map->sheet.show;
}
@@ -195,18 +195,18 @@ static s32 drawToolButton(Map* map, s32 x, s32 y, const u8* Icon, s32 width, con
{
x -= width;
SDL_Rect rect = {x, y, width, ICON_SIZE};
tic_rect rect = {x, y, width, ICON_SIZE};
bool over = false;
if(checkMousePos(&rect))
{
setCursor(SDL_SYSTEM_CURSOR_HAND);
setCursor(tic_cursor_hand);
over = true;
showTooltip(tip);
if(checkMouseClick(&rect, SDL_BUTTON_LEFT))
if(checkMouseClick(&rect, tic_mouse_left))
{
map->mode = mode;
}
@@ -293,7 +293,7 @@ static void drawTileIndex(Map* map, s32 x, s32 y)
if(map->sheet.show)
{
SDL_Rect rect = {TIC80_WIDTH - TIC_SPRITESHEET_SIZE - 1, TOOLBAR_SIZE, TIC_SPRITESHEET_SIZE, TIC_SPRITESHEET_SIZE};
tic_rect rect = {TIC80_WIDTH - TIC_SPRITESHEET_SIZE - 1, TOOLBAR_SIZE, TIC_SPRITESHEET_SIZE, TIC_SPRITESHEET_SIZE};
if(checkMousePos(&rect))
{
@@ -308,7 +308,7 @@ static void drawTileIndex(Map* map, s32 x, s32 y)
}
else
{
SDL_Rect rect = {MAP_X, MAP_Y, MAP_WIDTH, MAP_HEIGHT};
tic_rect rect = {MAP_X, MAP_Y, MAP_WIDTH, MAP_HEIGHT};
if(checkMousePos(&rect))
{
@@ -346,7 +346,7 @@ static void drawSheet(Map* map, s32 x, s32 y)
{
if(!map->sheet.show)return;
SDL_Rect rect = {x, y, TIC_SPRITESHEET_SIZE, TIC_SPRITESHEET_SIZE};
tic_rect rect = {x, y, TIC_SPRITESHEET_SIZE, TIC_SPRITESHEET_SIZE};
map->tic->api.rect_border(map->tic, rect.x - 1, rect.y - 1, rect.w + 2, rect.h + 2, (tic_color_white));
}
@@ -355,13 +355,13 @@ static void drawSheetOvr(Map* map, s32 x, s32 y)
{
if(!map->sheet.show)return;
SDL_Rect rect = {x, y, TIC_SPRITESHEET_SIZE, TIC_SPRITESHEET_SIZE};
tic_rect rect = {x, y, TIC_SPRITESHEET_SIZE, TIC_SPRITESHEET_SIZE};
if(checkMousePos(&rect))
{
setCursor(SDL_SYSTEM_CURSOR_HAND);
setCursor(tic_cursor_hand);
if(checkMouseDown(&rect, SDL_BUTTON_LEFT))
if(checkMouseDown(&rect, tic_mouse_left))
{
s32 mx = getMouseX() - rect.x;
s32 my = getMouseY() - rect.y;
@@ -371,19 +371,19 @@ static void drawSheetOvr(Map* map, s32 x, s32 y)
if(map->sheet.drag)
{
s32 rl = SDL_min(mx, map->sheet.start.x);
s32 rt = SDL_min(my, map->sheet.start.y);
s32 rr = SDL_max(mx, map->sheet.start.x);
s32 rb = SDL_max(my, map->sheet.start.y);
s32 rl = MIN(mx, map->sheet.start.x);
s32 rt = MIN(my, map->sheet.start.y);
s32 rr = MAX(mx, map->sheet.start.x);
s32 rb = MAX(my, map->sheet.start.y);
map->sheet.rect = (SDL_Rect){rl, rt, rr-rl+1, rb-rt+1};
map->sheet.rect = (tic_rect){rl, rt, rr-rl+1, rb-rt+1};
map->mode = MAP_DRAW_MODE;
}
else
{
map->sheet.drag = true;
map->sheet.start = (SDL_Point){mx, my};
map->sheet.start = (tic_point){mx, my};
}
}
else
@@ -447,7 +447,7 @@ static void drawTileCursor(Map* map)
if(map->scroll.active)
return;
SDL_Point offset = getTileOffset(map);
tic_point offset = getTileOffset(map);
s32 mx = getMouseX() + map->scroll.x - offset.x;
s32 my = getMouseY() + map->scroll.y - offset.y;
@@ -478,13 +478,13 @@ static void drawTileCursor(Map* map)
static void processMouseDrawMode(Map* map)
{
SDL_Rect rect = {MAP_X, MAP_Y, MAP_WIDTH, MAP_HEIGHT};
tic_rect rect = {MAP_X, MAP_Y, MAP_WIDTH, MAP_HEIGHT};
setCursor(SDL_SYSTEM_CURSOR_HAND);
setCursor(tic_cursor_hand);
drawTileCursor(map);
if(checkMouseDown(&rect, SDL_BUTTON_LEFT))
if(checkMouseDown(&rect, tic_mouse_left))
{
s32 tx = 0, ty = 0;
getMouseMap(map, &tx, &ty);
@@ -500,7 +500,7 @@ static void processMouseDrawMode(Map* map)
else
{
map->canvas.draw = true;
map->canvas.start = (SDL_Point){tx, ty};
map->canvas.start = (tic_point){tx, ty};
}
}
else
@@ -508,19 +508,19 @@ static void processMouseDrawMode(Map* map)
map->canvas.draw = false;
}
if(checkMouseDown(&rect, SDL_BUTTON_MIDDLE))
if(checkMouseDown(&rect, tic_mouse_middle))
{
s32 tx = 0, ty = 0;
getMouseMap(map, &tx, &ty);
s32 index = map->tic->api.map_get(map->tic, map->src, tx, ty);
map->sheet.rect = (SDL_Rect){index % SHEET_COLS, index / SHEET_COLS, 1, 1};
map->sheet.rect = (tic_rect){index % SHEET_COLS, index / SHEET_COLS, 1, 1};
}
}
static void processScrolling(Map* map, bool pressed)
{
SDL_Rect rect = {MAP_X, MAP_Y, MAP_WIDTH, MAP_HEIGHT};
tic_rect rect = {MAP_X, MAP_Y, MAP_WIDTH, MAP_HEIGHT};
if(map->scroll.active)
{
@@ -531,7 +531,7 @@ static void processScrolling(Map* map, bool pressed)
normalizeMap(&map->scroll.x, &map->scroll.y);
setCursor(SDL_SYSTEM_CURSOR_HAND);
setCursor(tic_cursor_hand);
}
else map->scroll.active = false;
}
@@ -549,15 +549,15 @@ static void processScrolling(Map* map, bool pressed)
static void processMouseDragMode(Map* map)
{
SDL_Rect rect = {MAP_X, MAP_Y, MAP_WIDTH, MAP_HEIGHT};
tic_rect rect = {MAP_X, MAP_Y, MAP_WIDTH, MAP_HEIGHT};
processScrolling(map, checkMouseDown(&rect, SDL_BUTTON_LEFT) ||
checkMouseDown(&rect, SDL_BUTTON_RIGHT));
processScrolling(map, checkMouseDown(&rect, tic_mouse_left) ||
checkMouseDown(&rect, tic_mouse_right));
}
static void resetSelection(Map* map)
{
map->select.rect = (SDL_Rect){0,0,0,0};
map->select.rect = (tic_rect){0,0,0,0};
}
static void drawSelectionRect(Map* map, s32 x, s32 y, s32 w, s32 h)
@@ -582,9 +582,9 @@ static void drawPasteData(Map* map)
s32 mx = getMouseX() + map->scroll.x - (w - 1)*TIC_SPRITESIZE / 2;
s32 my = getMouseY() + map->scroll.y - (h - 1)*TIC_SPRITESIZE / 2;
SDL_Rect rect = {MAP_X, MAP_Y, MAP_WIDTH, MAP_HEIGHT};
tic_rect rect = {MAP_X, MAP_Y, MAP_WIDTH, MAP_HEIGHT};
if(checkMouseClick(&rect, SDL_BUTTON_LEFT))
if(checkMouseClick(&rect, tic_mouse_left))
{
normalizeMap(&mx, &my);
@@ -597,7 +597,7 @@ static void drawPasteData(Map* map)
history_add(map->history);
SDL_free(map->paste);
free(map->paste);
map->paste = NULL;
}
else
@@ -626,7 +626,7 @@ static void normalizeMapRect(s32* x, s32* y)
static void processMouseSelectMode(Map* map)
{
SDL_Rect rect = {MAP_X, MAP_Y, MAP_WIDTH, MAP_HEIGHT};
tic_rect rect = {MAP_X, MAP_Y, MAP_WIDTH, MAP_HEIGHT};
if(checkMousePos(&rect))
{
@@ -634,7 +634,7 @@ static void processMouseSelectMode(Map* map)
drawPasteData(map);
else
{
if(checkMouseDown(&rect, SDL_BUTTON_LEFT))
if(checkMouseDown(&rect, tic_mouse_left))
{
s32 mx = getMouseX() + map->scroll.x;
s32 my = getMouseY() + map->scroll.y;
@@ -646,18 +646,18 @@ static void processMouseSelectMode(Map* map)
if(map->select.drag)
{
s32 rl = SDL_min(mx, map->select.start.x);
s32 rt = SDL_min(my, map->select.start.y);
s32 rr = SDL_max(mx, map->select.start.x);
s32 rb = SDL_max(my, map->select.start.y);
s32 rl = MIN(mx, map->select.start.x);
s32 rt = MIN(my, map->select.start.y);
s32 rr = MAX(mx, map->select.start.x);
s32 rb = MAX(my, map->select.start.y);
map->select.rect = (SDL_Rect){rl, rt, rr - rl + 1, rb - rt + 1};
map->select.rect = (tic_rect){rl, rt, rr - rl + 1, rb - rt + 1};
}
else
{
map->select.drag = true;
map->select.start = (SDL_Point){mx, my};
map->select.rect = (SDL_Rect){map->select.start.x, map->select.start.y, 1, 1};
map->select.start = (tic_point){mx, my};
map->select.rect = (tic_rect){map->select.start.x, map->select.start.y, 1, 1};
}
}
else if(map->select.drag)
@@ -673,8 +673,8 @@ static void processMouseSelectMode(Map* map)
typedef struct
{
SDL_Point* data;
SDL_Point* head;
tic_point* data;
tic_point* head;
} FillStack;
static bool push(FillStack* stack, s32 x, s32 y)
@@ -732,7 +732,7 @@ static void fillMap(Map* map, s32 x, s32 y, u8 tile)
static FillStack stack = {NULL, NULL};
if(!stack.data)
stack.data = (SDL_Point*)SDL_malloc(FILL_STACK_SIZE * sizeof(SDL_Point));
stack.data = (tic_point*)malloc(FILL_STACK_SIZE * sizeof(tic_point));
stack.head = NULL;
@@ -790,13 +790,13 @@ static void fillMap(Map* map, s32 x, s32 y, u8 tile)
static void processMouseFillMode(Map* map)
{
SDL_Rect rect = {MAP_X, MAP_Y, MAP_WIDTH, MAP_HEIGHT};
tic_rect rect = {MAP_X, MAP_Y, MAP_WIDTH, MAP_HEIGHT};
setCursor(SDL_SYSTEM_CURSOR_HAND);
setCursor(tic_cursor_hand);
drawTileCursor(map);
if(checkMouseClick(&rect, SDL_BUTTON_LEFT))
if(checkMouseClick(&rect, tic_mouse_left))
{
s32 tx = 0, ty = 0;
getMouseMap(map, &tx, &ty);
@@ -808,7 +808,7 @@ static void processMouseFillMode(Map* map)
static void drawSelection(Map* map)
{
SDL_Rect* sel = &map->select.rect;
tic_rect* sel = &map->select.rect;
if(sel->w > 0 && sel->h > 0)
{
@@ -859,12 +859,13 @@ static void drawGrid(Map* map)
static void drawMapOvr(Map* map)
{
SDL_Rect rect = {MAP_X, MAP_Y, MAP_WIDTH, MAP_HEIGHT};
tic_rect rect = {MAP_X, MAP_Y, MAP_WIDTH, MAP_HEIGHT};
s32 scrollX = map->scroll.x % TIC_SPRITESIZE;
s32 scrollY = map->scroll.y % TIC_SPRITESIZE;
map->tic->api.map(map->tic, map->src, getBankTiles(), map->scroll.x / TIC_SPRITESIZE, map->scroll.y / TIC_SPRITESIZE,
tic_mem* tic = map->tic;
tic->api.map(tic, map->src, getBankTiles(), map->scroll.x / TIC_SPRITESIZE, map->scroll.y / TIC_SPRITESIZE,
TIC_MAP_SCREEN_WIDTH + 1, TIC_MAP_SCREEN_HEIGHT + 1, -scrollX, -scrollY, -1, 1);
if(map->canvas.grid || map->scroll.active)
@@ -874,15 +875,15 @@ static void drawMapOvr(Map* map)
s32 screenScrollX = map->scroll.x % TIC80_WIDTH;
s32 screenScrollY = map->scroll.y % TIC80_HEIGHT;
map->tic->api.line(map->tic, 0, TIC80_HEIGHT - screenScrollY, TIC80_WIDTH, TIC80_HEIGHT - screenScrollY, (tic_color_gray));
map->tic->api.line(map->tic, TIC80_WIDTH - screenScrollX, 0, TIC80_WIDTH - screenScrollX, TIC80_HEIGHT, (tic_color_gray));
tic->api.line(tic, 0, TIC80_HEIGHT - screenScrollY, TIC80_WIDTH, TIC80_HEIGHT - screenScrollY, (tic_color_gray));
tic->api.line(tic, TIC80_WIDTH - screenScrollX, 0, TIC80_WIDTH - screenScrollX, TIC80_HEIGHT, (tic_color_gray));
}
if(!map->sheet.show && checkMousePos(&rect))
{
if(getKeyboard()[SDL_SCANCODE_SPACE])
if(tic->api.key(tic, tic_key_space))
{
processScrolling(map, checkMouseDown(&rect, SDL_BUTTON_LEFT) || checkMouseDown(&rect, SDL_BUTTON_RIGHT));
processScrolling(map, checkMouseDown(&rect, tic_mouse_left) || checkMouseDown(&rect, tic_mouse_right));
}
else
{
@@ -891,32 +892,13 @@ static void drawMapOvr(Map* map)
Handlers[map->mode](map);
if(map->mode != MAP_DRAG_MODE)
processScrolling(map, checkMouseDown(&rect, SDL_BUTTON_RIGHT));
processScrolling(map, checkMouseDown(&rect, tic_mouse_right));
}
}
drawSelection(map);
}
static void processKeyboard(Map* map)
{
enum{Step = 1};
if(getKeyboard()[SDL_SCANCODE_UP]) map->scroll.y -= Step;
if(getKeyboard()[SDL_SCANCODE_DOWN]) map->scroll.y += Step;
if(getKeyboard()[SDL_SCANCODE_LEFT]) map->scroll.x -= Step;
if(getKeyboard()[SDL_SCANCODE_RIGHT]) map->scroll.x += Step;
static const u8 Scancodes[] = {SDL_SCANCODE_UP, SDL_SCANCODE_DOWN, SDL_SCANCODE_LEFT, SDL_SCANCODE_RIGHT};
for(s32 i = 0; i < COUNT_OF(Scancodes); i++)
if(getKeyboard()[Scancodes[i]])
{
normalizeMap(&map->scroll.x, &map->scroll.y);
break;
}
}
static void undo(Map* map)
{
history_undo(map->history);
@@ -929,12 +911,12 @@ static void redo(Map* map)
static void copySelectionToClipboard(Map* map)
{
SDL_Rect* sel = &map->select.rect;
tic_rect* sel = &map->select.rect;
if(sel->w > 0 && sel->h > 0)
{
s32 size = sel->w * sel->h + 2;
u8* buffer = SDL_malloc(size);
u8* buffer = malloc(size);
if(buffer)
{
@@ -954,7 +936,7 @@ static void copySelectionToClipboard(Map* map)
}
toClipboard(buffer, size, true);
SDL_free(buffer);
free(buffer);
}
}
}
@@ -967,7 +949,7 @@ static void copyToClipboard(Map* map)
static void deleteSelection(Map* map)
{
SDL_Rect* sel = &map->select.rect;
tic_rect* sel = &map->select.rect;
if(sel->w > 0 && sel->h > 0)
{
@@ -994,9 +976,9 @@ static void cutToClipboard(Map* map)
static void copyFromClipboard(Map* map)
{
if(SDL_HasClipboardText())
if(getSystem()->hasClipboardText())
{
char* clipboard = SDL_GetClipboardText();
char* clipboard = getSystem()->getClipboardText();
if(clipboard)
{
@@ -1004,7 +986,7 @@ static void copyFromClipboard(Map* map)
if(size > 2)
{
u8* data = SDL_malloc(size);
u8* data = malloc(size);
str2buf(clipboard, strlen(clipboard), data, true);
@@ -1013,19 +995,25 @@ static void copyFromClipboard(Map* map)
map->paste = data;
map->mode = MAP_SELECT_MODE;
}
else SDL_free(data);
else free(data);
}
SDL_free(clipboard);
free(clipboard);
}
}
}
static void processKeydown(Map* map, SDL_Keycode keycode)
static void processKeyboard(Map* map)
{
SDL_Keymod keymod = SDL_GetModState();
tic_mem* tic = map->tic;
map->sheet.show = false;
switch(getClipboardEvent(keycode))
if(tic->ram.input.keyboard.data == 0) return;
bool shift = tic->api.key(tic, tic_key_shift);
bool ctrl = tic->api.key(tic, tic_key_ctrl);
switch(getClipboardEvent())
{
case TIC_CLIPBOARD_CUT: cutToClipboard(map); break;
case TIC_CLIPBOARD_COPY: copyToClipboard(map); break;
@@ -1033,90 +1021,47 @@ static void processKeydown(Map* map, SDL_Keycode keycode)
default: break;
}
if(keymod & TIC_MOD_CTRL)
if(ctrl)
{
switch(keycode)
{
case SDLK_z: undo(map); break;
case SDLK_y: redo(map); break;
}
if(keyWasPressed(tic_key_z)) undo(map);
else if(keyWasPressed(tic_key_y)) redo(map);
}
else
{
switch(keycode)
{
case SDLK_TAB: setStudioMode(TIC_WORLD_MODE); break;
case SDLK_1:
case SDLK_2:
case SDLK_3:
case SDLK_4:
map->mode = keycode - SDLK_1;
break;
case SDLK_DELETE:
deleteSelection(map);
break;
case SDLK_BACKQUOTE:
map->canvas.grid = !map->canvas.grid;
break;
}
if(keyWasPressed(tic_key_tab)) setStudioMode(TIC_WORLD_MODE);
else if(keyWasPressed(tic_key_1)) map->mode = MAP_DRAW_MODE;
else if(keyWasPressed(tic_key_2)) map->mode = MAP_DRAG_MODE;
else if(keyWasPressed(tic_key_3)) map->mode = MAP_SELECT_MODE;
else if(keyWasPressed(tic_key_4)) map->mode = MAP_FILL_MODE;
else if(keyWasPressed(tic_key_delete)) deleteSelection(map);
else if(keyWasPressed(tic_key_grave)) map->canvas.grid = !map->canvas.grid;
}
if(keymod & KMOD_SHIFT)
if(shift)
map->sheet.show = true;
}
static void processKeyup(Map* map, SDL_Keycode keycode)
{
SDL_Keymod keymod = SDL_GetModState();
enum{Step = 1};
if(!(keymod & KMOD_SHIFT))
map->sheet.show = false;
}
if(tic->api.key(tic, tic_key_up)) map->scroll.y -= Step;
if(tic->api.key(tic, tic_key_down)) map->scroll.y += Step;
if(tic->api.key(tic, tic_key_left)) map->scroll.x -= Step;
if(tic->api.key(tic, tic_key_right)) map->scroll.x += Step;
static void processGesture(Map* map)
{
SDL_Point point = {0, 0};
static const tic_key Keycodes[] = {tic_key_up, tic_key_down, tic_key_left, tic_key_right};
if(getGesturePos(&point))
{
if(map->scroll.gesture)
for(s32 i = 0; i < COUNT_OF(Keycodes); i++)
if(tic->api.key(tic, Keycodes[i]))
{
map->scroll.x = map->scroll.start.x - point.x;
map->scroll.y = map->scroll.start.y - point.y;
normalizeMap(&map->scroll.x, &map->scroll.y);
break;
}
else
{
map->scroll.start.x = point.x + map->scroll.x;
map->scroll.start.y = point.y + map->scroll.y;
map->scroll.gesture = true;
}
}
else map->scroll.gesture = false;
}
static void tick(Map* map)
{
map->tickCounter++;
SDL_Event* event = NULL;
while ((event = pollEvent()))
{
switch(event->type)
{
case SDL_KEYDOWN:
processKeydown(map, event->key.keysym.sym);
break;
case SDL_KEYUP:
processKeyup(map, event->key.keysym.sym);
break;
}
}
processKeyboard(map);
processGesture(map);
map->tic->api.clear(map->tic, TIC_COLOR_BG);
drawSheet(map, TIC80_WIDTH - TIC_SPRITESHEET_SIZE - 1, TOOLBAR_SIZE);
+6 -6
View File
@@ -46,14 +46,14 @@ struct Map
{
bool grid;
bool draw;
SDL_Point start;
tic_point start;
} canvas;
struct
{
bool show;
SDL_Rect rect;
SDL_Point start;
tic_rect rect;
tic_point start;
bool drag;
} sheet;
@@ -62,7 +62,7 @@ struct Map
s32 x;
s32 y;
SDL_Point start;
tic_point start;
bool active;
bool gesture;
@@ -71,8 +71,8 @@ struct Map
struct
{
SDL_Rect rect;
SDL_Point start;
tic_rect rect;
tic_point start;
bool drag;
} select;
+49 -49
View File
@@ -63,9 +63,9 @@ static void exitToTIC(Menu* menu)
static void(*const MenuHandlers[])(Menu*) = {resumeGame, resetGame, gamepadConfig, NULL, exitToTIC};
static SDL_Rect getRect(Menu* menu)
static tic_rect getRect(Menu* menu)
{
SDL_Rect rect = {(TIC80_WIDTH - DIALOG_WIDTH)/2, (TIC80_HEIGHT - DIALOG_HEIGHT)/2, DIALOG_WIDTH, DIALOG_HEIGHT};
tic_rect rect = {(TIC80_WIDTH - DIALOG_WIDTH)/2, (TIC80_HEIGHT - DIALOG_HEIGHT)/2, DIALOG_WIDTH, DIALOG_HEIGHT};
rect.x -= menu->pos.x;
rect.y -= menu->pos.y;
@@ -74,17 +74,17 @@ static SDL_Rect getRect(Menu* menu)
}
static void drawDialog(Menu* menu)
{
SDL_Rect rect = getRect(menu);
tic_rect rect = getRect(menu);
tic_mem* tic = menu->tic;
SDL_Rect header = {rect.x, rect.y-(TOOLBAR_SIZE-1), rect.w, TOOLBAR_SIZE};
tic_rect header = {rect.x, rect.y-(TOOLBAR_SIZE-1), rect.w, TOOLBAR_SIZE};
if(checkMousePos(&header))
{
setCursor(SDL_SYSTEM_CURSOR_HAND);
setCursor(tic_cursor_hand);
if(checkMouseDown(&header, SDL_BUTTON_LEFT))
if(checkMouseDown(&header, tic_mouse_left))
{
if(!menu->drag.active)
{
@@ -98,13 +98,13 @@ static void drawDialog(Menu* menu)
if(menu->drag.active)
{
setCursor(SDL_SYSTEM_CURSOR_HAND);
setCursor(tic_cursor_hand);
menu->pos.x = menu->drag.start.x - getMouseX();
menu->pos.y = menu->drag.start.y - getMouseY();
SDL_Rect rect = {0, 0, TIC80_WIDTH, TIC80_HEIGHT};
if(!checkMouseDown(&rect, SDL_BUTTON_LEFT))
tic_rect rect = {0, 0, TIC80_WIDTH, TIC80_HEIGHT};
if(!checkMouseDown(&rect, tic_mouse_left))
menu->drag.active = false;
}
@@ -133,15 +133,15 @@ static void drawTabDisabled(Menu* menu, s32 x, s32 y, s32 id)
enum{Width = 15, Height = 7};
tic_mem* tic = menu->tic;
SDL_Rect rect = {x, y, Width, Height};
tic_rect rect = {x, y, Width, Height};
bool over = false;
if(menu->gamepad.tab != id && checkMousePos(&rect))
{
setCursor(SDL_SYSTEM_CURSOR_HAND);
setCursor(tic_cursor_hand);
over = true;
if(checkMouseDown(&rect, SDL_BUTTON_LEFT))
if(checkMouseDown(&rect, tic_mouse_left))
{
menu->gamepad.tab = id;
menu->gamepad.selected = -1;
@@ -183,24 +183,24 @@ static void drawPlayerButtons(Menu* menu, s32 x, s32 y)
u8 chromakey = 0;
SDL_Scancode* codes = getKeymap();
tic_key* codes = getKeymap();
enum {Width = 41, Height = TIC_SPRITESIZE, Rows = 4, Cols = 2, MaxChars = 5, Buttons = 8};
for(s32 i = 0; i < Buttons; i++)
{
SDL_Rect rect = {x + i / Rows * (Width+2), y + (i%Rows)*(Height+1), Width, TIC_SPRITESIZE};
tic_rect rect = {x + i / Rows * (Width+2), y + (i%Rows)*(Height+1), Width, TIC_SPRITESIZE};
bool over = false;
s32 index = i+menu->gamepad.tab * Buttons;
if(checkMousePos(&rect))
{
setCursor(SDL_SYSTEM_CURSOR_HAND);
setCursor(tic_cursor_hand);
over = true;
if(checkMouseClick(&rect, SDL_BUTTON_LEFT))
if(checkMouseClick(&rect, tic_mouse_left))
{
menu->gamepad.selected = menu->gamepad.selected != index ? index : -1;
}
@@ -211,9 +211,11 @@ static void drawPlayerButtons(Menu* menu, s32 x, s32 y)
tic->api.sprite_ex(tic, &tic->config.bank0.tiles, 8+i, rect.x, rect.y, 1, 1, &chromakey, 1, 1, tic_no_flip, tic_no_rotate);
static const char const * Names[tic_keys_count] = {"...", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "minus", "equals", "leftbracket", "rightbracket", "backslash", "semicolon", "apostrophe", "grave", "comma", "period", "slash", "space", "tab", "return", "backspace", "delete", "insert", "pageup", "pagedown", "home", "end", "up", "down", "left", "right", "capslock", "ctrl", "shift", "alt", "escape", "f1", "f2", "f3", "f4", "f5", "f6", "f7", "f8", "f9", "f10", "f11", "f12"};
s32 code = codes[index];
char label[32];
strcpy(label, code ? SDL_GetKeyName(SDL_GetKeyFromScancode(code)) : "...");
strcpy(label, Names[code]);
if(strlen(label) > MaxChars)
label[MaxChars] = '\0';
@@ -246,27 +248,27 @@ static void drawGamepadMenu(Menu* menu)
tic_mem* tic = menu->tic;
SDL_Rect dlgRect = getRect(menu);
tic_rect dlgRect = getRect(menu);
static const char Label[] = "BACK";
SDL_Rect rect = {dlgRect.x + 25, dlgRect.y + 49, (sizeof(Label)-1)*TIC_FONT_WIDTH, TIC_FONT_HEIGHT};
tic_rect rect = {dlgRect.x + 25, dlgRect.y + 49, (sizeof(Label)-1)*TIC_FONT_WIDTH, TIC_FONT_HEIGHT};
bool over = false;
bool down = false;
if(checkMousePos(&rect))
{
setCursor(SDL_SYSTEM_CURSOR_HAND);
setCursor(tic_cursor_hand);
over = true;
if(checkMouseDown(&rect, SDL_BUTTON_LEFT))
if(checkMouseDown(&rect, tic_mouse_left))
{
down = true;
}
if(checkMouseClick(&rect, SDL_BUTTON_LEFT))
if(checkMouseClick(&rect, tic_mouse_left))
{
menu->gamepad.selected = -1;
menu->mode = MAIN_MENU_MODE;
@@ -311,30 +313,30 @@ static void drawMainMenu(Menu* menu)
drawDialog(menu);
SDL_Rect rect = getRect(menu);
tic_rect rect = getRect(menu);
{
for(s32 i = 0; i < COUNT_OF(Rows); i++)
{
if(!*Rows[i])continue;
SDL_Rect label = {rect.x + 22, rect.y + (TIC_FONT_HEIGHT+1)*i + 16, 86, TIC_FONT_HEIGHT+1};
tic_rect label = {rect.x + 22, rect.y + (TIC_FONT_HEIGHT+1)*i + 16, 86, TIC_FONT_HEIGHT+1};
bool over = false;
bool down = false;
if(checkMousePos(&label))
{
setCursor(SDL_SYSTEM_CURSOR_HAND);
setCursor(tic_cursor_hand);
over = true;
if(checkMouseDown(&label, SDL_BUTTON_LEFT))
if(checkMouseDown(&label, tic_mouse_left))
{
down = true;
menu->main.focus = i;
}
if(checkMouseClick(&label, SDL_BUTTON_LEFT))
if(checkMouseClick(&label, tic_mouse_left))
{
MenuHandlers[i](menu);
return;
@@ -432,22 +434,29 @@ static void saveMapping(Menu* menu)
fsSaveRootFile(menu->fs, KEYMAP_DAT_PATH, getKeymap(), KEYMAP_SIZE, true);
}
static void processKeydown(Menu* menu, SDL_Keysym* keysum)
static void processKeyboard(Menu* menu)
{
tic_mem* tic = menu->tic;
if(tic->ram.input.keyboard.data == 0) return;
if(menu->gamepad.selected < 0)
return;
SDL_Scancode scancode = keysum->scancode;
switch(scancode)
if(keyWasPressed(tic_key_escape));
else if(anyKeyWasPressed())
{
case SDL_SCANCODE_ESCAPE: break;
default:
for(s32 i = 0; i < TIC80_KEY_BUFFER; i++)
{
SDL_Scancode* codes = getKeymap();
codes[menu->gamepad.selected] = scancode;
tic_key key = tic->ram.input.keyboard.keys[i];
saveMapping(menu);
if(tic->api.keyp(tic, key, -1, -1))
{
tic_key* codes = getKeymap();
codes[menu->gamepad.selected] = key;
saveMapping(menu);
break;
}
}
}
@@ -458,16 +467,7 @@ static void tick(Menu* menu)
{
menu->ticks++;
SDL_Event* event = NULL;
while ((event = pollEvent()))
{
switch(event->type)
{
case SDL_KEYUP:
processKeydown(menu, &event->key.keysym);
break;
}
}
processKeyboard(menu);
if(getStudioMode() != TIC_MENU_MODE)
return;
@@ -479,7 +479,7 @@ static void tick(Menu* menu)
menu->init = true;
}
SDL_memcpy(menu->tic->ram.vram.screen.data, menu->bg, sizeof menu->tic->ram.vram.screen.data);
memcpy(menu->tic->ram.vram.screen.data, menu->bg, sizeof menu->tic->ram.vram.screen.data);
switch(menu->mode)
{
@@ -525,8 +525,8 @@ void initMenu(Menu* menu, tic_mem* tic, FileSystem* fs)
enum{Size = sizeof tic->ram.vram.screen.data};
if(!menu->bg)
menu->bg = SDL_malloc(Size);
menu->bg = malloc(Size);
if(menu->bg)
SDL_memcpy(menu->bg, tic->ram.vram.screen.data, Size);
memcpy(menu->bg, tic->ram.vram.screen.data, Size);
}
+2 -2
View File
@@ -46,11 +46,11 @@ struct Menu
s32 selected;
} gamepad;
SDL_Point pos;
tic_point pos;
struct
{
SDL_Point start;
tic_point start;
bool active;
} drag;
+200 -218
View File
@@ -91,19 +91,19 @@ static void drawEditbox(Music* music, s32 x, s32 y, s32 value, void(*set)(Music*
};
{
SDL_Rect rect = { x, y, TIC_FONT_WIDTH, TIC_FONT_HEIGHT };
tic_rect rect = { x, y, TIC_FONT_WIDTH, TIC_FONT_HEIGHT };
bool over = false;
bool down = false;
if (checkMousePos(&rect))
{
setCursor(SDL_SYSTEM_CURSOR_HAND);
setCursor(tic_cursor_hand);
over = true;
if (checkMouseDown(&rect, SDL_BUTTON_LEFT))
if (checkMouseDown(&rect, tic_mouse_left))
down = true;
if (checkMouseClick(&rect, SDL_BUTTON_LEFT))
if (checkMouseClick(&rect, tic_mouse_left))
set(music, -1, channel);
}
@@ -113,13 +113,13 @@ static void drawEditbox(Music* music, s32 x, s32 y, s32 value, void(*set)(Music*
{
x += TIC_FONT_WIDTH;
SDL_Rect rect = { x-1, y-1, TIC_FONT_WIDTH*2+1, TIC_FONT_HEIGHT+1 };
tic_rect rect = { x-1, y-1, TIC_FONT_WIDTH*2+1, TIC_FONT_HEIGHT+1 };
if (checkMousePos(&rect))
{
setCursor(SDL_SYSTEM_CURSOR_HAND);
setCursor(tic_cursor_hand);
if (checkMouseClick(&rect, SDL_BUTTON_LEFT))
if (checkMouseClick(&rect, tic_mouse_left))
{
music->tracker.row = -1;
music->tracker.col = channel * CHANNEL_COLS;
@@ -145,19 +145,19 @@ static void drawEditbox(Music* music, s32 x, s32 y, s32 value, void(*set)(Music*
{
x += 2*TIC_FONT_WIDTH;
SDL_Rect rect = { x, y, TIC_FONT_WIDTH, TIC_FONT_HEIGHT };
tic_rect rect = { x, y, TIC_FONT_WIDTH, TIC_FONT_HEIGHT };
bool over = false;
bool down = false;
if (checkMousePos(&rect))
{
setCursor(SDL_SYSTEM_CURSOR_HAND);
setCursor(tic_cursor_hand);
over = true;
if (checkMouseDown(&rect, SDL_BUTTON_LEFT))
if (checkMouseDown(&rect, tic_mouse_left))
down = true;
if (checkMouseClick(&rect, SDL_BUTTON_LEFT))
if (checkMouseClick(&rect, tic_mouse_left))
set(music, +1, channel);
}
@@ -197,20 +197,20 @@ static void drawSwitch(Music* music, s32 x, s32 y, const char* label, s32 value,
{
x += (s32)strlen(label)*TIC_FONT_WIDTH;
SDL_Rect rect = { x, y, TIC_FONT_WIDTH, TIC_FONT_HEIGHT };
tic_rect rect = { x, y, TIC_FONT_WIDTH, TIC_FONT_HEIGHT };
bool over = false;
bool down = false;
if (checkMousePos(&rect))
{
setCursor(SDL_SYSTEM_CURSOR_HAND);
setCursor(tic_cursor_hand);
over = true;
if (checkMouseDown(&rect, SDL_BUTTON_LEFT))
if (checkMouseDown(&rect, tic_mouse_left))
down = true;
if (checkMouseClick(&rect, SDL_BUTTON_LEFT))
if (checkMouseClick(&rect, tic_mouse_left))
set(music, -1, data);
}
@@ -227,20 +227,20 @@ static void drawSwitch(Music* music, s32 x, s32 y, const char* label, s32 value,
{
x += (value > 99 ? 3 : 2)*TIC_FONT_WIDTH;
SDL_Rect rect = { x, y, TIC_FONT_WIDTH, TIC_FONT_HEIGHT };
tic_rect rect = { x, y, TIC_FONT_WIDTH, TIC_FONT_HEIGHT };
bool over = false;
bool down = false;
if (checkMousePos(&rect))
{
setCursor(SDL_SYSTEM_CURSOR_HAND);
setCursor(tic_cursor_hand);
over = true;
if (checkMouseDown(&rect, SDL_BUTTON_LEFT))
if (checkMouseDown(&rect, tic_mouse_left))
down = true;
if (checkMouseClick(&rect, SDL_BUTTON_LEFT))
if (checkMouseClick(&rect, tic_mouse_left))
set(music, +1, data);
}
@@ -546,8 +546,8 @@ static void stopTrack(Music* music)
static void resetSelection(Music* music)
{
music->tracker.select.start = (SDL_Point){-1, -1};
music->tracker.select.rect = (SDL_Rect){0, 0, 0, 0};
music->tracker.select.start = (tic_point){-1, -1};
music->tracker.select.rect = (tic_rect){0, 0, 0, 0};
}
static void deleteSelection(Music* music)
@@ -556,7 +556,7 @@ static void deleteSelection(Music* music)
if(pattern)
{
SDL_Rect rect = music->tracker.select.rect;
tic_rect rect = music->tracker.select.rect;
if(rect.h <= 0)
{
@@ -565,7 +565,7 @@ static void deleteSelection(Music* music)
}
enum{RowSize = sizeof(tic_track_pattern) / MUSIC_PATTERN_ROWS};
SDL_memset(&pattern->rows[rect.y], 0, RowSize * rect.h);
memset(&pattern->rows[rect.y], 0, RowSize * rect.h);
}
}
@@ -580,7 +580,7 @@ static void copyToClipboard(Music* music, bool cut)
if(pattern)
{
SDL_Rect rect = music->tracker.select.rect;
tic_rect rect = music->tracker.select.rect;
if(rect.h <= 0)
{
@@ -593,16 +593,16 @@ static void copyToClipboard(Music* music, bool cut)
enum{RowSize = sizeof(tic_track_pattern) / MUSIC_PATTERN_ROWS, HeaderSize = sizeof(ClipboardHeader)};
s32 size = rect.h * RowSize + HeaderSize;
u8* data = SDL_malloc(size);
u8* data = malloc(size);
if(data)
{
SDL_memcpy(data, &header, HeaderSize);
SDL_memcpy(data + HeaderSize, &pattern->rows[rect.y], RowSize * rect.h);
memcpy(data, &header, HeaderSize);
memcpy(data + HeaderSize, &pattern->rows[rect.y], RowSize * rect.h);
toClipboard(data, size, true);
SDL_free(data);
free(data);
if(cut)
{
@@ -619,9 +619,9 @@ static void copyFromClipboard(Music* music)
{
tic_track_pattern* pattern = getChannelPattern(music);
if(pattern && SDL_HasClipboardText())
if(pattern && getSystem()->hasClipboardText())
{
char* clipboard = SDL_GetClipboardText();
char* clipboard = getSystem()->getClipboardText();
if(clipboard)
{
@@ -631,27 +631,27 @@ static void copyFromClipboard(Music* music)
if(size > HeaderSize)
{
u8* data = SDL_malloc(size);
u8* data = malloc(size);
str2buf(clipboard, strlen(clipboard), data, true);
ClipboardHeader header = {0};
SDL_memcpy(&header, data, HeaderSize);
memcpy(&header, data, HeaderSize);
if(header.size * RowSize == size - HeaderSize)
{
if(header.size + music->tracker.row > MUSIC_PATTERN_ROWS)
header.size = MUSIC_PATTERN_ROWS - music->tracker.row;
SDL_memcpy(&pattern->rows[music->tracker.row], data + HeaderSize, header.size * RowSize);
memcpy(&pattern->rows[music->tracker.row], data + HeaderSize, header.size * RowSize);
history_add(music->history);
}
SDL_free(data);
free(data);
}
SDL_free(clipboard);
free(clipboard);
}
}
}
@@ -726,116 +726,117 @@ static void checkSelection(Music* music)
static void updateSelection(Music* music)
{
s32 rl = SDL_min(music->tracker.col, music->tracker.select.start.x);
s32 rt = SDL_min(music->tracker.row, music->tracker.select.start.y);
s32 rr = SDL_max(music->tracker.col, music->tracker.select.start.x);
s32 rb = SDL_max(music->tracker.row, music->tracker.select.start.y);
s32 rl = MIN(music->tracker.col, music->tracker.select.start.x);
s32 rt = MIN(music->tracker.row, music->tracker.select.start.y);
s32 rr = MAX(music->tracker.col, music->tracker.select.start.x);
s32 rb = MAX(music->tracker.row, music->tracker.select.start.y);
SDL_Rect* rect = &music->tracker.select.rect;
*rect = (SDL_Rect){rl, rt, rr - rl + 1, rb - rt + 1};
tic_rect* rect = &music->tracker.select.rect;
*rect = (tic_rect){rl, rt, rr - rl + 1, rb - rt + 1};
if(rect->x % CHANNEL_COLS + rect->w > CHANNEL_COLS)
resetSelection(music);
}
static void processTrackerKeydown(Music* music, SDL_Keysym* keysum)
static void processTrackerKeyboard(Music* music)
{
SDL_Keycode keycode = keysum->sym;
SDL_Scancode scancode = keysum->scancode;
tic_mem* tic = music->tic;
bool shift = SDL_GetModState() & KMOD_SHIFT;
if(tic->ram.input.keyboard.data == 0)
{
music->tracker.note = -1;
s32 channel = music->tracker.col / CHANNEL_COLS;
music->tic->api.sfx_stop(music->tic, channel);
return;
}
bool shift = tic->api.key(tic, tic_key_shift);
if(shift)
{
switch (keycode)
if(keyWasPressed(tic_key_up)
|| keyWasPressed(tic_key_down)
|| keyWasPressed(tic_key_left)
|| keyWasPressed(tic_key_right)
|| keyWasPressed(tic_key_home)
|| keyWasPressed(tic_key_end)
|| keyWasPressed(tic_key_pageup)
|| keyWasPressed(tic_key_pagedown)
|| keyWasPressed(tic_key_tab))
{
case SDLK_UP:
case SDLK_DOWN:
case SDLK_LEFT:
case SDLK_RIGHT:
case SDLK_HOME:
case SDLK_END:
case SDLK_PAGEUP:
case SDLK_PAGEDOWN:
case SDLK_TAB:
checkSelection(music);
}
}
switch (keycode)
if(keyWasPressed(tic_key_up)) upRow(music);
else if(keyWasPressed(tic_key_down)) downRow(music);
else if(keyWasPressed(tic_key_left)) leftCol(music);
else if(keyWasPressed(tic_key_right)) rightCol(music);
else if(keyWasPressed(tic_key_home)) goHome(music);
else if(keyWasPressed(tic_key_end)) goEnd(music);
else if(keyWasPressed(tic_key_pageup)) pageUp(music);
else if(keyWasPressed(tic_key_pagedown)) pageDown(music);
else if(keyWasPressed(tic_key_tab)) doTab(music);
else if(keyWasPressed(tic_key_delete))
{
case SDLK_UP: upRow(music); break;
case SDLK_DOWN: downRow(music); break;
case SDLK_LEFT: leftCol(music); break;
case SDLK_RIGHT: rightCol(music); break;
case SDLK_HOME: goHome(music); break;
case SDLK_END: goEnd(music); break;
case SDLK_PAGEUP: pageUp(music); break;
case SDLK_PAGEDOWN: pageDown(music); break;
case SDLK_TAB: doTab(music); break;
case SDLK_DELETE:
deleteSelection(music);
history_add(music->history);
downRow(music);
break;
case SDLK_SPACE: playNote(music); break;
case SDLK_RETURN:
case SDLK_KP_ENTER:
{
}
else if(keyWasPressed(tic_key_space)) playNote(music);
else if(keyWasPressed(tic_key_return))
{
const tic_music_pos* pos = getMusicPos(music);
pos->track < 0
? (shift ? playFrameRow(music) : playFrame(music))
: stopTrack(music);
}
break;
}
if(shift)
{
switch (keycode)
if(keyWasPressed(tic_key_up)
|| keyWasPressed(tic_key_down)
|| keyWasPressed(tic_key_left)
|| keyWasPressed(tic_key_right)
|| keyWasPressed(tic_key_home)
|| keyWasPressed(tic_key_end)
|| keyWasPressed(tic_key_pageup)
|| keyWasPressed(tic_key_pagedown)
|| keyWasPressed(tic_key_tab))
{
case SDLK_UP:
case SDLK_DOWN:
case SDLK_LEFT:
case SDLK_RIGHT:
case SDLK_HOME:
case SDLK_END:
case SDLK_PAGEUP:
case SDLK_PAGEDOWN:
case SDLK_TAB:
updateSelection(music);
}
}
else resetSelection(music);
static const SDL_Scancode Piano[] =
static const tic_keycode Piano[] =
{
SDL_SCANCODE_Z,
SDL_SCANCODE_S,
SDL_SCANCODE_X,
SDL_SCANCODE_D,
SDL_SCANCODE_C,
SDL_SCANCODE_V,
SDL_SCANCODE_G,
SDL_SCANCODE_B,
SDL_SCANCODE_H,
SDL_SCANCODE_N,
SDL_SCANCODE_J,
SDL_SCANCODE_M,
tic_key_z,
tic_key_s,
tic_key_x,
tic_key_d,
tic_key_c,
tic_key_v,
tic_key_g,
tic_key_b,
tic_key_h,
tic_key_n,
tic_key_j,
tic_key_m,
// octave +1
SDL_SCANCODE_Q,
SDL_SCANCODE_2,
SDL_SCANCODE_W,
SDL_SCANCODE_3,
SDL_SCANCODE_E,
SDL_SCANCODE_R,
SDL_SCANCODE_5,
SDL_SCANCODE_T,
SDL_SCANCODE_6,
SDL_SCANCODE_Y,
SDL_SCANCODE_7,
SDL_SCANCODE_U,
tic_key_q,
tic_key_2,
tic_key_w,
tic_key_3,
tic_key_e,
tic_key_r,
tic_key_5,
tic_key_t,
tic_key_6,
tic_key_y,
tic_key_7,
tic_key_u,
};
if (getChannelPattern(music))
@@ -846,7 +847,7 @@ static void processTrackerKeydown(Music* music, SDL_Keysym* keysum)
{
case ColumnNote:
case ColumnSemitone:
if (scancode == SDL_SCANCODE_1 || scancode == SDL_SCANCODE_A)
if (keyWasPressed(tic_key_1) || keyWasPressed(tic_key_a))
{
setStopNote(music);
downRow(music);
@@ -857,7 +858,7 @@ static void processTrackerKeydown(Music* music, SDL_Keysym* keysum)
for (s32 i = 0; i < COUNT_OF(Piano); i++)
{
if (scancode == Piano[i])
if (keyWasPressed(Piano[i]))
{
s32 note = i % NOTES;
@@ -877,8 +878,7 @@ static void processTrackerKeydown(Music* music, SDL_Keysym* keysum)
downRow(music);
break;
}
}
}
}
break;
@@ -886,8 +886,10 @@ static void processTrackerKeydown(Music* music, SDL_Keysym* keysum)
if(getNote(music) >= 0)
{
s32 octave = -1;
if (keycode >= SDLK_1 && keycode <= SDLK_8) octave = keycode - SDLK_1;
if (keycode >= SDLK_KP_1 && keycode <= SDLK_KP_8) octave = keycode - SDLK_KP_1;
char sym = getKeyboardText();
if(sym >= '1' && sym <= '8') octave = sym - '1';
if(octave >= 0)
{
@@ -901,10 +903,10 @@ static void processTrackerKeydown(Music* music, SDL_Keysym* keysum)
if(getNote(music) >= 0)
{
s32 val = -1;
char sym = getKeyboardText();
if (keycode >= SDLK_0 && keycode <= SDLK_9) val = keycode - SDLK_0;
if (keycode >= SDLK_KP_1 && keycode <= SDLK_KP_9) val = keycode - SDLK_KP_1 + 1;
if (keycode == SDLK_KP_0) val = 0;
if (sym >= '0' && sym <= '9') val = sym - '0';
if(val >= 0)
{
@@ -927,10 +929,10 @@ static void processTrackerKeydown(Music* music, SDL_Keysym* keysum)
{
s32 val = -1;
if(keycode >= SDLK_0 && keycode <= SDLK_9) val = keycode - SDLK_0;
if(keycode >= SDLK_a && keycode <= SDLK_f) val = keycode - SDLK_a + 10;
if(keycode >= SDLK_KP_1 && keycode <= SDLK_KP_9) val = keycode - SDLK_KP_1 + 1;
if(keycode == SDLK_KP_0) val = 0;
char sym = getKeyboardText();
if(sym >= '0' && sym <= '9') val = sym - '0';
if(sym >= 'a' && sym <= 'f') val = sym - 'a' + 10;
if(val >= 0)
{
@@ -945,46 +947,40 @@ static void processTrackerKeydown(Music* music, SDL_Keysym* keysum)
}
}
static void processPatternKeydown(Music* music, SDL_Keysym* keysum)
static void processPatternKeyboard(Music* music)
{
SDL_Keycode keycode = keysum->sym;
s32 channel = music->tracker.col / CHANNEL_COLS;
switch (keycode)
if(keyWasPressed(tic_key_delete)) setChannelPatternValue(music, 0, channel);
else if(keyWasPressed(tic_key_tab)) nextPattern(music);
else if(keyWasPressed(tic_key_left)) patternColLeft(music);
else if(keyWasPressed(tic_key_right)) patternColRight(music);
else if(keyWasPressed(tic_key_down)
|| keyWasPressed(tic_key_return))
music->tracker.row = music->tracker.scroll;
else
{
case SDLK_DELETE: setChannelPatternValue(music, 0, channel); break;
case SDLK_TAB: nextPattern(music); break;
case SDLK_DOWN:
case SDLK_KP_ENTER:
case SDLK_RETURN: music->tracker.row = music->tracker.scroll; break;
case SDLK_LEFT: patternColLeft(music); break;
case SDLK_RIGHT: patternColRight(music); break;
default:
s32 val = -1;
char sym = getKeyboardText();
if(sym >= '0' && sym <= '9') val = sym - '0';
if(val >= 0)
{
s32 val = -1;
enum {Base = 10};
s32 patternId = tic_tool_get_pattern_id(getTrack(music), music->tracker.frame, channel);
if(keycode >= SDLK_0 && keycode <= SDLK_9) val = keycode - SDLK_0;
if(keycode >= SDLK_KP_1 && keycode <= SDLK_KP_9) val = keycode - SDLK_KP_1 + 1;
if(keycode == SDLK_KP_0) val = 0;
patternId = music->tracker.patternCol == 0
? val * Base + patternId % Base
: patternId / Base * Base + val % Base;
if(val >= 0)
if(patternId <= MUSIC_PATTERNS)
{
enum {Base = 10};
s32 patternId = tic_tool_get_pattern_id(getTrack(music), music->tracker.frame, channel);
setChannelPatternValue(music, patternId, channel);
patternId = music->tracker.patternCol == 0
? val * Base + patternId % Base
: patternId / Base * Base + val % Base;
if(patternId <= MUSIC_PATTERNS)
{
setChannelPatternValue(music, patternId, channel);
if(music->tracker.patternCol == 0)
patternColRight(music);
}
if(music->tracker.patternCol == 0)
patternColRight(music);
}
}
}
@@ -996,18 +992,20 @@ static void selectAll(Music* music)
s32 col = music->tracker.col - music->tracker.col % CHANNEL_COLS;
music->tracker.select.start = (SDL_Point){col, 0};
music->tracker.select.start = (tic_point){col, 0};
music->tracker.col = col + CHANNEL_COLS-1;
music->tracker.row = MUSIC_PATTERN_ROWS-1;
updateSelection(music);
}
static void processKeydown(Music* music, SDL_Keysym* keysum)
static void processKeyboard(Music* music)
{
SDL_Keycode keycode = keysum->sym;
tic_mem* tic = music->tic;
switch(getClipboardEvent(keycode))
if(tic->ram.input.keyboard.data == 0) return;
switch(getClipboardEvent())
{
case TIC_CLIPBOARD_CUT: copyToClipboard(music, true); break;
case TIC_CLIPBOARD_COPY: copyToClipboard(music, false); break;
@@ -1015,34 +1013,24 @@ static void processKeydown(Music* music, SDL_Keysym* keysum)
default: break;
}
SDL_Keymod keymod = SDL_GetModState();
bool ctrl = tic->api.key(tic, tic_key_ctrl);
if (keymod & TIC_MOD_CTRL)
if (ctrl)
{
switch (keycode)
{
case SDLK_a: selectAll(music); break;
case SDLK_z: undo(music); break;
case SDLK_y: redo(music); break;
case SDLK_UP: upFrame(music); break;
case SDLK_DOWN: downFrame(music); break;
}
if(keyWasPressed(tic_key_a)) selectAll(music);
else if(keyWasPressed(tic_key_z)) undo(music);
else if(keyWasPressed(tic_key_y)) redo(music);
else if(keyWasPressed(tic_key_up)) upFrame(music);
else if(keyWasPressed(tic_key_down)) downFrame(music);
}
else
{
music->tracker.row >= 0
? processTrackerKeydown(music, keysum)
: processPatternKeydown(music, keysum);
? processTrackerKeyboard(music)
: processPatternKeyboard(music);
}
}
static void processKeyup(Music* music, SDL_Keysym* keysum)
{
music->tracker.note = -1;
s32 channel = music->tracker.col / CHANNEL_COLS;
music->tic->api.sfx_stop(music->tic, channel);
}
static void setIndex(Music* music, s32 delta, void* data)
{
music->track += delta;
@@ -1134,13 +1122,13 @@ static void drawTrackerFrames(Music* music, s32 x, s32 y)
};
{
SDL_Rect rect = { x - Border, y - Border, Width, MUSIC_FRAMES * TIC_FONT_HEIGHT + Border };
tic_rect rect = { x - Border, y - Border, Width, MUSIC_FRAMES * TIC_FONT_HEIGHT + Border };
if (checkMousePos(&rect))
{
setCursor(SDL_SYSTEM_CURSOR_HAND);
setCursor(tic_cursor_hand);
if (checkMouseDown(&rect, SDL_BUTTON_LEFT))
if (checkMouseDown(&rect, tic_mouse_left))
{
s32 my = getMouseY() - rect.y - Border;
music->tracker.frame = my / TIC_FONT_HEIGHT;
@@ -1216,13 +1204,13 @@ static void drawTrackerChannel(Music* music, s32 x, s32 y, s32 channel)
Width = TIC_FONT_WIDTH * 8 + Border,
};
SDL_Rect rect = {x - Border, y - Border, Width, Rows*TIC_FONT_HEIGHT + Border};
tic_rect rect = {x - Border, y - Border, Width, Rows*TIC_FONT_HEIGHT + Border};
if(checkMousePos(&rect))
{
setCursor(SDL_SYSTEM_CURSOR_HAND);
setCursor(tic_cursor_hand);
if(checkMouseDown(&rect, SDL_BUTTON_LEFT))
if(checkMouseDown(&rect, tic_mouse_left))
{
s32 mx = getMouseX() - rect.x - Border;
s32 my = getMouseY() - rect.y - Border;
@@ -1237,7 +1225,7 @@ static void drawTrackerChannel(Music* music, s32 x, s32 y, s32 channel)
else
{
resetSelection(music);
music->tracker.select.start = (SDL_Point){col, row};
music->tracker.select.start = (tic_point){col, row};
music->tracker.select.drag = true;
}
@@ -1246,8 +1234,8 @@ static void drawTrackerChannel(Music* music, s32 x, s32 y, s32 channel)
if(music->tracker.select.drag)
{
SDL_Rect rect = {0, 0, TIC80_WIDTH, TIC80_HEIGHT};
if(!checkMouseDown(&rect, SDL_BUTTON_LEFT))
tic_rect rect = {0, 0, TIC80_WIDTH, TIC80_HEIGHT};
if(!checkMouseDown(&rect, tic_mouse_left))
{
music->tracker.select.drag = false;
}
@@ -1274,7 +1262,7 @@ static void drawTrackerChannel(Music* music, s32 x, s32 y, s32 channel)
// draw selection
if (selectedChannel)
{
SDL_Rect rect = music->tracker.select.rect;
tic_rect rect = music->tracker.select.rect;
if (rect.h > 1 && i >= rect.y && i < rect.y + rect.h)
{
s32 sx = x - 1;
@@ -1346,22 +1334,22 @@ static void drawTumbler(Music* music, s32 x, s32 y, s32 index)
enum{On=36, Off = 52, Size=5, Chroma=14};
SDL_Rect rect = {x, y, Size, Size};
tic_rect rect = {x, y, Size, Size};
if(checkMousePos(&rect))
{
setCursor(SDL_SYSTEM_CURSOR_HAND);
setCursor(tic_cursor_hand);
showTooltip("on/off channel");
if(checkMouseClick(&rect, SDL_BUTTON_LEFT))
if(checkMouseClick(&rect, tic_mouse_left))
{
if (SDL_GetModState() & KMOD_CTRL)
{
for (s32 i = 0; i < TIC_SOUND_CHANNELS; i++)
music->tracker.patterns[i] = i == index;
}
else music->tracker.patterns[index] = !music->tracker.patterns[index];
// if (SDL_GetModState() & KMOD_CTRL)
// {
// for (s32 i = 0; i < TIC_SOUND_CHANNELS; i++)
// music->tracker.patterns[i] = i == index;
// }
// else music->tracker.patterns[index] = !music->tracker.patterns[index];
}
}
@@ -1438,13 +1426,13 @@ static void drawPlayButtons(Music* music)
for (s32 i = 0; i < Count; i++)
{
SDL_Rect rect = { Offset + Width * i, 0, Width, Height };
tic_rect rect = { Offset + Width * i, 0, Width, Height };
bool over = false;
if (checkMousePos(&rect))
{
setCursor(SDL_SYSTEM_CURSOR_HAND);
setCursor(tic_cursor_hand);
over = true;
static const char* Tooltips[] = { "RECORD MUSIC", "PLAY FRAME [enter]", "PLAY TRACK", "STOP [enter]" };
@@ -1452,7 +1440,7 @@ static void drawPlayButtons(Music* music)
static void(*const Handlers[])(Music*) = { enableFollowMode, playFrame, playTrack, stopTrack };
if (checkMouseClick(&rect, SDL_BUTTON_LEFT))
if (checkMouseClick(&rect, tic_mouse_left))
Handlers[i](music);
}
@@ -1490,7 +1478,7 @@ static void drawModeTabs(Music* music)
for (s32 i = 0; i < Count; i++)
{
SDL_Rect rect = { TIC80_WIDTH - Width * (Count - i), 0, Width, Height };
tic_rect rect = { TIC80_WIDTH - Width * (Count - i), 0, Width, Height };
static const s32 Tabs[] = { MUSIC_PIANO_TAB, MUSIC_TRACKER_TAB };
@@ -1499,13 +1487,13 @@ static void drawModeTabs(Music* music)
if (checkMousePos(&rect))
{
setCursor(SDL_SYSTEM_CURSOR_HAND);
setCursor(tic_cursor_hand);
over = true;
static const char* Tooltips[] = { "PIANO MODE", "TRACKER MODE" };
showTooltip(Tooltips[i]);
if (checkMouseClick(&rect, SDL_BUTTON_LEFT))
if (checkMouseClick(&rect, tic_mouse_left))
music->tab = Tabs[i];
}
@@ -1529,9 +1517,6 @@ static void drawMusicToolbar(Music* music)
static void drawPianoLayout(Music* music)
{
SDL_Event* event = NULL;
while ((event = pollEvent())){}
music->tic->api.clear(music->tic, (tic_color_gray));
static const char Wip[] = "PIANO MODE - WORK IN PROGRESS...";
@@ -1544,7 +1529,7 @@ static void scrollNotes(Music* music, s32 delta)
if(pattern)
{
SDL_Rect rect = music->tracker.select.rect;
tic_rect rect = music->tracker.select.rect;
if(rect.h <= 0)
{
@@ -1571,35 +1556,32 @@ static void scrollNotes(Music* music, s32 delta)
static void drawTrackerLayout(Music* music)
{
SDL_Event* event = NULL;
while ((event = pollEvent()))
tic_mem* tic = music->tic;
// process scroll
{
switch (event->type)
tic80_input* input = &tic->ram.input;
if(input->mouse.scrolly)
{
case SDL_MOUSEWHEEL:
if(SDL_GetModState() & TIC_MOD_CTRL)
if(tic->api.key(tic, tic_key_ctrl))
{
scrollNotes(music, event->wheel.y > 0 ? 1 : -1);
scrollNotes(music, input->mouse.scrolly > 0 ? 1 : -1);
}
else
{
enum{Scroll = NOTES_PER_BEET};
s32 delta = event->wheel.y > 0 ? -Scroll : Scroll;
s32 delta = input->mouse.scrolly > 0 ? -Scroll : Scroll;
music->tracker.scroll += delta;
updateScroll(music);
}
break;
case SDL_KEYDOWN:
processKeydown(music, &event->key.keysym);
break;
case SDL_KEYUP:
processKeyup(music, &event->key.keysym);
break;
}
}
processKeyboard(music);
if(music->tracker.follow)
{
const tic_music_pos* pos = getMusicPos(music);
+2 -2
View File
@@ -54,8 +54,8 @@ struct Music
struct
{
SDL_Point start;
SDL_Rect rect;
tic_point start;
tic_rect rect;
bool drag;
} select;
+16 -172
View File
@@ -24,9 +24,8 @@
#include "tic.h"
#include "SDL_net.h"
#include <lua.h>
#include <lauxlib.h>
#include <lualib.h>
#include <stdlib.h>
#include <stdio.h>
struct Net
{
@@ -53,7 +52,7 @@ static void getRequest(Net* net, const char* path, NetResponse callback, void* d
static void netClearCache(Net* net)
{
if(net->cache.buffer)
SDL_free(net->cache.buffer);
free(net->cache.buffer);
net->cache.buffer = NULL;
net->cache.size = 0;
@@ -95,7 +94,7 @@ static Buffer httpRequest(const char* path, s32 timeout)
if(SDLNet_CheckSockets(set, timeout) == 1 && SDLNet_SocketReady(sock))
{
enum {Size = 4*1024+1};
buffer.data = SDL_malloc(Size);
buffer.data = malloc(Size);
s32 size = 0;
for(;;)
@@ -105,7 +104,7 @@ static Buffer httpRequest(const char* path, s32 timeout)
if(size > 0)
{
buffer.size += size;
buffer.data = SDL_realloc(buffer.data, buffer.size + Size);
buffer.data = realloc(buffer.data, buffer.size + Size);
}
else break;
}
@@ -141,34 +140,34 @@ static void getRequest(Net* net, const char* path, NetResponse callback, void* d
if(buffer.data && buffer.size)
{
if(SDL_strstr((char*)buffer.data, "200 OK"))
if(strstr((char*)buffer.data, "200 OK"))
{
s32 contentLength = 0;
{
static const char ContentLength[] = "Content-Length:";
char* start = SDL_strstr((char*)buffer.data, ContentLength);
char* start = strstr((char*)buffer.data, ContentLength);
if(start)
contentLength = SDL_atoi(start + sizeof(ContentLength));
contentLength = atoi(start + sizeof(ContentLength));
}
static const char Start[] = "\r\n\r\n";
u8* start = (u8*)SDL_strstr((char*)buffer.data, Start);
u8* start = (u8*)strstr((char*)buffer.data, Start);
if(start)
{
strcpy(net->cache.path, path);
net->cache.size = contentLength ? contentLength : buffer.size - (s32)(start - buffer.data);
net->cache.buffer = (u8*)SDL_malloc(net->cache.size);
SDL_memcpy(net->cache.buffer, start + sizeof Start - 1, net->cache.size);
net->cache.buffer = (u8*)malloc(net->cache.size);
memcpy(net->cache.buffer, start + sizeof Start - 1, net->cache.size);
callback(net->cache.buffer, net->cache.size, data);
done = true;
}
}
SDL_free(buffer.data);
free(buffer.data);
}
if(!done)
@@ -178,124 +177,6 @@ static void getRequest(Net* net, const char* path, NetResponse callback, void* d
#endif
static lua_State* netLuaInit(u8* buffer, s32 size)
{
if (buffer && size)
{
lua_State* lua = luaL_newstate();
if(lua)
{
if(luaL_loadstring(lua, (char*)buffer) == LUA_OK && lua_pcall(lua, 0, LUA_MULTRET, 0) == LUA_OK)
return lua;
else lua_close(lua);
}
}
return NULL;
}
typedef struct
{
ListCallback callback;
void* data;
} NetDirData;
static void onDirResponse(u8* buffer, s32 size, void* data)
{
NetDirData* netDirData = (NetDirData*)data;
lua_State* lua = netLuaInit(buffer, size);
if(lua)
{
{
lua_getglobal(lua, "folders");
if(lua_type(lua, -1) == LUA_TTABLE)
{
s32 count = (s32)lua_rawlen(lua, -1);
for(s32 i = 1; i <= count; i++)
{
lua_geti(lua, -1, i);
{
lua_getfield(lua, -1, "name");
if(lua_isstring(lua, -1))
netDirData->callback(lua_tostring(lua, -1), NULL, 0, netDirData->data, true);
lua_pop(lua, 1);
}
lua_pop(lua, 1);
}
}
lua_pop(lua, 1);
}
{
lua_getglobal(lua, "files");
if(lua_type(lua, -1) == LUA_TTABLE)
{
s32 count = (s32)lua_rawlen(lua, -1);
for(s32 i = 1; i <= count; i++)
{
lua_geti(lua, -1, i);
char hash[FILENAME_MAX] = {0};
char name[FILENAME_MAX] = {0};
{
lua_getfield(lua, -1, "hash");
if(lua_isstring(lua, -1))
strcpy(hash, lua_tostring(lua, -1));
lua_pop(lua, 1);
}
{
lua_getfield(lua, -1, "name");
if(lua_isstring(lua, -1))
strcpy(name, lua_tostring(lua, -1));
lua_pop(lua, 1);
}
{
lua_getfield(lua, -1, "id");
if(lua_isinteger(lua, -1))
netDirData->callback(name, hash, lua_tointeger(lua, -1), netDirData->data, false);
lua_pop(lua, 1);
}
lua_pop(lua, 1);
}
}
lua_pop(lua, 1);
}
lua_close(lua);
}
}
void netDirRequest(Net* net, const char* path, ListCallback callback, void* data)
{
char request[FILENAME_MAX] = {'\0'};
sprintf(request, "/api?fn=dir&path=%s", path);
NetDirData netDirData = {callback, data};
getRequest(net, request, onDirResponse, &netDirData);
}
typedef struct
{
void* buffer;
@@ -306,9 +187,9 @@ static void onGetResponse(u8* buffer, s32 size, void* data)
{
NetGetData* netGetData = (NetGetData*)data;
netGetData->buffer = SDL_malloc(size);
netGetData->buffer = malloc(size);
*netGetData->size = size;
SDL_memcpy(netGetData->buffer, buffer, size);
memcpy(netGetData->buffer, buffer, size);
}
void* netGetRequest(Net* net, const char* path, s32* size)
@@ -319,48 +200,11 @@ void* netGetRequest(Net* net, const char* path, s32* size)
return netGetData.buffer;
}
NetVersion netVersionRequest(Net* net)
{
NetVersion version =
{
.major = TIC_VERSION_MAJOR,
.minor = TIC_VERSION_MINOR,
.patch = TIC_VERSION_PATCH,
};
s32 size = 0;
void* buffer = netGetRequest(net, "/api?fn=version", &size);
if(buffer && size)
{
lua_State* lua = netLuaInit(buffer, size);
if(lua)
{
static const char* Fields[] = {"major", "minor", "patch"};
for(s32 i = 0; i < COUNT_OF(Fields); i++)
{
lua_getglobal(lua, Fields[i]);
if(lua_isinteger(lua, -1))
((s32*)&version)[i] = (s32)lua_tointeger(lua, -1);
lua_pop(lua, 1);
}
lua_close(lua);
}
}
return version;
}
Net* createNet()
{
SDLNet_Init();
Net* net = (Net*)SDL_malloc(sizeof(Net));
Net* net = (Net*)malloc(sizeof(Net));
*net = (Net)
{
@@ -377,7 +221,7 @@ Net* createNet()
void closeNet(Net* net)
{
SDL_free(net);
free(net);
SDLNet_Quit();
}
+1 -11
View File
@@ -26,16 +26,6 @@
typedef struct Net Net;
typedef struct
{
s32 major;
s32 minor;
s32 patch;
} NetVersion;
NetVersion netVersionRequest(Net* net);
void netDirRequest(Net* net, const char* path, ListCallback callback, void* data);
void* netGetRequest(Net* net, const char* path, s32* size);
Net* createNet();
void* netGetRequest(Net* net, const char* path, s32* size);
void closeNet(Net* net);
+16 -24
View File
@@ -86,8 +86,6 @@ static void initPMemName(Run* run)
static void tick(Run* run)
{
while(pollEvent());
if (getStudioMode() != TIC_RUN_MODE)
return;
@@ -95,10 +93,11 @@ static void tick(Run* run)
enum {Size = sizeof(tic_persistent)};
if(SDL_memcmp(&run->tic->persistent, &run->persistent, Size) != 0)
if(run->tickData.syncPMEM)
{
fsSaveRootFile(run->console->fs, run->saveid, &run->tic->persistent, Size, true);
SDL_memcpy(&run->persistent, &run->tic->persistent, Size);
memcpy(&run->persistent, &run->tic->persistent, Size);
run->tickData.syncPMEM = false;
}
if(run->exit)
@@ -139,7 +138,7 @@ static void processDoFile(void* data, char* dst)
return;
}
else SDL_memcpy(dst, buffer, size);
else memcpy(dst, buffer, size);
}
}
else
@@ -156,22 +155,14 @@ static void processDoFile(void* data, char* dst)
return;
}
static void preseed()
{
#if defined(__MACOSX__)
srandom(time(NULL));
random();
#else
srand(time(NULL));
rand();
#endif
}
static bool forceExit(void* data)
{
while(pollEvent());
getSystem()->poll();
return getStudioMode() != TIC_RUN_MODE;
tic_mem* tic = ((Run*)data)->tic;
return tic->api.key(tic, tic_key_escape);
}
void initRun(Run* run, Console* console, tic_mem* tic)
@@ -186,19 +177,20 @@ void initRun(Run* run, Console* console, tic_mem* tic)
{
.error = onError,
.trace = onTrace,
.counter = SDL_GetPerformanceCounter,
.freq = SDL_GetPerformanceFrequency,
.counter = getSystem()->getPerformanceCounter,
.freq = getSystem()->getPerformanceFrequency,
.start = 0,
.data = run,
.exit = onExit,
.preprocessor = processDoFile,
.forceExit = forceExit,
.syncPMEM = false,
},
};
{
enum {Size = sizeof(tic_persistent)};
SDL_memset(&run->tic->persistent, 0, Size);
memset(&run->tic->persistent, 0, Size);
initPMemName(run);
@@ -209,12 +201,12 @@ void initRun(Run* run, Console* console, tic_mem* tic)
if(data)
{
SDL_memcpy(&run->tic->persistent, data, size);
SDL_memcpy(&run->persistent, data, size);
memcpy(&run->tic->persistent, data, size);
memcpy(&run->persistent, data, size);
}
if(data) SDL_free(data);
if(data) free(data);
}
preseed();
getSystem()->preseed();
}
+99 -124
View File
@@ -68,13 +68,13 @@ static void drawSwitch(Sfx* sfx, s32 x, s32 y, const char* label, s32 value, voi
{
x += (s32)strlen(label)*TIC_FONT_WIDTH;
SDL_Rect rect = {x, y, TIC_FONT_WIDTH, TIC_FONT_HEIGHT};
tic_rect rect = {x, y, TIC_FONT_WIDTH, TIC_FONT_HEIGHT};
if(checkMousePos(&rect))
{
setCursor(SDL_SYSTEM_CURSOR_HAND);
setCursor(tic_cursor_hand);
if(checkMouseClick(&rect, SDL_BUTTON_LEFT))
if(checkMouseClick(&rect, tic_mouse_left))
set(sfx, -1);
}
@@ -90,13 +90,13 @@ static void drawSwitch(Sfx* sfx, s32 x, s32 y, const char* label, s32 value, voi
{
x += 2*TIC_FONT_WIDTH;
SDL_Rect rect = {x, y, TIC_FONT_WIDTH, TIC_FONT_HEIGHT};
tic_rect rect = {x, y, TIC_FONT_WIDTH, TIC_FONT_HEIGHT};
if(checkMousePos(&rect))
{
setCursor(SDL_SYSTEM_CURSOR_HAND);
setCursor(tic_cursor_hand);
if(checkMouseClick(&rect, SDL_BUTTON_LEFT))
if(checkMouseClick(&rect, tic_mouse_left))
set(sfx, +1);
}
@@ -207,16 +207,16 @@ static void drawWaveButtons(Sfx* sfx, s32 x, s32 y)
for(s32 i = 0; i < Count; i++)
{
SDL_Rect rect = {x, y + (Count - i - 1)*(Height+Gap), Width, Height};
tic_rect rect = {x, y + (Count - i - 1)*(Height+Gap), Width, Height};
bool over = false;
if(checkMousePos(&rect))
{
setCursor(SDL_SYSTEM_CURSOR_HAND);
setCursor(tic_cursor_hand);
over = true;
if(checkMouseClick(&rect, SDL_BUTTON_LEFT))
if(checkMouseClick(&rect, tic_mouse_left))
{
sfx->waveform.index = i;
sfx->tab = SFX_WAVEFORM_TAB;
@@ -238,15 +238,15 @@ static void drawWaveButtons(Sfx* sfx, s32 x, s32 y)
{
enum{Size = 5};
SDL_Rect iconRect = {x+Width+HGap, y + (Count - i - 1)*(Height+Gap), Size, Size};
tic_rect iconRect = {x+Width+HGap, y + (Count - i - 1)*(Height+Gap), Size, Size};
bool over = false;
if(checkMousePos(&iconRect))
{
setCursor(SDL_SYSTEM_CURSOR_HAND);
setCursor(tic_cursor_hand);
over = true;
if(checkMouseClick(&iconRect, SDL_BUTTON_LEFT))
if(checkMouseClick(&iconRect, tic_mouse_left))
{
tic_sample* effect = getEffect(sfx);
for(s32 c = 0; c < SFX_TICKS; c++)
@@ -295,13 +295,13 @@ static void drawCanvasTabs(Sfx* sfx, s32 x, s32 y)
{
s32 size = sfx->tic->api.text(sfx->tic, Labels[i], 0, -TIC_FONT_HEIGHT, (tic_color_black));
SDL_Rect rect = {x - size, sy, size, TIC_FONT_HEIGHT};
tic_rect rect = {x - size, sy, size, TIC_FONT_HEIGHT};
if(checkMousePos(&rect))
{
setCursor(SDL_SYSTEM_CURSOR_HAND);
setCursor(tic_cursor_hand);
if(checkMouseClick(&rect, SDL_BUTTON_LEFT))
if(checkMouseClick(&rect, tic_mouse_left))
{
sfx->canvasTab = i;
}
@@ -318,13 +318,13 @@ static void drawCanvasTabs(Sfx* sfx, s32 x, s32 y)
{
static const char Label[] = "x16";
enum{Width = (sizeof Label - 1) * TIC_FONT_WIDTH};
SDL_Rect rect = {(x - Width)/2, y + Height * 6, Width, TIC_FONT_HEIGHT};
tic_rect rect = {(x - Width)/2, y + Height * 6, Width, TIC_FONT_HEIGHT};
if(checkMousePos(&rect))
{
setCursor(SDL_SYSTEM_CURSOR_HAND);
setCursor(tic_cursor_hand);
if(checkMouseClick(&rect, SDL_BUTTON_LEFT))
if(checkMouseClick(&rect, tic_mouse_left))
effect->pitch16x++;
}
@@ -335,13 +335,13 @@ static void drawCanvasTabs(Sfx* sfx, s32 x, s32 y)
{
static const char Label[] = "DOWN";
enum{Width = (sizeof Label - 1) * TIC_FONT_WIDTH};
SDL_Rect rect = {(x - Width)/2, y + Height * 6, Width, TIC_FONT_HEIGHT};
tic_rect rect = {(x - Width)/2, y + Height * 6, Width, TIC_FONT_HEIGHT};
if(checkMousePos(&rect))
{
setCursor(SDL_SYSTEM_CURSOR_HAND);
setCursor(tic_cursor_hand);
if(checkMouseClick(&rect, SDL_BUTTON_LEFT))
if(checkMouseClick(&rect, tic_mouse_left))
effect->reverse++;
}
@@ -370,13 +370,13 @@ static void drawCanvas(Sfx* sfx, s32 x, s32 y)
sfx->tic->api.rect(sfx->tic, x + tickIndex * CANVAS_SIZE, y, CANVAS_SIZE + 1, CANVAS_HEIGHT + 1, (tic_color_white));
}
SDL_Rect rect = {x, y, CANVAS_WIDTH, CANVAS_HEIGHT};
tic_rect rect = {x, y, CANVAS_WIDTH, CANVAS_HEIGHT};
tic_sample* effect = getEffect(sfx);
if(checkMousePos(&rect))
{
setCursor(SDL_SYSTEM_CURSOR_HAND);
setCursor(tic_cursor_hand);
s32 mx = getMouseX() - x;
s32 my = getMouseY() - y;
@@ -384,7 +384,7 @@ static void drawCanvas(Sfx* sfx, s32 x, s32 y)
mx -= mx % CANVAS_SIZE;
my -= my % CANVAS_SIZE;
if(checkMouseDown(&rect, SDL_BUTTON_LEFT))
if(checkMouseDown(&rect, tic_mouse_left))
{
mx /= CANVAS_SIZE;
my /= CANVAS_SIZE;
@@ -420,7 +420,7 @@ static void drawCanvas(Sfx* sfx, s32 x, s32 y)
break;
case SFX_PITCH_TAB:
{
for(s32 j = SDL_min(0, effect->data[i].pitch); j <= SDL_max(0, effect->data[i].pitch); j++)
for(s32 j = MIN(0, effect->data[i].pitch); j <= MAX(0, effect->data[i].pitch); j++)
sfx->tic->api.rect(sfx->tic, x + i * CANVAS_SIZE + 1, y + 1 + (CANVAS_HEIGHT/2 - (j+1)*CANVAS_SIZE),
CANVAS_SIZE-1, CANVAS_SIZE-1, (tic_color_red));
}
@@ -451,26 +451,26 @@ static void drawPiano(Sfx* sfx, s32 x, s32 y)
static const s32 ButtonIndixes[] = {0, 2, 4, 5, 7, 9, 11, 1, 3, -1, 6, 8, 10};
SDL_Rect buttons[COUNT_OF(ButtonIndixes)];
tic_rect buttons[COUNT_OF(ButtonIndixes)];
for(s32 i = 0; i < COUNT_OF(buttons); i++)
{
buttons[i] = i < PIANO_WHITE_BUTTONS
? (SDL_Rect){x + (PIANO_BUTTON_WIDTH+1)*i, y, PIANO_BUTTON_WIDTH + 1, PIANO_BUTTON_HEIGHT}
: (SDL_Rect){x + (7 + 3) * (i - PIANO_WHITE_BUTTONS) + 6, y, 7, 8};
? (tic_rect){x + (PIANO_BUTTON_WIDTH+1)*i, y, PIANO_BUTTON_WIDTH + 1, PIANO_BUTTON_HEIGHT}
: (tic_rect){x + (7 + 3) * (i - PIANO_WHITE_BUTTONS) + 6, y, 7, 8};
}
SDL_Rect rect = {x, y, PIANO_WIDTH, PIANO_HEIGHT};
tic_rect rect = {x, y, PIANO_WIDTH, PIANO_HEIGHT};
if(checkMousePos(&rect))
{
setCursor(SDL_SYSTEM_CURSOR_HAND);
setCursor(tic_cursor_hand);
static const char* Tooltips[] = {"C [z]", "C# [s]", "D [x]", "D# [d]", "E [c]", "F [v]", "F# [g]", "G [b]", "G# [h]", "A [n]", "A# [j]", "B [m]" };
for(s32 i = COUNT_OF(buttons) - 1; i >= 0; i--)
{
SDL_Rect* rect = buttons + i;
tic_rect* rect = buttons + i;
if(checkMousePos(rect))
if(ButtonIndixes[i] >= 0)
@@ -480,11 +480,11 @@ static void drawPiano(Sfx* sfx, s32 x, s32 y)
}
}
if(checkMouseDown(&rect, SDL_BUTTON_LEFT))
if(checkMouseDown(&rect, tic_mouse_left))
{
for(s32 i = COUNT_OF(buttons) - 1; i >= 0; i--)
{
SDL_Rect* rect = buttons + i;
tic_rect* rect = buttons + i;
s32 index = ButtonIndixes[i];
if(index >= 0)
@@ -502,7 +502,7 @@ static void drawPiano(Sfx* sfx, s32 x, s32 y)
for(s32 i = 0; i < COUNT_OF(buttons); i++)
{
SDL_Rect* rect = buttons + i;
tic_rect* rect = buttons + i;
bool white = i < PIANO_WHITE_BUTTONS;
s32 index = ButtonIndixes[i];
@@ -525,13 +525,13 @@ static void drawOctavePanel(Sfx* sfx, s32 x, s32 y)
for(s32 i = 0; i < OCTAVES; i++)
{
SDL_Rect rect = {x + i * (TIC_FONT_WIDTH + Gap), y, TIC_FONT_WIDTH, TIC_FONT_HEIGHT};
tic_rect rect = {x + i * (TIC_FONT_WIDTH + Gap), y, TIC_FONT_WIDTH, TIC_FONT_HEIGHT};
if(checkMousePos(&rect))
{
setCursor(SDL_SYSTEM_CURSOR_HAND);
setCursor(tic_cursor_hand);
if(checkMouseClick(&rect, SDL_BUTTON_LEFT))
if(checkMouseClick(&rect, tic_mouse_left))
{
effect->octave = i;
}
@@ -629,34 +629,38 @@ static void copyWaveFromClipboard(Sfx* sfx)
static void processKeyboard(Sfx* sfx)
{
tic_mem* tic = sfx->tic;
if(tic->ram.input.keyboard.data == 0) return;
bool ctrl = tic->api.key(tic, tic_key_ctrl);
s32 keyboardButton = -1;
static const s32 Scancodes[] =
static const s32 Keycodes[] =
{
SDL_SCANCODE_Z,
SDL_SCANCODE_S,
SDL_SCANCODE_X,
SDL_SCANCODE_D,
SDL_SCANCODE_C,
SDL_SCANCODE_V,
SDL_SCANCODE_G,
SDL_SCANCODE_B,
SDL_SCANCODE_H,
SDL_SCANCODE_N,
SDL_SCANCODE_J,
SDL_SCANCODE_M,
tic_key_z,
tic_key_s,
tic_key_x,
tic_key_d,
tic_key_c,
tic_key_v,
tic_key_g,
tic_key_b,
tic_key_h,
tic_key_n,
tic_key_j,
tic_key_m,
};
SDL_Keymod keymod = SDL_GetModState();
if(keymod & TIC_MOD_CTRL)
if(ctrl)
{
}
else
{
for(int i = 0; i < COUNT_OF(Scancodes); i++)
if(getKeyboard()[Scancodes[i]])
for(int i = 0; i < COUNT_OF(Keycodes); i++)
if(tic->api.key(tic, Keycodes[i]))
keyboardButton = i;
}
@@ -668,13 +672,16 @@ static void processKeyboard(Sfx* sfx)
sfx->play.active = true;
}
if(getKeyboard()[SDL_SCANCODE_SPACE])
if(tic->api.key(tic, tic_key_space))
sfx->play.active = true;
}
static void processKeydown(Sfx* sfx, SDL_Keycode keycode)
static void processEnvelopesKeyboard(Sfx* sfx)
{
switch(getClipboardEvent(keycode))
tic_mem* tic = sfx->tic;
bool ctrl = tic->api.key(tic, tic_key_ctrl);
switch(getClipboardEvent())
{
case TIC_CLIPBOARD_CUT: cutToClipboard(sfx); break;
case TIC_CLIPBOARD_COPY: copyToClipboard(sfx); break;
@@ -682,29 +689,25 @@ static void processKeydown(Sfx* sfx, SDL_Keycode keycode)
default: break;
}
SDL_Keymod keymod = SDL_GetModState();
if(keymod & TIC_MOD_CTRL)
if(ctrl)
{
switch(keycode)
{
case SDLK_z: undo(sfx); break;
case SDLK_y: redo(sfx); break;
}
if(keyWasPressed(tic_key_z)) undo(sfx);
else if(keyWasPressed(tic_key_y)) redo(sfx);
}
switch(keycode)
{
case SDLK_TAB: sfx->tab = SFX_WAVEFORM_TAB; break;
case SDLK_LEFT: sfx->index--; break;
case SDLK_RIGHT: sfx->index++; break;
case SDLK_DELETE: resetSfx(sfx); break;
}
if(keyWasPressed(tic_key_tab)) sfx->tab = SFX_WAVEFORM_TAB;
else if(keyWasPressed(tic_key_left)) sfx->index--;
else if(keyWasPressed(tic_key_right)) sfx->index++;
else if(keyWasPressed(tic_key_delete)) resetSfx(sfx);
}
static void processWaveformKeydown(Sfx* sfx, SDL_Keycode keycode)
static void processWaveformKeyboard(Sfx* sfx)
{
switch(getClipboardEvent(keycode))
tic_mem* tic = sfx->tic;
bool ctrl = tic->api.key(tic, tic_key_ctrl);
switch(getClipboardEvent())
{
case TIC_CLIPBOARD_CUT: cutWaveToClipboard(sfx); break;
case TIC_CLIPBOARD_COPY: copyWaveToClipboard(sfx); break;
@@ -712,24 +715,16 @@ static void processWaveformKeydown(Sfx* sfx, SDL_Keycode keycode)
default: break;
}
SDL_Keymod keymod = SDL_GetModState();
if(keymod & TIC_MOD_CTRL)
if(ctrl)
{
switch(keycode)
{
case SDLK_z: undo(sfx); break;
case SDLK_y: redo(sfx); break;
}
if(keyWasPressed(tic_key_z)) undo(sfx);
else if(keyWasPressed(tic_key_y)) redo(sfx);
}
switch(keycode)
{
case SDLK_TAB: sfx->tab = SFX_ENVELOPES_TAB; break;
case SDLK_LEFT: sfx->waveform.index--; break;
case SDLK_RIGHT: sfx->waveform.index++; break;
case SDLK_DELETE: resetWave(sfx); break;
}
if(keyWasPressed(tic_key_tab)) sfx->tab = SFX_ENVELOPES_TAB;
else if(keyWasPressed(tic_key_left)) sfx->waveform.index--;
else if(keyWasPressed(tic_key_right)) sfx->waveform.index++;
else if(keyWasPressed(tic_key_delete)) resetWave(sfx);
}
static void drawModeTabs(Sfx* sfx)
@@ -759,7 +754,7 @@ static void drawModeTabs(Sfx* sfx)
for (s32 i = 0; i < Count; i++)
{
SDL_Rect rect = { TIC80_WIDTH - Width * (Count - i), 0, Width, Height };
tic_rect rect = { TIC80_WIDTH - Width * (Count - i), 0, Width, Height };
bool over = false;
@@ -767,13 +762,13 @@ static void drawModeTabs(Sfx* sfx)
if (checkMousePos(&rect))
{
setCursor(SDL_SYSTEM_CURSOR_HAND);
setCursor(tic_cursor_hand);
over = true;
static const char* Tooltips[] = { "WAVEFORMS [tab]", "ENVELOPES [tab]" };
showTooltip(Tooltips[i]);
if (checkMouseClick(&rect, SDL_BUTTON_LEFT))
if (checkMouseClick(&rect, tic_mouse_left))
sfx->tab = Tabs[i];
}
@@ -792,17 +787,17 @@ static void drawSfxToolbar(Sfx* sfx)
s32 x = TIC80_WIDTH - Width - TIC_SPRITESIZE*3;
s32 y = 1;
SDL_Rect rect = {x, y, Width, TIC_FONT_HEIGHT};
tic_rect rect = {x, y, Width, TIC_FONT_HEIGHT};
bool over = false;
if(checkMousePos(&rect))
{
setCursor(SDL_SYSTEM_CURSOR_HAND);
setCursor(tic_cursor_hand);
over = true;
showTooltip("PLAY SFX [space]");
if(checkMouseDown(&rect, SDL_BUTTON_LEFT))
if(checkMouseDown(&rect, tic_mouse_left))
{
sfx->play.active = true;
}
@@ -823,18 +818,8 @@ static void drawSfxToolbar(Sfx* sfx)
static void envelopesTick(Sfx* sfx)
{
SDL_Event* event = NULL;
while ((event = pollEvent()))
{
switch(event->type)
{
case SDL_KEYDOWN:
processKeydown(sfx, event->key.keysym.sym);
break;
}
}
processKeyboard(sfx);
processEnvelopesKeyboard(sfx);
sfx->tic->api.clear(sfx->tic, TIC_COLOR_BG);
@@ -869,13 +854,13 @@ static void drawWaveformBar(Sfx* sfx, s32 x, s32 y)
for(s32 i = 0; i < ENVELOPES_COUNT; i++)
{
SDL_Rect rect = {x + (i%Cols)*(Width+Gap), y + (i/Cols)*(Height+Gap), Width, Height};
tic_rect rect = {x + (i%Cols)*(Width+Gap), y + (i/Cols)*(Height+Gap), Width, Height};
if(checkMousePos(&rect))
{
setCursor(SDL_SYSTEM_CURSOR_HAND);
setCursor(tic_cursor_hand);
if(checkMouseClick(&rect, SDL_BUTTON_LEFT))
if(checkMouseClick(&rect, tic_mouse_left))
sfx->waveform.index = i;
}
@@ -909,7 +894,7 @@ static void drawWaveformCanvas(Sfx* sfx, s32 x, s32 y)
{
enum {Rows = CANVAS_ROWS, Width = ENVELOPE_VALUES * CANVAS_SIZE, Height = CANVAS_HEIGHT};
SDL_Rect rect = {x, y, Width, Height};
tic_rect rect = {x, y, Width, Height};
sfx->tic->api.rect(sfx->tic, rect.x, rect.y, rect.w, rect.h, (tic_color_dark_red));
@@ -921,9 +906,9 @@ static void drawWaveformCanvas(Sfx* sfx, s32 x, s32 y)
if(checkMousePos(&rect))
{
setCursor(SDL_SYSTEM_CURSOR_HAND);
setCursor(tic_cursor_hand);
if(checkMouseDown(&rect, SDL_BUTTON_LEFT))
if(checkMouseDown(&rect, tic_mouse_left))
{
s32 mx = getMouseX() - x;
s32 my = getMouseY() - y;
@@ -954,18 +939,8 @@ static void drawWaveformCanvas(Sfx* sfx, s32 x, s32 y)
static void waveformTick(Sfx* sfx)
{
SDL_Event* event = NULL;
while ((event = pollEvent()))
{
switch(event->type)
{
case SDL_KEYDOWN:
processWaveformKeydown(sfx, event->key.keysym.sym);
break;
}
}
processKeyboard(sfx);
processWaveformKeyboard(sfx);
sfx->tic->api.clear(sfx->tic, TIC_COLOR_BG);
+161 -180
View File
@@ -33,7 +33,7 @@
static void clearCanvasSelection(Sprite* sprite)
{
SDL_memset(&sprite->select.rect, 0, sizeof(SDL_Rect));
memset(&sprite->select.rect, 0, sizeof(tic_rect));
}
static u8 getSheetPixel(Sprite* sprite, s32 x, s32 y)
@@ -70,12 +70,12 @@ static void drawSelection(Sprite* sprite, s32 x, s32 y, s32 w, s32 h)
for(s32 i = (y+h-1); i >= y; i--) { sprite->tic->api.pixel(sprite->tic, x, i, index++ % Step ? color : 0);}
}
static SDL_Rect getSpriteRect(Sprite* sprite)
static tic_rect getSpriteRect(Sprite* sprite)
{
s32 x = getIndexPosX(sprite);
s32 y = getIndexPosY(sprite);
return (SDL_Rect){x, y, sprite->size, sprite->size};
return (tic_rect){x, y, sprite->size, sprite->size};
}
static void drawCursorBorder(Sprite* sprite, s32 x, s32 y, s32 w, s32 h)
@@ -86,12 +86,12 @@ static void drawCursorBorder(Sprite* sprite, s32 x, s32 y, s32 w, s32 h)
static void processPickerCanvasMouse(Sprite* sprite, s32 x, s32 y, s32 sx, s32 sy)
{
SDL_Rect rect = {x, y, CANVAS_SIZE, CANVAS_SIZE};
tic_rect rect = {x, y, CANVAS_SIZE, CANVAS_SIZE};
const s32 Size = CANVAS_SIZE / sprite->size;
if(checkMousePos(&rect))
{
setCursor(SDL_SYSTEM_CURSOR_HAND);
setCursor(tic_cursor_hand);
s32 mx = getMouseX() - x;
s32 my = getMouseY() - y;
@@ -101,22 +101,22 @@ static void processPickerCanvasMouse(Sprite* sprite, s32 x, s32 y, s32 sx, s32 s
drawCursorBorder(sprite, x + mx, y + my, Size, Size);
if(checkMouseDown(&rect, SDL_BUTTON_LEFT))
if(checkMouseDown(&rect, tic_mouse_left))
sprite->color = getSheetPixel(sprite, sx + mx / Size, sy + my / Size);
if(checkMouseDown(&rect, SDL_BUTTON_RIGHT))
if(checkMouseDown(&rect, tic_mouse_right))
sprite->color2 = getSheetPixel(sprite, sx + mx / Size, sy + my / Size);
}
}
static void processDrawCanvasMouse(Sprite* sprite, s32 x, s32 y, s32 sx, s32 sy)
{
SDL_Rect rect = {x, y, CANVAS_SIZE, CANVAS_SIZE};
tic_rect rect = {x, y, CANVAS_SIZE, CANVAS_SIZE};
const s32 Size = CANVAS_SIZE / sprite->size;
if(checkMousePos(&rect))
{
setCursor(SDL_SYSTEM_CURSOR_HAND);
setCursor(tic_cursor_hand);
s32 mx = getMouseX() - x;
s32 my = getMouseY() - y;
@@ -137,8 +137,8 @@ static void processDrawCanvasMouse(Sprite* sprite, s32 x, s32 y, s32 sx, s32 sy)
drawCursorBorder(sprite, x + mx, y + my, brushSize, brushSize);
bool left = checkMouseDown(&rect, SDL_BUTTON_LEFT);
bool right = checkMouseDown(&rect, SDL_BUTTON_RIGHT);
bool left = checkMouseDown(&rect, tic_mouse_left);
bool right = checkMouseDown(&rect, tic_mouse_right);
if(left || right)
{
@@ -167,7 +167,7 @@ static void pasteSelection(Sprite* sprite)
for(s32 sx = l; sx < r; sx++)
setSheetPixel(sprite, sx, sy, sprite->select.back[i++]);
SDL_Rect* rect = &sprite->select.rect;
tic_rect* rect = &sprite->select.rect;
l += rect->x;
t += rect->y;
@@ -183,7 +183,7 @@ static void pasteSelection(Sprite* sprite)
static void copySelection(Sprite* sprite)
{
SDL_Rect rect = getSpriteRect(sprite);
tic_rect rect = getSpriteRect(sprite);
s32 r = rect.x + rect.w;
s32 b = rect.y + rect.h;
@@ -192,8 +192,8 @@ static void copySelection(Sprite* sprite)
sprite->select.back[i++] = getSheetPixel(sprite, sx, sy);
{
SDL_Rect* rect = &sprite->select.rect;
SDL_memset(sprite->select.front, 0, CANVAS_SIZE * CANVAS_SIZE);
tic_rect* rect = &sprite->select.rect;
memset(sprite->select.front, 0, CANVAS_SIZE * CANVAS_SIZE);
for(s32 j = rect->y, index = 0; j < (rect->y + rect->h); j++)
for(s32 i = rect->x; i < (rect->x + rect->w); i++)
@@ -207,12 +207,12 @@ static void copySelection(Sprite* sprite)
static void processSelectCanvasMouse(Sprite* sprite, s32 x, s32 y)
{
SDL_Rect rect = {x, y, CANVAS_SIZE, CANVAS_SIZE};
tic_rect rect = {x, y, CANVAS_SIZE, CANVAS_SIZE};
const s32 Size = CANVAS_SIZE / sprite->size;
if(checkMousePos(&rect))
{
setCursor(SDL_SYSTEM_CURSOR_HAND);
setCursor(tic_cursor_hand);
s32 mx = getMouseX() - x;
s32 my = getMouseY() - y;
@@ -222,25 +222,25 @@ static void processSelectCanvasMouse(Sprite* sprite, s32 x, s32 y)
drawCursorBorder(sprite, x + mx, y + my, Size, Size);
if(checkMouseDown(&rect, SDL_BUTTON_LEFT))
if(checkMouseDown(&rect, tic_mouse_left))
{
if(sprite->select.drag)
{
s32 x = mx / Size;
s32 y = my / Size;
s32 rl = SDL_min(x, sprite->select.start.x);
s32 rt = SDL_min(y, sprite->select.start.y);
s32 rr = SDL_max(x, sprite->select.start.x);
s32 rb = SDL_max(y, sprite->select.start.y);
s32 rl = MIN(x, sprite->select.start.x);
s32 rt = MIN(y, sprite->select.start.y);
s32 rr = MAX(x, sprite->select.start.x);
s32 rb = MAX(y, sprite->select.start.y);
sprite->select.rect = (SDL_Rect){rl, rt, rr - rl + 1, rb - rt + 1};
sprite->select.rect = (tic_rect){rl, rt, rr - rl + 1, rb - rt + 1};
}
else
{
sprite->select.drag = true;
sprite->select.start = (SDL_Point){mx / Size, my / Size};
sprite->select.rect = (SDL_Rect){sprite->select.start.x, sprite->select.start.y, 1, 1};
sprite->select.start = (tic_point){mx / Size, my / Size};
sprite->select.rect = (tic_rect){sprite->select.start.x, sprite->select.start.y, 1, 1};
}
}
else if(sprite->select.drag)
@@ -274,12 +274,13 @@ static void replaceColor(Sprite* sprite, s32 l, s32 t, s32 r, s32 b, s32 x, s32
static void processFillCanvasMouse(Sprite* sprite, s32 x, s32 y, s32 l, s32 t)
{
SDL_Rect rect = {x, y, CANVAS_SIZE, CANVAS_SIZE};
tic_mem* tic = sprite->tic;
tic_rect rect = {x, y, CANVAS_SIZE, CANVAS_SIZE};
const s32 Size = CANVAS_SIZE / sprite->size;
if(checkMousePos(&rect))
{
setCursor(SDL_SYSTEM_CURSOR_HAND);
setCursor(tic_cursor_hand);
s32 mx = getMouseX() - x;
s32 my = getMouseY() - y;
@@ -289,8 +290,8 @@ static void processFillCanvasMouse(Sprite* sprite, s32 x, s32 y, s32 l, s32 t)
drawCursorBorder(sprite, x + mx, y + my, Size, Size);
bool left = checkMouseClick(&rect, SDL_BUTTON_LEFT);
bool right = checkMouseClick(&rect, SDL_BUTTON_RIGHT);
bool left = checkMouseClick(&rect, tic_mouse_left);
bool right = checkMouseClick(&rect, tic_mouse_right);
if(left || right)
{
@@ -302,9 +303,7 @@ static void processFillCanvasMouse(Sprite* sprite, s32 x, s32 y, s32 l, s32 t)
if(color != fill)
{
SDL_Keymod keymod = SDL_GetModState();
keymod & TIC_MOD_CTRL
tic->api.key(tic, tic_key_ctrl)
? replaceColor(sprite, l, t, l + sprite->size-1, t + sprite->size-1, sx, sy, color, fill)
: floodFill(sprite, l, t, l + sprite->size-1, t + sprite->size-1, sx, sy, color, fill);
}
@@ -323,17 +322,17 @@ static void drawBrushSlider(Sprite* sprite, s32 x, s32 y)
{
enum {Count = 4, Size = 5};
SDL_Rect rect = {x, y, Size, (Size+1)*Count};
tic_rect rect = {x, y, Size, (Size+1)*Count};
bool over = false;
if(checkMousePos(&rect))
{
setCursor(SDL_SYSTEM_CURSOR_HAND);
setCursor(tic_cursor_hand);
showTooltip("BRUSH SIZE");
over = true;
if(checkMouseDown(&rect, SDL_BUTTON_LEFT))
if(checkMouseDown(&rect, tic_mouse_left))
{
s32 my = getMouseY() - y;
@@ -386,7 +385,7 @@ static void drawCanvas(Sprite* sprite, s32 x, s32 y)
static void drawCanvasOvr(Sprite* sprite, s32 x, s32 y)
{
SDL_Rect rect = getSpriteRect(sprite);
tic_rect rect = getSpriteRect(sprite);
s32 r = rect.x + rect.w;
s32 b = rect.y + rect.h;
@@ -414,8 +413,8 @@ static void drawCanvasOvr(Sprite* sprite, s32 x, s32 y)
}
}
SDL_Rect canvasRect = {x, y, CANVAS_SIZE, CANVAS_SIZE};
if(checkMouseDown(&canvasRect, SDL_BUTTON_MIDDLE))
tic_rect canvasRect = {x, y, CANVAS_SIZE, CANVAS_SIZE};
if(checkMouseDown(&canvasRect, tic_mouse_middle))
{
s32 mx = getMouseX() - x;
s32 my = getMouseY() - y;
@@ -425,35 +424,35 @@ static void drawCanvasOvr(Sprite* sprite, s32 x, s32 y)
static void upCanvas(Sprite* sprite)
{
SDL_Rect* rect = &sprite->select.rect;
tic_rect* rect = &sprite->select.rect;
if(rect->y > 0) rect->y--;
pasteSelection(sprite);
}
static void downCanvas(Sprite* sprite)
{
SDL_Rect* rect = &sprite->select.rect;
tic_rect* rect = &sprite->select.rect;
if(rect->y + rect->h < sprite->size) rect->y++;
pasteSelection(sprite);
}
static void leftCanvas(Sprite* sprite)
{
SDL_Rect* rect = &sprite->select.rect;
tic_rect* rect = &sprite->select.rect;
if(rect->x > 0) rect->x--;
pasteSelection(sprite);
}
static void rightCanvas(Sprite* sprite)
{
SDL_Rect* rect = &sprite->select.rect;
tic_rect* rect = &sprite->select.rect;
if(rect->x + rect->w < sprite->size) rect->x++;
pasteSelection(sprite);
}
static void rotateSelectRect(Sprite* sprite)
{
SDL_Rect rect = sprite->select.rect;
tic_rect rect = sprite->select.rect;
s32 selection_center_x = rect.x + rect.w/2;
s32 selection_center_y = rect.y + rect.h/2;
@@ -483,12 +482,12 @@ static void rotateSelectRect(Sprite* sprite)
static void rotateCanvas(Sprite* sprite)
{
u8* buffer = (u8*)SDL_malloc(CANVAS_SIZE*CANVAS_SIZE);
u8* buffer = (u8*)malloc(CANVAS_SIZE*CANVAS_SIZE);
if(buffer)
{
{
SDL_Rect rect = sprite->select.rect;
tic_rect rect = sprite->select.rect;
const s32 Size = rect.h * rect.w;
s32 diff = 0;
@@ -507,13 +506,13 @@ static void rotateCanvas(Sprite* sprite)
history_add(sprite->history);
}
SDL_free(buffer);
free(buffer);
}
}
static void deleteCanvas(Sprite* sprite)
{
SDL_Rect* rect = &sprite->select.rect;
tic_rect* rect = &sprite->select.rect;
s32 left = getIndexPosX(sprite) + rect->x;
s32 top = getIndexPosY(sprite) + rect->y;
@@ -531,7 +530,7 @@ static void deleteCanvas(Sprite* sprite)
static void flipCanvasHorz(Sprite* sprite)
{
SDL_Rect* rect = &sprite->select.rect;
tic_rect* rect = &sprite->select.rect;
s32 sprite_x = getIndexPosX(sprite);
s32 sprite_y = getIndexPosY(sprite);
@@ -553,7 +552,7 @@ static void flipCanvasHorz(Sprite* sprite)
static void flipCanvasVert(Sprite* sprite)
{
SDL_Rect* rect = &sprite->select.rect;
tic_rect* rect = &sprite->select.rect;
s32 sprite_x = getIndexPosX(sprite);
s32 sprite_y = getIndexPosY(sprite);
@@ -619,7 +618,7 @@ static void drawMoveButtons(Sprite* sprite)
0b00000000,
};
static const SDL_Rect Rects[] =
static const tic_rect Rects[] =
{
{x + (CANVAS_SIZE - TIC_SPRITESIZE)/2, y - TIC_SPRITESIZE, TIC_SPRITESIZE, TIC_SPRITESIZE/2},
{x + (CANVAS_SIZE - TIC_SPRITESIZE)/2, y + CANVAS_SIZE + TIC_SPRITESIZE/2, TIC_SPRITESIZE, TIC_SPRITESIZE/2},
@@ -636,11 +635,11 @@ static void drawMoveButtons(Sprite* sprite)
if(checkMousePos(&Rects[i]))
{
setCursor(SDL_SYSTEM_CURSOR_HAND);
setCursor(tic_cursor_hand);
if(checkMouseDown(&Rects[i], SDL_BUTTON_LEFT)) down = true;
if(checkMouseDown(&Rects[i], tic_mouse_left)) down = true;
if(checkMouseClick(&Rects[i], SDL_BUTTON_LEFT))
if(checkMouseClick(&Rects[i], tic_mouse_left))
Func[i](sprite);
}
@@ -668,13 +667,13 @@ static void drawRGBSlider(Sprite* sprite, s32 x, s32 y, u8* value)
0b00000000,
};
SDL_Rect rect = {x, y-2, Size, 5};
tic_rect rect = {x, y-2, Size, 5};
if(checkMousePos(&rect))
{
setCursor(SDL_SYSTEM_CURSOR_HAND);
setCursor(tic_cursor_hand);
if(checkMouseDown(&rect, SDL_BUTTON_LEFT))
if(checkMouseDown(&rect, tic_mouse_left))
{
s32 mx = getMouseX() - x;
*value = mx * Max / (Size-1);
@@ -710,17 +709,17 @@ static void drawRGBSlider(Sprite* sprite, s32 x, s32 y, u8* value)
0b00000000,
};
SDL_Rect rect = {x - 4, y - 1, 2, 3};
tic_rect rect = {x - 4, y - 1, 2, 3};
bool down = false;
if(checkMousePos(&rect))
{
setCursor(SDL_SYSTEM_CURSOR_HAND);
setCursor(tic_cursor_hand);
if(checkMouseDown(&rect, SDL_BUTTON_LEFT))
if(checkMouseDown(&rect, tic_mouse_left))
down = true;
if(checkMouseClick(&rect, SDL_BUTTON_LEFT))
if(checkMouseClick(&rect, tic_mouse_left))
(*value)--;
}
@@ -748,17 +747,17 @@ static void drawRGBSlider(Sprite* sprite, s32 x, s32 y, u8* value)
0b00000000,
};
SDL_Rect rect = {x + Size + 2, y - 1, 2, 3};
tic_rect rect = {x + Size + 2, y - 1, 2, 3};
bool down = false;
if(checkMousePos(&rect))
{
setCursor(SDL_SYSTEM_CURSOR_HAND);
setCursor(tic_cursor_hand);
if(checkMouseDown(&rect, SDL_BUTTON_LEFT))
if(checkMouseDown(&rect, tic_mouse_left))
down = true;
if(checkMouseClick(&rect, SDL_BUTTON_LEFT))
if(checkMouseClick(&rect, tic_mouse_left))
(*value)++;
}
@@ -796,22 +795,22 @@ static void drawRGBTools(Sprite* sprite, s32 x, s32 y)
0b00000000,
};
SDL_Rect rect = {x, y, Size, Size};
tic_rect rect = {x, y, Size, Size};
bool over = false;
bool down = false;
if(checkMousePos(&rect))
{
setCursor(SDL_SYSTEM_CURSOR_HAND);
setCursor(tic_cursor_hand);
showTooltip("COPY PALETTE");
over = true;
if(checkMouseDown(&rect, SDL_BUTTON_LEFT))
if(checkMouseDown(&rect, tic_mouse_left))
down = true;
if(checkMouseClick(&rect, SDL_BUTTON_LEFT))
if(checkMouseClick(&rect, tic_mouse_left))
toClipboard(sprite->tic->cart.palette.data, sizeof(tic_palette), false);
}
@@ -840,21 +839,21 @@ static void drawRGBTools(Sprite* sprite, s32 x, s32 y)
0b00000000,
};
SDL_Rect rect = {x + 8, y, Size, Size};
tic_rect rect = {x + 8, y, Size, Size};
bool over = false;
bool down = false;
if(checkMousePos(&rect))
{
setCursor(SDL_SYSTEM_CURSOR_HAND);
setCursor(tic_cursor_hand);
showTooltip("PASTE PALETTE");
over = true;
if(checkMouseDown(&rect, SDL_BUTTON_LEFT))
if(checkMouseDown(&rect, tic_mouse_left))
down = true;
if(checkMouseClick(&rect, SDL_BUTTON_LEFT))
if(checkMouseClick(&rect, tic_mouse_left))
{
pasteColor(sprite);
}
@@ -898,14 +897,14 @@ static void drawRGBSlidersOvr(Sprite* sprite, s32 x, s32 y)
static void drawPalette(Sprite* sprite, s32 x, s32 y)
{
SDL_Rect rect = {x, y, PALETTE_WIDTH-1, PALETTE_HEIGHT-1};
tic_rect rect = {x, y, PALETTE_WIDTH-1, PALETTE_HEIGHT-1};
if(checkMousePos(&rect))
{
setCursor(SDL_SYSTEM_CURSOR_HAND);
setCursor(tic_cursor_hand);
bool left = checkMouseDown(&rect, SDL_BUTTON_LEFT);
bool right = checkMouseDown(&rect, SDL_BUTTON_RIGHT);
bool left = checkMouseDown(&rect, tic_mouse_left);
bool right = checkMouseDown(&rect, tic_mouse_right);
if(left || right)
{
@@ -946,21 +945,21 @@ static void drawPalette(Sprite* sprite, s32 x, s32 y)
0b11111111,
};
SDL_Rect rect = {x + PALETTE_WIDTH + 3, y + (PALETTE_HEIGHT-8)/2-1, 8, 8};
tic_rect rect = {x + PALETTE_WIDTH + 3, y + (PALETTE_HEIGHT-8)/2-1, 8, 8};
bool down = false;
bool over = false;
if(checkMousePos(&rect))
{
setCursor(SDL_SYSTEM_CURSOR_HAND);
setCursor(tic_cursor_hand);
over = true;
showTooltip("EDIT PALETTE");
if(checkMouseDown(&rect, SDL_BUTTON_LEFT))
if(checkMouseDown(&rect, tic_mouse_left))
down = true;
if(checkMouseClick(&rect, SDL_BUTTON_LEFT))
if(checkMouseClick(&rect, tic_mouse_left))
sprite->editPalette = !sprite->editPalette;
}
@@ -1040,16 +1039,16 @@ static void updateSpriteSize(Sprite* sprite, s32 size)
static void drawSheet(Sprite* sprite, s32 x, s32 y)
{
SDL_Rect rect = {x, y, TIC_SPRITESHEET_SIZE, TIC_SPRITESHEET_SIZE};
tic_rect rect = {x, y, TIC_SPRITESHEET_SIZE, TIC_SPRITESHEET_SIZE};
sprite->tic->api.rect_border(sprite->tic, rect.x - 1, rect.y - 1, rect.w + 2, rect.h + 2, (tic_color_white));
sprite->tic->api.rect(sprite->tic, rect.x, rect.y, rect.w, rect.h, (tic_color_black));
if(checkMousePos(&rect))
{
setCursor(SDL_SYSTEM_CURSOR_HAND);
setCursor(tic_cursor_hand);
if(checkMouseDown(&rect, SDL_BUTTON_LEFT))
if(checkMouseDown(&rect, tic_mouse_left))
{
s32 offset = (sprite->size - TIC_SPRITESIZE) / 2;
selectSprite(sprite, getMouseX() - x - offset, getMouseY() - y - offset);
@@ -1059,7 +1058,7 @@ static void drawSheet(Sprite* sprite, s32 x, s32 y)
static void drawSheetOvr(Sprite* sprite, s32 x, s32 y)
{
SDL_Rect rect = {x, y, TIC_SPRITESHEET_SIZE, TIC_SPRITESHEET_SIZE};
tic_rect rect = {x, y, TIC_SPRITESHEET_SIZE, TIC_SPRITESHEET_SIZE};
for(s32 j = 0, index = (sprite->index - sprite->index % TIC_BANK_SPRITES); j < rect.h; j += TIC_SPRITESIZE)
for(s32 i = 0; i < rect.w; i += TIC_SPRITESIZE, index++)
@@ -1074,7 +1073,7 @@ static void drawSheetOvr(Sprite* sprite, s32 x, s32 y)
static void flipSpriteHorz(Sprite* sprite)
{
SDL_Rect rect = getSpriteRect(sprite);
tic_rect rect = getSpriteRect(sprite);
s32 r = rect.x + rect.w/2;
s32 b = rect.y + rect.h;
@@ -1091,7 +1090,7 @@ static void flipSpriteHorz(Sprite* sprite)
static void flipSpriteVert(Sprite* sprite)
{
SDL_Rect rect = getSpriteRect(sprite);
tic_rect rect = getSpriteRect(sprite);
s32 r = rect.x + rect.w;
s32 b = rect.y + rect.h/2;
@@ -1109,12 +1108,12 @@ static void flipSpriteVert(Sprite* sprite)
static void rotateSprite(Sprite* sprite)
{
const s32 Size = sprite->size;
u8* buffer = (u8*)SDL_malloc(Size * Size);
u8* buffer = (u8*)malloc(Size * Size);
if(buffer)
{
{
SDL_Rect rect = getSpriteRect(sprite);
tic_rect rect = getSpriteRect(sprite);
s32 r = rect.x + rect.w;
s32 b = rect.y + rect.h;
@@ -1129,13 +1128,13 @@ static void rotateSprite(Sprite* sprite)
history_add(sprite->history);
}
SDL_free(buffer);
free(buffer);
}
}
static void deleteSprite(Sprite* sprite)
{
SDL_Rect rect = getSpriteRect(sprite);
tic_rect rect = getSpriteRect(sprite);
s32 r = rect.x + rect.w;
s32 b = rect.y + rect.h;
@@ -1200,19 +1199,19 @@ static void drawSpriteTools(Sprite* sprite, s32 x, s32 y)
bool pushed = false;
bool over = false;
SDL_Rect rect = {x + i * Gap, y, TIC_SPRITESIZE, TIC_SPRITESIZE};
tic_rect rect = {x + i * Gap, y, TIC_SPRITESIZE, TIC_SPRITESIZE};
if(checkMousePos(&rect))
{
setCursor(SDL_SYSTEM_CURSOR_HAND);
setCursor(tic_cursor_hand);
over = true;
showTooltip(Tooltips[i]);
if(checkMouseDown(&rect, SDL_BUTTON_LEFT)) pushed = true;
if(checkMouseDown(&rect, tic_mouse_left)) pushed = true;
if(checkMouseClick(&rect, SDL_BUTTON_LEFT))
if(checkMouseClick(&rect, tic_mouse_left))
{
if(hasCanvasSelection(sprite))
{
@@ -1283,19 +1282,19 @@ static void drawTools(Sprite* sprite, s32 x, s32 y)
for(s32 i = 0; i < COUNT_OF(Icons)/BITS_IN_BYTE; i++)
{
SDL_Rect rect = {x + i * Gap, y, TIC_SPRITESIZE, TIC_SPRITESIZE};
tic_rect rect = {x + i * Gap, y, TIC_SPRITESIZE, TIC_SPRITESIZE};
bool over = false;
if(checkMousePos(&rect))
{
setCursor(SDL_SYSTEM_CURSOR_HAND);
setCursor(tic_cursor_hand);
over = true;
static const char* Tooltips[] = {"BRUSH [1]", "COLOR PICKER [2]", "SELECT [3]", "FILL [4]"};
showTooltip(Tooltips[i]);
if(checkMouseClick(&rect, SDL_BUTTON_LEFT))
if(checkMouseClick(&rect, tic_mouse_left))
{
sprite->mode = i;
@@ -1337,11 +1336,11 @@ static void drawTools(Sprite* sprite, s32 x, s32 y)
static void copyToClipboard(Sprite* sprite)
{
s32 size = sprite->size * sprite->size * TIC_PALETTE_BPP / BITS_IN_BYTE;
u8* buffer = SDL_malloc(size);
u8* buffer = malloc(size);
if(buffer)
{
SDL_Rect rect = getSpriteRect(sprite);
tic_rect rect = getSpriteRect(sprite);
s32 r = rect.x + rect.w;
s32 b = rect.y + rect.h;
@@ -1351,7 +1350,7 @@ static void copyToClipboard(Sprite* sprite)
toClipboard(buffer, size, true);
SDL_free(buffer);
free(buffer);
}
}
@@ -1367,13 +1366,13 @@ static void copyFromClipboard(Sprite* sprite)
pasteColor(sprite);
s32 size = sprite->size * sprite->size * TIC_PALETTE_BPP / BITS_IN_BYTE;
u8* buffer = SDL_malloc(size);
u8* buffer = malloc(size);
if(buffer)
{
if(fromClipboard(buffer, size, true, false))
{
SDL_Rect rect = getSpriteRect(sprite);
tic_rect rect = getSpriteRect(sprite);
s32 r = rect.x + rect.w;
s32 b = rect.y + rect.h;
@@ -1384,7 +1383,7 @@ static void copyFromClipboard(Sprite* sprite)
history_add(sprite->history);
}
SDL_free(buffer);
free(buffer);
}
}
@@ -1428,9 +1427,13 @@ static void switchBanks(Sprite* sprite)
clearCanvasSelection(sprite);
}
static void processKeydown(Sprite* sprite, SDL_Keycode keycode)
static void processKeyboard(Sprite* sprite)
{
switch(getClipboardEvent(keycode))
tic_mem* tic = sprite->tic;
if(tic->ram.input.keyboard.data == 0) return;
switch(getClipboardEvent())
{
case TIC_CLIPBOARD_CUT: cutToClipboard(sprite); break;
case TIC_CLIPBOARD_COPY: copyToClipboard(sprite); break;
@@ -1438,66 +1441,49 @@ static void processKeydown(Sprite* sprite, SDL_Keycode keycode)
default: break;
}
SDL_Keymod keymod = SDL_GetModState();
bool ctrl = tic->api.key(tic, tic_key_ctrl);
if(keymod & TIC_MOD_CTRL)
{
switch(keycode)
{
case SDLK_z: undo(sprite); break;
case SDLK_y: redo(sprite); break;
}
if(ctrl)
{
if(keyWasPressed(tic_key_z)) undo(sprite);
else if(keyWasPressed(tic_key_y)) redo(sprite);
}
else
{
if(hasCanvasSelection(sprite))
{
switch(keycode)
{
case SDLK_UP: upCanvas(sprite); break;
case SDLK_DOWN: downCanvas(sprite); break;
case SDLK_LEFT: leftCanvas(sprite); break;
case SDLK_RIGHT: rightCanvas(sprite); break;
case SDLK_DELETE: deleteCanvas(sprite); break;
}
if(keyWasPressed(tic_key_up)) upCanvas(sprite);
else if(keyWasPressed(tic_key_down)) downCanvas(sprite);
else if(keyWasPressed(tic_key_left)) leftCanvas(sprite);
else if(keyWasPressed(tic_key_right)) rightCanvas(sprite);
else if(keyWasPressed(tic_key_delete)) deleteCanvas(sprite);
}
else
{
switch(keycode)
{
case SDLK_DELETE: deleteSprite(sprite); break;
case SDLK_UP: upSprite(sprite); break;
case SDLK_DOWN: downSprite(sprite); break;
case SDLK_LEFT: leftSprite(sprite); break;
case SDLK_RIGHT: rightSprite(sprite); break;
case SDLK_TAB: switchBanks(sprite); break;
}
if(keyWasPressed(tic_key_up)) upSprite(sprite);
else if(keyWasPressed(tic_key_down)) downSprite(sprite);
else if(keyWasPressed(tic_key_left)) leftSprite(sprite);
else if(keyWasPressed(tic_key_right)) rightSprite(sprite);
else if(keyWasPressed(tic_key_delete)) deleteSprite(sprite);
else if(keyWasPressed(tic_key_tab)) switchBanks(sprite);
if(!sprite->editPalette)
{
switch(keycode)
{
case SDLK_1:
case SDLK_2:
case SDLK_3:
case SDLK_4:
sprite->mode = keycode - SDLK_1;
break;
case SDLK_5:
case SDLK_6:
case SDLK_7:
case SDLK_8:
SpriteToolsFunc[keycode - SDLK_5](sprite);
break;
}
if(keyWasPressed(tic_key_1)) sprite->mode = SPRITE_DRAW_MODE;
else if(keyWasPressed(tic_key_2)) sprite->mode = SPRITE_PICK_MODE;
else if(keyWasPressed(tic_key_3)) sprite->mode = SPRITE_SELECT_MODE;
else if(keyWasPressed(tic_key_4)) sprite->mode = SPRITE_FILL_MODE;
else if(keyWasPressed(tic_key_5)) flipSpriteHorz(sprite);
else if(keyWasPressed(tic_key_6)) flipSpriteVert(sprite);
else if(keyWasPressed(tic_key_7)) rotateSprite(sprite);
else if(keyWasPressed(tic_key_8)) deleteSprite(sprite);
if(sprite->mode == SPRITE_DRAW_MODE)
{
switch(keycode)
{
case SDLK_LEFTBRACKET: if(sprite->brushSize > 1) sprite->brushSize--; break;
case SDLK_RIGHTBRACKET: if(sprite->brushSize < 4) sprite->brushSize++; break;
}
if(keyWasPressed(tic_key_leftbracket)) {if(sprite->brushSize > 1) sprite->brushSize--;}
else if(keyWasPressed(tic_key_rightbracket)) {if(sprite->brushSize < 4) sprite->brushSize++;}
}
}
}
@@ -1510,15 +1496,15 @@ static void drawSpriteToolbar(Sprite* sprite)
// draw sprite size control
{
SDL_Rect rect = {TIC80_WIDTH - 58, 1, 23, 5};
tic_rect rect = {TIC80_WIDTH - 58, 1, 23, 5};
if(checkMousePos(&rect))
{
setCursor(SDL_SYSTEM_CURSOR_HAND);
setCursor(tic_cursor_hand);
showTooltip("CANVAS ZOOM");
if(checkMouseDown(&rect, SDL_BUTTON_LEFT))
if(checkMouseDown(&rect, tic_mouse_left))
{
s32 mx = getMouseX() - rect.x;
mx /= 6;
@@ -1547,17 +1533,17 @@ static void drawSpriteToolbar(Sprite* sprite)
{
static const char Label[] = "BG";
SDL_Rect rect = {TIC80_WIDTH - 2 * TIC_FONT_WIDTH - 2, 0, 2 * TIC_FONT_WIDTH + 1, TIC_SPRITESIZE-1};
tic_rect rect = {TIC80_WIDTH - 2 * TIC_FONT_WIDTH - 2, 0, 2 * TIC_FONT_WIDTH + 1, TIC_SPRITESIZE-1};
sprite->tic->api.rect(sprite->tic, rect.x, rect.y, rect.w, rect.h, bg ? (tic_color_black) : (tic_color_gray));
sprite->tic->api.fixed_text(sprite->tic, Label, rect.x+1, rect.y+1, (tic_color_white));
if(checkMousePos(&rect))
{
setCursor(SDL_SYSTEM_CURSOR_HAND);
setCursor(tic_cursor_hand);
showTooltip("TILES [tab]");
if(!bg && checkMouseClick(&rect, SDL_BUTTON_LEFT))
if(!bg && checkMouseClick(&rect, tic_mouse_left))
{
sprite->index -= TIC_BANK_SPRITES;
clearCanvasSelection(sprite);
@@ -1567,17 +1553,17 @@ static void drawSpriteToolbar(Sprite* sprite)
{
static const char Label[] = "FG";
SDL_Rect rect = {TIC80_WIDTH - 4 * TIC_FONT_WIDTH - 4, 0, 2 * TIC_FONT_WIDTH + 1, TIC_SPRITESIZE-1};
tic_rect rect = {TIC80_WIDTH - 4 * TIC_FONT_WIDTH - 4, 0, 2 * TIC_FONT_WIDTH + 1, TIC_SPRITESIZE-1};
sprite->tic->api.rect(sprite->tic, rect.x, rect.y, rect.w, rect.h, bg ? (tic_color_gray) : (tic_color_black));
sprite->tic->api.fixed_text(sprite->tic, Label, rect.x+1, rect.y+1, (tic_color_white));
if(checkMousePos(&rect))
{
setCursor(SDL_SYSTEM_CURSOR_HAND);
setCursor(tic_cursor_hand);
showTooltip("SPRITES [tab]");
if(bg && checkMouseClick(&rect, SDL_BUTTON_LEFT))
if(bg && checkMouseClick(&rect, tic_mouse_left))
{
sprite->index += TIC_BANK_SPRITES;
clearCanvasSelection(sprite);
@@ -1588,32 +1574,27 @@ static void drawSpriteToolbar(Sprite* sprite)
static void tick(Sprite* sprite)
{
SDL_Event* event = NULL;
while ((event = pollEvent()))
// process scroll
{
switch(event->type)
tic80_input* input = &sprite->tic->ram.input;
if(input->mouse.scrolly)
{
case SDL_KEYDOWN:
processKeydown(sprite, event->key.keysym.sym);
break;
case SDL_MOUSEWHEEL:
s32 size = sprite->size;
s32 delta = input->mouse.scrolly;
if(delta > 0)
{
s32 size = sprite->size;
s32 delta = event->wheel.y;
if(delta > 0)
{
if(size < (TIC_SPRITESIZE * TIC_SPRITESIZE)) size <<= 1;
}
else if(size > TIC_SPRITESIZE) size >>= 1;
updateSpriteSize(sprite, size);
if(size < (TIC_SPRITESIZE * TIC_SPRITESIZE)) size <<= 1;
}
break;
else if(size > TIC_SPRITESIZE) size >>= 1;
updateSpriteSize(sprite, size);
}
}
processKeyboard(sprite);
sprite->tic->api.clear(sprite->tic, (tic_color_gray));
drawCanvas(sprite, 24, 20);
@@ -1658,8 +1639,8 @@ static void overlap(tic_mem* tic, void* data)
void initSprite(Sprite* sprite, tic_mem* tic, tic_tiles* src)
{
if(sprite->select.back == NULL) sprite->select.back = (u8*)SDL_malloc(CANVAS_SIZE*CANVAS_SIZE);
if(sprite->select.front == NULL) sprite->select.front = (u8*)SDL_malloc(CANVAS_SIZE*CANVAS_SIZE);
if(sprite->select.back == NULL) sprite->select.back = (u8*)malloc(CANVAS_SIZE*CANVAS_SIZE);
if(sprite->select.front == NULL) sprite->select.front = (u8*)malloc(CANVAS_SIZE*CANVAS_SIZE);
if(sprite->history) history_delete(sprite->history);
*sprite = (Sprite)
+2 -2
View File
@@ -44,8 +44,8 @@ struct Sprite
struct
{
SDL_Rect rect;
SDL_Point start;
tic_rect rect;
tic_point start;
bool drag;
u8* back;
u8* front;
-2
View File
@@ -78,8 +78,6 @@ static void tick(Start* start)
start->initialized = true;
}
while (pollEvent());
start->tic->api.clear(start->tic, TIC_COLOR_BG);
static void(*const steps[])(Start*) = {reset, header, end};
+543 -1587
View File
File diff suppressed because it is too large. Load diff
+27 -64
View File
@@ -27,22 +27,16 @@
#include <stdio.h>
#include <stdlib.h>
#include <SDL.h>
#if defined(__EMSCRIPTEN__)
#include <emscripten.h>
#endif
#include "tic.h"
#include "ticapi.h"
#include "defines.h"
#include "tools.h"
#include "ext/file_dialog.h"
#include "system.h"
#define TIC_LOCAL ".local/"
#define TIC_CACHE TIC_LOCAL "cache/"
#define TIC_MOD_CTRL (KMOD_GUI|KMOD_CTRL)
#define TOOLBAR_SIZE 7
#define STUDIO_TEXT_WIDTH (TIC_FONT_WIDTH)
#define STUDIO_TEXT_HEIGHT (TIC_FONT_HEIGHT+1)
@@ -55,8 +49,8 @@
#define CONFIG_TIC "config " TIC_VERSION_LABEL ".tic"
#define CONFIG_TIC_PATH TIC_LOCAL CONFIG_TIC
#define KEYMAP_COUNT (sizeof(tic80_input) * BITS_IN_BYTE)
#define KEYMAP_SIZE (KEYMAP_COUNT * sizeof(SDL_Scancode))
#define KEYMAP_COUNT (sizeof(tic80_gamepads) * BITS_IN_BYTE)
#define KEYMAP_SIZE (KEYMAP_COUNT)
#define KEYMAP_DAT "keymap.dat"
#define KEYMAP_DAT_PATH TIC_LOCAL KEYMAP_DAT
@@ -66,47 +60,6 @@
#define PROJECT_JS_EXT ".js"
#define PROJECT_WREN_EXT ".wren"
typedef struct
{
struct
{
struct
{
s32 sprite;
bool pixelPerfect;
} cursor;
struct
{
tic_code_theme syntax;
u8 bg;
u8 select;
u8 cursor;
bool shadow;
} code;
struct
{
struct
{
u8 alpha;
} touch;
} gamepad;
} theme;
s32 gifScale;
s32 gifLength;
bool checkNewVersion;
bool noSound;
bool useVsync;
bool showSync;
} StudioConfig;
typedef enum
{
TIC_START_MODE,
@@ -123,18 +76,23 @@ typedef enum
TIC_SURF_MODE,
} EditorMode;
SDL_Event* pollEvent();
void setCursor(SDL_SystemCursor id);
typedef struct
{
s32 x, y;
} tic_point;
typedef struct
{
s32 x, y, w, h;
} tic_rect;
void setCursor(tic_cursor id);
s32 getMouseX();
s32 getMouseY();
bool checkMousePos(const SDL_Rect* rect);
bool checkMouseClick(const SDL_Rect* rect, s32 button);
bool checkMouseDown(const SDL_Rect* rect, s32 button);
bool getGesturePos(SDL_Point* pos);
const u8* getKeyboard();
bool checkMousePos(const tic_rect* rect);
bool checkMouseClick(const tic_rect* rect, tic_mouse_btn button);
bool checkMouseDown(const tic_rect* rect, tic_mouse_btn button);
void drawToolbar(tic_mem* tic, u8 color, bool bg);
void drawBitIcon(s32 x, s32 y, const u8* ptr, u8 color);
@@ -161,7 +119,7 @@ typedef enum
TIC_CLIPBOARD_PASTE,
} ClipboardEvent;
ClipboardEvent getClipboardEvent(SDL_Keycode keycode);
ClipboardEvent getClipboardEvent();
typedef enum
{
@@ -175,9 +133,7 @@ typedef enum
void setStudioEvent(StudioEvent event);
void showTooltip(const char* text);
SDL_Scancode* getKeymap();
const StudioConfig* getConfig();
tic_key* getKeymap();
void setSpritePixel(tic_tile* tiles, s32 x, s32 y, u8 color);
u8 getSpritePixel(tic_tile* tiles, s32 x, s32 y);
@@ -199,3 +155,10 @@ void runProject();
tic_tiles* getBankTiles();
tic_map* getBankMap();
char getKeyboardText();
bool keyWasPressed(tic_key key);
bool anyKeyWasPressed();
const StudioConfig* getConfig();
System* getSystem();
+21 -27
View File
@@ -22,7 +22,6 @@
#include "surf.h"
#include "fs.h"
#include "net.h"
#include "console.h"
#include "ext/gif.h"
@@ -38,7 +37,7 @@
#define COVER_Y 5
#define COVER_X (TIC80_WIDTH - COVER_WIDTH - COVER_Y)
#if defined(__WINDOWS__) || defined(__LINUX__) || defined(__MACOSX__)
#if defined(__TIC_WINDOWS__) || defined(__TIC_LINUX__) || defined(__TIC_MACOSX__)
#define CAN_OPEN_URL 1
#endif
@@ -401,18 +400,18 @@ static bool addMenuItem(const char* name, const char* info, s32 id, void* ptr, b
{
MenuItem* item = &data->items[data->count++];
item->name = SDL_strdup(name);
item->name = strdup(name);
bool project = false;
if(dir)
{
char folder[FILENAME_MAX];
sprintf(folder, "[%s]", name);
item->label = SDL_strdup(folder);
item->label = strdup(folder);
}
else
{
item->label = SDL_strdup(name);
item->label = strdup(name);
if(hasExt(name, CartExt))
cutExt(item->label, CartExt);
@@ -426,7 +425,7 @@ static bool addMenuItem(const char* name, const char* info, s32 id, void* ptr, b
replace(item->label, "&#39;", "'");
}
item->hash = info ? SDL_strdup(info) : NULL;
item->hash = info ? strdup(info) : NULL;
item->id = id;
item->dir = dir;
item->cover = NULL;
@@ -442,19 +441,19 @@ static void resetMenu(Surf* surf)
{
for(s32 i = 0; i < surf->menu.count; i++)
{
SDL_free((void*)surf->menu.items[i].name);
free((void*)surf->menu.items[i].name);
const char* hash = surf->menu.items[i].hash;
if(hash) SDL_free((void*)hash);
if(hash) free((void*)hash);
tic_screen* cover = surf->menu.items[i].cover;
if(cover) SDL_free(cover);
if(cover) free(cover);
const char* label = surf->menu.items[i].label;
if(label) SDL_free((void*)label);
if(label) free((void*)label);
}
SDL_free(surf->menu.items);
free(surf->menu.items);
surf->menu.items = NULL;
surf->menu.count = 0;
@@ -478,7 +477,7 @@ static void* requestCover(Surf* surf, const char* hash, s32* size)
char path[FILENAME_MAX] = {0};
sprintf(path, "/cart/%s/cover.gif", hash);
void* data = netGetRequest(surf->net, path, size);
void* data = getSystem()->getUrlRequest(path, size);
if(data)
{
@@ -494,8 +493,7 @@ static void updateMenuItemCover(Surf* surf, const u8* cover, s32 size)
MenuItem* item = &surf->menu.items[surf->menu.pos];
item->cover = SDL_malloc(sizeof(tic_screen));
item->cover = malloc(sizeof(tic_screen));
gif_image* image = gif_read_data(cover, size);
@@ -532,7 +530,7 @@ static void loadCover(Surf* surf)
if(data)
{
tic_cartridge* cart = (tic_cartridge*)SDL_malloc(sizeof(tic_cartridge));
tic_cartridge* cart = (tic_cartridge*)malloc(sizeof(tic_cartridge));
if(cart)
{
@@ -544,10 +542,10 @@ static void loadCover(Surf* surf)
if(cart->cover.size)
updateMenuItemCover(surf, cart->cover.data, cart->cover.size);
SDL_free(cart);
free(cart);
}
SDL_free(data);
free(data);
}
}
else if(item->hash && !item->cover)
@@ -559,7 +557,7 @@ static void loadCover(Surf* surf)
if(cover)
{
updateMenuItemCover(surf, cover, size);
SDL_free(cover);
free(cover);
}
}
}
@@ -573,7 +571,7 @@ static void initMenu(Surf* surf)
AddMenuItem data =
{
.items = SDL_malloc(Size),
.items = malloc(Size),
.count = 0,
.surf = surf,
};
@@ -649,7 +647,7 @@ static void onPlayCart(Surf* surf)
if(item->project)
{
tic_cartridge* cart = SDL_malloc(sizeof(tic_cartridge));
tic_cartridge* cart = malloc(sizeof(tic_cartridge));
if(cart)
{
@@ -658,11 +656,11 @@ static void onPlayCart(Surf* surf)
surf->console->loadProject(surf->console, item->name, data, size, cart);
SDL_memcpy(&surf->tic->cart, cart, sizeof(tic_cartridge));
memcpy(&surf->tic->cart, cart, sizeof(tic_cartridge));
studioRomLoaded();
SDL_free(cart);
free(cart);
}
}
else
@@ -782,7 +780,7 @@ static void processGamepad(Surf* surf)
{
char url[FILENAME_MAX];
sprintf(url, "https://" TIC_HOST "/play?cart=%i", item->id);
fsOpenSystemPath(surf->fs, url);
getSystem()->openSystemPath(url);
}
}
#endif
@@ -804,9 +802,6 @@ static void tick(Surf* surf)
surf->ticks++;
while (pollEvent());
tic_mem* tic = surf->tic;
tic->api.clear(tic, TIC_COLOR_BG);
@@ -865,7 +860,6 @@ void initSurf(Surf* surf, tic_mem* tic, struct Console* console)
.items = NULL,
.count = 0,
},
.net = createNet(),
};
fsMakeDir(surf->fs, TIC_CACHE);
-1
View File
@@ -31,7 +31,6 @@ struct Surf
tic_mem* tic;
struct FileSystem* fs;
struct Console* console;
struct Net* net;
struct Movie* state;
bool init;
+1157
View File
File diff suppressed because it is too large. Load diff
+87
View File
@@ -0,0 +1,87 @@
#pragma once
#include "ticapi.h"
#include "ext/file_dialog.h"
typedef struct
{
void (*setClipboardText)(const char* text);
bool (*hasClipboardText)();
char* (*getClipboardText)();
u64 (*getPerformanceCounter)();
u64 (*getPerformanceFrequency)();
void* (*getUrlRequest)(const char* url, s32* size);
void (*fileDialogLoad)(file_dialog_load_callback callback, void* data);
void (*fileDialogSave)(file_dialog_save_callback callback, const char* name, const u8* buffer, size_t size, void* data, u32 mode);
void (*goFullscreen)();
void (*showMessageBox)(const char* title, const char* message);
void (*setWindowTitle)(const char* title);
void (*openSystemPath)(const char* path);
void (*preseed)();
void (*poll)();
} System;
typedef struct
{
struct
{
struct
{
s32 arrow;
s32 hand;
s32 ibeam;
bool pixelPerfect;
} cursor;
struct
{
tic_code_theme syntax;
u8 bg;
u8 select;
u8 cursor;
bool shadow;
} code;
struct
{
struct
{
u8 alpha;
} touch;
} gamepad;
} theme;
s32 gifScale;
s32 gifLength;
bool checkNewVersion;
bool noSound;
bool useVsync;
bool showSync;
} StudioConfig;
typedef struct
{
tic_mem* tic;
bool quit;
void (*tick)(void* pixels);
void (*exit)();
void (*close)();
void (*updateProject)();
const StudioConfig* (*config)();
} Studio;
TIC80_API Studio* studioInit(s32 argc, char **argv, s32 samplerate, const char* appFolder, System* system);
+3 -4
View File
@@ -1264,7 +1264,7 @@ static bool isNoiseWaveform(const tic_waveform* wave)
static bool isKeyPressed(const tic80_keyboard* input, tic_key key)
{
for(s32 i = 0; i < TIC_KEY_BUFFER; i++)
for(s32 i = 0; i < TIC80_KEY_BUFFER; i++)
if(input->keys[i] == key)
return true;
@@ -1696,7 +1696,7 @@ static bool api_keyp(tic_mem* tic, tic_key key, s32 hold, s32 period)
return !prevDown && down;
}
for(s32 i = 0; i < TIC_KEY_BUFFER; i++)
for(s32 i = 0; i < TIC80_KEY_BUFFER; i++)
{
tic_key key = tic->ram.input.keyboard.keys[i];
@@ -1704,7 +1704,7 @@ static bool api_keyp(tic_mem* tic, tic_key key, s32 hold, s32 period)
{
bool wasPressed = false;
for(s32 p = 0; p < TIC_KEY_BUFFER; p++)
for(s32 p = 0; p < TIC80_KEY_BUFFER; p++)
{
if(machine->state.keyboard.previous.keys[p] == key)
{
@@ -1721,7 +1721,6 @@ static bool api_keyp(tic_mem* tic, tic_key key, s32 hold, s32 period)
return false;
}
static void api_load(tic_cartridge* cart, const u8* buffer, s32 size, bool palette)
{
const u8* end = buffer + size;
+22 -3
View File
@@ -385,7 +385,12 @@ typedef union
s8 y;
} offset;
u8 cursor;
struct
{
u8 sprite:7;
bool system:1;
} cursor;
} vars;
u8 reserved[4];
@@ -418,7 +423,7 @@ typedef union
u8 data[TIC_RAM_SIZE];
} tic_ram;
enum
typedef enum
{
tic_key_unknown,
@@ -511,4 +516,18 @@ enum
////////////////
tic_keys_count
};
} tic_keycode;
typedef enum
{
tic_mouse_left,
tic_mouse_middle,
tic_mouse_right,
} tic_mouse_btn;
typedef enum
{
tic_cursor_arrow,
tic_cursor_hand,
tic_cursor_ibeam,
} tic_cursor;
+1
View File
@@ -104,6 +104,7 @@ TIC80_API void tic80_load(tic80* tic, void* cart, s32 size)
tic80->tickData.start = 0;
tic80->tickData.freq = getFreq;
tic80->tickData.counter = getCounter;
tic80->tickData.syncPMEM = false;
TickCounter = 0;
}
+2
View File
@@ -58,6 +58,8 @@ typedef struct
u64 (*freq)();
u64 start;
bool syncPMEM;
void (*preprocessor)(void* data, char* dst);
void* data;
+1 -1
View File
@@ -51,4 +51,4 @@ bool tic_tool_parse_note(const char* noteStr, s32* note, s32* octave);
s32 tic_tool_get_pattern_id(const tic_track* track, s32 frame, s32 channel);
void tic_tool_set_pattern_id(tic_track* track, s32 frame, s32 channel, s32 id);
u32 tic_tool_find_closest_color(const tic_rgb* palette, const tic_rgb* color);
u32* tic_palette_blit(const tic_palette* src);
u32* tic_palette_blit(const tic_palette* src);
+10 -28
View File
@@ -38,22 +38,22 @@ static void drawGrid(World* world)
world->tic->api.rect_border(world->tic, 0, 0, TIC80_WIDTH, TIC80_HEIGHT, color);
SDL_Rect rect = {0, 0, TIC80_WIDTH, TIC80_HEIGHT};
tic_rect rect = {0, 0, TIC80_WIDTH, TIC80_HEIGHT};
if(checkMousePos(&rect))
{
setCursor(SDL_SYSTEM_CURSOR_HAND);
setCursor(tic_cursor_hand);
s32 mx = getMouseX();
s32 my = getMouseY();
if(checkMouseDown(&rect, SDL_BUTTON_LEFT))
if(checkMouseDown(&rect, tic_mouse_left))
{
map->scroll.x = (mx - TIC_MAP_SCREEN_WIDTH/2) * TIC_SPRITESIZE;
map->scroll.y = (my - TIC_MAP_SCREEN_HEIGHT/2) * TIC_SPRITESIZE;
}
if(checkMouseClick(&rect, SDL_BUTTON_LEFT))
if(checkMouseClick(&rect, tic_mouse_left))
setStudioMode(TIC_MAP_MODE);
}
@@ -61,28 +61,11 @@ static void drawGrid(World* world)
TIC_MAP_SCREEN_WIDTH+1, TIC_MAP_SCREEN_HEIGHT+1, (tic_color_red));
}
static void processKeydown(World* world, SDL_Keycode keycode)
{
switch(keycode)
{
case SDLK_TAB: setStudioMode(TIC_MAP_MODE); break;
}
}
static void tick(World* world)
{
SDL_Event* event = NULL;
while ((event = pollEvent()))
{
switch(event->type)
{
case SDL_KEYDOWN:
processKeydown(world, event->key.keysym.sym);
break;
}
}
if(keyWasPressed(tic_key_tab)) setStudioMode(TIC_MAP_MODE);
SDL_memcpy(&world->tic->ram.vram, world->preview, PREVIEW_SIZE);
memcpy(&world->tic->ram.vram, world->preview, PREVIEW_SIZE);
drawGrid(world);
}
@@ -90,7 +73,7 @@ static void tick(World* world)
void initWorld(World* world, tic_mem* tic, Map* map)
{
if(!world->preview)
world->preview = SDL_malloc(PREVIEW_SIZE);
world->preview = malloc(PREVIEW_SIZE);
*world = (World)
{
@@ -100,7 +83,7 @@ void initWorld(World* world, tic_mem* tic, Map* map)
.preview = world->preview,
};
SDL_memset(world->preview, 0, PREVIEW_SIZE);
memset(world->preview, 0, PREVIEW_SIZE);
s32 colors[TIC_PALETTE_SIZE];
for(s32 i = 0; i < TIC80_WIDTH * TIC80_HEIGHT; i++)
@@ -109,7 +92,7 @@ void initWorld(World* world, tic_mem* tic, Map* map)
if(index)
{
SDL_memset(colors, 0, sizeof colors);
memset(colors, 0, sizeof colors);
tic_tile* tile = &getBankTiles()->data[index];
@@ -123,11 +106,10 @@ void initWorld(World* world, tic_mem* tic, Map* map)
s32 max = 0;
for(s32 c = 0; c < SDL_arraysize(colors); c++)
for(s32 c = 0; c < COUNT_OF(colors); c++)
if(colors[c] > colors[max]) max = c;
tic_tool_poke4(world->preview, i, max);
}
}
}
+1
View File
@@ -905,6 +905,7 @@ static void wren_pmem(WrenVM* vm)
if(top > 2)
{
memory->persistent.data[index] = getWrenNumber(vm, 2);
machine->data->syncPMEM = true;
}
wrenSetSlotDouble(vm, 0, val);