mirror of
https://github.com/MoleskiCoder/EightBit.git
synced 2024-12-23 00:29:47 +00:00
For convenience, add a very lightweight SDL wrapper to the EightBit library.
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
This commit is contained in:
parent
ee3ecc682d
commit
4afe6b6378
14
EightBit.sln
14
EightBit.sln
@ -1,7 +1,7 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 15
|
||||
VisualStudioVersion = 15.0.27130.2010
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.29306.81
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "EightBit", "src\EightBit.vcxproj", "{A9C24BD9-0CB4-4C84-B09B-46B815F9DA47}"
|
||||
EndProject
|
||||
@ -35,6 +35,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "unittest_MC6809", "MC6809\u
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "M6532", "M6532\src\M6532.vcxproj", "{61ACB9AF-314F-4D9E-BFF4-96BC85F38278}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Gaming", "Gaming\src\Gaming.vcxproj", "{BC526300-E3D0-44B1-B57B-312BAA6566AC}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|x64 = Debug|x64
|
||||
@ -171,6 +173,14 @@ Global
|
||||
{61ACB9AF-314F-4D9E-BFF4-96BC85F38278}.Release|x64.Build.0 = Release|x64
|
||||
{61ACB9AF-314F-4D9E-BFF4-96BC85F38278}.Release|x86.ActiveCfg = Release|Win32
|
||||
{61ACB9AF-314F-4D9E-BFF4-96BC85F38278}.Release|x86.Build.0 = Release|Win32
|
||||
{BC526300-E3D0-44B1-B57B-312BAA6566AC}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{BC526300-E3D0-44B1-B57B-312BAA6566AC}.Debug|x64.Build.0 = Debug|x64
|
||||
{BC526300-E3D0-44B1-B57B-312BAA6566AC}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{BC526300-E3D0-44B1-B57B-312BAA6566AC}.Debug|x86.Build.0 = Debug|Win32
|
||||
{BC526300-E3D0-44B1-B57B-312BAA6566AC}.Release|x64.ActiveCfg = Release|x64
|
||||
{BC526300-E3D0-44B1-B57B-312BAA6566AC}.Release|x64.Build.0 = Release|x64
|
||||
{BC526300-E3D0-44B1-B57B-312BAA6566AC}.Release|x86.ActiveCfg = Release|Win32
|
||||
{BC526300-E3D0-44B1-B57B-312BAA6566AC}.Release|x86.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
87
Gaming/inc/Game.h
Normal file
87
Gaming/inc/Game.h
Normal file
@ -0,0 +1,87 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
|
||||
#include <SDL.h>
|
||||
|
||||
#include <Device.h>
|
||||
|
||||
#include "GameController.h"
|
||||
|
||||
class Configuration;
|
||||
|
||||
namespace Gaming {
|
||||
class Game : public EightBit::Device {
|
||||
public:
|
||||
|
||||
static void throwSDLException(std::string failure) {
|
||||
throw std::runtime_error(failure + ::SDL_GetError());
|
||||
}
|
||||
|
||||
static void verifySDLCall(int returned, std::string failure) {
|
||||
if (returned < 0)
|
||||
throwSDLException(failure);
|
||||
}
|
||||
|
||||
Game();
|
||||
virtual ~Game();
|
||||
|
||||
virtual void runLoop();
|
||||
virtual void raisePOWER() override;
|
||||
|
||||
protected:
|
||||
virtual int fps() const = 0;
|
||||
virtual bool useVsync() const = 0;
|
||||
|
||||
virtual int displayWidth() const { return rasterWidth(); }
|
||||
virtual int displayHeight() const { return rasterHeight(); }
|
||||
virtual int displayScale() const = 0;
|
||||
|
||||
virtual int rasterWidth() const = 0;
|
||||
virtual int rasterHeight() const = 0;
|
||||
|
||||
virtual std::string title() const = 0;
|
||||
|
||||
virtual void runFrame() = 0;
|
||||
|
||||
void addJoystick(SDL_Event& e);
|
||||
void removeJoystick(SDL_Event& e);
|
||||
|
||||
virtual void updateTexture();
|
||||
virtual void copyTexture();
|
||||
virtual void displayTexture();
|
||||
|
||||
virtual const uint32_t* pixels() const = 0;
|
||||
|
||||
std::shared_ptr<SDL_PixelFormat> m_pixelFormat;
|
||||
|
||||
private:
|
||||
std::shared_ptr<SDL_Window> m_window;
|
||||
std::shared_ptr<SDL_Renderer> m_renderer;
|
||||
std::shared_ptr<SDL_Texture> m_bitmapTexture;
|
||||
Uint32 m_pixelType = SDL_PIXELFORMAT_ARGB8888;
|
||||
|
||||
bool m_vsync = false;
|
||||
Uint32 m_startTicks = 0;
|
||||
Uint32 m_frames = 0;
|
||||
|
||||
std::map<int, std::shared_ptr<GameController>> m_gameControllers;
|
||||
std::map<SDL_JoystickID, int> m_mappedControllers;
|
||||
|
||||
void configureBackground() const;
|
||||
void createBitmapTexture();
|
||||
|
||||
virtual void handleKeyDown(SDL_Keycode key) {}
|
||||
virtual void handleKeyUp(SDL_Keycode key) {}
|
||||
|
||||
virtual void handleJoyButtonDown(SDL_JoyButtonEvent event) {}
|
||||
virtual void handleJoyButtonUp(SDL_JoyButtonEvent event) {}
|
||||
|
||||
int chooseControllerIndex(int who) const;
|
||||
std::shared_ptr<GameController> chooseController(int who) const;
|
||||
};
|
||||
}
|
36
Gaming/inc/GameController.h
Normal file
36
Gaming/inc/GameController.h
Normal file
@ -0,0 +1,36 @@
|
||||
#pragma once
|
||||
|
||||
#include <SDL.h>
|
||||
|
||||
namespace Gaming {
|
||||
class GameController final {
|
||||
public:
|
||||
GameController(int index);
|
||||
virtual ~GameController();
|
||||
|
||||
void startRumble() noexcept;
|
||||
void stopRumble() noexcept;
|
||||
|
||||
static auto buildJoystickId(SDL_GameController* controller) noexcept {
|
||||
auto joystick = ::SDL_GameControllerGetJoystick(controller);
|
||||
return ::SDL_JoystickInstanceID(joystick);
|
||||
}
|
||||
|
||||
auto getJoystickId() const noexcept {
|
||||
return buildJoystickId(m_gameController);
|
||||
}
|
||||
|
||||
private:
|
||||
int m_index;
|
||||
SDL_GameController* m_gameController = nullptr;
|
||||
|
||||
void open();
|
||||
void close() noexcept;
|
||||
|
||||
SDL_Haptic* m_hapticController = nullptr;
|
||||
bool m_hapticRumbleSupported = false;
|
||||
|
||||
void openHapticController();
|
||||
void closeHapticController() noexcept;
|
||||
};
|
||||
}
|
182
Gaming/src/Game.cpp
Normal file
182
Gaming/src/Game.cpp
Normal file
@ -0,0 +1,182 @@
|
||||
#include "pch.h"
|
||||
#include "Game.h"
|
||||
|
||||
namespace Gaming {
|
||||
|
||||
Game::Game() {
|
||||
verifySDLCall(::SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_GAMECONTROLLER | SDL_INIT_HAPTIC), "Failed to initialise SDL: ");
|
||||
}
|
||||
|
||||
Game::~Game() {
|
||||
::SDL_Quit();
|
||||
}
|
||||
|
||||
void Game::raisePOWER() {
|
||||
|
||||
Device::raisePOWER();
|
||||
|
||||
m_window.reset(::SDL_CreateWindow(
|
||||
title().c_str(),
|
||||
SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
|
||||
displayWidth() * displayScale(), displayHeight() * displayScale(),
|
||||
SDL_WINDOW_SHOWN), ::SDL_DestroyWindow);
|
||||
if (m_window == nullptr)
|
||||
throwSDLException("Unable to create window: ");
|
||||
|
||||
::SDL_DisplayMode mode;
|
||||
verifySDLCall(::SDL_GetWindowDisplayMode(m_window.get(), &mode), "Unable to obtain window information");
|
||||
|
||||
Uint32 rendererFlags = 0;
|
||||
m_vsync = useVsync();
|
||||
if (m_vsync) {
|
||||
const auto required = fps();
|
||||
if (required == mode.refresh_rate) {
|
||||
rendererFlags |= SDL_RENDERER_PRESENTVSYNC;
|
||||
::SDL_Log("Attempting to use SDL_RENDERER_PRESENTVSYNC");
|
||||
} else {
|
||||
m_vsync = false;
|
||||
::SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION, "Display refresh rate is incompatible with required rate (%d)", required);
|
||||
}
|
||||
}
|
||||
m_renderer.reset(::SDL_CreateRenderer(m_window.get(), -1, rendererFlags), ::SDL_DestroyRenderer);
|
||||
if (m_renderer == nullptr)
|
||||
throwSDLException("Unable to create renderer: ");
|
||||
|
||||
::SDL_RendererInfo info;
|
||||
verifySDLCall(::SDL_GetRendererInfo(m_renderer.get(), &info), "Unable to obtain renderer information");
|
||||
|
||||
if (m_vsync) {
|
||||
if ((info.flags & SDL_RENDERER_PRESENTVSYNC) == 0) {
|
||||
::SDL_LogWarn(::SDL_LOG_CATEGORY_APPLICATION, "Renderer does not support VSYNC, reverting to timed delay loop.");
|
||||
m_vsync = false;
|
||||
}
|
||||
}
|
||||
|
||||
m_pixelFormat.reset(::SDL_AllocFormat(m_pixelType), ::SDL_FreeFormat);
|
||||
if (m_pixelFormat == nullptr)
|
||||
throwSDLException("Unable to allocate pixel format: ");
|
||||
|
||||
configureBackground();
|
||||
createBitmapTexture();
|
||||
}
|
||||
|
||||
void Game::configureBackground() const {
|
||||
verifySDLCall(::SDL_SetRenderDrawColor(m_renderer.get(), 0x00, 0x00, 0x00, SDL_ALPHA_OPAQUE), "Unable to set render draw colour");
|
||||
}
|
||||
|
||||
void Game::createBitmapTexture() {
|
||||
m_bitmapTexture.reset(::SDL_CreateTexture(m_renderer.get(), m_pixelType, SDL_TEXTUREACCESS_STREAMING, rasterWidth(), rasterHeight()), ::SDL_DestroyTexture);
|
||||
if (m_bitmapTexture == nullptr)
|
||||
throwSDLException("Unable to create bitmap texture");
|
||||
}
|
||||
|
||||
void Game::runLoop() {
|
||||
|
||||
m_frames = 0UL;
|
||||
m_startTicks = ::SDL_GetTicks();
|
||||
|
||||
while (powered()) {
|
||||
::SDL_Event e;
|
||||
while (::SDL_PollEvent(&e)) {
|
||||
switch (e.type) {
|
||||
case SDL_QUIT:
|
||||
lowerPOWER();
|
||||
break;
|
||||
case SDL_KEYDOWN:
|
||||
handleKeyDown(e.key.keysym.sym);
|
||||
break;
|
||||
case SDL_KEYUP:
|
||||
handleKeyUp(e.key.keysym.sym);
|
||||
break;
|
||||
case SDL_JOYBUTTONDOWN:
|
||||
handleJoyButtonDown(e.jbutton);
|
||||
break;
|
||||
case SDL_JOYBUTTONUP:
|
||||
handleJoyButtonUp(e.jbutton);
|
||||
break;
|
||||
case SDL_JOYDEVICEADDED:
|
||||
addJoystick(e);
|
||||
break;
|
||||
case SDL_JOYDEVICEREMOVED:
|
||||
removeJoystick(e);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
runFrame();
|
||||
|
||||
updateTexture();
|
||||
copyTexture();
|
||||
displayTexture();
|
||||
|
||||
++m_frames;
|
||||
|
||||
if (!m_vsync) {
|
||||
const auto elapsedTicks = ::SDL_GetTicks() - m_startTicks;
|
||||
const auto neededTicks = (m_frames / (float)fps()) * 1000.0;
|
||||
const auto sleepNeeded = (int)(neededTicks - elapsedTicks);
|
||||
if (sleepNeeded > 0) {
|
||||
::SDL_Delay(sleepNeeded);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Game::removeJoystick(SDL_Event& e) {
|
||||
const auto which = e.jdevice.which;
|
||||
const auto found = m_gameControllers.find(which);
|
||||
SDL_assert(found != m_gameControllers.end());
|
||||
auto controller = found->second;
|
||||
const auto joystickId = controller->getJoystickId();
|
||||
m_mappedControllers.erase(joystickId);
|
||||
m_gameControllers.erase(which);
|
||||
SDL_Log("Joystick device %d removed (%zd controllers)", which, m_gameControllers.size());
|
||||
}
|
||||
|
||||
void Game::addJoystick(SDL_Event& e) {
|
||||
const auto which = e.jdevice.which;
|
||||
SDL_assert(m_gameControllers.find(which) == m_gameControllers.end());
|
||||
auto controller = std::make_shared<GameController>(which);
|
||||
const auto joystickId = controller->getJoystickId();
|
||||
m_gameControllers[which] = controller;
|
||||
SDL_assert(m_mappedControllers.find(joystickId) == m_mappedControllers.end());
|
||||
m_mappedControllers[joystickId] = which;
|
||||
SDL_Log("Joystick device %d added (%zd controllers)", which, m_gameControllers.size());
|
||||
}
|
||||
|
||||
// -1 if no controllers, otherwise index
|
||||
int Game::chooseControllerIndex(const int who) const {
|
||||
const auto count = m_gameControllers.size();
|
||||
if (count == 0)
|
||||
return -1;
|
||||
auto firstController = m_gameControllers.cbegin();
|
||||
if (count == 1 || (who == 1))
|
||||
return firstController->first;
|
||||
auto secondController = (++firstController)->first;
|
||||
return secondController;
|
||||
}
|
||||
|
||||
std::shared_ptr<GameController> Game::chooseController(const int who) const {
|
||||
const auto which = chooseControllerIndex(who);
|
||||
if (which == -1)
|
||||
return nullptr;
|
||||
const auto found = m_gameControllers.find(which);
|
||||
SDL_assert(found != m_gameControllers.cend());
|
||||
return found->second;
|
||||
}
|
||||
|
||||
void Game::updateTexture() {
|
||||
verifySDLCall(::SDL_UpdateTexture(m_bitmapTexture.get(), nullptr, pixels(), displayWidth() * sizeof(Uint32)), "Unable to update texture: ");
|
||||
}
|
||||
|
||||
void Game::copyTexture() {
|
||||
verifySDLCall(
|
||||
::SDL_RenderCopy(m_renderer.get(), m_bitmapTexture.get(), nullptr, nullptr),
|
||||
"Unable to copy texture to renderer");
|
||||
}
|
||||
|
||||
void Game::displayTexture() {
|
||||
::SDL_RenderPresent(m_renderer.get());
|
||||
}
|
||||
|
||||
}
|
73
Gaming/src/GameController.cpp
Normal file
73
Gaming/src/GameController.cpp
Normal file
@ -0,0 +1,73 @@
|
||||
#include "pch.h"
|
||||
#include "GameController.h"
|
||||
#include "Game.h"
|
||||
|
||||
namespace Gaming {
|
||||
|
||||
GameController::GameController(int index)
|
||||
: m_index(index) {
|
||||
open();
|
||||
}
|
||||
|
||||
GameController::~GameController() {
|
||||
close();
|
||||
}
|
||||
|
||||
void GameController::open() {
|
||||
SDL_assert(::SDL_NumJoysticks() > 0);
|
||||
if (::SDL_IsGameController(m_index)) {
|
||||
m_gameController = ::SDL_GameControllerOpen(m_index);
|
||||
if (m_gameController == nullptr) {
|
||||
Game::throwSDLException("Unable to open game controller: ");
|
||||
}
|
||||
openHapticController();
|
||||
auto name = ::SDL_GameControllerName(m_gameController);
|
||||
::SDL_Log("Game controller name: %s", name);
|
||||
}
|
||||
else {
|
||||
::SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION, "Joystick is not a game controller!!");
|
||||
}
|
||||
}
|
||||
|
||||
void GameController::openHapticController() {
|
||||
m_hapticController = ::SDL_HapticOpen(m_index);
|
||||
if (m_hapticController == nullptr) {
|
||||
Game::throwSDLException("Unable to open haptic controller: ");
|
||||
}
|
||||
Game::verifySDLCall(::SDL_HapticRumbleInit(m_hapticController), "Unable to initialise haptic controller: ");
|
||||
m_hapticRumbleSupported = ::SDL_HapticRumbleSupported(m_hapticController) != SDL_FALSE;
|
||||
}
|
||||
|
||||
void GameController::closeHapticController() noexcept {
|
||||
if (m_hapticController != nullptr) {
|
||||
::SDL_HapticClose(m_hapticController);
|
||||
m_hapticController = nullptr;
|
||||
}
|
||||
m_hapticRumbleSupported = false;
|
||||
}
|
||||
|
||||
void GameController::close() noexcept {
|
||||
if (m_gameController != nullptr) {
|
||||
::SDL_GameControllerClose(m_gameController);
|
||||
m_gameController = nullptr;
|
||||
}
|
||||
closeHapticController();
|
||||
}
|
||||
|
||||
void GameController::startRumble() noexcept {
|
||||
if (m_hapticRumbleSupported) {
|
||||
if (::SDL_HapticRumblePlay(m_hapticController, 1.0, 1000) < 0) {
|
||||
::SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION, "Unable to start haptic rumble: %s", ::SDL_GetError());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void GameController::stopRumble() noexcept {
|
||||
if (m_hapticRumbleSupported) {
|
||||
if (::SDL_HapticRumbleStop(m_hapticController) < 0) {
|
||||
::SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION, "Unable to stop haptic rumble: %s", ::SDL_GetError());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
178
Gaming/src/Gaming.vcxproj
Normal file
178
Gaming/src/Gaming.vcxproj
Normal file
@ -0,0 +1,178 @@
|
||||
<?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>16.0</VCProjectVersion>
|
||||
<ProjectGuid>{BC526300-E3D0-44B1-B57B-312BAA6566AC}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>Gaming</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<IncludePath>..\inc;..\..\inc;C:\Libraries\SDL2-2.0.7\include;$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<IncludePath>..\inc;..\..\inc;C:\Libraries\SDL2-2.0.7\include;$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<IncludePath>..\inc;..\..\inc;C:\Libraries\SDL2-2.0.7\include;$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<IncludePath>..\inc;..\..\inc;C:\Libraries\SDL2-2.0.7\include;$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<PreprocessorDefinitions>NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||
<OmitFramePointers>true</OmitFramePointers>
|
||||
<BufferSecurityCheck>false</BufferSecurityCheck>
|
||||
<ControlFlowGuard>false</ControlFlowGuard>
|
||||
<EnableParallelCodeGeneration>true</EnableParallelCodeGeneration>
|
||||
<EnableEnhancedInstructionSet>AdvancedVectorExtensions</EnableEnhancedInstructionSet>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||
<OmitFramePointers>true</OmitFramePointers>
|
||||
<BufferSecurityCheck>false</BufferSecurityCheck>
|
||||
<ControlFlowGuard>false</ControlFlowGuard>
|
||||
<EnableParallelCodeGeneration>true</EnableParallelCodeGeneration>
|
||||
<EnableEnhancedInstructionSet>AdvancedVectorExtensions</EnableEnhancedInstructionSet>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Game.cpp" />
|
||||
<ClCompile Include="GameController.cpp" />
|
||||
<ClCompile Include="pch.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\inc\Game.h" />
|
||||
<ClInclude Include="..\inc\GameController.h" />
|
||||
<ClInclude Include="pch.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
35
Gaming/src/Gaming.vcxproj.filters
Normal file
35
Gaming/src/Gaming.vcxproj.filters
Normal file
@ -0,0 +1,35 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;hm;inl;inc;ipp;xsd</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Game.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="GameController.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="pch.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\inc\Game.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\inc\GameController.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="pch.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
5
Gaming/src/pch.cpp
Normal file
5
Gaming/src/pch.cpp
Normal file
@ -0,0 +1,5 @@
|
||||
// pch.cpp: source file corresponding to the pre-compiled header
|
||||
|
||||
#include "pch.h"
|
||||
|
||||
// When you are using pre-compiled headers, this source file is necessary for compilation to succeed.
|
20
Gaming/src/pch.h
Normal file
20
Gaming/src/pch.h
Normal file
@ -0,0 +1,20 @@
|
||||
// pch.h: This is a precompiled header file.
|
||||
// Files listed below are compiled only once, improving build performance for future builds.
|
||||
// This also affects IntelliSense performance, including code completion and many code browsing features.
|
||||
// However, files listed here are ALL re-compiled if any one of them is updated between builds.
|
||||
// Do not add files here that you will be updating frequently as this negates the performance advantage.
|
||||
|
||||
#ifndef PCH_H
|
||||
#define PCH_H
|
||||
|
||||
#include <cstdint>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
|
||||
#include <SDL.h>
|
||||
|
||||
#include <Device.h>
|
||||
|
||||
#endif //PCH_H
|
Loading…
Reference in New Issue
Block a user