Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.vs
x64/
screenshot.png
*.vcxproj.user
10 changes: 10 additions & 0 deletions Examples.sln
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Mandelbrot", "Examples\Mand
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Minesweeper", "Examples\Minesweeper\Minesweeper.vcxproj", "{7A5D47D3-25F8-4569-A2DC-910A6C132A93}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ControllerTest", "Examples\ControllerTest\ControllerTest.vcxproj", "{D11903AB-AD22-48A0-BAE2-75ADE9C8C024}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Expand Down Expand Up @@ -41,6 +43,14 @@ Global
{7A5D47D3-25F8-4569-A2DC-910A6C132A93}.Release|x64.Build.0 = Release|x64
{7A5D47D3-25F8-4569-A2DC-910A6C132A93}.Release|x86.ActiveCfg = Release|Win32
{7A5D47D3-25F8-4569-A2DC-910A6C132A93}.Release|x86.Build.0 = Release|Win32
{D11903AB-AD22-48A0-BAE2-75ADE9C8C024}.Debug|x64.ActiveCfg = Debug|x64
{D11903AB-AD22-48A0-BAE2-75ADE9C8C024}.Debug|x64.Build.0 = Debug|x64
{D11903AB-AD22-48A0-BAE2-75ADE9C8C024}.Debug|x86.ActiveCfg = Debug|Win32
{D11903AB-AD22-48A0-BAE2-75ADE9C8C024}.Debug|x86.Build.0 = Debug|Win32
{D11903AB-AD22-48A0-BAE2-75ADE9C8C024}.Release|x64.ActiveCfg = Release|x64
{D11903AB-AD22-48A0-BAE2-75ADE9C8C024}.Release|x64.Build.0 = Release|x64
{D11903AB-AD22-48A0-BAE2-75ADE9C8C024}.Release|x86.ActiveCfg = Release|Win32
{D11903AB-AD22-48A0-BAE2-75ADE9C8C024}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
139 changes: 139 additions & 0 deletions Examples/ControllerTest/ControllerTest.vcxproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>17.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{d11903ab-ad22-48a0-bae2-75ade9c8c024}</ProjectGuid>
<RootNamespace>ControllerTest</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EntryPointSymbol>
</EntryPointSymbol>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EntryPointSymbol>
</EntryPointSymbol>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EntryPointSymbol>
</EntryPointSymbol>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EntryPointSymbol>
</EntryPointSymbol>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="main.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
6 changes: 6 additions & 0 deletions Examples/ControllerTest/ControllerTest.vcxproj.filters
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<ClCompile Include="main.cpp" />
</ItemGroup>
</Project>
99 changes: 99 additions & 0 deletions Examples/ControllerTest/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
#define THIRTEEN_IMPLEMENTATION
#include "../../thirteen.h"

#include <math.h>
#include <stdio.h>

static const unsigned int c_width = 64;
static const unsigned int c_height = 64;
static const bool c_fullscreen = false;

static const float c_thumbStickEpsilon = 0.01f;

int main(int argc, char** argv)
{
Thirteen::SetApplicationName("Thirteen Demo - ControllerTest");

unsigned char* pixels = Thirteen::Init(c_width, c_height, c_fullscreen);
if (!pixels)
{
printf("Could not initialize Thirteen\n");
return 1;
}

printf("Interact with the controller to see controller values\n\n");

do
{
struct ButtonInfo
{
Thirteen::ControllerButton button;
const char* name;
};

static const ButtonInfo buttons[] =
{
{ Thirteen::ControllerButton::DPadUp, "DPadUp" },
{ Thirteen::ControllerButton::DPadDown, "DPadDown" },
{ Thirteen::ControllerButton::DPadLeft, "DPadLeft" },
{ Thirteen::ControllerButton::DPadRight, "DPadRight" },
{ Thirteen::ControllerButton::Start, "Start" },
{ Thirteen::ControllerButton::Back, "Back" },
{ Thirteen::ControllerButton::LeftThumb, "LeftThumb" },
{ Thirteen::ControllerButton::RightThumb, "RightThumb" },
{ Thirteen::ControllerButton::LeftShoulder, "LeftShoulder" },
{ Thirteen::ControllerButton::RightShoulder, "RightShoulder" },
{ Thirteen::ControllerButton::A, "A" },
{ Thirteen::ControllerButton::B, "B" },
{ Thirteen::ControllerButton::X, "X" },
{ Thirteen::ControllerButton::Y, "Y" }
};

for (const ButtonInfo& buttonInfo : buttons)
{
const bool currentState = Thirteen::GetControllerButton(0, buttonInfo.button);
const bool previousState = Thirteen::GetControllerButtonLastFrame(0, buttonInfo.button);

if (currentState != previousState)
{
if (currentState)
printf("%s pressed\n", buttonInfo.name);
else
printf("%s released\n", buttonInfo.name);
}
}

const float leftTrigger = Thirteen::GetControllerTrigger(0, true);
const float leftTriggerLastFrame = Thirteen::GetControllerTriggerLastFrame(0, true);
if (fabsf(leftTrigger - leftTriggerLastFrame) > c_thumbStickEpsilon)
printf("LeftTrigger: %.3f\n", leftTrigger);

const float rightTrigger = Thirteen::GetControllerTrigger(0, false);
const float rightTriggerLastFrame = Thirteen::GetControllerTriggerLastFrame(0, false);
if (fabsf(rightTrigger - rightTriggerLastFrame) > c_thumbStickEpsilon)
printf("RightTrigger: %.3f\n", rightTrigger);

float leftThumbX = 0.0f;
float leftThumbY = 0.0f;
float leftThumbXLastFrame = 0.0f;
float leftThumbYLastFrame = 0.0f;
Thirteen::GetControllerThumbstick(0, true, leftThumbX, leftThumbY);
Thirteen::GetControllerThumbstickLastFrame(0, true, leftThumbXLastFrame, leftThumbYLastFrame);
if (fabsf(leftThumbX - leftThumbXLastFrame) > c_thumbStickEpsilon || fabsf(leftThumbY - leftThumbYLastFrame) > c_thumbStickEpsilon)
printf("LeftThumb: x=%.3f, y=%.3f\n", leftThumbX, leftThumbY);

float rightThumbX = 0.0f;
float rightThumbY = 0.0f;
float rightThumbXLastFrame = 0.0f;
float rightThumbYLastFrame = 0.0f;
Thirteen::GetControllerThumbstick(0, false, rightThumbX, rightThumbY);
Thirteen::GetControllerThumbstickLastFrame(0, false, rightThumbXLastFrame, rightThumbYLastFrame);
if (fabsf(rightThumbX - rightThumbXLastFrame) > c_thumbStickEpsilon || fabsf(rightThumbY - rightThumbYLastFrame) > c_thumbStickEpsilon)
printf("RightThumb: x=%.3f, y=%.3f\n", rightThumbX, rightThumbY);
}
while (Thirteen::Render() && !Thirteen::GetKey(VK_ESCAPE));

Thirteen::Shutdown();

return 0;
}
4 changes: 0 additions & 4 deletions Examples/Mandelbrot/Mandelbrot.vcxproj.user

This file was deleted.

4 changes: 0 additions & 4 deletions Examples/Minesweeper/Minesweeper.vcxproj.user

This file was deleted.

4 changes: 0 additions & 4 deletions Examples/Simple/Simple.vcxproj.user

This file was deleted.

Loading
Loading