This repository has been archived by the owner on Oct 31, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
aidinabedi
committed
Dec 13, 2009
1 parent
90430aa
commit 0cfb423
Showing
8 changed files
with
367 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,199 @@ | ||
<?xml version="1.0" encoding="Windows-1252"?> | ||
<VisualStudioProject | ||
ProjectType="Visual C++" | ||
Version="9,00" | ||
Name="Demo_MainLoop" | ||
ProjectGUID="{23595110-7DBF-45AE-95B6-A1A888AED9BF}" | ||
RootNamespace="Demo_Simple" | ||
Keyword="Win32Proj" | ||
TargetFrameworkVersion="196613" | ||
> | ||
<Platforms> | ||
<Platform | ||
Name="Win32" | ||
/> | ||
</Platforms> | ||
<ToolFiles> | ||
</ToolFiles> | ||
<Configurations> | ||
<Configuration | ||
Name="Debug|Win32" | ||
OutputDirectory="../../bin/$(ConfigurationName)" | ||
IntermediateDirectory="../../obj/$(ConfigurationName)" | ||
ConfigurationType="1" | ||
CharacterSet="1" | ||
> | ||
<Tool | ||
Name="VCPreBuildEventTool" | ||
/> | ||
<Tool | ||
Name="VCCustomBuildTool" | ||
/> | ||
<Tool | ||
Name="VCXMLDataGeneratorTool" | ||
/> | ||
<Tool | ||
Name="VCWebServiceProxyGeneratorTool" | ||
/> | ||
<Tool | ||
Name="VCMIDLTool" | ||
/> | ||
<Tool | ||
Name="VCCLCompilerTool" | ||
Optimization="0" | ||
AdditionalIncludeDirectories="../../include" | ||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE" | ||
MinimalRebuild="true" | ||
BasicRuntimeChecks="3" | ||
RuntimeLibrary="3" | ||
UsePrecompiledHeader="0" | ||
WarningLevel="3" | ||
DebugInformationFormat="4" | ||
/> | ||
<Tool | ||
Name="VCManagedResourceCompilerTool" | ||
/> | ||
<Tool | ||
Name="VCResourceCompilerTool" | ||
/> | ||
<Tool | ||
Name="VCPreLinkEventTool" | ||
/> | ||
<Tool | ||
Name="VCLinkerTool" | ||
AdditionalDependencies="Shiny.lib" | ||
LinkIncremental="2" | ||
AdditionalLibraryDirectories="../../lib/$(ConfigurationName)" | ||
GenerateDebugInformation="true" | ||
SubSystem="1" | ||
TargetMachine="1" | ||
/> | ||
<Tool | ||
Name="VCALinkTool" | ||
/> | ||
<Tool | ||
Name="VCManifestTool" | ||
/> | ||
<Tool | ||
Name="VCXDCMakeTool" | ||
/> | ||
<Tool | ||
Name="VCBscMakeTool" | ||
/> | ||
<Tool | ||
Name="VCFxCopTool" | ||
/> | ||
<Tool | ||
Name="VCAppVerifierTool" | ||
/> | ||
<Tool | ||
Name="VCPostBuildEventTool" | ||
/> | ||
</Configuration> | ||
<Configuration | ||
Name="Release|Win32" | ||
OutputDirectory="../../bin/$(ConfigurationName)" | ||
IntermediateDirectory="../../obj/$(ConfigurationName)" | ||
ConfigurationType="1" | ||
CharacterSet="1" | ||
WholeProgramOptimization="1" | ||
> | ||
<Tool | ||
Name="VCPreBuildEventTool" | ||
/> | ||
<Tool | ||
Name="VCCustomBuildTool" | ||
/> | ||
<Tool | ||
Name="VCXMLDataGeneratorTool" | ||
/> | ||
<Tool | ||
Name="VCWebServiceProxyGeneratorTool" | ||
/> | ||
<Tool | ||
Name="VCMIDLTool" | ||
/> | ||
<Tool | ||
Name="VCCLCompilerTool" | ||
Optimization="2" | ||
EnableIntrinsicFunctions="true" | ||
AdditionalIncludeDirectories="../../include" | ||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE" | ||
RuntimeLibrary="2" | ||
EnableFunctionLevelLinking="true" | ||
UsePrecompiledHeader="0" | ||
WarningLevel="3" | ||
DebugInformationFormat="3" | ||
/> | ||
<Tool | ||
Name="VCManagedResourceCompilerTool" | ||
/> | ||
<Tool | ||
Name="VCResourceCompilerTool" | ||
/> | ||
<Tool | ||
Name="VCPreLinkEventTool" | ||
/> | ||
<Tool | ||
Name="VCLinkerTool" | ||
AdditionalDependencies="Shiny.lib" | ||
LinkIncremental="1" | ||
AdditionalLibraryDirectories="../../lib/$(ConfigurationName)" | ||
GenerateDebugInformation="true" | ||
SubSystem="1" | ||
OptimizeReferences="2" | ||
EnableCOMDATFolding="2" | ||
TargetMachine="1" | ||
/> | ||
<Tool | ||
Name="VCALinkTool" | ||
/> | ||
<Tool | ||
Name="VCManifestTool" | ||
/> | ||
<Tool | ||
Name="VCXDCMakeTool" | ||
/> | ||
<Tool | ||
Name="VCBscMakeTool" | ||
/> | ||
<Tool | ||
Name="VCFxCopTool" | ||
/> | ||
<Tool | ||
Name="VCAppVerifierTool" | ||
/> | ||
<Tool | ||
Name="VCPostBuildEventTool" | ||
/> | ||
</Configuration> | ||
</Configurations> | ||
<References> | ||
</References> | ||
<Files> | ||
<Filter | ||
Name="Source Files" | ||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" | ||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" | ||
> | ||
<File | ||
RelativePath=".\MainLoop.cpp" | ||
> | ||
</File> | ||
</Filter> | ||
<Filter | ||
Name="Header Files" | ||
Filter="h;hpp;hxx;hm;inl;inc;xsd" | ||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" | ||
> | ||
</Filter> | ||
<Filter | ||
Name="Resource Files" | ||
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav" | ||
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" | ||
> | ||
</Filter> | ||
</Files> | ||
<Globals> | ||
</Globals> | ||
</VisualStudioProject> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
/* | ||
The zlib/libpng License | ||
Copyright (c) 2007 Aidin Abedi (http:https://sourceforge.net/projects/shinyprofiler) | ||
This software is provided 'as-is', without any express or implied warranty. In no event will | ||
the authors be held liable for any damages arising from the use of this software. | ||
Permission is granted to anyone to use this software for any purpose, including commercial | ||
applications, and to alter it and redistribute it freely, subject to the following | ||
restrictions: | ||
1. The origin of this software must not be misrepresented; you must not claim that | ||
you wrote the original software. If you use this software in a product, | ||
an acknowledgment in the product documentation would be appreciated but is | ||
not required. | ||
2. Altered source versions must be plainly marked as such, and must not be | ||
misrepresented as being the original software. | ||
3. This notice may not be removed or altered from any source distribution. | ||
*/ | ||
|
||
#include "Shiny.h" | ||
|
||
#ifdef _WIN32 | ||
#include <windows.h> | ||
#else // assume POSIX | ||
#include <unistd.h> | ||
#endif | ||
|
||
|
||
//----------------------------------------------------------------------------- | ||
|
||
void millisleep(unsigned int milliseconds) { | ||
#ifdef _WIN32 | ||
Sleep(milliseconds); | ||
#else | ||
usleep(milliseconds * 1000); | ||
#endif | ||
} | ||
|
||
|
||
//----------------------------------------------------------------------------- | ||
|
||
PROFILE_SHARED_DEFINE(Physics); | ||
|
||
void DoPhysicsSimulation() { | ||
PROFILE_SHARED_BLOCK(Physics); | ||
} | ||
|
||
void CheckPhysicsRaycast() { | ||
PROFILE_SHARED_BEGIN(Physics); | ||
PROFILE_END(); | ||
} | ||
|
||
//----------------------------------------------------------------------------- | ||
|
||
void UpdateAllCharacters() { | ||
PROFILE_BEGIN(Gamelogic); | ||
|
||
PROFILE_BEGIN(AI); | ||
CheckPhysicsRaycast(); | ||
PROFILE_END(); | ||
|
||
PROFILE_BEGIN(Player); | ||
PROFILE_END(); | ||
|
||
PROFILE_END(); | ||
} | ||
|
||
|
||
//----------------------------------------------------------------------------- | ||
|
||
void DrawWorldObjects() { | ||
for (int i = 0; i < 10; i++) { | ||
PROFILE_BLOCK(Graphics); | ||
} | ||
} | ||
|
||
|
||
//----------------------------------------------------------------------------- | ||
|
||
|
||
int main() { | ||
int loops = 100; | ||
|
||
while (loops--) { | ||
UpdateAllCharacters(); | ||
DoPhysicsSimulation(); | ||
DrawWorldObjects(); | ||
} | ||
|
||
PROFILE_UPDATE(); // update all profiles | ||
PROFILE_OUTPUT(stdout); // print to cout | ||
|
||
#ifdef _WIN32 | ||
system("pause"); | ||
#endif | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.