Merge pull request #6 from andreja6/guiinstance

Merge Guiinstance
This commit is contained in:
andreja6
2018-04-19 21:42:11 -07:00
committed by GitHub
21 changed files with 926 additions and 672 deletions

Binary file not shown.

View File

@@ -1,109 +0,0 @@
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// English (Canada) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENC)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_CAN
#pragma code_page(1252)
#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_ABOUT_DIALOG DIALOGEX 0, 0, 226, 151
STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | DS_FIXEDSYS | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "About"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
DEFPUSHBUTTON "OK",IDOK,169,130,50,14
PUSHBUTTON "Cancel",IDCANCEL,112,130,50,14
END
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO
BEGIN
IDD_ABOUT_DIALOG, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 219
TOPMARGIN, 7
BOTTOMMARGIN, 144
END
END
#endif // APSTUDIO_INVOKED
#endif // English (Canada) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

Binary file not shown.

View File

@@ -1,32 +0,0 @@
<html>
<body>
<pre>
<h1>Build Log</h1>
<h3>
--------------------Configuration: G3DTest - Win32 Debug--------------------
</h3>
<h3>Command Lines</h3>
Creating temporary file "C:\Users\Andreja\AppData\Local\Temp\RSPFD70.tmp" with contents
[
/nologo /MLd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /Fp"Debug/G3DTest.pch" /YX /Fo"Debug/" /Fd"Debug/" /FD /GZ /c
"C:\USERS\ANDREJA\G3D\G3DTest\main.cpp"
]
Creating command line "cl.exe @C:\Users\Andreja\AppData\Local\Temp\RSPFD70.tmp"
Creating temporary file "C:\Users\Andreja\AppData\Local\Temp\RSPFD71.tmp" with contents
[
kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /incremental:yes /pdb:"Debug/G3DTest.pdb" /debug /machine:I386 /out:"Debug/G3DTest.exe" /pdbtype:sept
.\Debug\main.obj
]
Creating command line "link.exe @C:\Users\Andreja\AppData\Local\Temp\RSPFD71.tmp"
<h3>Output Window</h3>
Compiling...
main.cpp
Linking...
<h3>Results</h3>
G3DTest.exe - 0 error(s), 0 warning(s)
</pre>
</body>
</html>

Binary file not shown.

View File

