diff --git a/BaseButtonInstance.cpp b/BaseButtonInstance.cpp
new file mode 100644
index 0000000..5259e99
--- /dev/null
+++ b/BaseButtonInstance.cpp
@@ -0,0 +1,51 @@
+#include "BaseButtonInstance.h"
+
+bool floatBottom = false;
+bool floatRight = false;
+bool floatCenter = false;
+bool disabled = false;
+bool selected = false;
+ButtonListener* listener = NULL;
+
+BaseButtonInstance::BaseButtonInstance(void)
+{
+ listener = NULL;
+}
+
+BaseButtonInstance::~BaseButtonInstance(void)
+{
+ delete listener;
+}
+
+void BaseButtonInstance::setButtonListener(ButtonListener* buttonListener)
+{
+ listener = buttonListener;
+}
+
+void BaseButtonInstance::drawObj(RenderDevice* rd, Vector2 mousePos, bool mouseDown){}
+
+bool BaseButtonInstance::mouseInButton(float mousex, float mousey, RenderDevice* rd){return false;}
+
+void BaseButtonInstance::onMouseClick()
+{
+ if(listener != NULL)
+ {
+ listener->onButton1MouseClick(this);
+
+ }
+}
+
+
+bool BaseButtonInstance::mouseInArea(float point1x, float point1y, float point2x, float point2y, float mousex, float mousey)
+{
+
+
+ if(mousex >= point1x && mousey >= point1y)
+ {
+ if(mousex < point2x && mousey < point2y)
+ {
+ return true;
+ }
+ }
+ return false;
+}
\ No newline at end of file
diff --git a/BaseButtonInstance.h b/BaseButtonInstance.h
new file mode 100644
index 0000000..688299c
--- /dev/null
+++ b/BaseButtonInstance.h
@@ -0,0 +1,23 @@
+#pragma once
+#include "instance.h"
+#pragma once
+#include "ButtonListener.h"
+class ButtonListener;
+class BaseButtonInstance : public Instance
+{
+public:
+ BaseButtonInstance(void);
+ virtual ~BaseButtonInstance(void);
+ virtual void drawObj(RenderDevice* rd, Vector2 mousePos, bool mouseDown);
+ virtual bool mouseInButton(float, float, RenderDevice* rd);
+ virtual void onMouseClick();
+ void setButtonListener(ButtonListener*);
+ bool floatBottom;
+ bool floatRight;
+ bool floatCenter;
+ bool disabled;
+ bool selected;
+protected:
+ bool mouseInArea(float, float, float, float, float, float);
+ class ButtonListener* listener;
+};
diff --git a/ButtonListener.cpp b/ButtonListener.cpp
index 4e9ff6c..44510a5 100644
--- a/ButtonListener.cpp
+++ b/ButtonListener.cpp
@@ -1,5 +1,6 @@
#include "ButtonListener.h"
+
ButtonListener::ButtonListener(void)
{
}
@@ -8,7 +9,7 @@ ButtonListener::~ButtonListener(void)
{
}
-void ButtonListener::onButton1MouseClick(TextButtonInstance* button)
+void ButtonListener::onButton1MouseClick(BaseButtonInstance* button)
{
}
diff --git a/ButtonListener.h b/ButtonListener.h
index c12b8e3..6377b68 100644
--- a/ButtonListener.h
+++ b/ButtonListener.h
@@ -1,12 +1,12 @@
#pragma once
-#include "TextButtonInstance.h"
-class TextButtonInstance;
+#include "BaseButtonInstance.h"
+class BaseButtonInstance;
class ButtonListener
{
public:
ButtonListener(void);
~ButtonListener(void);
- virtual void onButton1MouseClick(TextButtonInstance*);
+ virtual void onButton1MouseClick(BaseButtonInstance*);
//virtual void onMouseOver(); //TODO
//virtual void onMouseOut(); //TODO
//virtual void onButton1MouseDown(); //TODO
diff --git a/Dialogs.aps b/Dialogs.aps
index 51701b7..88ed17c 100644
Binary files a/Dialogs.aps and b/Dialogs.aps differ
diff --git a/Dialogs.rc b/Dialogs.rc
index b346945..9763a82 100644
--- a/Dialogs.rc
+++ b/Dialogs.rc
@@ -46,6 +46,37 @@ END
#endif // APSTUDIO_INVOKED
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Dialog
+//
+
+IDD_TOOLBOX DIALOGEX 0, 0, 398, 64
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
+FONT 8, "MS Shell Dlg", 0, 0, 0x0
+BEGIN
+ CONTROL "",IDC_TOOLBOX_BROWSER,
+ "{A8F8E829-06DA-11D2-8D70-00A0C98B28E2}",WS_TABSTOP,0,0,398,64
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Dialog Info
+//
+
+IDD_TOOLBOX DLGINIT
+BEGIN
+ IDC_TOOLBOX_BROWSER, 0x376, 76, 0
+0x0000, 0x0000, 0xb293, 0x0000, 0x0048, 0x0000, 0x0003, 0x0008, 0xf20b,
+0x4757, 0x0020, 0x0000, 0x005f, 0x0065, 0x0078, 0x0074, 0x0065, 0x006e,
+0x0074, 0x0078, 0x3db4, 0x0000, 0x0003, 0x0008, 0xf20a, 0x4757, 0xffe0,
+0xffff, 0x005f, 0x0065, 0x0078, 0x0074, 0x0065, 0x006e, 0x0074, 0x0079,
+0x0ac0, 0x0000,
+ 0
+END
+
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
@@ -92,6 +123,15 @@ BEGIN
END
#endif // APSTUDIO_INVOKED
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Icon
+//
+
+// Icon with lowest ID value placed first to ensure application icon
+// remains consistent on all systems.
+IDI_ICON1 ICON "icon1.ico"
#endif // English (Canada) resources
/////////////////////////////////////////////////////////////////////////////
diff --git a/G3DTest.vcproj b/G3DTest.vcproj
index 5b27a90..79a70d6 100644
--- a/G3DTest.vcproj
+++ b/G3DTest.vcproj
@@ -230,6 +230,10 @@
Name="Source Files"
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
>
+
+
@@ -279,6 +283,10 @@
Name="Header Files"
Filter="h;hpp;hxx;hm;inl"
>
+
+
@@ -308,6 +316,10 @@
Name="Resource Files"
Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
>
+
+
diff --git a/ImageButtonInstance.cpp b/ImageButtonInstance.cpp
index 8b16f19..d5c9a85 100644
--- a/ImageButtonInstance.cpp
+++ b/ImageButtonInstance.cpp
@@ -5,17 +5,140 @@ 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)
+G3D::TextureRef image_ds = NULL;
+int openGLID_ds = 0;
+Vector2 size;
+Vector2 position;
+ImageButtonInstance::ImageButtonInstance(G3D::TextureRef newImage, G3D::TextureRef overImage = NULL, G3D::TextureRef downImage = NULL, G3D::TextureRef disableImage = NULL)
{
image = newImage;
openGLID = image->getOpenGLID();
image_ovr = overImage;
+ if(!image_ovr.isNull())
openGLID_ovr = image_ovr->getOpenGLID();
image_dn = downImage;
- openGLID_dn = image_dn->getOpenGLID();
+ if(!image_dn.isNull())
+ openGLID_dn = image_dn->getOpenGLID();
+ image_ds = disableImage;
+ if(!image_ds.isNull())
+ openGLID_ds = image_ds->getOpenGLID();
+ Vector2 size = Vector2(0,0);
+ Vector2 position = Vector2(0,0);
+ floatCenter = false;
+ floatBottom = false;
+ floatRight = false;
+ disabled = false;
+ className = "ImageButton";
}
ImageButtonInstance::~ImageButtonInstance(void)
{
+ //Delete everything on destruction
+ image.~ReferenceCountedPointer();
+ delete image.getPointer();
+ image_ovr.~ReferenceCountedPointer();
+ delete image_ovr.getPointer();
+ image_ds.~ReferenceCountedPointer();
+ delete image_ds.getPointer();
+ image_dn.~ReferenceCountedPointer();
+ delete image_dn.getPointer();
+ image = NULL;
+ image_ovr = NULL;
+ image_ds = NULL;
+ image_dn = NULL;
+ delete listener;
+ listener = NULL;
+ selected = false;
}
+
+bool ImageButtonInstance::mouseInButton(float mousex, float mousey, RenderDevice* rd)
+{
+ Vector2 positionRelative = position;
+ if(floatRight && floatBottom)
+ {
+ positionRelative = Vector2(rd->getWidth() + position.x, rd->getHeight() + position.y);
+ }
+ else if(floatBottom)
+ {
+ positionRelative = Vector2(position.x, rd->getHeight() + position.y);
+ }
+ else if(floatRight)
+ {
+ positionRelative = Vector2(rd->getWidth() + position.x, position.y);
+ }
+ if(mousex >= positionRelative.x && mousey >= positionRelative.y)
+ {
+ if(mousex < positionRelative.x + size.x && mousey < positionRelative.y + size.y)
+ {
+ return true;
+ }
+ }
+ return false;
+}
+
+void ImageButtonInstance::drawObj(RenderDevice* rd, Vector2 mousePos, bool mouseDown)
+{
+ bool drawDisabledBox = false;
+ Vector2 positionRelative = position;
+ if(floatRight && floatBottom)
+ {
+ positionRelative = Vector2(rd->getWidth() + position.x, rd->getHeight() + position.y);
+ }
+ else if(floatBottom)
+ {
+ positionRelative = Vector2(position.x, rd->getHeight() + position.y);
+ }
+ else if(floatRight)
+ {
+ positionRelative = Vector2(rd->getWidth() + position.x, position.y);
+ }
+ int renderimage = openGLID;
+ if(selected == true && !image_dn.isNull())
+ {
+ renderimage = openGLID_dn;
+ }
+ else if(disabled)
+ {
+ if(!image_ds.isNull())
+ renderimage = openGLID_ds;
+ else
+ drawDisabledBox = true;
+ }
+ else if(mouseInArea(positionRelative.x, positionRelative.y, positionRelative.x + size.x, positionRelative.y + size.y, mousePos.x, mousePos.y))
+ {
+ if(mouseDown && !image_dn.isNull())
+ {
+ renderimage = openGLID_dn;
+ }
+ else if(!image_ovr.isNull())
+ {
+ renderimage = openGLID_ovr;
+ }
+ }
+
+
+ rd->pushState();
+ rd->beforePrimitive();
+ glEnable( GL_TEXTURE_2D );
+ glEnable(GL_BLEND);// you enable blending function
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ glBindTexture( GL_TEXTURE_2D, renderimage);
+ glBegin( GL_QUADS );
+ glTexCoord2d(0.0,0.0);
+ glVertex2f( positionRelative.x, positionRelative.y );
+ glTexCoord2d( 1.0,0.0 );
+ glVertex2f( positionRelative.x + size.x, positionRelative.y );
+ glTexCoord2d( 1.0,1.0 );
+ glVertex2f( positionRelative.x + size.x, positionRelative.y + size.y );
+ glTexCoord2d( 0.0,1.0 );
+ glVertex2f( positionRelative.x, positionRelative.y + size.y );
+ glEnd();
+ glDisable( GL_TEXTURE_2D );
+ rd->afterPrimitive();
+ rd->popState();
+ if(drawDisabledBox)
+ {
+ Draw::box(Box(Vector3(positionRelative.x, positionRelative.y, 0), Vector3(positionRelative.x+size.x, positionRelative.y+size.y, 0)), rd, Color4(0.7F,0.7F,0.7F,0.3F), Color4::clear());
+ }
+}
\ No newline at end of file
diff --git a/ImageButtonInstance.h b/ImageButtonInstance.h
index 139b2b3..eaad788 100644
--- a/ImageButtonInstance.h
+++ b/ImageButtonInstance.h
@@ -1,10 +1,24 @@
#pragma once
-#include "instance.h"
-
-class ImageButtonInstance :
- public Instance
+#include "BaseButtonInstance.h"
+class ImageButtonInstance : public BaseButtonInstance
{
public:
- ImageButtonInstance(G3D::TextureRef,G3D::TextureRef,G3D::TextureRef);
+ //ImageButtonInstance(G3D::TextureRef);
+ //ImageButtonInstance(G3D::TextureRef,G3D::TextureRef);
+ //ImageButtonInstance(G3D::TextureRef,G3D::TextureRef,G3D::TextureRef);
+ ImageButtonInstance(G3D::TextureRef,G3D::TextureRef,G3D::TextureRef,G3D::TextureRef);
~ImageButtonInstance(void);
+ void drawObj(RenderDevice*, Vector2, bool);
+ Vector2 size;
+ Vector2 position;
+
+ G3D::TextureRef image;
+ int openGLID;
+ G3D::TextureRef image_ovr;
+ int openGLID_ovr;
+ G3D::TextureRef image_dn;
+ int openGLID_dn;
+ G3D::TextureRef image_ds;
+ int openGLID_ds;
+ bool mouseInButton(float, float, RenderDevice*);
};
diff --git a/Instance.cpp b/Instance.cpp
index d54e945..b981f8b 100644
--- a/Instance.cpp
+++ b/Instance.cpp
@@ -4,12 +4,12 @@
std::string name;
Instance* parent;
-static std::string className = "Instance";
+static std::string className = "DataModel";
Instance::Instance(void)
{
name = "Default Game Instance";
- className = "Part";
+ className = "DataModel";
}
Instance::~Instance(void)
diff --git a/Instance.h b/Instance.h
index fe087c0..8a58954 100644
--- a/Instance.h
+++ b/Instance.h
@@ -5,7 +5,7 @@ class Instance
{
public:
Instance(void);
- ~Instance(void);
+ virtual ~Instance(void);
std::string name;
Instance* parent; // Another pointer.
std::string className;
diff --git a/PhysicalInstance.cpp b/PhysicalInstance.cpp
index 5b3a068..247dc49 100644
--- a/PhysicalInstance.cpp
+++ b/PhysicalInstance.cpp
@@ -6,6 +6,7 @@ Vector3 size;
Vector3 position;
Vector3 velocity;
Vector3 rotVelocity;
+CoordinateFrame cFrame;
Color3 color;
PhysicalInstance::PhysicalInstance(void)
@@ -16,11 +17,32 @@ PhysicalInstance::PhysicalInstance(void)
anchored = true;
size = Vector3(2,1,4);
position = Vector3(0,0,0);
+ cFrame = CoordinateFrame(position);
color = Color3::gray();
velocity = Vector3(0,0,0);
rotVelocity = Vector3(0,0,0);
}
+Vector3 PhysicalInstance::getPosition()
+{
+ return position;
+}
+void PhysicalInstance::setPosition(Vector3 pos)
+{
+ position = pos;
+ cFrame = CoordinateFrame(pos);
+}
+CoordinateFrame PhysicalInstance::getCFrame()
+{
+ return cFrame;
+}
+void PhysicalInstance::setCFrame(CoordinateFrame coordinateFrame)
+{
+ cFrame = coordinateFrame;
+ position = coordinateFrame.translation;
+}
+
+
PhysicalInstance::~PhysicalInstance(void)
{
}
diff --git a/PhysicalInstance.h b/PhysicalInstance.h
index f063a51..4dd9cfe 100644
--- a/PhysicalInstance.h
+++ b/PhysicalInstance.h
@@ -8,8 +8,14 @@ public:
PhysicalInstance(void);
~PhysicalInstance(void);
Vector3 size;
- Vector3 position;
Vector3 velocity;
Vector3 rotvelocity;
+ CoordinateFrame cFrame;
Color3 color;
+ Vector3 getPosition();
+ void setPosition(Vector3);
+ CoordinateFrame getCFrame();
+ void setCFrame(CoordinateFrame);
+private:
+ Vector3 position;
};
diff --git a/TextButtonInstance.cpp b/TextButtonInstance.cpp
index e22b991..523c918 100644
--- a/TextButtonInstance.cpp
+++ b/TextButtonInstance.cpp
@@ -18,11 +18,8 @@ bool centeredWithinBox;
std::string title;
G3D::GFontRef* font;
int textSize;
-bool floatBottom;
-bool floatRight;
-bool floatCenter;
+
bool visible;
-ButtonListener* buttonListener;
TextButtonInstance::TextButtonInstance(void)
{
@@ -35,33 +32,17 @@ TextButtonInstance::TextButtonInstance(void)
textOutlineColor = Color4(0, 0, 0, 0);
boxColor = Color4(0.6F,0.6F,0.6F,0.4F);
boxOutlineColor = Color4(0, 0, 0, 0);
+ setAllColorsSame();
textSize = 12;
floatBottom = false;
floatRight = false;
floatCenter = false;
visible = true;
className = "TextButton";
+ disabled = false;
}
-TextButtonInstance::~TextButtonInstance(void)
-{
- delete buttonListener;
-}
-
-void TextButtonInstance::setButtonListener(ButtonListener* listener)
-{
- buttonListener = listener;
-}
-
-void TextButtonInstance::onClick()
-{
- if(buttonListener != NULL)
- {
- buttonListener->onButton1MouseClick(this);
- }
-}
-
-void TextButtonInstance::drawObj(RenderDevice* rd)
+bool TextButtonInstance::mouseInButton(float mousex, float mousey, RenderDevice* rd)
{
Vector3 point1;
Vector3 point2;
@@ -76,8 +57,65 @@ void TextButtonInstance::drawObj(RenderDevice* rd)
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);
+ if(mousex >= point1.x && mousey >= point1.y)
+ {
+ if(mousex < point2.x && mousey < point2.y)
+ {
+ return true;
+ }
+ }
+ return false;
+}
+void TextButtonInstance::setAllColorsSame()
+{
+ textColorOvr = textColor;
+ textOutlineColorOvr = textOutlineColor;
+ boxColorOvr = boxColor;
+ boxOutlineColorOvr = boxOutlineColor;
+ textColorDn = textColor;
+ textOutlineColorDn = textOutlineColor;
+ boxColorDn = boxColor;
+ boxOutlineColorDn = boxOutlineColor;
+}
+
+TextButtonInstance::~TextButtonInstance(void)
+{
+}
+
+void TextButtonInstance::drawObj(RenderDevice* rd, Vector2 mousePos, bool mouseDown)
+{
+ 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);
+ }
+ Vector2 RelativeTo = Vector2(point1.x + fontLocationRelativeTo.x, point1.y + fontLocationRelativeTo.y);
+ if(mouseInArea(point1.x, point1.y, point2.x, point2.y, mousePos.x, mousePos.y) && mouseDown)
+ {
+ Draw::box(Box(point1, point2), rd, boxColorDn, boxOutlineColorDn);
+ font->draw2D(rd, title, RelativeTo, textSize, textColorDn, textOutlineColorDn);
+ }
+ else if(mouseInArea(point1.x, point1.y, point2.x, point2.y, mousePos.x, mousePos.y))
+ {
+ Draw::box(Box(point1, point2), rd, boxColorOvr, boxOutlineColorOvr);
+ font->draw2D(rd, title, RelativeTo, textSize, textColorOvr, textOutlineColorOvr);
+ }
+ else
+ {
+ Draw::box(Box(point1, point2), rd, boxColor, boxOutlineColor);
+ font->draw2D(rd, title, RelativeTo, textSize, textColor, textOutlineColor);
+ }
+}
+
+void doNullCheck()
+{
}
\ No newline at end of file
diff --git a/TextButtonInstance.h b/TextButtonInstance.h
index 8dddb0c..2f8823c 100644
--- a/TextButtonInstance.h
+++ b/TextButtonInstance.h
@@ -1,14 +1,11 @@
#pragma once
-#include "instance.h"
-#pragma once
-#include "ButtonListener.h"
-class ButtonListener;
-class TextButtonInstance :
- public Instance
+#include "BaseButtonInstance.h"
+class TextButtonInstance : public BaseButtonInstance
{
public:
TextButtonInstance(void);
~TextButtonInstance(void);
+ void setAllColorsSame();
Vector2 boxBegin;
Vector2 boxEnd;
Vector2 fontLocationRelativeTo;
@@ -27,11 +24,8 @@ public:
bool centeredWithinBox;
std::string title;
G3D::GFontRef font;
- bool floatBottom;
- bool floatRight;
bool visible;
int textSize;
- void drawObj(G3D::RenderDevice*);
- void setButtonListener(ButtonListener*);
- void onClick();
+ void drawObj(RenderDevice*, Vector2, bool);
+ bool mouseInButton(float, float, RenderDevice*);
};
\ No newline at end of file
diff --git a/content/cursor.png b/content/cursor.png
index 229081c..1ef72c3 100644
Binary files a/content/cursor.png and b/content/cursor.png differ
diff --git a/content/cursor2.png b/content/cursor2.png
new file mode 100644
index 0000000..f9f972a
Binary files /dev/null and b/content/cursor2.png differ
diff --git a/content/images/CameraZoomIn.png b/content/images/CameraZoomIn.png
new file mode 100644
index 0000000..da8f900
Binary files /dev/null and b/content/images/CameraZoomIn.png differ
diff --git a/content/images/CameraZoomIn_dn.png b/content/images/CameraZoomIn_dn.png
new file mode 100644
index 0000000..120ac0e
Binary files /dev/null and b/content/images/CameraZoomIn_dn.png differ
diff --git a/content/images/CameraZoomIn_ovr.png b/content/images/CameraZoomIn_ovr.png
new file mode 100644
index 0000000..df86686
Binary files /dev/null and b/content/images/CameraZoomIn_ovr.png differ
diff --git a/content/images/CameraZoomOut.png b/content/images/CameraZoomOut.png
new file mode 100644
index 0000000..144f48e
Binary files /dev/null and b/content/images/CameraZoomOut.png differ
diff --git a/content/images/CameraZoomOut_dn.png b/content/images/CameraZoomOut_dn.png
new file mode 100644
index 0000000..f3afc50
Binary files /dev/null and b/content/images/CameraZoomOut_dn.png differ
diff --git a/content/images/CameraZoomOut_ovr.png b/content/images/CameraZoomOut_ovr.png
new file mode 100644
index 0000000..7d03f42
Binary files /dev/null and b/content/images/CameraZoomOut_ovr.png differ
diff --git a/content/images/PlayDelete.png b/content/images/PlayDelete.png
deleted file mode 100644
index 8b049d1..0000000
Binary files a/content/images/PlayDelete.png and /dev/null differ
diff --git a/content/images/PlayDelete_dn.png b/content/images/PlayDelete_dn.png
deleted file mode 100644
index 180066c..0000000
Binary files a/content/images/PlayDelete_dn.png and /dev/null differ
diff --git a/content/images/PlayDelete_ds.png b/content/images/PlayDelete_ds.png
deleted file mode 100644
index 49b6c2f..0000000
Binary files a/content/images/PlayDelete_ds.png and /dev/null differ
diff --git a/content/images/PlayDelete_ovr.png b/content/images/PlayDelete_ovr.png
deleted file mode 100644
index c0a49d8..0000000
Binary files a/content/images/PlayDelete_ovr.png and /dev/null differ
diff --git a/content/images/ScaleTool.png b/content/images/ScaleTool.png
new file mode 100644
index 0000000..6b6db4a
Binary files /dev/null and b/content/images/ScaleTool.png differ
diff --git a/content/images/ScaleTool_dn.png b/content/images/ScaleTool_dn.png
new file mode 100644
index 0000000..e8cb04c
Binary files /dev/null and b/content/images/ScaleTool_dn.png differ
diff --git a/content/images/ScaleTool_ds.png b/content/images/ScaleTool_ds.png
new file mode 100644
index 0000000..cd3b372
Binary files /dev/null and b/content/images/ScaleTool_ds.png differ
diff --git a/content/images/ScaleTool_ovr.png b/content/images/ScaleTool_ovr.png
new file mode 100644
index 0000000..c64cf6d
Binary files /dev/null and b/content/images/ScaleTool_ovr.png differ
diff --git a/content/images/StopReset.png b/content/images/StopReset.png
deleted file mode 100644
index 8c4963f..0000000
Binary files a/content/images/StopReset.png and /dev/null differ
diff --git a/content/images/StopReset_dn.png b/content/images/StopReset_dn.png
deleted file mode 100644
index 9afde4a..0000000
Binary files a/content/images/StopReset_dn.png and /dev/null differ
diff --git a/content/images/StopReset_ds.png b/content/images/StopReset_ds.png
deleted file mode 100644
index 4e85960..0000000
Binary files a/content/images/StopReset_ds.png and /dev/null differ
diff --git a/content/images/StopReset_ovr.png b/content/images/StopReset_ovr.png
deleted file mode 100644
index 0cd0546..0000000
Binary files a/content/images/StopReset_ovr.png and /dev/null differ
diff --git a/content/images/rico.png b/content/images/rico.png
deleted file mode 100644
index d2c4976..0000000
Binary files a/content/images/rico.png and /dev/null differ
diff --git a/content/images/rico16c.png b/content/images/rico16c.png
deleted file mode 100644
index 264bcf8..0000000
Binary files a/content/images/rico16c.png and /dev/null differ
diff --git a/content/images/rico256c.png b/content/images/rico256c.png
deleted file mode 100644
index 582f532..0000000
Binary files a/content/images/rico256c.png and /dev/null differ
diff --git a/content/images/7.ico b/icon1.ico
similarity index 100%
rename from content/images/7.ico
rename to icon1.ico
diff --git a/main.cpp b/main.cpp
index cd8aeed..d7c01eb 100644
--- a/main.cpp
+++ b/main.cpp
@@ -15,6 +15,7 @@
#include "resource.h"
#include "PhysicalInstance.h"
#include "TextButtonInstance.h"
+#include "ImageButtonInstance.h"
#if G3D_VER < 61000
@@ -32,6 +33,7 @@ GFontRef fntlighttrek = NULL;
static bool democ = true;
static std::string message = "";
static G3D::RealTime messageTime = 0;
+static G3D::RealTime inputTime = 0;
static int FPSVal[8] = {10, 20, 30, 60, 120, 240, INT_MAX,1};
static int index = 2;
static float TIMERVAL = 60.0F;
@@ -41,19 +43,35 @@ 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 int cursorid = 0;
static G3D::TextureRef cursor = NULL;
static bool mouseButton1Down = false;
static bool running = true;
static bool mouseMovedBeginMotion = false;
static bool showMouse = true;
+//Controller
+static bool forwards = false;
+static bool backwards = false;
+static bool left = false;
+static bool right = false;
+static bool centerCam = false;
+static const int CURSOR = 0;
+static const int ARROWS = 1;
+static const int RESIZE = 2;
+static int mode = CURSOR;
+Vector3 cameraPos = Vector3(0,2,10);
+Vector2 oldMouse = Vector2(0,0);
+float moveRate = 0.5;
+Instance* selectedInstance = NULL;
/**
This simple demo applet uses the debug mode as the regular
rendering mode so you can fly around the scene.
*/
+
+
+
+
+
class Demo : public GApplet {
public:
@@ -64,6 +82,8 @@ public:
class App* app;
+ virtual void exitApplication();
+
Demo(App* app);
virtual ~Demo() {}
@@ -86,7 +106,7 @@ public:
-class App : public GApp {
+/*class App : public GApp {
protected:
void main();
public:
@@ -97,11 +117,90 @@ public:
App(const GAppSettings& settings, GWindow* wnd);
~App();
+};*/
+
+class App : public GApp {
+ protected:
+ void main();
+ public:
+ SkyRef sky;
+
+ Demo* applet;
+
+ App(const GAppSettings& settings, GWindow* wnd,HWND tempMainHWnd, SDLWindow*);
+
+
+ ~App();
+ HWND getHWND();
+ HWND getPropertyHWND();
+ HWND getMainHWND();
+ //void addHWND(HWND hwnd);
+ private:
+ HWND hwnd;
+ HWND propertyHWnd;
+ HWND mainHWnd;
};
+
+App *usableApp = NULL;
+
+HWND App::getHWND()
+{
+ return hwnd;
+}
+HWND App::getPropertyHWND()
+{
+ return propertyHWnd;
+}
+HWND App::getMainHWND()
+{
+ return mainHWnd;
+}
+
Demo::Demo(App* _app) : GApplet(_app), app(_app) {
}
+
+void clearInstances()
+{
+ for(size_t i = 0; i < instances.size(); i++)
+ {
+ delete instances.at(i);
+ }
+ delete dataModel;
+}
+
+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);
+ exit(err);
+}
+
+std::string ExePath() {
+ char buffer[MAX_PATH];
+ GetModuleFileName( NULL, buffer, MAX_PATH );
+ std::string::size_type pos = std::string( buffer ).find_last_of( "\\/" );
+ return std::string( buffer ).substr( 0, pos);
+}
+
+std::string GetFileInPath(std::string file)
+{
+ std::string name = ExePath() + file;
+ struct stat buf;
+ if (stat(name.c_str(), &buf) != -1)
+ {
+ return name;
+ }
+ else
+ OnError(202, " \r\nFile not found: " + name);
+ return NULL;
+
+
+}
+
#include
std::string Convert (float number){
std::ostringstream buff;
@@ -125,6 +224,61 @@ TextButtonInstance* makeTextButton()
return part;
}
+ImageButtonInstance* makeImageButton(G3D::TextureRef newImage = NULL, G3D::TextureRef overImage = NULL, G3D::TextureRef downImage = NULL, G3D::TextureRef disableImage = NULL)
+{
+ ImageButtonInstance* part = new ImageButtonInstance(newImage,overImage, downImage, disableImage);
+ instances.push_back(part);
+ instances_2D.push_back(part);
+ return part;
+}
+
+
+
+class CameraButtonListener : public ButtonListener {
+public:
+ void onButton1MouseClick(BaseButtonInstance*);
+};
+
+void CameraButtonListener::onButton1MouseClick(BaseButtonInstance* button)
+{
+ CoordinateFrame frame = usableApp->debugCamera.getCoordinateFrame();
+ if(button->name == "CenterCam")
+ centerCam = true;
+ else if(button->name == "ZoomIn")
+ cameraPos = Vector3(cameraPos.x, cameraPos.y, cameraPos.z) + frame.lookVector()*2;
+ else if(button->name == "ZoomOut")
+ cameraPos = Vector3(cameraPos.x, cameraPos.y, cameraPos.z) - frame.lookVector()*2;
+}
+
+
+class ModeSelectionListener : public ButtonListener {
+public:
+ void onButton1MouseClick(BaseButtonInstance*);
+};
+
+void ModeSelectionListener::onButton1MouseClick(BaseButtonInstance* button)
+{
+ CoordinateFrame frame = usableApp->debugCamera.getCoordinateFrame();
+
+
+ for(size_t i = 0; i < instances_2D.size(); i++)
+ {
+ if(instances_2D.at(i)->name == "Cursor" || instances_2D.at(i)->name == "Resize" || instances_2D.at(i)->name == "Arrows")
+ {
+ BaseButtonInstance* button = (BaseButtonInstance*)instances_2D.at(i);
+ button->selected = false;
+ }
+ }
+
+ button->selected = true;
+ if(button->name == "Cursor")
+ mode = CURSOR;
+ else if(button->name == "Resize")
+ mode = RESIZE;
+ else if(button->name == "Arrows")
+ mode = ARROWS;
+}
+
void initGUI()
{
@@ -138,6 +292,7 @@ void initGUI()
button->textOutlineColor = Color4::clear();
button->title = "Hopper";
button->fontLocationRelativeTo = Vector2(10, 3);
+ button->setAllColorsSame();
button = makeTextButton();
button->boxBegin = Vector2(0, -48);
@@ -149,6 +304,7 @@ void initGUI()
button->textOutlineColor = Color4::clear();
button->title = "Controller";
button->fontLocationRelativeTo = Vector2(10, 3);
+ button->setAllColorsSame();
button = makeTextButton();
button->boxBegin = Vector2(0, -72);
@@ -160,6 +316,7 @@ void initGUI()
button->textOutlineColor = Color4::clear();
button->title = "Color";
button->fontLocationRelativeTo = Vector2(10, 3);
+ button->setAllColorsSame();
button = makeTextButton();
button->boxBegin = Vector2(0, -96);
@@ -171,6 +328,7 @@ void initGUI()
button->textOutlineColor = Color4::clear();
button->title = "Surface";
button->fontLocationRelativeTo = Vector2(10, 3);
+ button->setAllColorsSame();
button = makeTextButton();
button->boxBegin = Vector2(0, -120);
@@ -182,6 +340,7 @@ void initGUI()
button->boxOutlineColor = Color3(0,255,255);
button->title = "Model";
button->fontLocationRelativeTo = Vector2(10, 3);
+ button->setAllColorsSame();
button = makeTextButton();
button->boxBegin = Vector2(0, 0);
@@ -194,6 +353,7 @@ void initGUI()
button->title = "File";
button->textSize = 16;
button->fontLocationRelativeTo = Vector2(10, 0);
+ button->setAllColorsSame();
button = makeTextButton();
button->boxBegin = Vector2(125, 0);
@@ -206,6 +366,7 @@ void initGUI()
button->title = "Edit";
button->textSize = 16;
button->fontLocationRelativeTo = Vector2(10, 0);
+ button->setAllColorsSame();
button = makeTextButton();
button->boxBegin = Vector2(250, 0);
@@ -218,6 +379,7 @@ void initGUI()
button->title = "View";
button->textSize = 16;
button->fontLocationRelativeTo = Vector2(10, 0);
+ button->setAllColorsSame();
button = makeTextButton();
button->boxBegin = Vector2(375, 0);
@@ -230,6 +392,7 @@ void initGUI()
button->title = "Insert";
button->textSize = 16;
button->fontLocationRelativeTo = Vector2(10, 0);
+ button->setAllColorsSame();
button = makeTextButton();
button->boxBegin = Vector2(500, 0);
@@ -242,13 +405,174 @@ void initGUI()
button->title = "Format";
button->textSize = 16;
button->fontLocationRelativeTo = Vector2(10, 0);
+ button->setAllColorsSame();
+
+ ImageButtonInstance* instance = makeImageButton(go, go_ovr, go_dn);
+ instance->name = "go";
+ instance->size = Vector2(65,65);
+ instance->position = Vector2(6.5, 25);
+ instance->parent = dataModel;
+
+
+
+ instance = makeImageButton(
+ Texture::fromFile(GetFileInPath("/content/images/ArrowTool.png")),
+ Texture::fromFile(GetFileInPath("/content/images/ArrowTool_ovr.png")),
+ Texture::fromFile(GetFileInPath("/content/images/ArrowTool_dn.png")),
+ Texture::fromFile(GetFileInPath("/content/images/ArrowTool_ds.png")));
+ instance->size = Vector2(50,50);
+ instance->position = Vector2(15, 90);
+ instance->parent = dataModel;
+ instance->name = "Cursor";
+ instance->setButtonListener(new ModeSelectionListener());
+
+ instance = makeImageButton(Texture::fromFile(GetFileInPath("/content/images/ScaleTool.png")),Texture::fromFile(GetFileInPath("/content/images/ScaleTool_ovr.png")),Texture::fromFile(GetFileInPath("/content/images/ScaleTool_dn.png")),Texture::fromFile(GetFileInPath("/content/images/ScaleTool_ds.png")));
+ instance->size = Vector2(40,40);
+ instance->position = Vector2(0, 140);
+ instance->parent = dataModel;
+ instance->name = "Resize";
+ instance->setButtonListener(new ModeSelectionListener());
+
+
+ instance = makeImageButton(
+ Texture::fromFile(GetFileInPath("/content/images/MoveTool.png")),
+ Texture::fromFile(GetFileInPath("/content/images/MoveTool_ovr.png")),
+ Texture::fromFile(GetFileInPath("/content/images/MoveTool_dn.png")),
+ Texture::fromFile(GetFileInPath("/content/images/MoveTool_ds.png")));
+ instance->size = Vector2(40,40);
+ instance->position = Vector2(40, 140);
+ instance->parent = dataModel;
+ instance->name = "Arrows";
+ instance->setButtonListener(new ModeSelectionListener());
+
+ instance = makeImageButton(
+ Texture::fromFile(GetFileInPath("/content/images/SelectionRotate.png")),
+ Texture::fromFile(GetFileInPath("/content/images/SelectionRotate_ovr.png")),
+ NULL,
+ Texture::fromFile(GetFileInPath("/content/images/SelectionRotate_ds.png")));
+ instance->size = Vector2(30,30);
+ instance->position = Vector2(10, 175);
+ instance->parent = dataModel;
+
+ instance = makeImageButton(
+ Texture::fromFile(GetFileInPath("/content/images/SelectionTilt.png")),
+ Texture::fromFile(GetFileInPath("/content/images/SelectionTilt_ovr.png")),
+ NULL,
+ Texture::fromFile(GetFileInPath("/content/images/SelectionTilt_ds.png")));
+ instance->size = Vector2(30,30);
+ instance->position = Vector2(40, 175);
+ instance->parent = dataModel;
+
+
+ instance = makeImageButton(
+ Texture::fromFile(GetFileInPath("/content/images/Delete.png")),
+ Texture::fromFile(GetFileInPath("/content/images/Delete_ovr.png")),
+ Texture::fromFile(GetFileInPath("/content/images/Delete_dn.png")),
+ Texture::fromFile(GetFileInPath("/content/images/Delete_ds.png")));
+ instance->size = Vector2(40,46);
+ instance->position = Vector2(20, 284);
+ instance->parent = dataModel;
+
+ instance = makeImageButton(
+ Texture::fromFile(GetFileInPath("/content/images/Delete.png")),
+ Texture::fromFile(GetFileInPath("/content/images/Delete_ovr.png")),
+ Texture::fromFile(GetFileInPath("/content/images/Delete_dn.png")),
+ Texture::fromFile(GetFileInPath("/content/images/Delete_ds.png")));
+ instance->size = Vector2(40,46);
+ instance->position = Vector2(20, 284);
+ instance->parent = dataModel;
+
+ instance = makeImageButton(
+ Texture::fromFile(GetFileInPath("/content/images/CameraZoomIn.png")),
+ Texture::fromFile(GetFileInPath("/content/images/CameraZoomIn_ovr.png")),
+ Texture::fromFile(GetFileInPath("/content/images/CameraZoomIn_dn.png")));
+ instance->size = Vector2(34,25);
+ instance->floatBottom = true;
+ instance->floatRight = true;
+ instance->position = Vector2(-77, -90);
+ instance->parent = dataModel;
+ instance->name = "ZoomIn";
+ instance->setButtonListener(new CameraButtonListener());
+
+ instance = makeImageButton(
+ Texture::fromFile(GetFileInPath("/content/images/CameraZoomOut.png")),
+ Texture::fromFile(GetFileInPath("/content/images/CameraZoomOut_ovr.png")),
+ Texture::fromFile(GetFileInPath("/content/images/CameraZoomOut_dn.png")));
+ instance->size = Vector2(34,26);
+ instance->floatBottom = true;
+ instance->floatRight = true;
+ instance->position = Vector2(-77, -31);
+ instance->parent = dataModel;
+ instance->name = "ZoomOut";
+ instance->setButtonListener(new CameraButtonListener());
+
+ instance = makeImageButton(
+ Texture::fromFile(GetFileInPath("/content/images/CameraPanLeft.png")),
+ Texture::fromFile(GetFileInPath("/content/images/CameraPanLeft_ovr.png")),
+ Texture::fromFile(GetFileInPath("/content/images/CameraPanLeft_dn.png")));
+ instance->size = Vector2(34,34);
+ instance->floatBottom = true;
+ instance->floatRight = true;
+ instance->position = Vector2(-110, -50);
+ instance->parent = dataModel;
+ instance->name = "PanLeft";
+ instance->setButtonListener(new CameraButtonListener());
+
+ instance = makeImageButton(
+ Texture::fromFile(GetFileInPath("/content/images/CameraPanRight.png")),
+ Texture::fromFile(GetFileInPath("/content/images/CameraPanRight_ovr.png")),
+ Texture::fromFile(GetFileInPath("/content/images/CameraPanRight_dn.png")));
+ instance->size = Vector2(34,34);
+ instance->floatBottom = true;
+ instance->floatRight = true;
+ instance->position = Vector2(-45, -50);
+ instance->parent = dataModel;
+ instance->name = "PanRight";
+ instance->setButtonListener(new CameraButtonListener());
+
+ instance = makeImageButton(
+ Texture::fromFile(GetFileInPath("/content/images/CameraCenter.png")),
+ Texture::fromFile(GetFileInPath("/content/images/CameraCenter_ovr.png")),
+ Texture::fromFile(GetFileInPath("/content/images/CameraCenter_dn.png")));
+ instance->size = Vector2(34,20);
+ instance->floatBottom = true;
+ instance->floatRight = true;
+ instance->position = Vector2(-77, -60);
+ instance->parent = dataModel;
+ instance->name = "CenterCam";
+ instance->setButtonListener(new CameraButtonListener());
+
+ instance = makeImageButton(
+ Texture::fromFile(GetFileInPath("/content/images/CameraTiltUp.png")),
+ Texture::fromFile(GetFileInPath("/content/images/CameraTiltUp_ovr.png")),
+ Texture::fromFile(GetFileInPath("/content/images/CameraTiltUp_dn.png")));
+ instance->size = Vector2(24,24);
+ instance->floatBottom = true;
+ instance->floatRight = true;
+ instance->position = Vector2(-105, -75);
+ instance->parent = dataModel;
+ instance->name = "TiltUp";
+ instance->setButtonListener(new CameraButtonListener());
+
+ instance = makeImageButton(
+ Texture::fromFile(GetFileInPath("/content/images/CameraTiltDown.png")),
+ Texture::fromFile(GetFileInPath("/content/images/CameraTiltDown_ovr.png")),
+ Texture::fromFile(GetFileInPath("/content/images/CameraTiltDown_dn.png")));
+ instance->size = Vector2(24,24);
+ instance->floatBottom = true;
+ instance->floatRight = true;
+ instance->position = Vector2(-40, -75);
+ instance->parent = dataModel;
+ instance->name = "TiltDown";
+ instance->setButtonListener(new CameraButtonListener());
}
+
void Demo::onInit() {
// Called before Demo::run() beings
-
+
dataModel = new Instance();
dataModel->parent = NULL;
dataModel->name = "undefined";
@@ -260,7 +584,8 @@ void Demo::onInit() {
test->parent = dataModel;
test->color = Color3(0.2F,0.3F,1);
test->size = Vector3(24,1,24);
-
+ test->setCFrame(CoordinateFrame(Matrix3::fromEulerAnglesXYZ(toRadians(90),toRadians(45),toRadians(45)), Vector3(0,0,0)));
+ selectedInstance = test;
@@ -268,73 +593,75 @@ void Demo::onInit() {
test->parent = dataModel;
test->color = Color3(.5F,1,.5F);
test->size = Vector3(4,1,2);
- test->position = Vector3(10,1,0);
+ test->setPosition(Vector3(10,1,0));
test = makePart();
test->parent = dataModel;
test->color = Color3(.5F,1,.5F);
test->size = Vector3(4,1,2);
- test->position = Vector3(-10,1,0);
+ test->setPosition(Vector3(-10,1,0));
test = makePart();
test->parent = dataModel;
test->color = Color3::gray();
test->size = Vector3(4,1,2);
- test->position = Vector3(-7,2,0);
+ test->setPosition(Vector3(-7,2,0));
test = makePart();
test->parent = dataModel;
test->color = Color3::gray();
test->size = Vector3(4,1,2);
- test->position = Vector3(7,2,0);
+ test->setPosition(Vector3(7,2,0));
test = makePart();
test->parent = dataModel;
test->color = Color3::gray();
test->size = Vector3(4,1,2);
- test->position = Vector3(-4,3,0);
+ test->setPosition(Vector3(-4,3,0));
test = makePart();
test->parent = dataModel;
test->color = Color3::gray();
test->size = Vector3(4,1,2);
- test->position = Vector3(5,3,0);
+ test->setPosition(Vector3(5,3,0));
test = makePart();
test->parent = dataModel;
test->color = Color3::gray();
test->size = Vector3(4,1,2);
- test->position = Vector3(-1,4,0);
+ test->setPosition(Vector3(-1,4,0));
test = makePart();
test->parent = dataModel;
test->color = Color3::gray();
test->size = Vector3(4,1,2);
- test->position = Vector3(3,4,0);
+ test->setPosition(Vector3(3,4,0));
test = makePart();
test->parent = dataModel;
test->color = Color3::gray();
test->size = Vector3(4,1,2);
- test->position = Vector3(2,5,0);
+ test->setPosition(Vector3(2,5,0));
+
+
test = makePart();
test->parent = dataModel;
test->color = Color3::gray();
test->size = Vector3(4,1,2);
- test->position = Vector3(0,6,0);
+ test->setPosition(Vector3(0,6,0));
test = makePart();
test->parent = dataModel;
test->color = Color3::gray();
test->size = Vector3(4,1,2);
- test->position = Vector3(-2,7,0);
+ test->setPosition(Vector3(-2,7,0));
+
+
setDesiredFrameRate(FPSVal[index]);
- app->debugCamera.setPosition(Vector3(0, 2, 10));
- app->debugCamera.lookAt(Vector3(0, 2, 0));
@@ -345,22 +672,8 @@ void Demo::onInit() {
-void clearInstances()
-{
- for(size_t i = 0; i < instances.size(); i++)
- {
- delete instances.at(i);
- }
- delete dataModel;
-}
-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);
- exit(err);
-}
+
+
void Demo::onCleanup() {
clearInstances();
@@ -393,8 +706,43 @@ void Demo::onSimulation(RealTime rdt, SimTime sdt, SimTime idt) {
if(dataModel->name != title)
{
title = dataModel->name;
- app->renderDevice->setCaption("Game \"" + title + "\"");
+ std::string text = "Game \"" + title + "\"";
+ SetWindowText(app->getMainHWND(), text.c_str());
}
+
+ CoordinateFrame frame = app->debugCamera.getCoordinateFrame();
+ if(forwards)
+ {
+ forwards = false;
+ cameraPos = Vector3(cameraPos.x, cameraPos.y, cameraPos.z) + frame.lookVector()*moveRate;
+ }
+ else if(backwards)
+ {
+ backwards = false;
+ cameraPos = Vector3(cameraPos.x, cameraPos.y, cameraPos.z) - frame.lookVector()*moveRate;
+ }
+ if(left)
+ {
+ left = false;
+ cameraPos = Vector3(cameraPos.x, cameraPos.y, cameraPos.z) + frame.leftVector()*moveRate;
+ }
+ else if(right)
+ {
+ right = false;
+ cameraPos = Vector3(cameraPos.x, cameraPos.y, cameraPos.z) + frame.rightVector()*moveRate;
+ }
+ app->debugCamera.setPosition(cameraPos);
+ if(centerCam)
+ {
+ CoordinateFrame frame = CoordinateFrame(app->debugCamera.getCoordinateFrame().translation);
+ if(selectedInstance == NULL)
+ frame.lookAt(Vector3(0,0,0));
+ else
+ frame.lookAt(((PhysicalInstance*)selectedInstance)->getPosition());
+ app->debugController.setCoordinateFrame(frame);
+ centerCam = false;
+ }
+
}
@@ -428,6 +776,7 @@ void Demo::onUserInput(UserInput* ui) {
}
if(ui->keyPressed(SDL_RIGHT_MOUSE_KEY))
{
+ oldMouse = ui->getMouseXY();
showMouse = false;
app->window()->setRelativeMousePosition(app->window()->width()/2, app->window()->height()/2);
mouseMovedBeginMotion = true;
@@ -435,19 +784,29 @@ void Demo::onUserInput(UserInput* ui) {
}
else if(ui->keyReleased(SDL_RIGHT_MOUSE_KEY))
{
+ ui->setMouseXY(oldMouse);
showMouse = true;
app->debugController.setActive(false);
}
- if(ui->keyPressed(SDLK_LSHIFT))
+ if(ui->keyPressed(SDLK_LSHIFT) || ui->keyPressed(SDLK_RSHIFT))
{
- app->debugController.setMoveRate(20);
-
-
+ moveRate = 1;
}
- else if(ui->keyReleased(SDLK_LSHIFT))
+ else if(ui->keyReleased(SDLK_LSHIFT) || ui->keyReleased(SDLK_RSHIFT))
{
- app->debugController.setMoveRate(10);
+ moveRate = 0.5;
+ }
+
+ if(ui->keyPressed(SDL_MOUSE_WHEEL_UP_KEY))
+ {
+ CoordinateFrame frame = app->debugCamera.getCoordinateFrame();
+ cameraPos = cameraPos + frame.lookVector()*2;
+ }
+ if(ui->keyPressed(SDL_MOUSE_WHEEL_DOWN_KEY))
+ {
+ CoordinateFrame frame = app->debugCamera.getCoordinateFrame();
+ cameraPos = cameraPos - frame.lookVector()*2;
}
if(ui->keyDown(SDLK_LCTRL))
@@ -472,14 +831,14 @@ void Demo::onUserInput(UserInput* ui) {
}
if(ui->keyPressed(SDLK_F8))
{
- index++;
- if(index >= 7)
- {
- index = 0;
- }
+ //index++;
+ //if(index >= 7)
+ //{
+ // index = 0;
+ //}
messageTime = System::time();
- message = "FPS has been set to " + Convert(FPSVal[index]);
- setDesiredFrameRate(FPSVal[index]);
+ message = "FPS has been locked at " + Convert(FPSVal[index]);
+ //setDesiredFrameRate(FPSVal[index]);
}
if(ui->keyPressed('u'))
{
@@ -488,36 +847,52 @@ void Demo::onUserInput(UserInput* ui) {
mousex = ui->getMouseX();
mousey = ui->getMouseY();
mouseButton1Down = ui->keyDown(SDL_LEFT_MOUSE_KEY);
+ if(ui->keyDown(SDLK_UP))
+ {
+ forwards = true;
+ }
+ else if(ui->keyDown(SDLK_DOWN))
+ {
+ backwards = true;
+ }
+ if(ui->keyDown(SDLK_LEFT))
+ {
+ left = true;
+ }
+ else if(ui->keyDown(SDLK_RIGHT))
+ {
+
+ right = true;
+ }
+
+ if(ui->keyReleased(SDL_LEFT_MOUSE_KEY))
+ {
+
+ for(size_t i = 0; i < instances_2D.size(); i++)
+ {
+ if(instances_2D.at(i)->className == "TextButton" || instances_2D.at(i)->className == "ImageButton")
+ {
+ BaseButtonInstance* button = (BaseButtonInstance*)instances_2D.at(i);
+ if(button->mouseInButton(ui->mouseXY().x, ui->mouseXY().y, app->renderDevice))
+ {
+ button->onMouseClick();
+ }
+ }
+ }
+ }
+
+
//readMouseGUIInput();
// Add other key handling here
}
-std::string ExePath() {
- char buffer[MAX_PATH];
- GetModuleFileName( NULL, buffer, MAX_PATH );
- std::string::size_type pos = std::string( buffer ).find_last_of( "\\/" );
- return std::string( buffer ).substr( 0, pos);
-}
-std::string GetFileInPath(std::string file)
-{
- std::string name = ExePath() + file;
- struct stat buf;
- if (stat(name.c_str(), &buf) != -1)
- {
- return name;
- }
- else
- OnError(202, " \r\nFile not found: " + name);
- return NULL;
-
-
-}
void makeFlag(Vector3 &vec, RenderDevice* &rd)
{
+
Vector3 up = Vector3(vec.x, vec.y+3, vec.z);
//Draw::lineSegment(G3D::LineSegment::fromTwoPoints(vec, up), rd, Color3::blue(), 3);
rd->setColor(Color3::blue());
@@ -565,20 +940,100 @@ 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)
+ if((instance->className == "TextButton" || instance->className == "ImageButton") && instance->parent == dataModel)
{
- TextButtonInstance* tbi = (TextButtonInstance*)instance;
- tbi->drawObj(rd);
+ BaseButtonInstance* tbi = (BaseButtonInstance*)instance;
+ tbi->drawObj(rd, Vector2(mousex, mousey), mouseButton1Down);
}
}
}
+void drawOutline(Vector3 from, Vector3 to, RenderDevice* rd, LightingParameters lighting, Vector3 size, Vector3 pos, CoordinateFrame c)
+{
+ //rd->setLight(0, NULL);
+ //rd->setAmbientLightColor(Color3(1,1,1));
+ Color3 outline = Color3::cyan();//Color3(0.098F,0.6F,1.0F);
+ float offsetSize = 0.05F;
+ //X
+ Draw::box(c.toWorldSpace(Box(Vector3(from.x - offsetSize, from.y + offsetSize, from.z + offsetSize), Vector3(to.x + offsetSize, from.y - offsetSize, from.z - offsetSize))), rd, outline, Color4::clear());
+ Draw::box(c.toWorldSpace(Box(Vector3(from.x - offsetSize, to.y + offsetSize, from.z + offsetSize), Vector3(to.x + offsetSize, to.y - offsetSize, from.z - offsetSize))), rd, outline, Color4::clear());
+ Draw::box(c.toWorldSpace(Box(Vector3(from.x - offsetSize, to.y + offsetSize, to.z + offsetSize), Vector3(to.x + offsetSize, to.y - offsetSize, to.z - offsetSize))), rd, outline, Color4::clear());
+ Draw::box(c.toWorldSpace(Box(Vector3(from.x - offsetSize, from.y + offsetSize, to.z + offsetSize), Vector3(to.x + offsetSize, from.y - offsetSize, to.z - offsetSize))), rd, outline, Color4::clear());
+ //Y
+ Draw::box(c.toWorldSpace(Box(Vector3(from.x + offsetSize, from.y - offsetSize + 0.1, from.z + offsetSize), Vector3(from.x - offsetSize, to.y + offsetSize - 0.1, from.z - offsetSize))), rd, outline, Color4::clear());
+ Draw::box(c.toWorldSpace(Box(Vector3(to.x + offsetSize, from.y - offsetSize + 0.1, from.z + offsetSize), Vector3(to.x - offsetSize, to.y + offsetSize - 0.1, from.z - offsetSize))), rd, outline, Color4::clear());
+ Draw::box(c.toWorldSpace(Box(Vector3(to.x + offsetSize, from.y - offsetSize + 0.1, to.z + offsetSize), Vector3(to.x - offsetSize, to.y + offsetSize-0.1, to.z - offsetSize))), rd, outline, Color4::clear());
+ Draw::box(c.toWorldSpace(Box(Vector3(from.x + offsetSize, from.y - offsetSize + 0.1, to.z + offsetSize), Vector3(from.x - offsetSize, to.y + offsetSize - 0.1, to.z - offsetSize))), rd, outline, Color4::clear());
+
+ //Z
+ Draw::box(c.toWorldSpace(Box(Vector3(from.x + offsetSize, from.y + offsetSize, from.z - offsetSize), Vector3(from.x - offsetSize, from.y - offsetSize, to.z + offsetSize))), rd, outline, Color4::clear());
+ Draw::box(c.toWorldSpace(Box(Vector3(from.x + offsetSize, to.y + offsetSize, from.z - offsetSize), Vector3(from.x - offsetSize, to.y - offsetSize, to.z + offsetSize))), rd, outline, Color4::clear());
+ Draw::box(c.toWorldSpace(Box(Vector3(to.x + offsetSize, from.y + offsetSize, from.z - offsetSize), Vector3(to.x - offsetSize, from.y - offsetSize, to.z + offsetSize))), rd, outline, Color4::clear());
+ Draw::box(c.toWorldSpace(Box(Vector3(to.x + offsetSize, to.y + offsetSize, from.z - offsetSize), Vector3(to.x - offsetSize, to.y - offsetSize, to.z + offsetSize))), rd, outline, Color4::clear());
+
+ if(mode == ARROWS)
+ {
+ rd->setLight(0, NULL);
+ rd->setAmbientLightColor(Color3(1,1,1));
+ float max = size.x;
+ if(abs(size.y) > max)
+ max = size.y;
+ if(abs(size.z) > max)
+ max = size.z;
+ max = max / 2;
+ Draw::arrow(pos, Vector3(0, 1+max, 0), rd);
+ Draw::arrow(pos, Vector3(1+max, 0, 0), rd);
+ Draw::arrow(pos, Vector3(0, 0, 1+max), rd);
+ Draw::arrow(pos, Vector3(0, (-1)-max, 0), rd);
+ Draw::arrow(pos, Vector3((-1)-max, 0, 0), rd);
+ Draw::arrow(pos, Vector3(0, 0, (-1)-max), rd);
+ rd->setAmbientLightColor(lighting.ambient);
+ rd->setLight(0, GLight::directional(lighting.lightDirection, lighting.lightColor));
+ }
+ else if(mode == RESIZE)
+ {
+
+ rd->setLight(0, NULL);
+ rd->setAmbientLightColor(Color3(1,1,1));
+ Vector3 gamepoint = pos;
+ Vector3 camerapoint = rd->getCameraToWorldMatrix().translation;
+ float distance = pow(pow((double)gamepoint.x - (double)camerapoint.x, 2) + pow((double)gamepoint.y - (double)camerapoint.y, 2) + pow((double)gamepoint.z - (double)camerapoint.z, 2), 0.5);
+ if(distance < 200)
+ {
+ Color3 sphereColor = outline;
+ float multiplier = distance * 0.025F/2;
+ if(multiplier < 0.25F)
+ multiplier = 0.25F;
+
+ Draw::sphere(Sphere(Vector3(pos.x, pos.y + (size.y/2 + 1), pos.z), multiplier), rd, sphereColor, Color4::clear());
+ Draw::sphere(Sphere(Vector3(pos.x, pos.y - (size.y/2 + 1), pos.z), multiplier), rd, sphereColor, Color4::clear());
+ Draw::sphere(Sphere(Vector3(pos.x + (size.x/2 + 1), pos.y, pos.z), multiplier), rd, sphereColor, Color4::clear());
+ Draw::sphere(Sphere(Vector3(pos.x - (size.x/2 + 1), pos.y, pos.z), multiplier), rd, sphereColor, Color4::clear());
+ Draw::sphere(Sphere(Vector3(pos.x, pos.y, pos.z + (size.z/2 + 1)), multiplier), rd, sphereColor, Color4::clear());
+ Draw::sphere(Sphere(Vector3(pos.x, pos.y, pos.z - (size.z/2 + 1)), multiplier), rd, sphereColor, Color4::clear());
+ }
+ rd->setAmbientLightColor(lighting.ambient);
+ rd->setLight(0, GLight::directional(lighting.lightDirection, lighting.lightColor));
+ }
+
+}
+
+void Demo::exitApplication()
+{
+ endApplet = true;
+ app->endProgram = true;
+}
+
void Demo::onGraphics(RenderDevice* rd) {
+
+
+
Vector2 mousepos = Vector2(0,0);
G3D::uint8 num = 0;
rd->window()->getRelativeMouseState(mousepos, num);
+
bool mouseOnScreen = true;
- if(mousepos.x < 5 || mousepos.y < 5 || mousepos.x > rd->getViewport().width()-5 || mousepos.y > rd->getViewport().height()-5)
+ if(mousepos.x < 1 || mousepos.y < 1 || mousepos.x >= rd->getViewport().width()-1 || mousepos.y >= rd->getViewport().height()-1)
{
mouseOnScreen = false;
rd->window()->setInputCaptureCount(0);
@@ -591,7 +1046,11 @@ void Demo::onGraphics(RenderDevice* rd) {
LightingParameters lighting(G3D::toSeconds(11, 00, 00, AM));
app->renderDevice->setProjectionAndCameraMatrix(app->debugCamera);
+
+
+
+
// Cyan background
app->renderDevice->setColorClearValue(Color3(0.0f, 0.5f, 1.0f));
@@ -610,7 +1069,6 @@ void Demo::onGraphics(RenderDevice* rd) {
makeFlag(Vector3(-1, 3.5, 0), rd);
-
app->renderDevice->setLight(0, GLight::directional(lighting.lightDirection, lighting.lightColor));
app->renderDevice->setAmbientLightColor(lighting.ambient);
@@ -622,10 +1080,17 @@ void Demo::onGraphics(RenderDevice* rd) {
{
PhysicalInstance* part = (PhysicalInstance*)instance;
Vector3 size = part->size;
- Vector3 pos = part->position;
+ Vector3 pos = part->getCFrame().translation;
+ rd->setObjectToWorldMatrix(CoordinateFrame());
Vector3 pos2 = Vector3((pos.x-size.x/2)/2,(pos.y-size.y/2)/2,(pos.z-size.z/2)/2);
Vector3 pos3 = Vector3((pos.x+size.x/2)/2,(pos.y+size.y/2)/2,(pos.z+size.z/2)/2);
- Draw::box(Box(pos2 ,pos3), app->renderDevice, part->color, Color4::clear());
+ Box box = Box(Vector3(0+size.x/4, 0+size.y/4, 0+size.z/4) ,Vector3(0-size.x/4,0-size.y/4,0-size.z/4));
+ CoordinateFrame c = CoordinateFrame(part->getCFrame().rotation,Vector3(part->getCFrame().translation.x/2, part->getCFrame().translation.y/2, part->getCFrame().translation.z/2));
+ Draw::box(c.toWorldSpace(box), app->renderDevice, part->color, Color4::clear());
+ if(selectedInstance == part)
+ {
+ drawOutline(Vector3(0+size.x/4, 0+size.y/4, 0+size.z/4) ,Vector3(0-size.x/4,0-size.y/4,0-size.z/4), rd, lighting, Vector3(size.x/2, size.y/2, size.z/2), Vector3(pos.x/2, pos.y/2, pos.z/2), c);
+ }
}
@@ -691,52 +1156,20 @@ void Demo::onGraphics(RenderDevice* rd) {
//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));
- fntlighttrek->draw2D(rd,"UnGroup", Vector2(10,195+offset), 12, Color3::white(), Color4(0.5F,0.5F,0.5F,0.5F));
- fntlighttrek->draw2D(rd,"Duplicate", Vector2(10,220+offset), 12, Color3::white(), Color4(0.5F,0.5F,0.5F,0.5F));
- fntlighttrek->draw2D(rd,"MENU", Vector2(10,305+offset), 16, Color3::white(), Color4(0.5F,0.5F,0.5F,0.5F));
+ Draw::box(G3D::Box(Vector3(5, 185+offset,0),Vector3(75, 185+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,190+offset), 12, Color3::white(), Color4(0.5F,0.5F,0.5F,0.5F));
+ fntlighttrek->draw2D(rd,"UnGroup", Vector2(10,215+offset), 12, Color3::white(), Color4(0.5F,0.5F,0.5F,0.5F));
+ fntlighttrek->draw2D(rd,"Duplicate", Vector2(10,240+offset), 12, Color3::white(), Color4(0.5F,0.5F,0.5F,0.5F));
+ fntlighttrek->draw2D(rd,"MENU", Vector2(10,307+offset), 14, Color3::white(), Color4(0.5F,0.5F,0.5F,0.5F));
//G3D::GFont::draw2D("Debug Mode Enabled", Vector2(0,30), 20, Color3::white(), Color3::black());
//app->debugFont->draw2D("Dynamica 2004-2005 Simulation Client version " + VERSION + str, Vector2(0,0), 20, Color3::white(), Color3::black());
//app->debugFont->draw2D("Debug Mode Enabled", Vector2(0,30), 20, Color3::white(), Color3::black());
-
+ drawButtons(rd);
rd->pushState();
rd->beforePrimitive();
-
-
- 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 );
-
-
-
-
if(showMouse && mouseOnScreen)
{
glEnable( GL_TEXTURE_2D );
@@ -770,24 +1203,25 @@ void Demo::onGraphics(RenderDevice* rd) {
- drawButtons(rd);
+
app->renderDevice->pop2D();
+
+
+
}
void App::main() {
+ usableApp = this;
setDebugMode(false);
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"));
- cursor = Texture::fromFile(GetFileInPath("/content/cursor.png"));
- go_id = go->getOpenGLID();
- go_dn_id = go_dn->getOpenGLID();
- go_ovr_id = go_ovr->getOpenGLID();
+ cursor = Texture::fromFile(GetFileInPath("/content/cursor2.png"));
fntdominant = GFont::fromFile(GetFileInPath("/content/font/dominant.fnt"));
fntlighttrek = GFont::fromFile(GetFileInPath("/content/font/lighttrek.fnt"));
sky = Sky::create(NULL, ExePath() + "/content/sky/");
@@ -797,8 +1231,21 @@ void App::main() {
-App::App(const GAppSettings& settings, GWindow* wnd) : GApp(settings, wnd) {
+//App::App(const GAppSettings& settings, GWindow* wnd) : GApp(settings, wnd) {
+// applet = new Demo(this);
+//}
+
+App::App(const GAppSettings& settings, GWindow* wnd,HWND tempMainHWnd, SDLWindow* wndSDL) : GApp(settings, wnd) {
applet = new Demo(this);
+ hwnd = wndSDL->win32HWND();
+ mainHWnd = tempMainHWnd;
+ propertyHWnd = CreateWindowEx(
+ WS_EX_TOOLWINDOW,
+ "ToolWindowClass", "ToolWindow",
+ WS_SYSMENU | WS_THICKFRAME | WS_VISIBLE | WS_CHILD,
+ 200, 700, 400, 64,
+ mainHWnd, NULL, GetModuleHandle(0), NULL
+ );
}
@@ -809,16 +1256,41 @@ App::~App() {
LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
+ App *app = (App *)GetWindowLongPtr(hwnd, GWL_USERDATA);
switch(msg)
{
case WM_CLOSE:
- DestroyWindow(hwnd);
+ if (app != 0)
+ {
+
+ HWND g3DWind = app->getHWND();
+ app->applet->exitApplication();
+ //DestroyWindow(hwnd);
+ }
+ //DestroyWindow(hwnd);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
+ case WM_SIZE:
+ if(app != 0)
+ {
+ HWND g3DWind = app->getHWND();
+ int width = 640;
+ int height = 480;
+ RECT rect;
+ if(GetClientRect(hwnd, &rect))
+ {
+ width = rect.right - rect.left;
+ height = rect.bottom - rect.top;
+ }
+ SetWindowPos(g3DWind, NULL, 0, 0, width, height, NULL);
+ }
+ break;
default:
+ {
return DefWindowProc(hwnd, msg, wParam, lParam);
+ }
}
return 0;
}
@@ -828,20 +1300,95 @@ int main(int argc, char** argv) {
//_CrtSetBreakAlloc(1279);
GAppSettings settings;
- 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.window.fsaaSamples = 8;
settings.writeLicenseFile = false;
-
+ settings.window.center = true;
//Using the damned SDL window now
SDLWindow* wnd = new SDLWindow(settings.window);
//wnd->setInputCaptureCount(200);
wnd->setMouseVisible(false);
- App app = App(settings, wnd);
- HWND hwnd = wnd->win32HWND();
+
+
+ WNDCLASSEX wc;
+ HINSTANCE hInstance = GetModuleHandle(NULL);
+ wc.cbSize = sizeof(WNDCLASSEX);
+ wc.style = 0;
+ wc.lpfnWndProc = WndProc;
+ wc.cbClsExtra = 0;
+ wc.cbWndExtra = 0;
+ wc.hInstance = hInstance;
+ wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
+ wc.hCursor = LoadCursor(NULL, IDC_ARROW);
+ wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
+ wc.lpszMenuName = NULL;
+ wc.lpszClassName = "containerHWND";
+ wc.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
+
+ if (!RegisterClassEx (&wc))
+ return false;
+
+ HMODULE hThisInstance = GetModuleHandle(NULL);
+ HWND hwnd = wnd->win32HWND();
+ HWND hwndMain = CreateWindowEx(
+ WS_EX_ACCEPTFILES | WS_EX_CLIENTEDGE,
+ "containerHWND",
+ "Main test",
+ WS_OVERLAPPEDWINDOW,
+ CW_USEDEFAULT,
+ CW_USEDEFAULT,
+ 800,
+ 600,
+ NULL, // parent
+ NULL, // menu
+ hThisInstance,
+ NULL
+ );
+ ShowWindow(hwndMain, SW_SHOW);
+ if(hwndMain == NULL)
+ {
+ MessageBox(NULL, "Failed to create HWND","Dynamica Crash", MB_OK);
+ return 0;
+ }
+ SetParent(hwnd, hwndMain);
+ App app = App(settings, wnd, hwndMain, wnd);
+ RECT rect;
+ int width = 640;
+ int height = 480;
+ if(GetClientRect(hwndMain, &rect))
+ {
+ width = rect.right - rect.left;
+ height = rect.bottom - rect.top;
+ }
+ SetWindowPos(hwnd, NULL, 0, 0, width, height, NULL);
+
+ LONG lStyle = GetWindowLong(hwnd, GWL_STYLE);
+ lStyle &= ~(WS_CAPTION | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_SYSMENU);
+ SetWindowLong(hwnd, GWL_STYLE, lStyle);
+
+ LONG lExStyle = GetWindowLong(hwnd, GWL_EXSTYLE);
+ lExStyle &= ~(WS_EX_DLGMODALFRAME | WS_EX_CLIENTEDGE | WS_EX_STATICEDGE);
+ SetWindowLong(hwnd, GWL_EXSTYLE, lExStyle);
+
+ //SetWindowLong(hwnd, GWL_STYLE, WS_VISIBLE | WS_CHILD);
+ SetWindowLongPtr(hwndMain, GWL_USERDATA, (LONG)&app);
+ HICON hicon = (HICON)LoadImage(GetModuleHandleW(NULL), (LPCSTR)MAKEINTRESOURCEW(IDI_ICON1), IMAGE_ICON, 0, 0, LR_DEFAULTCOLOR | LR_DEFAULTSIZE);
+ SendMessage(hwndMain, WM_SETICON, ICON_BIG, (LPARAM)hicon);
+
+
+
+ SetWindowPos(hwndMain, NULL, 0, 0, 800, 600, NULL);
+ HMONITOR monitor = MonitorFromWindow(hwndMain, MONITOR_DEFAULTTONEAREST);
+ MONITORINFO lpmi;
+ GetMonitorInfo( monitor, &lpmi);
+
+ int widthMON = lpmi.rcMonitor.bottom;
+ int heightMON = lpmi.rcMonitor.right;
+
+ //message = Convert(widthMON) + ", " + Convert(heightMON);
+ //messageTime = G3D::System::time();
+
app.run();
return 0;
}
diff --git a/resource.h b/resource.h
index 3d988c8..56d9469 100644
--- a/resource.h
+++ b/resource.h
@@ -3,14 +3,17 @@
// Used by Dialogs.rc
//
#define IDD_ABOUT_DIALOG 102
+#define IDD_TOOLBOX 103
+#define IDI_ICON1 106
+#define IDC_TOOLBOX_BROWSER 1001
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 105
+#define _APS_NEXT_RESOURCE_VALUE 107
#define _APS_NEXT_COMMAND_VALUE 40004
-#define _APS_NEXT_CONTROL_VALUE 1001
+#define _APS_NEXT_CONTROL_VALUE 1002
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif