mirror of
https://github.com/k4zmu2a/SpaceCadetPinball.git
synced 2024-11-14 19:25:18 -05:00
Add project files.
This commit is contained in:
parent
b91a0b71a0
commit
2d96ba2dd0
9 changed files with 430 additions and 0 deletions
31
SpaceCadetPinball.sln
Normal file
31
SpaceCadetPinball.sln
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio 15
|
||||||
|
VisualStudioVersion = 15.0.28307.705
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SpaceCadetPinball", "SpaceCadetPinball\SpaceCadetPinball.vcxproj", "{F7B78CC7-6984-4F79-9486-ABCF87DF9F06}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|x64 = Debug|x64
|
||||||
|
Debug|x86 = Debug|x86
|
||||||
|
Release|x64 = Release|x64
|
||||||
|
Release|x86 = Release|x86
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{F7B78CC7-6984-4F79-9486-ABCF87DF9F06}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
|
{F7B78CC7-6984-4F79-9486-ABCF87DF9F06}.Debug|x64.Build.0 = Debug|x64
|
||||||
|
{F7B78CC7-6984-4F79-9486-ABCF87DF9F06}.Debug|x86.ActiveCfg = Debug|Win32
|
||||||
|
{F7B78CC7-6984-4F79-9486-ABCF87DF9F06}.Debug|x86.Build.0 = Debug|Win32
|
||||||
|
{F7B78CC7-6984-4F79-9486-ABCF87DF9F06}.Release|x64.ActiveCfg = Release|x64
|
||||||
|
{F7B78CC7-6984-4F79-9486-ABCF87DF9F06}.Release|x64.Build.0 = Release|x64
|
||||||
|
{F7B78CC7-6984-4F79-9486-ABCF87DF9F06}.Release|x86.ActiveCfg = Release|Win32
|
||||||
|
{F7B78CC7-6984-4F79-9486-ABCF87DF9F06}.Release|x86.Build.0 = Release|Win32
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
SolutionGuid = {4B620E0B-FD42-4AEC-BC4A-261C1669A1B5}
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
26
SpaceCadetPinball/NatvisFile.natvis
Normal file
26
SpaceCadetPinball/NatvisFile.natvis
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
|
||||||
|
<Type Name="objlist_class">
|
||||||
|
<DisplayString>{{ size={ListPtr->Count} }}</DisplayString>
|
||||||
|
<Expand>
|
||||||
|
<Item Name="[size]" ExcludeView="simple">ListPtr->Count</Item>
|
||||||
|
<Item Name="[capacity]" ExcludeView="simple">ListPtr->Size</Item>
|
||||||
|
<ArrayItems>
|
||||||
|
<Size>ListPtr->Size</Size>
|
||||||
|
<ValuePointer>ListPtr->Array</ValuePointer>
|
||||||
|
</ArrayItems>
|
||||||
|
</Expand>
|
||||||
|
</Type>
|
||||||
|
|
||||||
|
<Type Name="objlist_struct1">
|
||||||
|
<DisplayString>{{ size={Count} }}</DisplayString>
|
||||||
|
<Expand>
|
||||||
|
<Item Name="[size]" ExcludeView="simple">Count</Item>
|
||||||
|
<Item Name="[capacity]" ExcludeView="simple">Size</Item>
|
||||||
|
<ArrayItems>
|
||||||
|
<Size>Size</Size>
|
||||||
|
<ValuePointer>Array</ValuePointer>
|
||||||
|
</ArrayItems>
|
||||||
|
</Expand>
|
||||||
|
</Type>
|
||||||
|
</AutoVisualizer>
|
29
SpaceCadetPinball/SpaceCadetPinball.cpp
Normal file
29
SpaceCadetPinball/SpaceCadetPinball.cpp
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
// SpaceCadetPinball.cpp : This file contains the 'main' function. Program execution begins and ends there.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "pch.h"
|
||||||
|
#include <iostream>
|
||||||
|
#include "objlist_class.h"
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
std::cout << "Hello World!\n";
|
||||||
|
|
||||||
|
objlist_class d = objlist_class(2, 4);
|
||||||
|
for(int i=0;i<100;i++)
|
||||||
|
{
|
||||||
|
d.Add((void*)i);
|
||||||
|
}
|
||||||
|
d.Delete(3);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Run program: Ctrl + F5 or Debug > Start Without Debugging menu
|
||||||
|
// Debug program: F5 or Debug > Start Debugging menu
|
||||||
|
|
||||||
|
// Tips for Getting Started:
|
||||||
|
// 1. Use the Solution Explorer window to add/manage files
|
||||||
|
// 2. Use the Team Explorer window to connect to source control
|
||||||
|
// 3. Use the Output window to see build output and other messages
|
||||||
|
// 4. Use the Error List window to view errors
|
||||||
|
// 5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project
|
||||||
|
// 6. In the future, to open this project again, go to File > Open > Project and select the .sln file
|
173
SpaceCadetPinball/SpaceCadetPinball.vcxproj
Normal file
173
SpaceCadetPinball/SpaceCadetPinball.vcxproj
Normal file
|
@ -0,0 +1,173 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
|
<ProjectConfiguration Include="Debug|Win32">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|Win32">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Debug|x64">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|x64">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
</ItemGroup>
|
||||||
|
<PropertyGroup Label="Globals">
|
||||||
|
<VCProjectVersion>15.0</VCProjectVersion>
|
||||||
|
<ProjectGuid>{F7B78CC7-6984-4F79-9486-ABCF87DF9F06}</ProjectGuid>
|
||||||
|
<Keyword>Win32Proj</Keyword>
|
||||||
|
<RootNamespace>SpaceCadetPinball</RootNamespace>
|
||||||
|
<WindowsTargetPlatformVersion>10.0.17763.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>v141</PlatformToolset>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v141</PlatformToolset>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v141</PlatformToolset>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v141</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)'=='Debug|Win32'">
|
||||||
|
<LinkIncremental>true</LinkIncremental>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<LinkIncremental>true</LinkIncremental>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<LinkIncremental>false</LinkIncremental>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<LinkIncremental>false</LinkIncremental>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<Optimization>Disabled</Optimization>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<ConformanceMode>true</ConformanceMode>
|
||||||
|
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</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;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<ConformanceMode>true</ConformanceMode>
|
||||||
|
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<Optimization>MaxSpeed</Optimization>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<ConformanceMode>true</ConformanceMode>
|
||||||
|
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<Optimization>MaxSpeed</Optimization>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<ConformanceMode>true</ConformanceMode>
|
||||||
|
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClInclude Include="objlist_class.h" />
|
||||||
|
<ClInclude Include="pch.h" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="objlist_class.cpp" />
|
||||||
|
<ClCompile Include="pch.cpp">
|
||||||
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
||||||
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
|
||||||
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
|
||||||
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="SpaceCadetPinball.cpp" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Natvis Include="NatvisFile.natvis" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
|
<ImportGroup Label="ExtensionTargets">
|
||||||
|
</ImportGroup>
|
||||||
|
</Project>
|
39
SpaceCadetPinball/SpaceCadetPinball.vcxproj.filters
Normal file
39
SpaceCadetPinball/SpaceCadetPinball.vcxproj.filters
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
<?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>
|
||||||
|
<Filter Include="Resource Files">
|
||||||
|
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||||
|
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||||
|
</Filter>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClInclude Include="pch.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="objlist_class.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="pch.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="SpaceCadetPinball.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="objlist_class.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Natvis Include="NatvisFile.natvis" />
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
86
SpaceCadetPinball/objlist_class.cpp
Normal file
86
SpaceCadetPinball/objlist_class.cpp
Normal file
|
@ -0,0 +1,86 @@
|
||||||
|
#include "pch.h""
|
||||||
|
#include "objlist_class.h"
|
||||||
|
#include <cstdlib>
|
||||||
|
// v1 from Ida
|
||||||
|
|
||||||
|
objlist_class::objlist_class(int SizeInt, int growSize)
|
||||||
|
{
|
||||||
|
ListPtr = objlist_new(SizeInt);
|
||||||
|
GrowSize = growSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
objlist_class::~objlist_class()
|
||||||
|
{
|
||||||
|
if (ListPtr)
|
||||||
|
free(ListPtr);
|
||||||
|
}
|
||||||
|
|
||||||
|
void objlist_class::Add(void* value)
|
||||||
|
{
|
||||||
|
if (this->ListPtr->Count == this->ListPtr->Size)
|
||||||
|
Grow();
|
||||||
|
objlist_add_object(ListPtr, (int)value);
|
||||||
|
}
|
||||||
|
|
||||||
|
void objlist_class::Grow()
|
||||||
|
{
|
||||||
|
this->ListPtr = objlist_grow(this->ListPtr, this->GrowSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
int objlist_class::Delete(int value)
|
||||||
|
{
|
||||||
|
return objlist_delete_object(ListPtr, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
objlist_struct1* objlist_class::objlist_new(int sizeInt)
|
||||||
|
{
|
||||||
|
objlist_struct1* result = (objlist_struct1 *)malloc(4 * sizeInt + 12);
|
||||||
|
if (!result)
|
||||||
|
return result;
|
||||||
|
result->Count = 0;
|
||||||
|
result->Size = sizeInt;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
int objlist_class::objlist_add_object(objlist_struct1* ptrToStruct, int value)
|
||||||
|
{
|
||||||
|
int addIndex = ptrToStruct->Count;
|
||||||
|
if (addIndex >= ptrToStruct->Size)
|
||||||
|
return 0;
|
||||||
|
ptrToStruct->Array[addIndex] = value;
|
||||||
|
return ++ptrToStruct->Count;
|
||||||
|
}
|
||||||
|
|
||||||
|
objlist_struct1* objlist_class::objlist_grow(objlist_struct1* ptrToStruct, int growSize)
|
||||||
|
{
|
||||||
|
objlist_struct1* resultPtr = ptrToStruct;
|
||||||
|
if (!ptrToStruct)
|
||||||
|
return resultPtr;
|
||||||
|
int newSizeInt = growSize + ptrToStruct->Count;
|
||||||
|
if (newSizeInt <= ptrToStruct->Size)
|
||||||
|
return resultPtr;
|
||||||
|
objlist_struct1* resultPtr2 = (objlist_struct1 *)realloc(ptrToStruct, 4 * newSizeInt + 12);
|
||||||
|
if (!resultPtr2)
|
||||||
|
return resultPtr;
|
||||||
|
resultPtr = resultPtr2;
|
||||||
|
resultPtr2->Size = growSize + resultPtr2->Count;
|
||||||
|
return resultPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
int objlist_class::objlist_delete_object(objlist_struct1* ptrToStruct, int value)
|
||||||
|
{
|
||||||
|
int count = ptrToStruct->Count;
|
||||||
|
int index = count - 1;
|
||||||
|
if (count - 1 < 0)
|
||||||
|
return 0;
|
||||||
|
for (int* i = &ptrToStruct->Array[index]; *i != value; --i)
|
||||||
|
{
|
||||||
|
if (--index < 0)
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
//ptrToStruct->Array[index] = *(&ptrToStruct->Count + count);
|
||||||
|
ptrToStruct->Array[index] = ptrToStruct->Array[count - 1];
|
||||||
|
--ptrToStruct->Count;
|
||||||
|
return 1;
|
||||||
|
}
|
27
SpaceCadetPinball/objlist_class.h
Normal file
27
SpaceCadetPinball/objlist_class.h
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
struct __declspec(align(4)) objlist_struct1
|
||||||
|
{
|
||||||
|
int Size;
|
||||||
|
int Count;
|
||||||
|
int Array[];
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class objlist_class
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
objlist_class(int SizeInt, int growSize);
|
||||||
|
~objlist_class();
|
||||||
|
void Add(void* value);
|
||||||
|
void Grow();
|
||||||
|
int Delete(int value);
|
||||||
|
|
||||||
|
private:
|
||||||
|
objlist_struct1* ListPtr;
|
||||||
|
int GrowSize;
|
||||||
|
objlist_struct1* objlist_new(int sizeInt);
|
||||||
|
int objlist_add_object(objlist_struct1 *ptrToStruct, int value);
|
||||||
|
objlist_struct1* objlist_grow(objlist_struct1 *ptrToStruct, int growSize);
|
||||||
|
int objlist_delete_object(objlist_struct1 *ptrToStruct, int value);
|
||||||
|
};
|
5
SpaceCadetPinball/pch.cpp
Normal file
5
SpaceCadetPinball/pch.cpp
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
// pch.cpp: source file corresponding to pre-compiled header; necessary for compilation to succeed
|
||||||
|
|
||||||
|
#include "pch.h"
|
||||||
|
|
||||||
|
// In general, ignore this file, but keep it around if you are using pre-compiled headers.
|
14
SpaceCadetPinball/pch.h
Normal file
14
SpaceCadetPinball/pch.h
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
// Tips for Getting Started:
|
||||||
|
// 1. Use the Solution Explorer window to add/manage files
|
||||||
|
// 2. Use the Team Explorer window to connect to source control
|
||||||
|
// 3. Use the Output window to see build output and other messages
|
||||||
|
// 4. Use the Error List window to view errors
|
||||||
|
// 5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project
|
||||||
|
// 6. In the future, to open this project again, go to File > Open > Project and select the .sln file
|
||||||
|
|
||||||
|
#ifndef PCH_H
|
||||||
|
#define PCH_H
|
||||||
|
|
||||||
|
// TODO: add headers that you want to pre-compile here
|
||||||
|
|
||||||
|
#endif //PCH_H
|
Loading…
Reference in a new issue