@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "G3DTest", "G3DTest.vcproj", "{6C4D6EEF-B1D1-456A-B850-92CAB17124BE}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "G3D_New", "G3D_New.vcproj", "{583B17DE-1A0C-4070-801A-021DC0C84B0C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -9,10 +9,10 @@ Global
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{6C4D6EEF-B1D1-456A-B850-92CAB17124BE}.Debug|Win32.ActiveCfg = Debug|Win32
{6C4D6EEF-B1D1-456A-B850-92CAB17124BE}.Debug|Win32.Build.0 = Debug|Win32
{6C4D6EEF-B1D1-456A-B850-92CAB17124BE}.Release|Win32.ActiveCfg = Release|Win32
{6C4D6EEF-B1D1-456A-B850-92CAB17124BE}.Release|Win32.Build.0 = Release|Win32
{583B17DE-1A0C-4070-801A-021DC0C84B0C}.Debug|Win32.ActiveCfg = Debug|Win32
{583B17DE-1A0C-4070-801A-021DC0C84B0C}.Debug|Win32.Build.0 = Debug|Win32
{583B17DE-1A0C-4070-801A-021DC0C84B0C}.Release|Win32.ActiveCfg = Release|Win32
{583B17DE-1A0C-4070-801A-021DC0C84B0C}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@@ -1,24 +1,24 @@
# Microsoft Developer Studio Project File - Name="G3DTest" - Package Owner=<4>
# Microsoft Developer Studio Project File - Name="G3D_New" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Application" 0x0101
CFG=G3DTest - Win32 Debug
CFG=G3D_New - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "G3DTest.mak".
!MESSAGE NMAKE /f "G3D_New.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "G3DTest.mak" CFG="G3DTest - Win32 Debug"
!MESSAGE NMAKE /f "G3D_New.mak" CFG="G3D_New - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "G3DTest - Win32 Release" (based on "Win32 (x86) Application")
!MESSAGE "G3DTest - Win32 Debug" (based on "Win32 (x86) Application")
!MESSAGE "G3D_New - Win32 Release" (based on "Win32 (x86) Application")
!MESSAGE "G3D_New - Win32 Debug" (based on "Win32 (x86) Application")
!MESSAGE
# Begin Project
@@ -29,7 +29,7 @@ CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "G3DTest - Win32 Release"
!IF "$(CFG)" == "G3D_New - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
@@ -54,7 +54,7 @@ LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
!ELSEIF "$(CFG)" == "G3DTest - Win32 Debug"
!ELSEIF "$(CFG)" == "G3D_New - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
@@ -83,23 +83,55 @@ LINK32=link.exe
# Begin Target
# Name "G3DTest - Win32 Release"
# Name "G3DTest - Win32 Debug"
# Name "G3D_New - Win32 Release"
# Name "G3D_New - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\main.cpp
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=.\ImageButtonInstance.h
# End Source File
# Begin Source File
SOURCE=.\Instance.h
# End Source File
# Begin Source File
SOURCE=.\PhysicalInstance.h
# End Source File
# Begin Source File
SOURCE=.\TextButtonInstance.h
# End Source File
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# Begin Source File
SOURCE=.\ImageButtonInstance.cpp
# End Source File
# Begin Source File
SOURCE=.\Instance.cpp
# End Source File
# Begin Source File
SOURCE=.\main.cpp
# End Source File
# Begin Source File
SOURCE=.\PhysicalInstance.cpp
# End Source File
# Begin Source File
SOURCE=.\TextButtonInstance.cpp
# End Source File
# End Group
# End Target
# End Project

View File

@@ -3,7 +3,7 @@ Microsoft Developer Studio Workspace File, Format Version 6.00
###############################################################################
Project: "G3DTest"=.\G3DTest.dsp - Package Owner=<4>
Project: "G3D_New"=.\G3D_New.dsp - Package Owner=<4>
Package=<5>
{{{

View File

@@ -2,9 +2,9 @@
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="G3DTest"
ProjectGUID="{6C4D6EEF-B1D1-456A-B850-92CAB17124BE}"
RootNamespace="G3DTest"
Name="G3D_Application"
ProjectGUID="{583B17DE-1A0C-4070-801A-021DC0C84B0C}"
RootNamespace="G3D_New"
>
<Platforms>
<Platform
@@ -14,6 +14,100 @@
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory=".\Debug"
IntermediateDirectory=".\Debug"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="_DEBUG"
MkTypLibCompatible="true"
SuppressStartupBanner="true"
TargetEnvironment="1"
TypeLibraryName=".\Debug/G3D_New.tlb"
HeaderFileName=""
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
PrecompiledHeaderFile=".\Debug/G3D_New.pch"
AssemblerListingLocation=".\Debug/"
ObjectFile=".\Debug/"
ProgramDataBaseFileName=".\Debug/"
WarningLevel="3"
SuppressStartupBanner="true"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="4105"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
OutputFile="./G3D-Fun-Debug.exe"
LinkIncremental="2"
SuppressStartupBanner="true"
GenerateDebugInformation="true"
ProgramDatabaseFile=".\Debug/G3D_New.pdb"
SubSystem="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
SuppressStartupBanner="true"
OutputFile=".\Debug/G3D_New.bsc"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory=".\Release"
@@ -42,7 +136,7 @@
MkTypLibCompatible="true"
SuppressStartupBanner="true"
TargetEnvironment="1"
TypeLibraryName=".\Release/G3DTest.tlb"
TypeLibraryName=".\Release/G3D_New.tlb"
HeaderFileName=""
/>
<Tool
@@ -53,7 +147,7 @@
StringPooling="true"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
PrecompiledHeaderFile=".\Release/G3DTest.pch"
PrecompiledHeaderFile=".\Release/G3D_New.pch"
AssemblerListingLocation=".\Release/"
ObjectFile=".\Release/"
ProgramDataBaseFileName=".\Release/"
@@ -73,10 +167,10 @@
/>
<Tool
Name="VCLinkerTool"
OutputFile=".\Release/G3DTest.exe"
OutputFile="./G3D-Fun.exe"
LinkIncremental="1"
SuppressStartupBanner="true"
ProgramDatabaseFile=".\Release/G3DTest.pdb"
ProgramDatabaseFile=".\Release/G3D_New.pdb"
SubSystem="2"
TargetMachine="1"
/>
@@ -92,102 +186,7 @@
<Tool
Name="VCBscMakeTool"
SuppressStartupBanner="true"
OutputFile=".\Release/G3DTest.bsc"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug|Win32"
OutputDirectory=".\Debug"
IntermediateDirectory=".\Debug"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
ManagedExtensions="0"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="_DEBUG"
MkTypLibCompatible="true"
SuppressStartupBanner="true"
TargetEnvironment="1"
TypeLibraryName=".\Debug/G3DTest.tlb"
HeaderFileName=""
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
MinimalRebuild="false"
BasicRuntimeChecks="0"
RuntimeLibrary="2"
PrecompiledHeaderFile=".\Debug/G3DTest.pch"
AssemblerListingLocation=".\Debug/"
ObjectFile=".\Debug/"
ProgramDataBaseFileName=".\Debug/"
WarningLevel="3"
SuppressStartupBanner="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="4105"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
OutputFile=".\Debug/G3DTest.exe"
LinkIncremental="2"
SuppressStartupBanner="true"
GenerateDebugInformation="true"
ProgramDatabaseFile=".\Debug/G3DTest.pdb"
SubSystem="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
SuppressStartupBanner="true"
OutputFile=".\Debug/G3DTest.bsc"
OutputFile=".\Release/G3D_New.bsc"
/>
<Tool
Name="VCFxCopTool"
@@ -204,51 +203,36 @@
</Configuration>
</Configurations>
<References>
<AssemblyReference
RelativePath="System.dll"
AssemblyName="System, Version=2.0.0.0, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"
/>
<AssemblyReference
RelativePath="System.Data.dll"
AssemblyName="System.Data, Version=2.0.0.0, PublicKeyToken=b77a5c561934e089, processorArchitecture=x86"
/>
<AssemblyReference
RelativePath="System.Drawing.dll"
AssemblyName="System.Drawing, Version=2.0.0.0, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"
/>
<AssemblyReference
RelativePath="System.Windows.Forms.dll"
AssemblyName="System.Windows.Forms, Version=2.0.0.0, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"
/>
<AssemblyReference
RelativePath="System.XML.dll"
AssemblyName="System.Xml, Version=2.0.0.0, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"
/>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
Name="Header Files"
Filter="h;hpp;hxx;hm;inl"
>
<File
RelativePath=".\Dialogs.rc"
RelativePath="ImageButtonInstance.h"
>
</File>
<File
RelativePath=".\Instance.cpp"
RelativePath="Instance.h"
>
</File>
<File
RelativePath="main.cpp"
RelativePath="PhysicalInstance.h"
>
</File>
<File
RelativePath="TextButtonInstance.h"
>
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
>
<File
RelativePath="ImageButtonInstance.cpp"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
PreprocessorDefinitions=""
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
>
@@ -257,32 +241,99 @@
PreprocessorDefinitions=""
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
PreprocessorDefinitions=""
/>
</FileConfiguration>
</File>
<File
RelativePath=".\PhysicalInstance.cpp"
RelativePath="Instance.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
PreprocessorDefinitions=""
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
PreprocessorDefinitions=""
/>
</FileConfiguration>
</File>
<File
RelativePath="main.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
PreprocessorDefinitions=""
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
PreprocessorDefinitions=""
/>
</FileConfiguration>
</File>
<File
RelativePath="PhysicalInstance.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
PreprocessorDefinitions=""
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
PreprocessorDefinitions=""
/>
</FileConfiguration>
</File>
<File
RelativePath="TextButtonInstance.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
PreprocessorDefinitions=""
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
PreprocessorDefinitions=""
/>
</FileConfiguration>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl"
>
<File
RelativePath=".\Instance.h"
>
</File>
<File
RelativePath=".\PhysicalInstance.h"
>
</File>
<File
RelativePath=".\resource.h"
>
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
Name="Source Files"
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
>
</Filter>
</Files>

21
ImageButtonInstance.cpp Normal file
View File

@@ -0,0 +1,21 @@
#include "ImageButtonInstance.h"
G3D::TextureRef image = NULL;
int openGLID = 0;
G3D::TextureRef image_ovr = NULL;
int openGLID_ovr = 0;
G3D::TextureRef image_dn = NULL;
int openGLID_dn = 0;
ImageButtonInstance::ImageButtonInstance(G3D::TextureRef newImage = NULL, G3D::TextureRef overImage = NULL, G3D::TextureRef downImage = NULL)
{
image = newImage;
openGLID = image->getOpenGLID();
image_ovr = overImage;
openGLID_ovr = image_ovr->getOpenGLID();
image_dn = downImage;
openGLID_dn = image_dn->getOpenGLID();
}
ImageButtonInstance::~ImageButtonInstance(void)
{
}

10
ImageButtonInstance.h Normal file
View File

@@ -0,0 +1,10 @@
#pragma once
#include "instance.h"
class ImageButtonInstance :
public Instance
{
public:
ImageButtonInstance(G3D::TextureRef,G3D::TextureRef,G3D::TextureRef);
~ImageButtonInstance(void);
};

View File

@@ -1,3 +1,4 @@
#include <G3DAll.h>
#pragma once
class Instance

View File

@@ -1,4 +1,3 @@
#include <G3DAll.h>
#include "PhysicalInstance.h"
bool canCollide = true;
@@ -27,3 +26,5 @@ PhysicalInstance::~PhysicalInstance(void)
}

69
TextButtonInstance.cpp Normal file
View File

@@ -0,0 +1,69 @@
#include "TextButtonInstance.h"
Vector2 boxBegin;
Vector2 boxEnd;
Vector2 fontLocationRelativeTo;
Color4 textColor;
Color4 textOutlineColor;
Color4 boxColor;
Color4 boxOutlineColor;
Color4 textColorOvr;
Color4 textOutlineColorOvr;
Color4 boxColorOvr;
Color4 boxOutlineColorOvr;
Color4 textColorDn;
Color4 textOutlineColorDn;
Color4 boxColorDn;
Color4 boxOutlineColorDn;
bool centeredWithinBox;
std::string title;
G3D::GFontRef* font;
int textSize;
bool floatBottom;
bool floatRight;
bool floatCenter;
bool visible;
TextButtonInstance::TextButtonInstance(void)
{
boxBegin = Vector2(0,0);
boxEnd = Vector2(0,0);
fontLocationRelativeTo = Vector2(0,0);
centeredWithinBox = false;
title = "TextBox";
textColor = Color4(1, 1, 1, 1);
textOutlineColor = Color4(0, 0, 0, 0);
boxColor = Color4(0.6F,0.6F,0.6F,0.4F);
boxOutlineColor = Color4(0, 0, 0, 0);
textSize = 12;
floatBottom = false;
floatRight = false;
floatCenter = false;
visible = true;
className = "TextButton";
}
TextButtonInstance::~TextButtonInstance(void)
{
}
void TextButtonInstance::drawObj(RenderDevice* rd)
{
Vector3 point1;
Vector3 point2;
if(floatBottom)
{
point1 = Vector3(boxBegin.x, rd->getHeight() + boxBegin.y,0);
point2 = Vector3(boxEnd.x, rd->getHeight() + boxEnd.y,0);
}
else
{
point1 = Vector3(boxBegin.x, boxBegin.y,0);
point2 = Vector3(boxEnd.x, boxEnd.y,0);
}
Draw::box(Box(point1, point2), rd, boxColor, boxOutlineColor);
Vector2 RelativeTo = Vector2(point1.x + fontLocationRelativeTo.x, point1.y + fontLocationRelativeTo.y);
font->draw2D(rd, title, RelativeTo, textSize, textColor, textOutlineColor);
}

34
TextButtonInstance.h Normal file
View File

@@ -0,0 +1,34 @@
#pragma once
#include "instance.h"
class TextButtonInstance :
public Instance
{
public:
TextButtonInstance(void);
~TextButtonInstance(void);
Vector2 boxBegin;
Vector2 boxEnd;
Vector2 fontLocationRelativeTo;
Color4 textColor;
Color4 textOutlineColor;
Color4 boxColor;
Color4 boxOutlineColor;
Color4 textColorOvr;
Color4 textOutlineColorOvr;
Color4 boxColorOvr;
Color4 boxOutlineColorOvr;
Color4 textColorDn;
Color4 textOutlineColorDn;
Color4 boxColorDn;
Color4 boxOutlineColorDn;
bool centeredWithinBox;
std::string title;
G3D::GFontRef font;
bool floatBottom;
bool floatRight;
bool visible;
int textSize;
void drawObj(G3D::RenderDevice*);
};

Binary file not shown.

BIN
content/font/comics.fnt Normal file

Binary file not shown.

BIN
content/images/rico16c.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 484 B

BIN
content/images/rico256c.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 792 B

326
main.cpp
View File

@@ -11,9 +11,9 @@
@author Morgan McGuire, matrix@graphics3d.com
*/
#include <G3DAll.h>
#include "resource.h"
#include "Instance.h"
#include "PhysicalInstance.h"
#include "TextButtonInstance.h"
#if G3D_VER < 61000
#error Requires G3D 6.10
@@ -22,6 +22,7 @@ static const float VNUM = 0.01F;
static std::string title = "";
static const std::string VERSION = "PRE-ALPHA ";
static std::vector<Instance*> instances;
static std::vector<Instance*> instances_2D;
static Instance* dataModel;
static GFontRef fntdominant = NULL;
static GFontRef fntlighttrek = NULL;
@@ -32,9 +33,16 @@ static int FPSVal[8] = {10, 20, 30, 60, 120, 240, INT_MAX,1};
static int index = 2;
static float TIMERVAL = 60.0F;
static int SCOREVAL = 0;
static int sep = 125;
static int spacing = 25;
static G3D::TextureRef go = NULL;
static G3D::TextureRef go_ovr = NULL;
static G3D::TextureRef go_dn = NULL;
static float mousex = 0;
static float mousey = 0;
static int go_id = 0;
static int go_ovr_id = 0;
static int go_dn_id = 0;
static bool mouseButton1Down = false;
static bool running = true;
/**
This simple demo applet uses the debug mode as the regular
rendering mode so you can fly around the scene.
@@ -102,19 +110,151 @@ PhysicalInstance* makePart()
return part;
}
TextButtonInstance* makeTextButton()
{
TextButtonInstance* part = new TextButtonInstance();
instances.push_back(part);
instances_2D.push_back(part);
return part;
}
void initGUI()
{
TextButtonInstance* button = makeTextButton();
button->boxBegin = Vector2(0, -24);
button->boxEnd = Vector2(80, 0);
button->floatBottom = true;
button->parent = dataModel;
button->font = fntlighttrek;
button->textColor = Color3(0,255,255);
button->textOutlineColor = Color4::clear();
button->title = "Hopper";
button->fontLocationRelativeTo = Vector2(10, 3);
button = makeTextButton();
button->boxBegin = Vector2(0, -48);
button->boxEnd = Vector2(80, -24);
button->floatBottom = true;
button->parent = dataModel;
button->font = fntlighttrek;
button->textColor = Color3(0,255,255);
button->textOutlineColor = Color4::clear();
button->title = "Controller";
button->fontLocationRelativeTo = Vector2(10, 3);
button = makeTextButton();
button->boxBegin = Vector2(0, -72);
button->boxEnd = Vector2(80, -48);
button->floatBottom = true;
button->parent = dataModel;
button->font = fntlighttrek;
button->textColor = Color3(0,255,255);
button->textOutlineColor = Color4::clear();
button->title = "Color";
button->fontLocationRelativeTo = Vector2(10, 3);
button = makeTextButton();
button->boxBegin = Vector2(0, -96);
button->boxEnd = Vector2(80, -72);
button->floatBottom = true;
button->parent = dataModel;
button->font = fntlighttrek;
button->textColor = Color3(0,255,255);
button->textOutlineColor = Color4::clear();
button->title = "Surface";
button->fontLocationRelativeTo = Vector2(10, 3);
button = makeTextButton();
button->boxBegin = Vector2(0, -120);
button->boxEnd = Vector2(80, -96);
button->floatBottom = true;
button->parent = dataModel;
button->font = fntlighttrek;
button->textColor = Color3(0,255,255);
button->boxOutlineColor = Color3(0,255,255);
button->title = "Model";
button->fontLocationRelativeTo = Vector2(10, 3);
button = makeTextButton();
button->boxBegin = Vector2(0, 0);
button->boxEnd = Vector2(125, 25);
button->parent = dataModel;
button->font = fntlighttrek;
button->textColor = Color3::white();
button->boxColor = Color4::clear();
button->textOutlineColor = Color4(0.5F,0.5F,0.5F,0.5F);
button->title = "File";
button->textSize = 16;
button->fontLocationRelativeTo = Vector2(10, 0);
button = makeTextButton();
button->boxBegin = Vector2(125, 0);
button->boxEnd = Vector2(250, 25);
button->parent = dataModel;
button->font = fntlighttrek;
button->textColor = Color3::white();
button->boxColor = Color4::clear();
button->textOutlineColor = Color4(0.5F,0.5F,0.5F,0.5F);
button->title = "Edit";
button->textSize = 16;
button->fontLocationRelativeTo = Vector2(10, 0);
button = makeTextButton();
button->boxBegin = Vector2(250, 0);
button->boxEnd = Vector2(375, 25);
button->parent = dataModel;
button->font = fntlighttrek;
button->textColor = Color3::white();
button->boxColor = Color4::clear();
button->textOutlineColor = Color4(0.5F,0.5F,0.5F,0.5F);
button->title = "View";
button->textSize = 16;
button->fontLocationRelativeTo = Vector2(10, 0);
button = makeTextButton();
button->boxBegin = Vector2(375, 0);
button->boxEnd = Vector2(500, 25);
button->parent = dataModel;
button->font = fntlighttrek;
button->textColor = Color3::white();
button->boxColor = Color4::clear();
button->textOutlineColor = Color4(0.5F,0.5F,0.5F,0.5F);
button->title = "Insert";
button->textSize = 16;
button->fontLocationRelativeTo = Vector2(10, 0);
button = makeTextButton();
button->boxBegin = Vector2(500, 0);
button->boxEnd = Vector2(625, 25);
button->parent = dataModel;
button->font = fntlighttrek;
button->textColor = Color3::white();
button->boxColor = Color4::clear();
button->textOutlineColor = Color4(0.5F,0.5F,0.5F,0.5F);
button->title = "Format";
button->textSize = 16;
button->fontLocationRelativeTo = Vector2(10, 0);
}
void Demo::onInit() {
// Called before Demo::run() beings
dataModel = new Instance();
//dataModel->name = "undefined";
dataModel->parent = NULL;
initGUI();
PhysicalInstance* test = makePart();
test->parent = dataModel;
test->color = Color3(0.2F,0.3F,1);
test->size = Vector3(24,1,24);
test = makePart();
test->parent = dataModel;
test->color = Color3(.5F,1,.5F);
@@ -185,12 +325,12 @@ void Demo::onInit() {
setDesiredFrameRate(FPSVal[index]);
app->debugCamera.setPosition(Vector3(0, 2, 10));
app->debugCamera.lookAt(Vector3(0, 2, 0));
//std::string str = "Dynamica Duomillenium 5 Version " + VERSION + Convert(VNUM);
//title = dataModel->name;
GApplet::onInit();
}
@@ -206,7 +346,7 @@ void OnError(int err, std::string msg = "")
std::string emsg = "An unexpected error has occured and DUOM 5 has to quit. We're sorry!" + msg;
clearInstances();
//DialogBox(NULL, MAKEINTRESOURCE(IDD_DIALOG1), NULL, NULL);
MessageBox(NULL, emsg.c_str(),"Dynamica Crash", MB_OK);
MessageBoxA(NULL, emsg.c_str(),"Dynamica Crash", MB_OK);
exit(err);
}
@@ -235,7 +375,24 @@ void Demo::onSimulation(RealTime rdt, SimTime sdt, SimTime idt) {
}
//void readMouseGUIInput()
//{
//}
double getOSVersion() {
OSVERSIONINFO osvi;
ZeroMemory(&osvi, sizeof(OSVERSIONINFO));
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
GetVersionEx(&osvi);
std::string version = Convert(osvi.dwMajorVersion) + "." + Convert(osvi.dwMinorVersion);
return ::atof(version.c_str());
}
void Demo::onUserInput(UserInput* ui) {
if (ui->keyPressed(SDLK_ESCAPE)) {
// Even when we aren't in debug mode, quit on escape.
endApplet = true;
@@ -245,20 +402,6 @@ void Demo::onUserInput(UserInput* ui) {
{
app->debugController.setActive(true);
}
if(ui->keyPressed(SDLK_KP_PLUS))
{
spacing++;
messageTime = System::time();
message = "Spacing set to " + Convert(spacing);
}
if(ui->keyPressed(SDLK_KP_MINUS))
{
spacing--;
messageTime = System::time();
message = "Spacing set to " + Convert(spacing);
OnError(3423);
}
else if(ui->keyReleased(SDL_RIGHT_MOUSE_KEY))
{
app->debugController.setActive(false);
@@ -268,6 +411,8 @@ void Demo::onUserInput(UserInput* ui) {
if(ui->keyPressed(SDLK_LSHIFT))
{
app->debugController.setMoveRate(20);
}
else if(ui->keyReleased(SDLK_LSHIFT))
{
@@ -282,10 +427,18 @@ void Demo::onUserInput(UserInput* ui) {
if(app->debugMode())
message = "Debug Mode Disabled";
else
message = "Debug Mode Enabled";
message = "Debug Mode Enabled, Soon to be depricated";
app->setDebugMode(!app->debugMode());
}
}
if(ui->keyDown(SDLK_LCTRL))
{
if(ui->keyPressed('v'))
{
messageTime = System::time();
message = Convert(getOSVersion());
}
}
if(ui->keyPressed(SDLK_F8))
{
index++;
@@ -297,13 +450,18 @@ void Demo::onUserInput(UserInput* ui) {
message = "FPS has been set to " + Convert(FPSVal[index]);
setDesiredFrameRate(FPSVal[index]);
}
mousex = ui->getMouseX();
mousey = ui->getMouseY();
mouseButton1Down = ui->keyDown(SDL_LEFT_MOUSE_KEY);
//readMouseGUIInput();
// Add other key handling here
}
std::string ExePath() {
char buffer[MAX_PATH];
GetModuleFileName( NULL, buffer, MAX_PATH );
GetModuleFileNameA( NULL, buffer, MAX_PATH );
std::string::size_type pos = std::string( buffer ).find_last_of( "\\/" );
return std::string( buffer ).substr( 0, pos);
}
@@ -332,14 +490,37 @@ void makeFlag(Vector3 &vec, RenderDevice* &rd)
parray.push(Vector2(up.x-1, up.y-.5));
parray.push(Vector2(up.x, up.y-1));
Draw::poly2D(parray, rd, Color3::blue());
//rd->pushState();
//rd->beginPrimitive(RenderDevice::QUADS);
//rd->setColor(Color4(0,0,1,1));
// rd->sendVertex(up);
// rd->sendVertex(Vector3(up.x-1, up.y-1, up.z));
// rd->sendVertex(Vector3(up.x, up.y-2, up.z));
//rd->endPrimitive();
//rd->popState();
//I know how i will approach this now
}
bool mouseInArea(float point1x, float point1y, float point2x, float point2y)
{
if(mousex >= point1x && mousey >= point1y)
{
if(mousex < point2x && mousey < point2y)
{
return true;
}
}
return false;
}
void drawButtons(RenderDevice* rd)
{
for(size_t i = 0; i < instances_2D.size(); i++)
{
Instance* instance = instances_2D.at(i);
if(instance->className == "TextButton" && instance->parent == dataModel)
{
TextButtonInstance* tbi = (TextButtonInstance*)instance;
tbi->drawObj(rd);
}
}
}
void Demo::onGraphics(RenderDevice* rd) {
@@ -362,7 +543,6 @@ void Demo::onGraphics(RenderDevice* rd) {
app->renderDevice->setAmbientLightColor(Color3(1,1,1));
Draw::axes(CoordinateFrame(Vector3(0, 0, 0)), app->renderDevice);
//makeFlag(Vector3(1, 0.5, 0.5), rd);
@@ -370,7 +550,6 @@ void Demo::onGraphics(RenderDevice* rd) {
app->renderDevice->setLight(0, GLight::directional(lighting.lightDirection, lighting.lightColor));
app->renderDevice->setAmbientLightColor(lighting.ambient);
//Draw::box(G3D::Box(Vector3(4.0/2,1.0/2,2.0/2),Vector3(0,0,0)), rd, Color3::gray(), Color4(0,0,0,0));
for(size_t i = 0; i < instances.size(); i++)
{
Instance* instance = instances.at(i);
@@ -383,7 +562,6 @@ void Demo::onGraphics(RenderDevice* rd) {
}
}
//Draw::cylinder(G3D::Cylinder::Cylinder(Vector3(0,5,0),Vector3(0,10,0),1),app->renderDevice,Color4(0,0,1,0.5),Color4(0,0,0,0));
@@ -409,14 +587,12 @@ void Demo::onGraphics(RenderDevice* rd) {
fntdominant->draw2D(rd, "Timer: " + Convert(TIMERVAL), Vector2(rd->getWidth() - 120, 0+offset), 20, Color3::fromARGB(0x81C518), Color3::black());
fntdominant->draw2D(rd, "Score: " + Convert(SCOREVAL), Vector2(rd->getWidth() - 120, 25+offset), 20, Color3::fromARGB(0x81C518), Color3::black());
//fntlighttrek->draw2D(rd, "Button: " + button, Vector2(10,30 + offset), 15, Color3::white(), Color3::black());
//GUI Boxes
Draw::box(G3D::Box(Vector3(0,offset,0),Vector3(80,330+offset,0)),rd,Color4(0.6F,0.6F,0.6F,0.4F), Color4(0,0,0,0));
Draw::box(G3D::Box(Vector3(0,rd->getHeight() - 120,0),Vector3(80,rd->getHeight(),0)),rd,Color4(0.6F,0.6F,0.6F,0.4F), Color4(0,0,0,0));
//Draw::box(G3D::Box(Vector3(0,rd->getHeight() - 120,0),Vector3(80,rd->getHeight(),0)),rd,Color4(0.6F,0.6F,0.6F,0.4F), Color4(0,0,0,0));
Draw::box(G3D::Box(Vector3(rd->getWidth() - 120,rd->getHeight() - 120,0),Vector3(rd->getWidth(),rd->getHeight(),0)),rd,Color4(0.6F,0.6F,0.6F,0.4F), Color4(0,0,0,0));
@@ -427,20 +603,15 @@ void Demo::onGraphics(RenderDevice* rd) {
fntlighttrek->draw2D(rd, "CameraMenu", Vector2(rd->getWidth()-(fntlighttrek->get2DStringBounds("CameraMenu", 14).x+1),rd->getHeight() - 120), 14, Color3::white(), Color4(0.5F,0.5F,0.5F,0.5F));
/*
fntlighttrek->draw2D(rd, "Model", Vector2(10,rd->getHeight() - (120 - spacing*0)), 12, Color3(0,255,255), Color4(0,0,0,0));
fntlighttrek->draw2D(rd, "Surface", Vector2(10,rd->getHeight() - (120 - spacing*1)), 12, Color3(0,255,255), Color4(0,0,0,0));
fntlighttrek->draw2D(rd, "Color", Vector2(10,rd->getHeight() - (120 - spacing*2)), 12, Color3(0,255,255), Color4(0,0,0,0));
fntlighttrek->draw2D(rd, "Controller", Vector2(10,rd->getHeight() - (120 - spacing*3)), 12, Color3(0,255,255), Color4(0,0,0,0));
fntlighttrek->draw2D(rd, "Hopper", Vector2(10,rd->getHeight() - (120 - spacing*4)), 12, Color3(0,255,255), Color4(0,0,0,0));
*/
//Top menu
fntlighttrek->draw2D(rd,"File", Vector2(10+0*sep,0), 16, Color3::white(), Color4(0.5F,0.5F,0.5F,0.5F));
fntlighttrek->draw2D(rd,"Edit", Vector2(10+1*sep,0), 16, Color3::white(), Color4(0.5F,0.5F,0.5F,0.5F));
fntlighttrek->draw2D(rd,"View", Vector2(10+2*sep,0), 16, Color3::white(), Color4(0.5F,0.5F,0.5F,0.5F));
fntlighttrek->draw2D(rd,"Insert", Vector2(10+3*sep,0), 16, Color3::white(), Color4(0.5F,0.5F,0.5F,0.5F));
fntlighttrek->draw2D(rd,"Format", Vector2(10+4*sep,0), 16, Color3::white(), Color4(0.5F,0.5F,0.5F,0.5F));
//Tools menu
Draw::box(G3D::Box(Vector3(5, 165+offset,0),Vector3(75, 165+offset,0)),rd,Color4(0.6F,0.6F,0.6F,0.4F), Color4(0.6F,0.6F,0.6F,0.4F));
fntlighttrek->draw2D(rd,"Group", Vector2(10,170+offset), 12, Color3::white(), Color4(0.5F,0.5F,0.5F,0.5F));
@@ -453,26 +624,43 @@ void Demo::onGraphics(RenderDevice* rd) {
//rd->pushState();
//rd->setTexture(0, go);
rd->pushState();
rd->beforePrimitive();
/*rd->enableAlphaWrite();
rd->setTexCoord(0, Vector2(0.0F, 0.0F));
rd->setTexCoord(0, Vector2(1.0F, 0.0F));
rd->setTexCoord(0, Vector2(0.0F, 1.0F));
rd->setTexCoord(0, Vector2(1.0F, 1.0F));
rd->setTextureCombineMode(0, RenderDevice::CombineMode::TEX_ADD);
rd->beginPrimitive(RenderDevice::QUADS);
rd->sendVertex(Vector2(10,25));
rd->sendVertex(Vector2(70,25));
rd->sendVertex(Vector2(70,85));
rd->sendVertex(Vector2(10,85));
rd->endPrimitive();
rd->setTexture(0, NULL);
//rd->popState();*/
glEnable( GL_TEXTURE_2D );
glEnable(GL_BLEND);// you enable blending function
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
if(mouseInArea(10,25,70,85))
{
if(mouseButton1Down)
glBindTexture( GL_TEXTURE_2D, go_dn_id);
else
glBindTexture( GL_TEXTURE_2D, go_ovr_id);
}
else
glBindTexture( GL_TEXTURE_2D, go_id);
glBegin( GL_QUADS );
glTexCoord2d(0.0,0.0);
glVertex2f( 10, 0+offset );
glTexCoord2d( 1.0,0.0 );
glVertex2f( 70, 0+offset );
glTexCoord2d( 1.0,1.0 );
glVertex2f( 70, 60+offset );
glTexCoord2d( 0.0,1.0 );
glVertex2f( 10, 60+offset );
glEnd();
glDisable( GL_TEXTURE_2D );
rd->afterPrimitive();
rd->popState();
drawButtons(rd);
app->renderDevice->pop2D();
}
@@ -484,6 +672,11 @@ void App::main() {
debugController.setActive(false);
// Load objects here
go = Texture::fromFile(GetFileInPath("/content/images/Run.png"));
go_ovr = Texture::fromFile(GetFileInPath("/content/images/Run_ovr.png"));
go_dn = Texture::fromFile(GetFileInPath("/content/images/Run_dn.png"));
go_id = go->getOpenGLID();
go_dn_id = go_dn->getOpenGLID();
go_ovr_id = go_ovr->getOpenGLID();
fntdominant = GFont::fromFile(GetFileInPath("/content/font/dominant.fnt"));
fntlighttrek = GFont::fromFile(GetFileInPath("/content/font/lighttrek.fnt"));
sky = Sky::create(NULL, ExePath() + "/content/sky/");
@@ -503,13 +696,12 @@ App::~App() {
int main(int argc, char** argv) {
GAppSettings settings;
//settings.debugFontName = "lighttrek.fnt";
//settings.useNetwork = false;
//settings.window.width = 1024;
//settings.window.height = 768;
settings.window.defaultIconFilename = GetFileInPath("/content/images/rico.png");
if(getOSVersion() > 5.0)
settings.window.defaultIconFilename = GetFileInPath("/content/images/rico.png");
else
settings.window.defaultIconFilename = GetFileInPath("/content/images/rico256c.png");
settings.window.resizable = true;
settings.writeLicenseFile = false;
App app = App(settings);
//app.window()->setIcon(ExePath() + "/content/images/rico.png");
app.run();

View File

@@ -1,16 +0,0 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by Dialogs.rc
//
#define IDD_ABOUT_DIALOG 102
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 105
#define _APS_NEXT_COMMAND_VALUE 40004
#define _APS_NEXT_CONTROL_VALUE 1001
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif