Merge pull request #24 from andreja6/master
Request to merge master into MusicalProgrammer branch, to work on bevels.
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -51,3 +51,5 @@ log.txt
|
|||||||
G3DTest.suo
|
G3DTest.suo
|
||||||
G3DTest.suo
|
G3DTest.suo
|
||||||
stderr.txt
|
stderr.txt
|
||||||
|
desktop.ini
|
||||||
|
main.cpp
|
||||||
|
|||||||
@@ -1,15 +1,12 @@
|
|||||||
#include "BaseButtonInstance.h"
|
#include "BaseButtonInstance.h"
|
||||||
#include "Globals.h"
|
#include "Globals.h"
|
||||||
|
|
||||||
bool floatBottom = false;
|
|
||||||
bool floatRight = false;
|
|
||||||
bool floatCenter = false;
|
|
||||||
bool disabled = false;
|
|
||||||
bool selected = false;
|
|
||||||
ButtonListener* listener = NULL;
|
ButtonListener* listener = NULL;
|
||||||
|
|
||||||
BaseButtonInstance::BaseButtonInstance(void)
|
BaseButtonInstance::BaseButtonInstance(void)
|
||||||
{
|
{
|
||||||
|
Instance::Instance();
|
||||||
listener = NULL;
|
listener = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ public:
|
|||||||
bool floatBottom;
|
bool floatBottom;
|
||||||
bool floatRight;
|
bool floatRight;
|
||||||
bool floatCenter;
|
bool floatCenter;
|
||||||
bool disabled;
|
volatile bool disabled;
|
||||||
bool selected;
|
bool selected;
|
||||||
protected:
|
protected:
|
||||||
bool mouseInArea(float, float, float, float, float, float);
|
bool mouseInArea(float, float, float, float, float, float);
|
||||||
|
|||||||
9
BrowserCallHandler.cpp
Normal file
9
BrowserCallHandler.cpp
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
#include "BrowserCallHandler.h"
|
||||||
|
|
||||||
|
BrowserCallHandler::BrowserCallHandler(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
BrowserCallHandler::~BrowserCallHandler(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
8
BrowserCallHandler.h
Normal file
8
BrowserCallHandler.h
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
#pragma once
|
||||||
|
#include <Mshtmhst.h>
|
||||||
|
class BrowserCallHandler : IDocHostUIHandler
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
BrowserCallHandler(void);
|
||||||
|
~BrowserCallHandler(void);
|
||||||
|
};
|
||||||
@@ -196,11 +196,17 @@ void CameraController::update(Demo* demo)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(rightButtonHolding) {
|
if(rightButtonHolding) {
|
||||||
|
Globals::useMousePoint = true;
|
||||||
|
Globals::mousepoint = oldDesktopMouse;
|
||||||
POINT mouse;
|
POINT mouse;
|
||||||
GetCursorPos(&mouse);
|
GetCursorPos(&mouse);
|
||||||
pan(&frame,(mouse.x-oldDesktopMouse.x)/100.f,(mouse.y-oldDesktopMouse.y)/100.f);
|
pan(&frame,(mouse.x-oldDesktopMouse.x)/100.f,(mouse.y-oldDesktopMouse.y)/100.f);
|
||||||
SetCursorPos(oldDesktopMouse.x,oldDesktopMouse.y);
|
SetCursorPos(oldDesktopMouse.x,oldDesktopMouse.y);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Globals::useMousePoint = false;
|
||||||
|
}
|
||||||
|
|
||||||
if(GetHoldKeyState(VK_RSHIFT) || GetHoldKeyState(VK_LSHIFT)) {
|
if(GetHoldKeyState(VK_RSHIFT) || GetHoldKeyState(VK_LSHIFT)) {
|
||||||
moveRate = 1;
|
moveRate = 1;
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
#include <G3DAll.h>
|
#include <G3DAll.h>
|
||||||
#include "Instance.h"
|
#include "Instance.h"
|
||||||
|
#include "Globals.h"
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#define CAM_ZOOM_MIN 0.1f
|
#define CAM_ZOOM_MIN 0.1f
|
||||||
|
|||||||
@@ -1,18 +1,12 @@
|
|||||||
#include "DataModelInstance.h"
|
#include "DataModelInstance.h"
|
||||||
|
|
||||||
|
|
||||||
WorkspaceInstance* workspace;
|
|
||||||
Instance* guiRoot;
|
|
||||||
float mousex;
|
|
||||||
float mousey;
|
|
||||||
bool mouseButton1Down;
|
|
||||||
std::string message;
|
|
||||||
bool showMessage;
|
|
||||||
G3D::GFontRef font;
|
|
||||||
|
|
||||||
|
|
||||||
DataModelInstance::DataModelInstance(void)
|
DataModelInstance::DataModelInstance(void)
|
||||||
{
|
{
|
||||||
|
Instance::Instance();
|
||||||
workspace = new WorkspaceInstance();
|
workspace = new WorkspaceInstance();
|
||||||
guiRoot = new Instance();
|
guiRoot = new Instance();
|
||||||
children.push_back(workspace);
|
children.push_back(workspace);
|
||||||
|
|||||||
@@ -11,8 +11,12 @@ public:
|
|||||||
void setMessage(std::string);
|
void setMessage(std::string);
|
||||||
void clearMessage();
|
void clearMessage();
|
||||||
void drawMessage(RenderDevice*);
|
void drawMessage(RenderDevice*);
|
||||||
GFontRef font;
|
|
||||||
WorkspaceInstance* getWorkspace();
|
WorkspaceInstance* getWorkspace();
|
||||||
|
WorkspaceInstance* workspace;
|
||||||
|
Instance* guiRoot;
|
||||||
|
std::string message;
|
||||||
|
bool showMessage;
|
||||||
|
G3D::GFontRef font;
|
||||||
Instance* getGuiRoot();
|
Instance* getGuiRoot();
|
||||||
float mousex;
|
float mousex;
|
||||||
float mousey;
|
float mousey;
|
||||||
|
|||||||
32
Demo.h
32
Demo.h
@@ -1,10 +1,12 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include <G3DAll.h>
|
#include <G3DAll.h>
|
||||||
#include "CameraController.h"
|
#include "CameraController.h"
|
||||||
|
#include "PropertyWindow.h"
|
||||||
|
|
||||||
class Demo : public GApp {
|
class Demo { // : public GApp {
|
||||||
public:
|
public:
|
||||||
Demo(const GAppSettings& settings,Win32Window* wind);
|
Demo(const GAppSettings& settings,HWND parentWindow);
|
||||||
|
void Boop();
|
||||||
virtual ~Demo() {}
|
virtual ~Demo() {}
|
||||||
virtual void exitApplication();
|
virtual void exitApplication();
|
||||||
virtual void onInit();
|
virtual void onInit();
|
||||||
@@ -15,22 +17,42 @@ class Demo : public GApp {
|
|||||||
virtual void onUserInput(UserInput* ui);
|
virtual void onUserInput(UserInput* ui);
|
||||||
virtual void onCleanup();
|
virtual void onCleanup();
|
||||||
|
|
||||||
Instance* getSelection();
|
std::vector<Instance*> getSelection();
|
||||||
|
void run();
|
||||||
void QuitApp();
|
void QuitApp();
|
||||||
|
void resizeWithParent(HWND parentWindow);
|
||||||
|
void onCreate(HWND parentWindow);
|
||||||
void onKeyPressed(int key);
|
void onKeyPressed(int key);
|
||||||
void onKeyUp(int key);
|
void onKeyUp(int key);
|
||||||
void onMouseLeftPressed(int x, int y);
|
void onMouseLeftPressed(HWND hwnd,int x, int y);
|
||||||
void onMouseLeftUp(int x, int y);
|
void onMouseLeftUp(int x, int y);
|
||||||
void onMouseRightPressed(int x, int y);
|
void onMouseRightPressed(int x, int y);
|
||||||
void onMouseRightUp(int x, int y);
|
void onMouseRightUp(int x, int y);
|
||||||
void onMouseMoved(int x, int y);
|
void onMouseMoved(int x, int y);
|
||||||
void onMouseWheel(int x, int y, short delta);
|
void onMouseWheel(int x, int y, short delta);
|
||||||
|
|
||||||
CameraController cameraController;
|
CameraController cameraController;
|
||||||
|
RenderDevice* renderDevice;
|
||||||
|
UserInput* userInput;
|
||||||
|
PropertyWindow* _propWindow;
|
||||||
private:
|
private:
|
||||||
void initGUI();
|
void initGUI();
|
||||||
HWND hWndMain;
|
HWND _hWndMain;
|
||||||
SkyRef sky;
|
SkyRef sky;
|
||||||
bool quit;
|
bool quit;
|
||||||
|
bool mouseOnScreen;
|
||||||
bool rightButtonHolding;
|
bool rightButtonHolding;
|
||||||
void main();
|
void main();
|
||||||
|
GWindow* _window;
|
||||||
|
HWND _hwndToolbox;
|
||||||
|
HWND _buttonTest;
|
||||||
|
HWND _hwndRenderer;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
Stopwatch m_graphicsWatch;
|
||||||
|
Stopwatch m_logicWatch;
|
||||||
|
Stopwatch m_networkWatch;
|
||||||
|
Stopwatch m_userInputWatch;
|
||||||
|
Stopwatch m_simulationWatch;
|
||||||
|
Stopwatch m_waitWatch;
|
||||||
};
|
};
|
||||||
|
|||||||
BIN
Dialogs.aps
BIN
Dialogs.aps
Binary file not shown.
76
Dialogs.rc
76
Dialogs.rc
@@ -7,7 +7,7 @@
|
|||||||
//
|
//
|
||||||
// Generated from the TEXTINCLUDE 2 resource.
|
// Generated from the TEXTINCLUDE 2 resource.
|
||||||
//
|
//
|
||||||
#include "afxres.h"
|
#include "windows.h"
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
#undef APSTUDIO_READONLY_SYMBOLS
|
#undef APSTUDIO_READONLY_SYMBOLS
|
||||||
@@ -34,7 +34,7 @@ END
|
|||||||
|
|
||||||
2 TEXTINCLUDE
|
2 TEXTINCLUDE
|
||||||
BEGIN
|
BEGIN
|
||||||
"#include ""afxres.h""\r\n"
|
"#include ""windows.h""\r\n"
|
||||||
"\0"
|
"\0"
|
||||||
END
|
END
|
||||||
|
|
||||||
@@ -46,37 +46,6 @@ END
|
|||||||
|
|
||||||
#endif // APSTUDIO_INVOKED
|
#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
|
#endif // English (U.S.) resources
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
@@ -90,40 +59,6 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_CAN
|
|||||||
#pragma code_page(1252)
|
#pragma code_page(1252)
|
||||||
#endif //_WIN32
|
#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
|
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Icon
|
// Icon
|
||||||
@@ -132,6 +67,13 @@ END
|
|||||||
// Icon with lowest ID value placed first to ensure application icon
|
// Icon with lowest ID value placed first to ensure application icon
|
||||||
// remains consistent on all systems.
|
// remains consistent on all systems.
|
||||||
IDI_ICON1 ICON "icon1.ico"
|
IDI_ICON1 ICON "icon1.ico"
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Bitmap
|
||||||
|
//
|
||||||
|
|
||||||
|
IDB_BITMAP1 BITMAP "Parts.bmp"
|
||||||
#endif // English (Canada) resources
|
#endif // English (Canada) resources
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|||||||
9
Enum.h
Normal file
9
Enum.h
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
namespace Enum
|
||||||
|
{
|
||||||
|
namespace SurfaceType
|
||||||
|
{
|
||||||
|
enum Value {
|
||||||
|
Smooth, Bumps, Welds, Glue
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
14
Enums.h
Normal file
14
Enums.h
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
#ifndef ENUM_H
|
||||||
|
#define ENUM_H
|
||||||
|
static enum BinType {GameTool, Grab, Clone, Hammer};
|
||||||
|
static enum ControllerType {None, KeyboardRight, KeyboardLeft, Joypad1, Joypad2, Chase, Flee};
|
||||||
|
//static enum JointType {UNK0, WeldJoint, SnapJoint, UNK3, Rotate, RotateP, RotateV, GlueJoint, UNK8, UNK9, None};
|
||||||
|
static enum ActionType {Nothing, Pause, Lose, Draw, Win};
|
||||||
|
static enum AffectType {NoChange, Increase, Decrease};
|
||||||
|
static enum InputType {NoInput, LeftTread, RightTread, Steer, Throtle, UpDown, Action1, Action2, Action3, Action4, Action5, Constant, Sin};
|
||||||
|
//static enum SurfaceConstraint {None, Hinge, SteppingMotor, Motor};
|
||||||
|
static enum SurfaceType{Smooth, Snaps, Inlets, Glue, Weld, Hinge, Motor, Bumps};
|
||||||
|
static enum SoundType {NoSound, Boing, Bomb, Break, Click, Clock, Slingshot, Page, Ping, Snap, Splat, Step, StepOn, Swoosh, Victory};
|
||||||
|
static enum PartType {Ball, Block, Cylinder};
|
||||||
|
static enum KeywordFilterType {Include, Exclude};
|
||||||
|
#endif
|
||||||
BIN
G3DTest.aps
Normal file
BIN
G3DTest.aps
Normal file
Binary file not shown.
@@ -21,6 +21,7 @@
|
|||||||
ConfigurationType="1"
|
ConfigurationType="1"
|
||||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
|
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
|
||||||
UseOfMFC="0"
|
UseOfMFC="0"
|
||||||
|
UseOfATL="0"
|
||||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||||
CharacterSet="2"
|
CharacterSet="2"
|
||||||
>
|
>
|
||||||
@@ -73,6 +74,7 @@
|
|||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCLinkerTool"
|
Name="VCLinkerTool"
|
||||||
|
AdditionalDependencies="Advapi32.lib UxTheme.lib Comctl32.lib Comdlg32.lib Shell32.lib"
|
||||||
OutputFile="./G3DTest.exe"
|
OutputFile="./G3DTest.exe"
|
||||||
LinkIncremental="1"
|
LinkIncremental="1"
|
||||||
SuppressStartupBanner="true"
|
SuppressStartupBanner="true"
|
||||||
@@ -145,7 +147,8 @@
|
|||||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
|
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
|
||||||
MinimalRebuild="false"
|
MinimalRebuild="false"
|
||||||
BasicRuntimeChecks="0"
|
BasicRuntimeChecks="0"
|
||||||
RuntimeLibrary="2"
|
RuntimeLibrary="3"
|
||||||
|
EnableFunctionLevelLinking="false"
|
||||||
PrecompiledHeaderFile=".\Debug/G3DTest.pch"
|
PrecompiledHeaderFile=".\Debug/G3DTest.pch"
|
||||||
AssemblerListingLocation=".\Debug/"
|
AssemblerListingLocation=".\Debug/"
|
||||||
ObjectFile=".\Debug/"
|
ObjectFile=".\Debug/"
|
||||||
@@ -167,12 +170,13 @@
|
|||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCLinkerTool"
|
Name="VCLinkerTool"
|
||||||
|
AdditionalDependencies="Advapi32.lib UxTheme.lib Comctl32.lib Comdlg32.lib Shell32.lib"
|
||||||
OutputFile="./G3DTest-Debug.exe"
|
OutputFile="./G3DTest-Debug.exe"
|
||||||
LinkIncremental="2"
|
LinkIncremental="2"
|
||||||
SuppressStartupBanner="true"
|
SuppressStartupBanner="true"
|
||||||
GenerateDebugInformation="true"
|
GenerateDebugInformation="true"
|
||||||
ProgramDatabaseFile=".\Debug/G3DTest.pdb"
|
ProgramDatabaseFile=".\Debug/G3DTest.pdb"
|
||||||
SubSystem="2"
|
SubSystem="1"
|
||||||
TargetMachine="1"
|
TargetMachine="1"
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
@@ -234,6 +238,14 @@
|
|||||||
RelativePath=".\AudioPlayer.cpp"
|
RelativePath=".\AudioPlayer.cpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\ax.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\BrowserCallHandler.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\ButtonListener.cpp"
|
RelativePath=".\ButtonListener.cpp"
|
||||||
>
|
>
|
||||||
@@ -243,11 +255,19 @@
|
|||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\Dialogs.rc"
|
RelativePath=".\Globals.cpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\Globals.cpp"
|
RelativePath=".\IEBrowser.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\IEBrowser.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\IEDispatcher.cpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
@@ -270,6 +290,18 @@
|
|||||||
/>
|
/>
|
||||||
</FileConfiguration>
|
</FileConfiguration>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\propertyGrid.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\PropertyWindow.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\WindowFunctions.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<Filter
|
<Filter
|
||||||
Name="Instance"
|
Name="Instance"
|
||||||
>
|
>
|
||||||
@@ -311,6 +343,14 @@
|
|||||||
RelativePath=".\AudioPlayer.h"
|
RelativePath=".\AudioPlayer.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\ax.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\BrowserCallHandler.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\ButtonListener.h"
|
RelativePath=".\ButtonListener.h"
|
||||||
>
|
>
|
||||||
@@ -323,10 +363,30 @@
|
|||||||
RelativePath=".\Demo.h"
|
RelativePath=".\Demo.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\Enum.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\Enums.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\Globals.h"
|
RelativePath=".\Globals.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\IEDispatcher.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\propertyGrid.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\PropertyWindow.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\resource.h"
|
RelativePath=".\resource.h"
|
||||||
>
|
>
|
||||||
@@ -335,6 +395,10 @@
|
|||||||
RelativePath=".\win32Defines.h"
|
RelativePath=".\win32Defines.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\WindowFunctions.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<Filter
|
<Filter
|
||||||
Name="Instance"
|
Name="Instance"
|
||||||
>
|
>
|
||||||
@@ -372,10 +436,18 @@
|
|||||||
Name="Resource Files"
|
Name="Resource Files"
|
||||||
Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
||||||
>
|
>
|
||||||
|
<File
|
||||||
|
RelativePath=".\Dialogs.rc"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\icon1.ico"
|
RelativePath=".\icon1.ico"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\Parts.bmp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
</Filter>
|
</Filter>
|
||||||
</Files>
|
</Files>
|
||||||
<Globals>
|
<Globals>
|
||||||
|
|||||||
@@ -5,7 +5,14 @@ int const Globals::gen = 0;
|
|||||||
int const Globals::major = 0;
|
int const Globals::major = 0;
|
||||||
int const Globals::minor = 4;
|
int const Globals::minor = 4;
|
||||||
int const Globals::patch = 2;
|
int const Globals::patch = 2;
|
||||||
|
int Globals::surfaceId = 2;
|
||||||
|
bool Globals::showMouse = true;
|
||||||
|
bool Globals::useMousePoint = false;
|
||||||
|
|
||||||
|
const std::string Globals::PlaceholderName = "Dynamica";
|
||||||
|
std::vector<Instance*> g_selectedInstances = std::vector<Instance*>();
|
||||||
|
G3D::TextureRef Globals::surface;
|
||||||
|
POINT Globals::mousepoint;
|
||||||
Globals::Globals(void){}
|
Globals::Globals(void){}
|
||||||
|
|
||||||
Globals::~Globals(void){}
|
Globals::~Globals(void){}
|
||||||
|
|||||||
11
Globals.h
11
Globals.h
@@ -1,5 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "DataModelInstance.h"
|
#include "DataModelInstance.h"
|
||||||
|
#include <G3DAll.h>
|
||||||
|
|
||||||
class Globals
|
class Globals
|
||||||
{
|
{
|
||||||
@@ -7,8 +8,16 @@ public:
|
|||||||
Globals(void);
|
Globals(void);
|
||||||
~Globals(void);
|
~Globals(void);
|
||||||
static DataModelInstance* dataModel;
|
static DataModelInstance* dataModel;
|
||||||
|
static bool showMouse;
|
||||||
|
static POINT mousepoint;
|
||||||
|
static bool useMousePoint;
|
||||||
static const int gen;
|
static const int gen;
|
||||||
static const int major;
|
static const int major;
|
||||||
static const int minor;
|
static const int minor;
|
||||||
static const int patch;
|
static const int patch;
|
||||||
};
|
static G3D::TextureRef surface;
|
||||||
|
static int surfaceId;
|
||||||
|
static const std::string PlaceholderName;
|
||||||
|
};
|
||||||
|
|
||||||
|
extern std::vector<Instance*> g_selectedInstances;
|
||||||
68
IEBrowser.cpp
Normal file
68
IEBrowser.cpp
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
#ifndef WIN32_LEAN_AND_MEAN
|
||||||
|
#define WIN32_LEAN_AND_MEAN
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <windows.h>
|
||||||
|
|
||||||
|
#include "IEBrowser.h"
|
||||||
|
#include "Globals.h"
|
||||||
|
#include "ax.h"
|
||||||
|
|
||||||
|
void IEBrowser::Boop(char* test)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
IEBrowser::IEBrowser(HWND attachHWnd) {
|
||||||
|
MSG messages;
|
||||||
|
while (PeekMessage (&messages, NULL, 0, 0,PM_REMOVE))
|
||||||
|
{
|
||||||
|
if (IsDialogMessage(hwnd, &messages) == 0)
|
||||||
|
{
|
||||||
|
TranslateMessage(&messages);
|
||||||
|
DispatchMessage(&messages);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
hwnd = attachHWnd;
|
||||||
|
spDocument = 0;
|
||||||
|
webBrowser = 0;
|
||||||
|
SendMessage(hwnd,AX_INPLACE,1,0);
|
||||||
|
SendMessage(hwnd,AX_QUERYINTERFACE,(WPARAM)&IID_IWebBrowser2,(LPARAM)&webBrowser);
|
||||||
|
}
|
||||||
|
|
||||||
|
IEBrowser::~IEBrowser(void) {
|
||||||
|
if (webBrowser)
|
||||||
|
{
|
||||||
|
webBrowser->Release();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IEBrowser::navigateSyncURL(wchar_t* url)
|
||||||
|
{
|
||||||
|
MSG messages;
|
||||||
|
if (webBrowser)
|
||||||
|
{
|
||||||
|
webBrowser->Navigate(url,0,0,0,0);
|
||||||
|
for (int i=1;i<1000;i++)
|
||||||
|
{
|
||||||
|
while (PeekMessage (&messages, NULL, 0, 0,PM_REMOVE))
|
||||||
|
{
|
||||||
|
if (IsDialogMessage(hwnd, &messages) == 0)
|
||||||
|
{
|
||||||
|
TranslateMessage(&messages);
|
||||||
|
DispatchMessage(&messages);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Sleep(30);
|
||||||
|
HRESULT hresult = webBrowser->get_Document(&spDocument);
|
||||||
|
if (&spDocument!=0)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MessageBox(NULL,"Cannot read IWebBrowser2...",(Globals::PlaceholderName+" Crash").c_str(),MB_OK);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
17
IEBrowser.h
Normal file
17
IEBrowser.h
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
//#include "WindowFunctions.h"
|
||||||
|
#pragma once
|
||||||
|
#include <mshtml.h>
|
||||||
|
#include <exdisp.h>
|
||||||
|
//#include <Mshtmhst.h>
|
||||||
|
|
||||||
|
class IEBrowser {
|
||||||
|
public:
|
||||||
|
IEBrowser(HWND attachHWnd);
|
||||||
|
~IEBrowser(void);
|
||||||
|
bool navigateSyncURL(wchar_t* url);
|
||||||
|
void Boop(char* test);
|
||||||
|
private:
|
||||||
|
IWebBrowser2* webBrowser;
|
||||||
|
HWND hwnd;
|
||||||
|
IDispatch* spDocument;
|
||||||
|
};
|
||||||
40
IEDispatcher.cpp
Normal file
40
IEDispatcher.cpp
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
#include "IEDispatcher.h"
|
||||||
|
|
||||||
|
IEDispatcher::IEDispatcher(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
IEDispatcher::~IEDispatcher(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
HRESULT STDMETHODCALLTYPE IEDispatcher::QueryInterface(const IID &riid, void **ppvObject)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
ULONG STDMETHODCALLTYPE IEDispatcher::AddRef()
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
ULONG STDMETHODCALLTYPE IEDispatcher::Release()
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
HRESULT STDMETHODCALLTYPE IEDispatcher::GetTypeInfoCount(UINT *pctinfo)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
HRESULT STDMETHODCALLTYPE IEDispatcher::GetTypeInfo(UINT, LCID, ITypeInfo **)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
HRESULT STDMETHODCALLTYPE IEDispatcher::GetIDsOfNames(const IID &, LPOLESTR *, UINT, LCID, DISPID *)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
HRESULT STDMETHODCALLTYPE IEDispatcher::Invoke(DISPID, const IID &, LCID, WORD, DISPPARAMS *, VARIANT *, EXCEPINFO *, UINT *)
|
||||||
|
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
17
IEDispatcher.h
Normal file
17
IEDispatcher.h
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "oaidl.h"
|
||||||
|
|
||||||
|
class IEDispatcher : public IDispatch
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
IEDispatcher(void);
|
||||||
|
~IEDispatcher(void);
|
||||||
|
HRESULT STDMETHODCALLTYPE IEDispatcher::QueryInterface(const IID &riid, void **ppvObject);
|
||||||
|
ULONG STDMETHODCALLTYPE IEDispatcher::AddRef();
|
||||||
|
ULONG STDMETHODCALLTYPE IEDispatcher::Release();
|
||||||
|
HRESULT STDMETHODCALLTYPE IEDispatcher::GetTypeInfoCount(UINT *pctinfo);
|
||||||
|
HRESULT STDMETHODCALLTYPE IEDispatcher::GetTypeInfo(UINT, LCID, ITypeInfo **);
|
||||||
|
HRESULT STDMETHODCALLTYPE IEDispatcher::GetIDsOfNames(const IID &, LPOLESTR *, UINT, LCID, DISPID *);
|
||||||
|
HRESULT STDMETHODCALLTYPE IEDispatcher::Invoke(DISPID, const IID &, LCID, WORD, DISPPARAMS *, VARIANT *, EXCEPINFO *, UINT *);
|
||||||
|
|
||||||
|
};
|
||||||
@@ -1,17 +1,8 @@
|
|||||||
#include "ImageButtonInstance.h"
|
#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;
|
|
||||||
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)
|
ImageButtonInstance::ImageButtonInstance(G3D::TextureRef newImage, G3D::TextureRef overImage = NULL, G3D::TextureRef downImage = NULL, G3D::TextureRef disableImage = NULL)
|
||||||
{
|
{
|
||||||
|
BaseButtonInstance::BaseButtonInstance();
|
||||||
image = newImage;
|
image = newImage;
|
||||||
openGLID = image->getOpenGLID();
|
openGLID = image->getOpenGLID();
|
||||||
image_ovr = overImage;
|
image_ovr = overImage;
|
||||||
@@ -94,7 +85,7 @@ void ImageButtonInstance::drawObj(RenderDevice* rd, Vector2 mousePos, bool mouse
|
|||||||
positionRelative = Vector2(rd->getWidth() + position.x, position.y);
|
positionRelative = Vector2(rd->getWidth() + position.x, position.y);
|
||||||
}
|
}
|
||||||
int renderimage = openGLID;
|
int renderimage = openGLID;
|
||||||
if(selected == true && !image_dn.isNull())
|
if(selected == true && !image_dn.isNull() && !disabled)
|
||||||
{
|
{
|
||||||
renderimage = openGLID_dn;
|
renderimage = openGLID_dn;
|
||||||
}
|
}
|
||||||
|
|||||||
65
Instance.cpp
65
Instance.cpp
@@ -2,18 +2,25 @@
|
|||||||
#include <G3DAll.h>
|
#include <G3DAll.h>
|
||||||
#include "Instance.h"
|
#include "Instance.h"
|
||||||
|
|
||||||
std::string name;
|
|
||||||
Instance* parent = NULL;
|
|
||||||
std::vector<Instance* > children;
|
|
||||||
static std::string className = "BaseInstance";
|
|
||||||
|
|
||||||
Instance::Instance(void)
|
Instance::Instance(void)
|
||||||
{
|
{
|
||||||
parent = NULL;
|
parent = NULL;
|
||||||
name = "Default Game Instance";
|
name = "Default Game Instance";
|
||||||
className = "BaseInstance";
|
className = "BaseInstance";
|
||||||
|
listicon = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Instance::Instance(const Instance &oinst)
|
||||||
|
{
|
||||||
|
|
||||||
|
name = oinst.name;
|
||||||
|
className = oinst.className;
|
||||||
|
//setParent(oinst.parent);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void Instance::render(RenderDevice* rd)
|
void Instance::render(RenderDevice* rd)
|
||||||
{
|
{
|
||||||
for(size_t i = 0; i < children.size(); i++)
|
for(size_t i = 0; i < children.size(); i++)
|
||||||
@@ -22,6 +29,45 @@ void Instance::render(RenderDevice* rd)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
PROPGRIDITEM Instance::createPGI(LPSTR catalog, LPSTR propName, LPSTR propDesc, LPARAM curVal, INT type)
|
||||||
|
{
|
||||||
|
PROPGRIDITEM pItem;
|
||||||
|
PropGrid_ItemInit(pItem);
|
||||||
|
pItem.lpszCatalog=catalog;
|
||||||
|
pItem.lpszPropName=propName;
|
||||||
|
pItem.lpszPropDesc=propDesc;
|
||||||
|
pItem.lpCurValue=curVal;
|
||||||
|
pItem.iItemType=type;
|
||||||
|
return pItem;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Instance::PropUpdate(LPPROPGRIDITEM &item)
|
||||||
|
{
|
||||||
|
if(strcmp(item->lpszPropName, "Name") == 0)
|
||||||
|
{
|
||||||
|
name = (LPSTR)item->lpCurValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<PROPGRIDITEM> Instance::getProperties()
|
||||||
|
{
|
||||||
|
std::vector<PROPGRIDITEM> properties;
|
||||||
|
|
||||||
|
|
||||||
|
properties.push_back(createPGI(
|
||||||
|
"Properties",
|
||||||
|
"Name",
|
||||||
|
"The name of this instance",
|
||||||
|
(LPARAM)name.c_str(),
|
||||||
|
PIT_EDIT
|
||||||
|
));
|
||||||
|
return properties;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Instance::~Instance(void)
|
Instance::~Instance(void)
|
||||||
{
|
{
|
||||||
for(size_t i = 0; i < children.size(); i++)
|
for(size_t i = 0; i < children.size(); i++)
|
||||||
@@ -92,14 +138,15 @@ void Instance::removeChild(Instance* oldChild)
|
|||||||
|
|
||||||
Instance* Instance::findFirstChild(std::string name)
|
Instance* Instance::findFirstChild(std::string name)
|
||||||
{
|
{
|
||||||
Instance* child = NULL;
|
|
||||||
for(size_t i = 0; i < children.size(); i++)
|
for(size_t i = 0; i < children.size(); i++)
|
||||||
{
|
{
|
||||||
if(children.at(i)->name == name)
|
if(children.at(i)->name.compare(name) == 0)
|
||||||
{
|
{
|
||||||
child = children.at(i);
|
return children.at(i);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return child;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
14
Instance.h
14
Instance.h
@@ -1,23 +1,31 @@
|
|||||||
#include <G3DAll.h>
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
#include <G3DAll.h>
|
||||||
|
#include "propertyGrid.h"
|
||||||
class Instance
|
class Instance
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Instance(void);
|
Instance(void);
|
||||||
|
Instance(const Instance&);
|
||||||
virtual ~Instance(void);
|
virtual ~Instance(void);
|
||||||
std::string name;
|
std::string name;
|
||||||
virtual void render(RenderDevice*);
|
virtual void render(RenderDevice*);
|
||||||
std::vector<Instance*> children; // All children.
|
std::vector<Instance*> children; // All children.
|
||||||
std::string getClassName();
|
std::string getClassName();
|
||||||
Instance* findFirstChild(std::string);
|
virtual Instance* findFirstChild(std::string);
|
||||||
std::vector<Instance* > getChildren();
|
std::vector<Instance* > getChildren();
|
||||||
std::vector<Instance* > getAllChildren();
|
std::vector<Instance* > getAllChildren();
|
||||||
void setParent(Instance*);
|
void setParent(Instance*);
|
||||||
void addChild(Instance*);
|
void addChild(Instance*);
|
||||||
void removeChild(Instance*);
|
void removeChild(Instance*);
|
||||||
Instance* getParent();
|
Instance* getParent();
|
||||||
|
virtual Instance* clone() const { return new Instance(*this); }
|
||||||
|
virtual std::vector<PROPGRIDITEM> getProperties();
|
||||||
|
virtual void PropUpdate(LPPROPGRIDITEM &pItem);
|
||||||
|
int listicon;
|
||||||
protected:
|
protected:
|
||||||
std::string className;
|
std::string className;
|
||||||
Instance* parent; // Another pointer.
|
Instance* parent; // Another pointer.
|
||||||
|
PROPGRIDITEM createPGI(LPSTR catalog, LPSTR propName, LPSTR propDesc, LPARAM curVal, INT type);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,30 +1,48 @@
|
|||||||
#include "PhysicalInstance.h"
|
#include "PhysicalInstance.h"
|
||||||
bool canCollide = true;
|
#include "Globals.h"
|
||||||
bool anchored = false;
|
|
||||||
Vector3 size;
|
|
||||||
Vector3 position;
|
|
||||||
Vector3 velocity;
|
|
||||||
Vector3 rotVelocity;
|
|
||||||
GLfloat vertecies[96];
|
|
||||||
CoordinateFrame cFrame;
|
|
||||||
Color3 color;
|
|
||||||
bool changed = true;
|
|
||||||
Box itemBox = Box();
|
|
||||||
|
|
||||||
|
|
||||||
PhysicalInstance::PhysicalInstance(void)
|
PhysicalInstance::PhysicalInstance(void)
|
||||||
{
|
{
|
||||||
name = "Default PhysicalInstance";
|
Instance::Instance();
|
||||||
|
name = "Default PhysicalInstance";
|
||||||
className = "Part";
|
className = "Part";
|
||||||
canCollide = true;
|
canCollide = true;
|
||||||
anchored = true;
|
anchored = true;
|
||||||
size = Vector3(2,1,4);
|
size = Vector3(2,1,4);
|
||||||
position = Vector3(0,0,0);
|
setCFrame(CoordinateFrame(Vector3(0,0,0)));
|
||||||
cFrame = CoordinateFrame(position);
|
|
||||||
color = Color3::gray();
|
color = Color3::gray();
|
||||||
velocity = Vector3(0,0,0);
|
velocity = Vector3(0,0,0);
|
||||||
rotVelocity = Vector3(0,0,0);
|
rotVelocity = Vector3(0,0,0);
|
||||||
|
top = Enum::SurfaceType::Smooth;
|
||||||
|
front = Enum::SurfaceType::Smooth;
|
||||||
|
right = Enum::SurfaceType::Smooth;
|
||||||
|
back = Enum::SurfaceType::Smooth;
|
||||||
|
left = Enum::SurfaceType::Smooth;
|
||||||
|
bottom = Enum::SurfaceType::Smooth;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PhysicalInstance::PhysicalInstance(const PhysicalInstance &oinst)
|
||||||
|
{
|
||||||
|
Instance::Instance(oinst);
|
||||||
|
//name = oinst.name;
|
||||||
|
//className = "Part";
|
||||||
|
canCollide = oinst.canCollide;
|
||||||
|
setParent(oinst.parent);
|
||||||
|
anchored = oinst.anchored;
|
||||||
|
size = oinst.size;
|
||||||
|
setCFrame(oinst.cFrame);
|
||||||
|
color = oinst.color;
|
||||||
|
velocity = oinst.velocity;
|
||||||
|
rotVelocity = oinst.rotVelocity;
|
||||||
|
top = oinst.top;
|
||||||
|
front = oinst.front;
|
||||||
|
right = oinst.right;
|
||||||
|
back = oinst.back;
|
||||||
|
left = oinst.left;
|
||||||
|
bottom = oinst.bottom;
|
||||||
|
}
|
||||||
|
|
||||||
void PhysicalInstance::setSize(Vector3 newSize)
|
void PhysicalInstance::setSize(Vector3 newSize)
|
||||||
{
|
{
|
||||||
int minsize = 1;
|
int minsize = 1;
|
||||||
@@ -114,22 +132,74 @@ Box PhysicalInstance::getBox()
|
|||||||
return itemBox;
|
return itemBox;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool PhysicalInstance::collides(Box box)
|
||||||
|
{
|
||||||
|
return CollisionDetection::fixedSolidBoxIntersectsFixedSolidBox(getBox(), box);
|
||||||
|
}
|
||||||
|
|
||||||
void PhysicalInstance::render(RenderDevice* rd)
|
void PhysicalInstance::render(RenderDevice* rd)
|
||||||
{
|
{
|
||||||
if(changed)
|
if(changed)
|
||||||
Box box = getBox();
|
Box box = getBox();
|
||||||
|
|
||||||
glColor(color);
|
glColor(color);
|
||||||
glBegin(GL_QUADS);
|
/*glEnable( GL_TEXTURE_2D );
|
||||||
|
glEnable(GL_BLEND);// you enable blending function
|
||||||
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
glBindTexture( GL_TEXTURE_2D, Globals::surfaceId);
|
||||||
|
glBegin(GL_QUADS);*/
|
||||||
for(int i = 0; i < 96; i+=16)
|
for(int i = 0; i < 96; i+=16)
|
||||||
{
|
{
|
||||||
|
double add = 0.8;
|
||||||
|
Enum::SurfaceType::Value face;
|
||||||
|
if(i == 0)//Back
|
||||||
|
face = back;
|
||||||
|
else if(i == 16)//Right
|
||||||
|
face = right;
|
||||||
|
else if(i == 32)//Front
|
||||||
|
face = front;
|
||||||
|
else if(i == 48)//Top
|
||||||
|
face = top;
|
||||||
|
else if(i == 64)//Left
|
||||||
|
face = left;
|
||||||
|
else if(i == 80)//Bottom
|
||||||
|
face = bottom;
|
||||||
|
|
||||||
|
/*if(face == Snaps)
|
||||||
|
add = 0.0;
|
||||||
|
else if(face == Inlets)
|
||||||
|
add = 0.2;*/
|
||||||
|
|
||||||
Vector3 v0 = Vector3(vertecies[i], vertecies[i+1], vertecies[i+2]), v1 = Vector3(vertecies[i+3], vertecies[i+4], vertecies[i+5]), v3 = Vector3(vertecies[i+9], vertecies[i+10], vertecies[i+11]);
|
Vector3 v0 = Vector3(vertecies[i], vertecies[i+1], vertecies[i+2]), v1 = Vector3(vertecies[i+3], vertecies[i+4], vertecies[i+5]), v3 = Vector3(vertecies[i+9], vertecies[i+10], vertecies[i+11]);
|
||||||
glNormal3fv((v1 - v0).cross(v3 - v0).direction());
|
/*glNormal3fv((v1 - v0).cross(v3 - v0).direction());
|
||||||
|
glTexCoord2f(0.0F,0.0F);
|
||||||
glVertex3fv(v0);
|
glVertex3fv(v0);
|
||||||
|
glTexCoord2f(1.0F,0.0F);
|
||||||
glVertex3fv(v1);
|
glVertex3fv(v1);
|
||||||
|
glTexCoord2f(1.0F,0.25F);
|
||||||
glVertex3f(vertecies[i+6], vertecies[i+7], vertecies[i+8]);
|
glVertex3f(vertecies[i+6], vertecies[i+7], vertecies[i+8]);
|
||||||
|
glTexCoord2f(0.0F,0.25F);
|
||||||
|
glVertex3fv(v3);*/
|
||||||
|
|
||||||
|
glEnable( GL_TEXTURE_2D );
|
||||||
|
glEnable(GL_BLEND);// you enable blending function
|
||||||
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
glBindTexture( GL_TEXTURE_2D, Globals::surfaceId);
|
||||||
|
glBegin( GL_QUADS );
|
||||||
|
glNormal3fv((v1 - v0).cross(v3 - v0).direction());
|
||||||
|
glTexCoord2d(0.0,0.0+add);
|
||||||
|
glVertex3fv(v0);
|
||||||
|
glTexCoord2d( 1.0,0.0+add);
|
||||||
|
glVertex3fv(v1);
|
||||||
|
glTexCoord2d(1.0,0.2+add);
|
||||||
|
glVertex3f(vertecies[i+6], vertecies[i+7], vertecies[i+8]);
|
||||||
|
glTexCoord2d( 0.0,0.2+add);
|
||||||
glVertex3fv(v3);
|
glVertex3fv(v3);
|
||||||
|
glEnd();
|
||||||
|
glDisable( GL_TEXTURE_2D );
|
||||||
}
|
}
|
||||||
glEnd();
|
/*glEnd();
|
||||||
|
glDisable(GL_TEXTURE_2D);*/
|
||||||
glColor(Color3::white());
|
glColor(Color3::white());
|
||||||
if(!children.empty())
|
if(!children.empty())
|
||||||
{
|
{
|
||||||
@@ -144,7 +214,106 @@ void PhysicalInstance::render(RenderDevice* rd)
|
|||||||
PhysicalInstance::~PhysicalInstance(void)
|
PhysicalInstance::~PhysicalInstance(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
char pto[512];
|
||||||
|
char pto2[512];
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
|
void PhysicalInstance::PropUpdate(LPPROPGRIDITEM &item)
|
||||||
|
{
|
||||||
|
if(strcmp(item->lpszPropName, "Color3") == 0)
|
||||||
|
{
|
||||||
|
color = Color3(GetRValue(item->lpCurValue)/255.0F,GetGValue(item->lpCurValue)/255.0F,GetBValue(item->lpCurValue)/255.0F);
|
||||||
|
}
|
||||||
|
else if(strcmp(item->lpszPropName, "Offset") == 0)
|
||||||
|
{
|
||||||
|
std::string str = (LPTSTR)item->lpCurValue;
|
||||||
|
std::vector<float> vect;
|
||||||
|
std::stringstream ss(str);
|
||||||
|
float i;
|
||||||
|
|
||||||
|
while (ss >> i)
|
||||||
|
{
|
||||||
|
vect.push_back(i);
|
||||||
|
|
||||||
|
if (ss.peek() == ',')
|
||||||
|
ss.ignore();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(vect.size() != 3)
|
||||||
|
{
|
||||||
|
sprintf(pto, "%g, %g, %g", cFrame.translation.x, cFrame.translation.y, cFrame.translation.z, "what");
|
||||||
|
LPCSTR str = LPCSTR(pto);
|
||||||
|
item->lpCurValue = (LPARAM)str;
|
||||||
|
MessageBox(NULL, "NO","NO", MB_OK);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Vector3 pos(vect.at(0),vect.at(1),vect.at(2));
|
||||||
|
setPosition(pos);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
else if(strcmp(item->lpszPropName, "Size") == 0)
|
||||||
|
{
|
||||||
|
std::string str = (LPTSTR)item->lpCurValue;
|
||||||
|
std::vector<float> vect;
|
||||||
|
std::stringstream ss(str);
|
||||||
|
float i;
|
||||||
|
|
||||||
|
while (ss >> i)
|
||||||
|
{
|
||||||
|
vect.push_back(i);
|
||||||
|
|
||||||
|
if (ss.peek() == ',')
|
||||||
|
ss.ignore();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(vect.size() != 3)
|
||||||
|
{
|
||||||
|
sprintf(pto, "%g, %g, %g", cFrame.translation.x, cFrame.translation.y, cFrame.translation.z, "what");
|
||||||
|
LPCSTR str = LPCSTR(pto);
|
||||||
|
item->lpCurValue = (LPARAM)str;
|
||||||
|
MessageBox(NULL, "NO","NO", MB_OK);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Vector3 size(vect.at(0),vect.at(1),vect.at(2));
|
||||||
|
setSize(size);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
else Instance::PropUpdate(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<PROPGRIDITEM> PhysicalInstance::getProperties()
|
||||||
|
{
|
||||||
|
std::vector<PROPGRIDITEM> properties = Instance::getProperties();
|
||||||
|
|
||||||
|
|
||||||
|
properties.push_back(createPGI(
|
||||||
|
"Properties",
|
||||||
|
"Color3",
|
||||||
|
"The color of the selected part",
|
||||||
|
RGB((color.r*255),(color.g*255),(color.b*255)),
|
||||||
|
PIT_COLOR
|
||||||
|
));
|
||||||
|
|
||||||
|
sprintf(pto, "%g, %g, %g", cFrame.translation.x, cFrame.translation.y, cFrame.translation.z);
|
||||||
|
properties.push_back(createPGI(
|
||||||
|
"Item",
|
||||||
|
"Offset",
|
||||||
|
"The position of the object in the workspace",
|
||||||
|
(LPARAM)pto,
|
||||||
|
PIT_EDIT
|
||||||
|
));
|
||||||
|
sprintf(pto2, "%g, %g, %g", size.x, size.y, size.z);
|
||||||
|
properties.push_back(createPGI(
|
||||||
|
"Item",
|
||||||
|
"Size",
|
||||||
|
"The position of the object in the workspace",
|
||||||
|
(LPARAM)pto2,
|
||||||
|
PIT_EDIT
|
||||||
|
));
|
||||||
|
return properties;
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,15 +1,23 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "instance.h"
|
#include "instance.h"
|
||||||
|
#include "Enum.h"
|
||||||
|
|
||||||
class PhysicalInstance :
|
class PhysicalInstance :
|
||||||
public Instance
|
public Instance
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PhysicalInstance(void);
|
PhysicalInstance(void);
|
||||||
|
PhysicalInstance(const PhysicalInstance &oinst);
|
||||||
|
Instance* clone() const { return new PhysicalInstance(*this); }
|
||||||
~PhysicalInstance(void);
|
~PhysicalInstance(void);
|
||||||
virtual void render(RenderDevice*);
|
virtual void render(RenderDevice*);
|
||||||
Vector3 velocity;
|
Vector3 velocity;
|
||||||
Vector3 rotvelocity;
|
Enum::SurfaceType::Value top;
|
||||||
|
Enum::SurfaceType::Value front;
|
||||||
|
Enum::SurfaceType::Value right;
|
||||||
|
Enum::SurfaceType::Value back;
|
||||||
|
Enum::SurfaceType::Value left;
|
||||||
|
Enum::SurfaceType::Value bottom;
|
||||||
CoordinateFrame cFrame;
|
CoordinateFrame cFrame;
|
||||||
Color3 color;
|
Color3 color;
|
||||||
Vector3 getPosition();
|
Vector3 getPosition();
|
||||||
@@ -17,10 +25,20 @@ public:
|
|||||||
CoordinateFrame getCFrame();
|
CoordinateFrame getCFrame();
|
||||||
void setCFrame(CoordinateFrame);
|
void setCFrame(CoordinateFrame);
|
||||||
Box getBox();
|
Box getBox();
|
||||||
|
Box getScaledBox();
|
||||||
CoordinateFrame getCFrameRenderBased();
|
CoordinateFrame getCFrameRenderBased();
|
||||||
Vector3 getSize();
|
Vector3 getSize();
|
||||||
void setSize(Vector3);
|
void setSize(Vector3);
|
||||||
|
bool canCollide;
|
||||||
|
bool anchored;
|
||||||
|
Vector3 rotVelocity;
|
||||||
|
bool collides(Box);
|
||||||
|
virtual std::vector<PROPGRIDITEM> getProperties();
|
||||||
|
virtual void PropUpdate(LPPROPGRIDITEM &pItem);
|
||||||
private:
|
private:
|
||||||
Vector3 position;
|
Vector3 position;
|
||||||
Vector3 size;
|
Vector3 size;
|
||||||
|
GLfloat vertecies[96];
|
||||||
|
bool changed;
|
||||||
|
Box itemBox;
|
||||||
};
|
};
|
||||||
|
|||||||
226
PropertyWindow.cpp
Normal file
226
PropertyWindow.cpp
Normal file
@@ -0,0 +1,226 @@
|
|||||||
|
#define _WINSOCKAPI_
|
||||||
|
#include <windows.h>
|
||||||
|
#include "WindowFunctions.h"
|
||||||
|
#include "resource.h"
|
||||||
|
#include "PropertyWindow.h"
|
||||||
|
#include "Globals.h"
|
||||||
|
/*typedef struct typPRGP {
|
||||||
|
Instance* instance; // Declare member types
|
||||||
|
Property ∝
|
||||||
|
} PRGP;*/
|
||||||
|
|
||||||
|
std::vector<PROPGRIDITEM> prop;
|
||||||
|
std::vector<Instance*> children;
|
||||||
|
Instance* selectedInstance;
|
||||||
|
|
||||||
|
|
||||||
|
LRESULT CALLBACK PropProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
|
{
|
||||||
|
PropertyWindow *propWind = (PropertyWindow *)GetWindowLongPtr(hwnd, GWL_USERDATA);
|
||||||
|
if (propWind==NULL)
|
||||||
|
{
|
||||||
|
return DefWindowProc(hwnd, msg, wParam, lParam);
|
||||||
|
}
|
||||||
|
switch(msg)
|
||||||
|
{
|
||||||
|
case WM_CLOSE:
|
||||||
|
{
|
||||||
|
ShowWindow(hwnd, SW_HIDE);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case WM_MEASUREITEM:
|
||||||
|
{
|
||||||
|
LPMEASUREITEMSTRUCT lpmis = (LPMEASUREITEMSTRUCT) lParam;
|
||||||
|
if (lpmis->itemHeight < 18)
|
||||||
|
lpmis->itemHeight = 18;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case WM_SIZE:
|
||||||
|
{
|
||||||
|
propWind->onResize();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case WM_COMMAND:
|
||||||
|
{
|
||||||
|
if(HIWORD(wParam) == CBN_SELCHANGE)
|
||||||
|
{
|
||||||
|
int ItemIndex = SendMessage((HWND) lParam, (UINT) CB_GETCURSEL, (WPARAM) 0, (LPARAM) 0);
|
||||||
|
CHAR ListItem[256];
|
||||||
|
SendMessage((HWND) lParam, (UINT) CB_GETLBTEXT, (WPARAM) ItemIndex, (LPARAM) ListItem);
|
||||||
|
if(ItemIndex != 0)
|
||||||
|
{
|
||||||
|
propWind->ClearProperties();
|
||||||
|
while(g_selectedInstances.size() != 0)
|
||||||
|
g_selectedInstances.erase(g_selectedInstances.begin());
|
||||||
|
g_selectedInstances.push_back(children.at(ItemIndex-1));
|
||||||
|
propWind->SetProperties(children.at(ItemIndex-1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case WM_NOTIFY:
|
||||||
|
{
|
||||||
|
switch(((LPNMHDR)lParam)->code)
|
||||||
|
{
|
||||||
|
case PGN_PROPERTYCHANGE:
|
||||||
|
{
|
||||||
|
if (IDC_PROPERTYGRID==wParam) {
|
||||||
|
LPNMHDR pnm = (LPNMHDR)lParam;
|
||||||
|
LPNMPROPGRID lpnmp = (LPNMPROPGRID)pnm;
|
||||||
|
LPPROPGRIDITEM item = PropGrid_GetItemData(pnm->hwndFrom,lpnmp->iIndex);
|
||||||
|
selectedInstance->PropUpdate(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
//MessageBox(NULL,"Test","Test",0);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return DefWindowProc(hwnd, msg, wParam, lParam);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PropertyWindow::refreshExplorer()
|
||||||
|
{
|
||||||
|
SendMessage(_explorerComboBox,CB_RESETCONTENT,0,0);
|
||||||
|
for (unsigned int i=0;i<g_selectedInstances.size();i++) {
|
||||||
|
SendMessage(_explorerComboBox,CB_ADDSTRING, 0,(LPARAM)g_selectedInstances[i]->name.c_str());
|
||||||
|
children = g_selectedInstances[i]->getChildren();
|
||||||
|
for(size_t z = 0; z < children.size(); z++)
|
||||||
|
{
|
||||||
|
SendMessage(_explorerComboBox,CB_ADDSTRING, 0,(LPARAM)children.at(z)->name.c_str());
|
||||||
|
}
|
||||||
|
SendMessage(_explorerComboBox,CB_SETCURSEL,0,(LPARAM)0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool PropertyWindow::onCreate(int x, int y, int sx, int sy, HMODULE hThisInstance) {
|
||||||
|
if (!createWindowClass("propHWND",PropProc,hThisInstance))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
_hwndProp = CreateWindowEx(
|
||||||
|
WS_EX_TOOLWINDOW,
|
||||||
|
"propHWND",
|
||||||
|
"PropertyGrid",
|
||||||
|
WS_VISIBLE | WS_POPUPWINDOW | WS_THICKFRAME | WS_CAPTION,
|
||||||
|
CW_USEDEFAULT,
|
||||||
|
CW_USEDEFAULT,
|
||||||
|
300,
|
||||||
|
660,
|
||||||
|
NULL, // parent
|
||||||
|
NULL, // menu
|
||||||
|
hThisInstance,
|
||||||
|
NULL
|
||||||
|
);
|
||||||
|
|
||||||
|
_explorerComboBox = CreateWindowEx(
|
||||||
|
NULL,
|
||||||
|
"COMBOBOX",
|
||||||
|
"Combo",
|
||||||
|
WS_VISIBLE | WS_CHILD | CBS_DROPDOWNLIST,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
_hwndProp, // parent
|
||||||
|
NULL, // menu
|
||||||
|
hThisInstance,
|
||||||
|
NULL
|
||||||
|
);
|
||||||
|
SendMessage(_explorerComboBox, WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT), 0);
|
||||||
|
|
||||||
|
_propGrid = New_PropertyGrid(_hwndProp,IDC_PROPERTYGRID);
|
||||||
|
|
||||||
|
/*PROPGRIDITEM pItem;
|
||||||
|
PropGrid_ItemInit(pItem);
|
||||||
|
|
||||||
|
pItem.lpszCatalog="Test";
|
||||||
|
pItem.lpszPropName="Offset";
|
||||||
|
pItem.lpszzCmbItems="What";
|
||||||
|
pItem.lpszPropDesc="Description";
|
||||||
|
pItem.lpCurValue=(LPARAM)"0, 0, 0";
|
||||||
|
|
||||||
|
pItem.iItemType=PIT_EDIT;
|
||||||
|
|
||||||
|
PROPGRIDITEM pItem2;
|
||||||
|
PropGrid_ItemInit(pItem2);
|
||||||
|
|
||||||
|
pItem2.lpszCatalog="Test";
|
||||||
|
pItem2.lpszPropName="s";
|
||||||
|
pItem2.lpszzCmbItems="itemlist\0itemlist2\0itemlist3";
|
||||||
|
pItem2.lpszPropDesc="";
|
||||||
|
pItem2.lpCurValue=0;
|
||||||
|
|
||||||
|
pItem2.iItemType=PIT_COMBO;
|
||||||
|
|
||||||
|
/*PROPGRIDITEM FauxExplorerItem;
|
||||||
|
PropGrid_ItemInit(FauxExplorerItem);
|
||||||
|
FauxExplorerItem.lpszCatalog="Test";
|
||||||
|
FauxExplorerItem.lpszPropName = "Editable Combo Field";
|
||||||
|
FauxExplorerItem.lpszzCmbItems = "Test1\0Test2\0Test3";
|
||||||
|
FauxExplorerItem.lpszPropDesc = "Press F4 to view drop down.";
|
||||||
|
FauxExplorerItem.iItemType = PIT_EDITCOMBO;
|
||||||
|
FauxExplorerItem.lpCurValue = 1;
|
||||||
|
PropGrid_AddItem(_propGrid, &FauxExplorerItem);*/
|
||||||
|
|
||||||
|
PropGrid_Enable(_propGrid,true);
|
||||||
|
ShowWindow(_propGrid,SW_SHOW);
|
||||||
|
// PropGrid_AddItem(_propGrid,&pItem);
|
||||||
|
// PropGrid_AddItem(_propGrid,&pItem2);
|
||||||
|
PropGrid_SetItemHeight(_propGrid,20);
|
||||||
|
PropGrid_ShowToolTips(_propGrid,TRUE);
|
||||||
|
PropGrid_ShowPropertyDescriptions(_propGrid,TRUE);
|
||||||
|
PropGrid_ExpandAllCatalogs(_propGrid);
|
||||||
|
|
||||||
|
|
||||||
|
SetWindowLongPtr(_hwndProp,GWL_USERDATA,(LONG)this);
|
||||||
|
|
||||||
|
refreshExplorer();
|
||||||
|
_resize();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
PropertyWindow::PropertyWindow(int x, int y, int sx, int sy, HMODULE hThisInstance) {
|
||||||
|
onCreate(x, y, sx, sy, hThisInstance);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PropertyWindow::onResize()
|
||||||
|
{
|
||||||
|
_resize();
|
||||||
|
}
|
||||||
|
|
||||||
|
void PropertyWindow::_resize()
|
||||||
|
{
|
||||||
|
RECT rect;
|
||||||
|
GetClientRect(_hwndProp,&rect);
|
||||||
|
SetWindowPos(_propGrid, NULL, 0, 20, rect.right, rect.bottom-20, SWP_NOZORDER | SWP_NOACTIVATE);
|
||||||
|
SetWindowPos(_explorerComboBox, NULL, 0, 0, rect.right, 400, SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PropertyWindow::SetProperties(Instance * instance)
|
||||||
|
{
|
||||||
|
PropGrid_ResetContent(_propGrid);
|
||||||
|
prop = instance->getProperties();
|
||||||
|
selectedInstance = instance;
|
||||||
|
for(size_t i = 0; i < prop.size(); i++)
|
||||||
|
{
|
||||||
|
::PROPGRIDITEM item = prop.at(i);
|
||||||
|
PropGrid_AddItem(_propGrid, &item);
|
||||||
|
//PRGP propgp;
|
||||||
|
//propgp.instance = instance;
|
||||||
|
//propgp.prop = prop.at(i);
|
||||||
|
}
|
||||||
|
PropGrid_ExpandAllCatalogs(_propGrid);
|
||||||
|
//SetWindowLongPtr(_propGrid,GWL_USERDATA,(LONG)this);
|
||||||
|
|
||||||
|
refreshExplorer();
|
||||||
|
_resize();
|
||||||
|
}
|
||||||
|
|
||||||
|
void PropertyWindow::ClearProperties()
|
||||||
|
{
|
||||||
|
PropGrid_ResetContent(_propGrid);
|
||||||
|
}
|
||||||
16
PropertyWindow.h
Normal file
16
PropertyWindow.h
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "Instance.h"
|
||||||
|
class PropertyWindow {
|
||||||
|
public:
|
||||||
|
PropertyWindow(int x, int y, int sx, int sy, HMODULE hThisInstance);
|
||||||
|
bool onCreate(int x, int y, int sx, int sy, HMODULE hThisInstance);
|
||||||
|
void SetProperties(Instance *);
|
||||||
|
void ClearProperties();
|
||||||
|
void onResize();
|
||||||
|
void refreshExplorer();
|
||||||
|
HWND _hwndProp;
|
||||||
|
private:
|
||||||
|
HWND _propGrid;
|
||||||
|
HWND _explorerComboBox;
|
||||||
|
void _resize();
|
||||||
|
};
|
||||||
10
README.md
Normal file
10
README.md
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
# ROBLOX 2005 Recreation Project
|
||||||
|
## Why are we doing this?
|
||||||
|
ROBLOX in 2005 was a different game, based around minigames with win and lose conditions rather than a 3D building game. Since this build of the client is presumed lost despite having around 100 users, we have to recreate it. We are using era-appropriate tools for this as well (Visual Studio 2005 and 2005-era compilers), as well as G3D 6.10, the era-appropriate version of the Graphics3D graphics library used by ROBLOX to this day.
|
||||||
|
|
||||||
|
## Features
|
||||||
|
Equivalent to known features of 05 as it stood in October 2005 with the 'Morgan McGuire builds'
|
||||||
|
|
||||||
|
## Credits
|
||||||
|
- Morgan McGuire, creator of G3D - his old pre-2006 website for the only existing colour pictures of 2005 era roblox on the internet, as well as a couple of helpful emails. He assisted roblox development in the 2004-2006 timeframe.
|
||||||
|
- David Baszucki and Erik Cassel (1967-2013, RIP) - for creating roblox
|
||||||
@@ -1,28 +1,9 @@
|
|||||||
#include "TextButtonInstance.h"
|
#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 visible;
|
|
||||||
|
|
||||||
TextButtonInstance::TextButtonInstance(void)
|
TextButtonInstance::TextButtonInstance(void)
|
||||||
{
|
{
|
||||||
|
BaseButtonInstance::BaseButtonInstance();
|
||||||
boxBegin = Vector2(0,0);
|
boxBegin = Vector2(0,0);
|
||||||
boxEnd = Vector2(0,0);
|
boxEnd = Vector2(0,0);
|
||||||
fontLocationRelativeTo = Vector2(0,0);
|
fontLocationRelativeTo = Vector2(0,0);
|
||||||
|
|||||||
32
WindowFunctions.cpp
Normal file
32
WindowFunctions.cpp
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
|
||||||
|
#include "WindowFunctions.h"
|
||||||
|
#include <sstream>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
bool createWindowClass(const char* name,WNDPROC proc,HMODULE hInstance)
|
||||||
|
{
|
||||||
|
WNDCLASSEX wc;
|
||||||
|
wc.cbSize = sizeof(WNDCLASSEX);
|
||||||
|
wc.style = 0;
|
||||||
|
wc.lpfnWndProc = proc;
|
||||||
|
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);
|
||||||
|
wc.lpszMenuName = NULL;
|
||||||
|
wc.lpszClassName = name;
|
||||||
|
wc.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
|
||||||
|
if (!RegisterClassEx (&wc))
|
||||||
|
{
|
||||||
|
stringstream errMsg;
|
||||||
|
errMsg<<"Failed to register " << name;
|
||||||
|
MessageBox(NULL, errMsg.str().c_str(),"Dynamica Crash", MB_OK);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
4
WindowFunctions.h
Normal file
4
WindowFunctions.h
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
#pragma once
|
||||||
|
#include <windows.h>
|
||||||
|
|
||||||
|
bool createWindowClass(const char* name,WNDPROC proc,HMODULE hInstance);
|
||||||
@@ -1,10 +1,11 @@
|
|||||||
#include "WorkspaceInstance.h"
|
#include "WorkspaceInstance.h"
|
||||||
float timer = 60.0F;
|
|
||||||
int score = 0;
|
|
||||||
|
|
||||||
WorkspaceInstance::WorkspaceInstance(void)
|
WorkspaceInstance::WorkspaceInstance(void)
|
||||||
{
|
{
|
||||||
className = "Workspace";
|
Instance::Instance();
|
||||||
|
name = "Instance";
|
||||||
|
className = "Level";
|
||||||
timer = 60.0F;
|
timer = 60.0F;
|
||||||
score = 0;
|
score = 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,4 +9,5 @@ public:
|
|||||||
int score;
|
int score;
|
||||||
WorkspaceInstance(void);
|
WorkspaceInstance(void);
|
||||||
~WorkspaceInstance(void);
|
~WorkspaceInstance(void);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
639
ax.cpp
Normal file
639
ax.cpp
Normal file
@@ -0,0 +1,639 @@
|
|||||||
|
// AX.CPP
|
||||||
|
#include <windows.h>
|
||||||
|
#include <comdef.h>
|
||||||
|
#include <exdisp.h>
|
||||||
|
#include <oledlg.h>
|
||||||
|
#include "ax.h"
|
||||||
|
|
||||||
|
|
||||||
|
#pragma warning (disable: 4311)
|
||||||
|
#pragma warning (disable: 4312)
|
||||||
|
#pragma warning (disable: 4244)
|
||||||
|
#pragma warning (disable: 4800)
|
||||||
|
|
||||||
|
|
||||||
|
// AXClientSite class
|
||||||
|
// ------- Implement member functions
|
||||||
|
AXClientSite :: AXClientSite()
|
||||||
|
{
|
||||||
|
refNum = 0;
|
||||||
|
CalledCanInPlace = 0;
|
||||||
|
InPlace = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
AXClientSite :: ~AXClientSite()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// IUnknown methods
|
||||||
|
STDMETHODIMP AXClientSite :: QueryInterface(REFIID iid,void**ppvObject)
|
||||||
|
{
|
||||||
|
*ppvObject = 0;
|
||||||
|
if (iid == IID_IOleClientSite)
|
||||||
|
*ppvObject = (IOleClientSite*)this;
|
||||||
|
if (iid == IID_IUnknown)
|
||||||
|
*ppvObject = this;
|
||||||
|
if (iid == IID_IAdviseSink)
|
||||||
|
*ppvObject = (IAdviseSink*)this;
|
||||||
|
if (iid == IID_IDispatch)
|
||||||
|
*ppvObject = (IDispatch*)this;
|
||||||
|
if (ExternalPlace == false)
|
||||||
|
{
|
||||||
|
if (iid == IID_IOleInPlaceSite)
|
||||||
|
*ppvObject = (IOleInPlaceSite*)this;
|
||||||
|
if (iid == IID_IOleInPlaceFrame)
|
||||||
|
*ppvObject = (IOleInPlaceFrame*)this;
|
||||||
|
if (iid == IID_IOleInPlaceUIWindow)
|
||||||
|
*ppvObject = (IOleInPlaceUIWindow*)this;
|
||||||
|
}
|
||||||
|
|
||||||
|
//* Log Call
|
||||||
|
if (*ppvObject)
|
||||||
|
{
|
||||||
|
AddRef();
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
return E_NOINTERFACE;
|
||||||
|
}
|
||||||
|
|
||||||
|
STDMETHODIMP_(ULONG) AXClientSite :: AddRef()
|
||||||
|
{
|
||||||
|
refNum++;
|
||||||
|
return refNum;
|
||||||
|
}
|
||||||
|
|
||||||
|
STDMETHODIMP_(ULONG) AXClientSite :: Release()
|
||||||
|
{
|
||||||
|
refNum--;
|
||||||
|
return refNum;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// IOleClientSite methods
|
||||||
|
STDMETHODIMP AXClientSite :: SaveObject()
|
||||||
|
{
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
STDMETHODIMP AXClientSite :: GetMoniker(DWORD dwA,DWORD dwW,IMoniker**pm)
|
||||||
|
{
|
||||||
|
*pm = 0;
|
||||||
|
return E_NOTIMPL;
|
||||||
|
}
|
||||||
|
|
||||||
|
STDMETHODIMP AXClientSite :: GetContainer(IOleContainer**pc)
|
||||||
|
{
|
||||||
|
*pc = 0;
|
||||||
|
return E_FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
STDMETHODIMP AXClientSite :: ShowObject()
|
||||||
|
{
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
STDMETHODIMP AXClientSite :: OnShowWindow(BOOL f)
|
||||||
|
{
|
||||||
|
InvalidateRect(Window, 0, TRUE);
|
||||||
|
InvalidateRect(Parent, 0, TRUE);
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
STDMETHODIMP AXClientSite :: RequestNewObjectLayout()
|
||||||
|
{
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
STDMETHODIMP_(void) AXClientSite :: OnViewChange(DWORD dwAspect,LONG lIndex)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
STDMETHODIMP_(void) AXClientSite :: OnRename(IMoniker * pmk)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
STDMETHODIMP_(void) AXClientSite :: OnSave()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
STDMETHODIMP_(void) AXClientSite :: OnClose()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// IOleInPlaceSite methods
|
||||||
|
STDMETHODIMP AXClientSite :: GetWindow(HWND *p)
|
||||||
|
{
|
||||||
|
*p = Window;
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
STDMETHODIMP AXClientSite :: ContextSensitiveHelp(BOOL)
|
||||||
|
{
|
||||||
|
return E_NOTIMPL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
STDMETHODIMP AXClientSite :: CanInPlaceActivate()
|
||||||
|
{
|
||||||
|
if (InPlace)
|
||||||
|
{
|
||||||
|
CalledCanInPlace = true;
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
return S_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
STDMETHODIMP AXClientSite :: OnInPlaceActivate()
|
||||||
|
{
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
STDMETHODIMP AXClientSite :: OnUIActivate()
|
||||||
|
{
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
STDMETHODIMP AXClientSite :: GetWindowContext(IOleInPlaceFrame** ppFrame,IOleInPlaceUIWindow **ppDoc,LPRECT r1,LPRECT r2,LPOLEINPLACEFRAMEINFO o)
|
||||||
|
{
|
||||||
|
*ppFrame = (IOleInPlaceFrame*)this;
|
||||||
|
AddRef();
|
||||||
|
|
||||||
|
*ppDoc = NULL;
|
||||||
|
GetClientRect(Window,r1);
|
||||||
|
GetClientRect(Window,r2);
|
||||||
|
o->cb = sizeof(OLEINPLACEFRAMEINFO);
|
||||||
|
o->fMDIApp = false;
|
||||||
|
o->hwndFrame = Parent;
|
||||||
|
o->haccel = 0;
|
||||||
|
o->cAccelEntries = 0;
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
STDMETHODIMP AXClientSite :: Scroll(SIZE s)
|
||||||
|
{
|
||||||
|
return E_NOTIMPL;
|
||||||
|
}
|
||||||
|
|
||||||
|
STDMETHODIMP AXClientSite :: OnUIDeactivate(int)
|
||||||
|
{
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
STDMETHODIMP AXClientSite :: OnInPlaceDeactivate()
|
||||||
|
{
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
STDMETHODIMP AXClientSite :: DiscardUndoState()
|
||||||
|
{
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
STDMETHODIMP AXClientSite :: DeactivateAndUndo()
|
||||||
|
{
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
STDMETHODIMP AXClientSite :: OnPosRectChange(LPCRECT)
|
||||||
|
{
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// IOleInPlaceFrame methods
|
||||||
|
STDMETHODIMP AXClientSite :: GetBorder(LPRECT l)
|
||||||
|
{
|
||||||
|
GetClientRect(Window,l);
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
STDMETHODIMP AXClientSite :: RequestBorderSpace(LPCBORDERWIDTHS b)
|
||||||
|
{
|
||||||
|
//return S_OK;
|
||||||
|
return E_NOTIMPL;
|
||||||
|
}
|
||||||
|
|
||||||
|
STDMETHODIMP AXClientSite :: SetBorderSpace(LPCBORDERWIDTHS b)
|
||||||
|
{
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
STDMETHODIMP AXClientSite :: SetActiveObject(IOleInPlaceActiveObject*pV,LPCOLESTR s)
|
||||||
|
{
|
||||||
|
ax->Pao = pV;
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
STDMETHODIMP AXClientSite :: SetStatusText(LPCOLESTR t)
|
||||||
|
{
|
||||||
|
return E_NOTIMPL;
|
||||||
|
}
|
||||||
|
|
||||||
|
STDMETHODIMP AXClientSite :: EnableModeless(BOOL f)
|
||||||
|
{
|
||||||
|
return E_NOTIMPL;
|
||||||
|
}
|
||||||
|
|
||||||
|
STDMETHODIMP AXClientSite :: TranslateAccelerator(LPMSG,WORD)
|
||||||
|
{
|
||||||
|
return E_NOTIMPL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// IDispatch Methods
|
||||||
|
HRESULT _stdcall AXClientSite :: GetTypeInfoCount(
|
||||||
|
unsigned int * pctinfo) {return E_NOTIMPL;}
|
||||||
|
|
||||||
|
HRESULT _stdcall AXClientSite :: GetTypeInfo(
|
||||||
|
unsigned int iTInfo,
|
||||||
|
LCID lcid,
|
||||||
|
ITypeInfo FAR* FAR* ppTInfo) {return E_NOTIMPL;}
|
||||||
|
|
||||||
|
HRESULT _stdcall AXClientSite :: GetIDsOfNames(
|
||||||
|
REFIID riid,
|
||||||
|
OLECHAR FAR* FAR*,
|
||||||
|
unsigned int cNames,
|
||||||
|
LCID lcid,
|
||||||
|
DISPID FAR* ) {return E_NOTIMPL;}
|
||||||
|
|
||||||
|
|
||||||
|
// Other Methods
|
||||||
|
void AX :: Init(char* cls)
|
||||||
|
{
|
||||||
|
wchar_t x[1000] = {0};
|
||||||
|
MultiByteToWideChar(CP_ACP,0,cls,-1,x,1000);
|
||||||
|
CLSIDFromString(x,&clsid);
|
||||||
|
iid = (IID*)&IID_IOleObject;
|
||||||
|
OleObject = 0;
|
||||||
|
Storage = 0;
|
||||||
|
View = 0;
|
||||||
|
Data = 0;
|
||||||
|
Unk = 0;
|
||||||
|
Pao = 0;
|
||||||
|
AdviseToken = 0;
|
||||||
|
memset(DAdviseToken,0,sizeof(DAdviseToken));
|
||||||
|
Site.ax = this;
|
||||||
|
}
|
||||||
|
|
||||||
|
AX :: AX(char* cls)
|
||||||
|
{
|
||||||
|
Init(cls);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void AX :: Clean()
|
||||||
|
{
|
||||||
|
if (Site.InPlace == true)
|
||||||
|
{
|
||||||
|
Site.InPlace = false;
|
||||||
|
IOleInPlaceObject* iib = 0;
|
||||||
|
if (OleObject)
|
||||||
|
OleObject->QueryInterface(IID_IOleInPlaceObject,(void**)&iib);
|
||||||
|
if (iib)
|
||||||
|
{
|
||||||
|
iib->UIDeactivate();
|
||||||
|
iib->InPlaceDeactivate();
|
||||||
|
iib->Release();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (AdviseToken && OleObject)
|
||||||
|
{
|
||||||
|
OleObject->Unadvise(AdviseToken);
|
||||||
|
AdviseToken = 0;
|
||||||
|
}
|
||||||
|
if (Data)
|
||||||
|
{
|
||||||
|
for(int i = 0 ; i < 100 ; i++)
|
||||||
|
if (DAdviseToken[i])
|
||||||
|
Data->DUnadvise(DAdviseToken[i]);
|
||||||
|
memset(DAdviseToken,0,sizeof(DAdviseToken));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (Pao) Pao->Release();
|
||||||
|
if (Unk) Unk->Release();
|
||||||
|
if (Data) Data->Release();
|
||||||
|
if (View) View->Release();
|
||||||
|
if (Storage) Storage->Release();
|
||||||
|
if (OleObject) OleObject->Release();
|
||||||
|
Unk = 0;
|
||||||
|
Data = 0;
|
||||||
|
View = 0;
|
||||||
|
Storage = 0;
|
||||||
|
OleObject = 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
AX :: ~AX()
|
||||||
|
{
|
||||||
|
Clean();
|
||||||
|
}
|
||||||
|
|
||||||
|
CLSID AX :: GetCLSID()
|
||||||
|
{
|
||||||
|
return clsid;
|
||||||
|
}
|
||||||
|
|
||||||
|
HRESULT _stdcall AXClientSite :: InsertMenus(HMENU h,LPOLEMENUGROUPWIDTHS x)
|
||||||
|
{
|
||||||
|
/* AX * t = (AX*)ax;
|
||||||
|
if (t->AddMenu)
|
||||||
|
{
|
||||||
|
x->width[0] = 0;
|
||||||
|
x->width[2] = 0;
|
||||||
|
x->width[4] = 0;
|
||||||
|
//InsertMenu(h,0,MF_BYPOSITION | MF_POPUP,(int)Menu,"test");
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
return E_NOTIMPL;
|
||||||
|
}
|
||||||
|
HRESULT _stdcall AXClientSite :: SetMenu(HMENU h,HOLEMENU hO,HWND hw)
|
||||||
|
{
|
||||||
|
AX * t = (AX*)ax;
|
||||||
|
/* if (t->AddMenu)
|
||||||
|
{
|
||||||
|
if (!h && !hO)
|
||||||
|
{
|
||||||
|
//::SetMenu(Window,Menu);
|
||||||
|
//DrawMenuBar(Window);
|
||||||
|
::SetMenu(Parent,Menu);
|
||||||
|
DrawMenuBar(Parent);
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
//::SetMenu(Window,h);
|
||||||
|
//DrawMenuBar(Window);
|
||||||
|
|
||||||
|
//HMENU hm = GetMenu(Parent);
|
||||||
|
//AppendMenu(hm,MF_POPUP | MF_MENUBREAK,(int)h,0);
|
||||||
|
//::SetMenu(Parent,hm);
|
||||||
|
::SetMenu(Parent,h);
|
||||||
|
DrawMenuBar(Parent);
|
||||||
|
|
||||||
|
//hOleWindow = hw;
|
||||||
|
//OleSetMenuDescriptor(hO,Window,hw,0,0);
|
||||||
|
OleSetMenuDescriptor(hO,Parent,hw,0,0);
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
return E_NOTIMPL;
|
||||||
|
}
|
||||||
|
|
||||||
|
HRESULT _stdcall AXClientSite :: RemoveMenus(HMENU h)
|
||||||
|
{
|
||||||
|
AX * t = (AX*)ax;
|
||||||
|
if (t->AddMenu)
|
||||||
|
{
|
||||||
|
if (!h)
|
||||||
|
return S_OK;
|
||||||
|
|
||||||
|
int c = GetMenuItemCount(h);
|
||||||
|
for (int i = c ; i >= 0 ; i--)
|
||||||
|
{
|
||||||
|
HMENU hh = GetSubMenu(h,i);
|
||||||
|
if (hh == Menu)
|
||||||
|
RemoveMenu(h,i,MF_BYPOSITION);
|
||||||
|
}
|
||||||
|
if (h == Menu)
|
||||||
|
DestroyMenu(h);
|
||||||
|
|
||||||
|
//DrawMenuBar(Window);
|
||||||
|
DrawMenuBar(Parent);
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
return E_NOTIMPL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
HRESULT _stdcall AXClientSite :: Invoke(
|
||||||
|
DISPID dispIdMember,
|
||||||
|
REFIID riid,
|
||||||
|
LCID lcid,
|
||||||
|
WORD wFlags,
|
||||||
|
DISPPARAMS FAR* pDispParams,
|
||||||
|
VARIANT FAR* pVarResult,
|
||||||
|
EXCEPINFO FAR* pExcepInfo,
|
||||||
|
unsigned int FAR* puArgErr)
|
||||||
|
{
|
||||||
|
return E_NOTIMPL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void _stdcall AXClientSite :: OnDataChange(FORMATETC *pFormatEtc,STGMEDIUM *pStgmed)
|
||||||
|
{
|
||||||
|
// Notify our app that a change is being requested
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Window Procedure for AX control
|
||||||
|
LRESULT CALLBACK AXWndProc(HWND hh,UINT mm,WPARAM ww,LPARAM ll)
|
||||||
|
{
|
||||||
|
if (mm == WM_CREATE)
|
||||||
|
{
|
||||||
|
char tit[1000] = {0};
|
||||||
|
HRESULT hr;
|
||||||
|
|
||||||
|
GetWindowTextA(hh,tit,1000);
|
||||||
|
|
||||||
|
AX* ax;
|
||||||
|
ax = new AX(tit);
|
||||||
|
|
||||||
|
SetWindowLong(hh,GWL_USERDATA,(LONG)ax);
|
||||||
|
ax->Site.Window = hh;
|
||||||
|
ax->Site.Parent = GetParent(hh);
|
||||||
|
|
||||||
|
hr = StgCreateDocfile(0,STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_DIRECT | STGM_CREATE,0,&ax->Storage);
|
||||||
|
ax->Site.Window = hh;
|
||||||
|
|
||||||
|
REFIID rid = *ax->iid;
|
||||||
|
hr = OleCreate(ax->GetCLSID(),rid,OLERENDER_DRAW,0,&ax->Site,ax->Storage,(void**)&ax->OleObject);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (!ax->OleObject)
|
||||||
|
{
|
||||||
|
delete ax;
|
||||||
|
SetWindowLong(hh,GWL_USERDATA,0);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
hr = OleSetContainedObject(ax->OleObject, TRUE);
|
||||||
|
hr = ax->OleObject->Advise(&ax->Site,&ax->AdviseToken);
|
||||||
|
hr = ax->OleObject->QueryInterface(IID_IViewObject,(void**)&ax->View);
|
||||||
|
hr = ax->OleObject->QueryInterface(IID_IDataObject,(void**)&ax->Data);
|
||||||
|
if (ax->View)
|
||||||
|
hr = ax->View->SetAdvise(DVASPECT_CONTENT,0,&ax->Site);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (mm == WM_DESTROY)
|
||||||
|
{
|
||||||
|
AX* ax = (AX*)GetWindowLong(hh,GWL_USERDATA);
|
||||||
|
if (!ax)
|
||||||
|
return 0;
|
||||||
|
ax->Clean();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mm == AX_SETDATAADVISE)
|
||||||
|
{
|
||||||
|
AX* ax = (AX*)GetWindowLong(hh,GWL_USERDATA);
|
||||||
|
if (!ax)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
// 1.Enum available FORMATETC structures
|
||||||
|
// 2.Set Data Advise specified to index ww
|
||||||
|
if (!ax->Data)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
IEnumFORMATETC* ief = 0;
|
||||||
|
int i = 0;
|
||||||
|
|
||||||
|
FORMATETC fe;
|
||||||
|
ax->Data->EnumFormatEtc((LPARAM)ll,&ief);
|
||||||
|
if (!ief)
|
||||||
|
return 0;
|
||||||
|
for(;;)
|
||||||
|
{
|
||||||
|
HRESULT hr = ief->Next(1,&fe,0);
|
||||||
|
if (hr != S_OK)
|
||||||
|
break;
|
||||||
|
if (ww == i)
|
||||||
|
break;
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
ief->Release();
|
||||||
|
if (ww == -1)
|
||||||
|
return i;
|
||||||
|
|
||||||
|
if (ax->Data)
|
||||||
|
ax->Data->DAdvise(&fe,0,&ax->Site,&ax->DAdviseToken[ww]);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mm == AX_GETAXINTERFACE)
|
||||||
|
{
|
||||||
|
AX* ax = (AX*)GetWindowLong(hh,GWL_USERDATA);
|
||||||
|
return (LONG)ax;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mm == AX_QUERYINTERFACE)
|
||||||
|
{
|
||||||
|
char* p = (char*)ww;
|
||||||
|
AX* ax = (AX*)GetWindowLong(hh,GWL_USERDATA);
|
||||||
|
if (!ax)
|
||||||
|
return 0;
|
||||||
|
return ax->OleObject->QueryInterface((REFIID)*p,(void**)ll);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mm == WM_LBUTTONDBLCLK)
|
||||||
|
{
|
||||||
|
PostMessage(hh,AX_INPLACE,1,0);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (mm == AX_INPLACE)
|
||||||
|
{
|
||||||
|
AX* ax = (AX*)GetWindowLong(hh,GWL_USERDATA);
|
||||||
|
if (!ax)
|
||||||
|
return 0;
|
||||||
|
if (!ax->OleObject)
|
||||||
|
return 0;
|
||||||
|
RECT rect;
|
||||||
|
HRESULT hr;
|
||||||
|
::GetClientRect(hh,&rect);
|
||||||
|
|
||||||
|
if (ax->Site.InPlace == false && ww == 1) // Activate In Place
|
||||||
|
{
|
||||||
|
ax->Site.InPlace = true;
|
||||||
|
ax->Site.ExternalPlace = ll;
|
||||||
|
hr = ax->OleObject->DoVerb(OLEIVERB_INPLACEACTIVATE,0,&ax->Site,0,hh,&rect);
|
||||||
|
InvalidateRect(hh,0,true);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ax->Site.InPlace == true && ww == 0) // Deactivate
|
||||||
|
{
|
||||||
|
ax->Site.InPlace = false;
|
||||||
|
|
||||||
|
IOleInPlaceObject* iib;
|
||||||
|
ax->OleObject->QueryInterface(IID_IOleInPlaceObject,(void**)&iib);
|
||||||
|
if (iib)
|
||||||
|
{
|
||||||
|
iib->UIDeactivate();
|
||||||
|
iib->InPlaceDeactivate();
|
||||||
|
iib->Release();
|
||||||
|
InvalidateRect(hh,0,true);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mm == WM_SIZE)
|
||||||
|
{
|
||||||
|
AX* ax = (AX*)GetWindowLong(hh,GWL_USERDATA);
|
||||||
|
if (!ax)
|
||||||
|
return 0;
|
||||||
|
if (!ax->OleObject)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
DefWindowProc(hh,mm,ww,ll);
|
||||||
|
|
||||||
|
if (ax->Site.InPlace == true)
|
||||||
|
{
|
||||||
|
SendMessage(hh,AX_INPLACE,0,0);
|
||||||
|
InvalidateRect(hh,0,true);
|
||||||
|
SendMessage(hh,AX_INPLACE,1,0);
|
||||||
|
}
|
||||||
|
|
||||||
|
IOleInPlaceObject* pl;
|
||||||
|
ax->OleObject->QueryInterface(IID_IOleInPlaceObject,(void**)&pl);
|
||||||
|
if (!pl)
|
||||||
|
return 0;
|
||||||
|
RECT r;
|
||||||
|
GetClientRect(ax->Site.Window,&r);
|
||||||
|
pl->SetObjectRects(&r,&r);
|
||||||
|
pl->Release();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return DefWindowProc(hh,mm,ww,ll);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Registration function
|
||||||
|
ATOM AXRegister()
|
||||||
|
{
|
||||||
|
WNDCLASSEXA wC = {0};
|
||||||
|
|
||||||
|
wC.cbSize = sizeof(wC);
|
||||||
|
wC.style = CS_GLOBALCLASS | CS_DBLCLKS;
|
||||||
|
wC.lpfnWndProc = AXWndProc;
|
||||||
|
wC.cbWndExtra = 4;
|
||||||
|
wC.hInstance = GetModuleHandle(0);
|
||||||
|
wC.lpszClassName = "AX";
|
||||||
|
return RegisterClassExA(&wC);
|
||||||
|
}
|
||||||
|
|
||||||
142
ax.h
Normal file
142
ax.h
Normal file
@@ -0,0 +1,142 @@
|
|||||||
|
// AX.H
|
||||||
|
|
||||||
|
// messages
|
||||||
|
#define AX_QUERYINTERFACE (WM_USER + 1)
|
||||||
|
#define AX_INPLACE (WM_USER + 2)
|
||||||
|
#define AX_GETAXINTERFACE (WM_USER + 3)
|
||||||
|
#define AX_CONNECTOBJECT (WM_USER + 4)
|
||||||
|
#define AX_DISCONNECTOBJECT (WM_USER + 5)
|
||||||
|
#define AX_SETDATAADVISE (WM_USER + 6)
|
||||||
|
#define AX_DOVERB (WM_USER + 7)
|
||||||
|
|
||||||
|
|
||||||
|
// Registration function
|
||||||
|
ATOM AXRegister();
|
||||||
|
|
||||||
|
|
||||||
|
// Class AXClientSide
|
||||||
|
class AXClientSite :
|
||||||
|
public IOleClientSite,
|
||||||
|
public IDispatch,
|
||||||
|
public IAdviseSink,
|
||||||
|
public IOleInPlaceSite,
|
||||||
|
public IOleInPlaceFrame
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
|
||||||
|
int refNum;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
|
||||||
|
HWND Window;
|
||||||
|
HWND Parent;
|
||||||
|
HMENU Menu;
|
||||||
|
bool InPlace;
|
||||||
|
bool ExternalPlace;
|
||||||
|
bool CalledCanInPlace;
|
||||||
|
|
||||||
|
class AX* ax;
|
||||||
|
|
||||||
|
// MyClientSite Methods
|
||||||
|
AXClientSite();
|
||||||
|
virtual ~AXClientSite();
|
||||||
|
STDMETHODIMP_(void) OnDataChange2(FORMATETC*);
|
||||||
|
|
||||||
|
// IUnknown methods
|
||||||
|
STDMETHODIMP QueryInterface(REFIID iid,void**ppvObject);
|
||||||
|
STDMETHODIMP_(ULONG) AddRef();
|
||||||
|
STDMETHODIMP_(ULONG) Release();
|
||||||
|
|
||||||
|
// IOleClientSite methods
|
||||||
|
STDMETHODIMP SaveObject();
|
||||||
|
STDMETHODIMP GetMoniker(DWORD dwA,DWORD dwW,IMoniker**pm);
|
||||||
|
STDMETHODIMP GetContainer(IOleContainer**pc);
|
||||||
|
STDMETHODIMP ShowObject();
|
||||||
|
STDMETHODIMP OnShowWindow(BOOL f);
|
||||||
|
STDMETHODIMP RequestNewObjectLayout();
|
||||||
|
|
||||||
|
// IAdviseSink methods
|
||||||
|
STDMETHODIMP_(void) OnDataChange(FORMATETC *pFormatEtc,STGMEDIUM *pStgmed);
|
||||||
|
|
||||||
|
STDMETHODIMP_(void) OnViewChange(DWORD dwAspect,LONG lIndex);
|
||||||
|
STDMETHODIMP_(void) OnRename(IMoniker * pmk);
|
||||||
|
STDMETHODIMP_(void) OnSave();
|
||||||
|
STDMETHODIMP_(void) OnClose();
|
||||||
|
|
||||||
|
// IOleInPlaceSite methods
|
||||||
|
STDMETHODIMP GetWindow(HWND *p);
|
||||||
|
STDMETHODIMP ContextSensitiveHelp(BOOL);
|
||||||
|
STDMETHODIMP CanInPlaceActivate();
|
||||||
|
STDMETHODIMP OnInPlaceActivate();
|
||||||
|
STDMETHODIMP OnUIActivate();
|
||||||
|
STDMETHODIMP GetWindowContext(IOleInPlaceFrame** ppFrame,IOleInPlaceUIWindow **ppDoc,LPRECT r1,LPRECT r2,LPOLEINPLACEFRAMEINFO o);
|
||||||
|
STDMETHODIMP Scroll(SIZE s);
|
||||||
|
STDMETHODIMP OnUIDeactivate(int);
|
||||||
|
STDMETHODIMP OnInPlaceDeactivate();
|
||||||
|
STDMETHODIMP DiscardUndoState();
|
||||||
|
STDMETHODIMP DeactivateAndUndo();
|
||||||
|
STDMETHODIMP OnPosRectChange(LPCRECT);
|
||||||
|
|
||||||
|
// IOleInPlaceFrame methods
|
||||||
|
STDMETHODIMP GetBorder(LPRECT l);
|
||||||
|
STDMETHODIMP RequestBorderSpace(LPCBORDERWIDTHS);
|
||||||
|
STDMETHODIMP SetBorderSpace(LPCBORDERWIDTHS w);
|
||||||
|
STDMETHODIMP SetActiveObject(IOleInPlaceActiveObject*pV,LPCOLESTR s);
|
||||||
|
STDMETHODIMP InsertMenus(HMENU h,LPOLEMENUGROUPWIDTHS x);
|
||||||
|
STDMETHODIMP SetMenu(HMENU h,HOLEMENU hO,HWND hw);
|
||||||
|
STDMETHODIMP RemoveMenus(HMENU h);
|
||||||
|
STDMETHODIMP SetStatusText(LPCOLESTR t);
|
||||||
|
STDMETHODIMP EnableModeless(BOOL f);
|
||||||
|
STDMETHODIMP TranslateAccelerator(LPMSG,WORD);
|
||||||
|
|
||||||
|
|
||||||
|
// IDispatch Methods
|
||||||
|
HRESULT _stdcall GetTypeInfoCount(unsigned int * pctinfo);
|
||||||
|
HRESULT _stdcall GetTypeInfo(unsigned int iTInfo,LCID lcid,ITypeInfo FAR* FAR* ppTInfo);
|
||||||
|
HRESULT _stdcall GetIDsOfNames(REFIID riid,OLECHAR FAR* FAR*,unsigned int cNames,LCID lcid,DISPID FAR* );
|
||||||
|
HRESULT _stdcall Invoke(DISPID dispIdMember,REFIID riid,LCID lcid,WORD wFlags,DISPPARAMS FAR* pDispParams,VARIANT FAR* pVarResult,EXCEPINFO FAR* pExcepInfo,unsigned int FAR* puArgErr);
|
||||||
|
|
||||||
|
// IOleControlSite Methods
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Class AX
|
||||||
|
class AX
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
AX(char* clsid);
|
||||||
|
CLSID GetCLSID();
|
||||||
|
~AX();
|
||||||
|
|
||||||
|
|
||||||
|
void Init(char* clsid);
|
||||||
|
void Clean();
|
||||||
|
|
||||||
|
AXClientSite Site;
|
||||||
|
IID* iid;
|
||||||
|
IOleObject* OleObject;
|
||||||
|
IStorage* Storage;
|
||||||
|
IViewObject* View;
|
||||||
|
IDataObject* Data;
|
||||||
|
IUnknown* Unk;
|
||||||
|
IOleInPlaceActiveObject* Pao;
|
||||||
|
//AX_CONNECTSTRUCT* tcs;
|
||||||
|
bool AddMenu;
|
||||||
|
DWORD AdviseToken;
|
||||||
|
DWORD DAdviseToken[100];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
CLSID clsid;
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
BIN
content/images/surface.png
Normal file
BIN
content/images/surface.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 14 KiB |
BIN
content/images/surfacebr.png
Normal file
BIN
content/images/surfacebr.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 14 KiB |
566
main.cpp
566
main.cpp
@@ -11,9 +11,12 @@
|
|||||||
@author Morgan McGuire, matrix@graphics3d.com
|
@author Morgan McGuire, matrix@graphics3d.com
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// TODO: Move toolbar buttons with resized window.
|
||||||
|
|
||||||
#define _WIN32_WINNT 0x0400
|
#define _WIN32_WINNT 0x0400
|
||||||
|
|
||||||
#include <G3DAll.h>
|
#include <G3DAll.h>
|
||||||
|
#include <initguid.h>
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
#include "Instance.h"
|
#include "Instance.h"
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
@@ -26,70 +29,120 @@
|
|||||||
#include "Globals.h"
|
#include "Globals.h"
|
||||||
#include "Demo.h"
|
#include "Demo.h"
|
||||||
#include "win32Defines.h"
|
#include "win32Defines.h"
|
||||||
|
#include "WindowFunctions.h"
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
#include <mshtml.h>
|
||||||
|
#include <exdisp.h>
|
||||||
|
#include <vector>
|
||||||
|
#include <string>
|
||||||
|
#include "ax.h"
|
||||||
|
#include <cguid.h>
|
||||||
|
#include "IEBrowser.h"
|
||||||
|
#include "PropertyWindow.h"
|
||||||
|
#include <commctrl.h>
|
||||||
|
|
||||||
#if G3D_VER < 61000
|
#if G3D_VER < 61000
|
||||||
#error Requires G3D 6.10
|
#error Requires G3D 6.10
|
||||||
#endif
|
#endif
|
||||||
HWND hwnd;
|
HWND hwnd;
|
||||||
|
|
||||||
|
DEFINE_GUID(CLSID_G3d, 0xB323F8E0L, 0x2E68, 0x11D0, 0x90, 0xEA, 0x00, 0xAA, 0x00, 0x60, 0xF8, 0x6F);
|
||||||
|
HRESULT hresult;
|
||||||
|
OLECHAR dat = ((OLECHAR)"SayHello");
|
||||||
|
OLECHAR * szMember = &dat;
|
||||||
|
DISPID dispid;
|
||||||
|
DISPPARAMS dispparamsNoArgs = {NULL, NULL, 0, 0};
|
||||||
|
EXCEPINFO excepinfo;
|
||||||
|
UINT nArgErr;
|
||||||
|
|
||||||
static std::string title = "";
|
static std::string title = "";
|
||||||
static DataModelInstance* dataModel;
|
static DataModelInstance* dataModel;
|
||||||
GFontRef fntdominant = NULL;
|
GFontRef fntdominant = NULL;
|
||||||
GFontRef fntlighttrek = NULL;
|
GFontRef fntlighttrek = NULL;
|
||||||
Ray testRay;
|
Ray testRay;
|
||||||
static bool democ = true;
|
|
||||||
static std::string message = "";
|
static std::string message = "";
|
||||||
static G3D::RealTime messageTime = 0;
|
static G3D::RealTime messageTime = 0;
|
||||||
static std::string tempPath = "";
|
static std::string tempPath = "";
|
||||||
static G3D::RealTime inputTime = 0;
|
|
||||||
static int FPSVal[8] = {10, 20, 30, 60, 120, 240, INT_MAX,1};
|
|
||||||
static int index = 2;
|
|
||||||
static std::string cameraSound = "";
|
static std::string cameraSound = "";
|
||||||
static std::string clickSound = "";
|
static std::string clickSound = "";
|
||||||
static std::string dingSound = "";
|
static std::string dingSound = "";
|
||||||
static G3D::TextureRef go = NULL;
|
|
||||||
static G3D::TextureRef go_ovr = NULL;
|
|
||||||
static G3D::TextureRef go_dn = NULL;
|
|
||||||
VARAreaRef varStatic = NULL;
|
|
||||||
//static float dataModel->mousex = 0;
|
|
||||||
//static float dataModel->mousey = 0;
|
|
||||||
static int cursorid = 0;
|
static int cursorid = 0;
|
||||||
static G3D::TextureRef cursor = NULL;
|
static G3D::TextureRef cursor = NULL;
|
||||||
//static bool dataModel->mouseButton1Down = false;
|
|
||||||
static bool running = true;
|
static bool running = true;
|
||||||
static bool mouseMovedBeginMotion = false;
|
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 bool panRight = false;
|
|
||||||
static bool panLeft = false;
|
|
||||||
static bool tiltUp = false;
|
|
||||||
static const int CURSOR = 0;
|
static const int CURSOR = 0;
|
||||||
static const int ARROWS = 1;
|
static const int ARROWS = 1;
|
||||||
static const int RESIZE = 2;
|
static const int RESIZE = 2;
|
||||||
static POINT oldGlobalMouse;
|
static POINT oldGlobalMouse;
|
||||||
|
|
||||||
static int mode = CURSOR;
|
static int mode = CURSOR;
|
||||||
bool dragging = false;
|
bool dragging = false;
|
||||||
Vector3 cameraPos = Vector3(0,2,10);
|
|
||||||
Vector2 oldMouse = Vector2(0,0);
|
Vector2 oldMouse = Vector2(0,0);
|
||||||
float moveRate = 0.5;
|
float moveRate = 0.5;
|
||||||
Instance* selectedInstance = NULL;
|
static const std::string PlaceholderName = "HyperCube";
|
||||||
|
|
||||||
Demo *usableApp = NULL;
|
Demo *usableApp = NULL;
|
||||||
|
|
||||||
Demo::Demo(const GAppSettings& settings,Win32Window* window) : GApp(settings,window) {
|
Demo::Demo(const GAppSettings& settings,HWND parentWindow) { //: GApp(settings,window) {
|
||||||
varStatic = VARArea::create(1024 * 1024);
|
_hWndMain = parentWindow;
|
||||||
hWndMain = window->hwnd();
|
|
||||||
|
HMODULE hThisInstance = GetModuleHandle(NULL);
|
||||||
|
|
||||||
|
_hwndToolbox = CreateWindowEx(
|
||||||
|
WS_EX_ACCEPTFILES,
|
||||||
|
"AX",
|
||||||
|
"{8856F961-340A-11D0-A96B-00C04FD705A2}",
|
||||||
|
WS_CHILD | WS_VISIBLE,
|
||||||
|
0,
|
||||||
|
560,
|
||||||
|
800,
|
||||||
|
60,
|
||||||
|
_hWndMain, // parent
|
||||||
|
NULL, // menu
|
||||||
|
hThisInstance,
|
||||||
|
NULL
|
||||||
|
);
|
||||||
|
|
||||||
|
_hwndRenderer = CreateWindowEx(
|
||||||
|
WS_EX_ACCEPTFILES,
|
||||||
|
"G3DWindow",
|
||||||
|
"3D",
|
||||||
|
WS_CHILD,
|
||||||
|
CW_USEDEFAULT,
|
||||||
|
CW_USEDEFAULT,
|
||||||
|
1,
|
||||||
|
1,
|
||||||
|
_hWndMain, // parent
|
||||||
|
NULL, // menu
|
||||||
|
hThisInstance,
|
||||||
|
NULL
|
||||||
|
);
|
||||||
|
|
||||||
|
Win32Window* window = Win32Window::create(settings.window,_hwndRenderer);
|
||||||
|
ShowWindow(_hwndRenderer, SW_SHOW);
|
||||||
|
ShowWindow(_hWndMain, SW_SHOW);
|
||||||
|
|
||||||
quit=false;
|
quit=false;
|
||||||
rightButtonHolding=false;
|
rightButtonHolding=false;
|
||||||
|
mouseOnScreen=false;
|
||||||
|
// GApp replacement
|
||||||
|
renderDevice = new RenderDevice();
|
||||||
|
if (window != NULL) {
|
||||||
|
renderDevice->init(window, NULL);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MessageBox(NULL,"Window not found!","Error",MB_OK);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_window = renderDevice->window();
|
||||||
|
_window->makeCurrent();
|
||||||
|
|
||||||
|
SetWindowLongPtr(_hWndMain,GWL_USERDATA,(LONG)this);
|
||||||
|
SetWindowLongPtr(_hwndRenderer,GWL_USERDATA,(LONG)this);
|
||||||
|
_propWindow = new PropertyWindow(0, 0, 200, 640, hThisInstance);
|
||||||
|
IEBrowser* webBrowser = new IEBrowser(_hwndToolbox);
|
||||||
|
//webBrowser->navigateSyncURL(L"http://scottbeebiwan.tk/g3d/toolbox/");
|
||||||
}
|
}
|
||||||
|
|
||||||
void clearInstances()
|
void clearInstances()
|
||||||
@@ -101,9 +154,10 @@ void OnError(int err, std::string msg = "")
|
|||||||
{
|
{
|
||||||
//usableApp->window()->setInputCaptureCount(0);
|
//usableApp->window()->setInputCaptureCount(0);
|
||||||
//usableApp->window()->setMouseVisible(true);
|
//usableApp->window()->setMouseVisible(true);
|
||||||
std::string emsg = "An unexpected error has occured and DUOM 5 has to quit. We're sorry!" + msg;
|
std::string emsg = "An unexpected error has occured and "+PlaceholderName+" has to quit. We're sorry!" + msg;
|
||||||
clearInstances();
|
std::string title = PlaceholderName+"Crash";
|
||||||
MessageBox(NULL, emsg.c_str(),"Dynamica Crash", MB_OK);
|
//clearInstances();
|
||||||
|
MessageBox(NULL, emsg.c_str(), title.c_str(), MB_OK);
|
||||||
exit(err);
|
exit(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -168,8 +222,8 @@ void CameraButtonListener::onButton1MouseClick(BaseButtonInstance* button)
|
|||||||
{
|
{
|
||||||
AudioPlayer::playSound(cameraSound);
|
AudioPlayer::playSound(cameraSound);
|
||||||
CoordinateFrame frame = usableApp->cameraController.getCamera()->getCoordinateFrame();
|
CoordinateFrame frame = usableApp->cameraController.getCamera()->getCoordinateFrame();
|
||||||
if(button->name == "CenterCam")
|
if(button->name == "CenterCam" && g_selectedInstances.size() > 0)
|
||||||
usableApp->cameraController.centerCamera(selectedInstance);
|
usableApp->cameraController.centerCamera(g_selectedInstances.at(0));
|
||||||
else if(button->name == "ZoomIn")
|
else if(button->name == "ZoomIn")
|
||||||
usableApp->cameraController.Zoom(1);
|
usableApp->cameraController.Zoom(1);
|
||||||
else if(button->name == "ZoomOut")
|
else if(button->name == "ZoomOut")
|
||||||
@@ -191,15 +245,30 @@ public:
|
|||||||
|
|
||||||
void GUDButtonListener::onButton1MouseClick(BaseButtonInstance* button)
|
void GUDButtonListener::onButton1MouseClick(BaseButtonInstance* button)
|
||||||
{
|
{
|
||||||
if(selectedInstance != NULL)
|
if(g_selectedInstances.size() > 0)
|
||||||
{
|
{
|
||||||
AudioPlayer::playSound(dingSound);
|
AudioPlayer::playSound(dingSound);
|
||||||
if(button->name == "Duplicate")
|
if(button->name == "Duplicate")
|
||||||
{
|
{
|
||||||
|
std::vector<Instance*> newinst;
|
||||||
|
for(size_t i = 0; i < g_selectedInstances.size(); i++)
|
||||||
|
{
|
||||||
|
if(g_selectedInstances.at(i) != dataModel->getWorkspace())
|
||||||
|
{
|
||||||
|
Instance* tempinst = g_selectedInstances.at(i);
|
||||||
|
|
||||||
|
Instance* clonedInstance = g_selectedInstances.at(i)->clone();
|
||||||
|
|
||||||
|
newinst.push_back(tempinst);
|
||||||
|
}
|
||||||
|
/*tempinst->setPosition(Vector3(tempPos.x, tempPos.y + tempSize.y, tempPos.z));
|
||||||
|
usableApp->cameraController.centerCamera(g_selectedInstances.at(0));*/
|
||||||
|
}
|
||||||
|
g_selectedInstances = newinst;
|
||||||
|
if(g_selectedInstances.size() > 0)
|
||||||
|
usableApp->_propWindow->SetProperties(newinst.at(0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class RotateButtonListener : public ButtonListener {
|
class RotateButtonListener : public ButtonListener {
|
||||||
@@ -209,12 +278,12 @@ public:
|
|||||||
|
|
||||||
void RotateButtonListener::onButton1MouseClick(BaseButtonInstance* button)
|
void RotateButtonListener::onButton1MouseClick(BaseButtonInstance* button)
|
||||||
{
|
{
|
||||||
if(selectedInstance != NULL)
|
if(g_selectedInstances.size() > 0)
|
||||||
{
|
{
|
||||||
|
Instance* selectedInstance = g_selectedInstances.at(0);
|
||||||
AudioPlayer::playSound(clickSound);
|
AudioPlayer::playSound(clickSound);
|
||||||
if(selectedInstance->getClassName() == "Part")
|
if(PhysicalInstance* part = dynamic_cast<PhysicalInstance*>(selectedInstance))
|
||||||
{
|
{
|
||||||
PhysicalInstance* part = (PhysicalInstance*) selectedInstance;
|
|
||||||
if(button->name == "Tilt")
|
if(button->name == "Tilt")
|
||||||
part->setCFrame(part->getCFrame()*Matrix3::fromEulerAnglesXYZ(0,0,toRadians(90)));
|
part->setCFrame(part->getCFrame()*Matrix3::fromEulerAnglesXYZ(0,0,toRadians(90)));
|
||||||
else if(button->name == "Rotate")
|
else if(button->name == "Rotate")
|
||||||
@@ -227,14 +296,29 @@ void RotateButtonListener::onButton1MouseClick(BaseButtonInstance* button)
|
|||||||
|
|
||||||
void deleteInstance()
|
void deleteInstance()
|
||||||
{
|
{
|
||||||
if(selectedInstance != NULL)
|
if(g_selectedInstances.size() > 0)
|
||||||
{
|
{
|
||||||
if(selectedInstance->getParent() != NULL)
|
size_t undeletable = 0;
|
||||||
selectedInstance->getParent()->removeChild(selectedInstance);
|
while(g_selectedInstances.size() > undeletable)
|
||||||
delete selectedInstance;
|
{
|
||||||
selectedInstance = NULL;
|
if(g_selectedInstances.at(0) != dataModel && g_selectedInstances.at(0) != dataModel->getWorkspace())
|
||||||
AudioPlayer::playSound(GetFileInPath("/content/sounds/pageturn.wav"));
|
{
|
||||||
|
AudioPlayer::playSound(GetFileInPath("/content/sounds/pageturn.wav"));
|
||||||
|
Instance* selectedInstance = g_selectedInstances.at(0);
|
||||||
|
if(selectedInstance->getParent() != NULL)
|
||||||
|
selectedInstance->getParent()->removeChild(selectedInstance);
|
||||||
|
delete selectedInstance;
|
||||||
|
selectedInstance = NULL;
|
||||||
|
g_selectedInstances.erase(g_selectedInstances.begin());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
undeletable++;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
if(g_selectedInstances.size() == 0)
|
||||||
|
usableApp->_propWindow->ClearProperties();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -452,14 +536,15 @@ void Demo::initGUI()
|
|||||||
button->name = "Duplicate";
|
button->name = "Duplicate";
|
||||||
button->setButtonListener(new GUDButtonListener());
|
button->setButtonListener(new GUDButtonListener());
|
||||||
|
|
||||||
|
ImageButtonInstance* instance = makeImageButton(
|
||||||
ImageButtonInstance* instance = makeImageButton(go, go_ovr, go_dn);
|
Texture::fromFile(GetFileInPath("/content/images/Run.png")),
|
||||||
|
Texture::fromFile(GetFileInPath("/content/images/Run_ovr.png")),
|
||||||
|
Texture::fromFile(GetFileInPath("/content/images/Run_dn.png")));
|
||||||
instance->name = "go";
|
instance->name = "go";
|
||||||
instance->size = Vector2(65,65);
|
instance->size = Vector2(65,65);
|
||||||
instance->position = Vector2(6.5, 25);
|
instance->position = Vector2(6.5, 25);
|
||||||
instance->setParent(dataModel->getGuiRoot());
|
instance->setParent(dataModel->getGuiRoot());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
instance = makeImageButton(
|
instance = makeImageButton(
|
||||||
Texture::fromFile(GetFileInPath("/content/images/ArrowTool.png")),
|
Texture::fromFile(GetFileInPath("/content/images/ArrowTool.png")),
|
||||||
@@ -614,7 +699,7 @@ void Demo::initGUI()
|
|||||||
void Demo::onInit() {
|
void Demo::onInit() {
|
||||||
|
|
||||||
// Called before Demo::run() beings
|
// Called before Demo::run() beings
|
||||||
cameraController.setFrame(cameraPos);
|
cameraController.setFrame(Vector3(0,2,10));
|
||||||
dataModel = new DataModelInstance();
|
dataModel = new DataModelInstance();
|
||||||
dataModel->setParent(NULL);
|
dataModel->setParent(NULL);
|
||||||
dataModel->name = "undefined";
|
dataModel->name = "undefined";
|
||||||
@@ -629,7 +714,7 @@ void Demo::onInit() {
|
|||||||
test->color = Color3(0.2F,0.3F,1);
|
test->color = Color3(0.2F,0.3F,1);
|
||||||
test->setSize(Vector3(24,1,24));
|
test->setSize(Vector3(24,1,24));
|
||||||
test->setPosition(Vector3(0,0,0));
|
test->setPosition(Vector3(0,0,0));
|
||||||
test->setCFrame(test->getCFrame() * Matrix3::fromEulerAnglesXYZ(0,toRadians(40),toRadians(40)));
|
test->setCFrame(test->getCFrame() * Matrix3::fromEulerAnglesXYZ(0,toRadians(0),toRadians(0)));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -721,15 +806,6 @@ void Demo::onInit() {
|
|||||||
|
|
||||||
void Demo::onCleanup() {
|
void Demo::onCleanup() {
|
||||||
clearInstances();
|
clearInstances();
|
||||||
go->~Texture();
|
|
||||||
go_ovr->~Texture();
|
|
||||||
go_dn->~Texture();
|
|
||||||
go_dn.~ReferenceCountedPointer();
|
|
||||||
delete go_dn.pointer();
|
|
||||||
go.~ReferenceCountedPointer();
|
|
||||||
delete go.pointer();
|
|
||||||
go_ovr.~ReferenceCountedPointer();
|
|
||||||
delete go_ovr.pointer();
|
|
||||||
sky->~Sky();
|
sky->~Sky();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -738,16 +814,8 @@ void Demo::onCleanup() {
|
|||||||
|
|
||||||
void Demo::onLogic() {
|
void Demo::onLogic() {
|
||||||
// Add non-simulation game logic and AI code here
|
// Add non-simulation game logic and AI code here
|
||||||
|
|
||||||
Instance* obj = dataModel->getGuiRoot()->findFirstChild("Delete");
|
|
||||||
if(obj != NULL)
|
|
||||||
{
|
|
||||||
ImageButtonInstance* button = (ImageButtonInstance*)obj;
|
|
||||||
if(selectedInstance == NULL)
|
|
||||||
button->disabled = true;
|
|
||||||
else
|
|
||||||
button->disabled = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -763,16 +831,28 @@ void Demo::onNetwork() {
|
|||||||
// return pow(pow((double)vector1.x - (double)vector2.x, 2) + pow((double)vector1.y - (double)vector2.y, 2) + pow((double)vector1.z - (double)vector2.z, 2), 0.5);
|
// return pow(pow((double)vector1.x - (double)vector2.x, 2) + pow((double)vector1.y - (double)vector2.y, 2) + pow((double)vector1.z - (double)vector2.z, 2), 0.5);
|
||||||
//}
|
//}
|
||||||
|
|
||||||
Instance* Demo::getSelection()
|
std::vector<Instance*> Demo::getSelection()
|
||||||
{
|
{
|
||||||
return selectedInstance;
|
return g_selectedInstances;
|
||||||
}
|
}
|
||||||
void Demo::onSimulation(RealTime rdt, SimTime sdt, SimTime idt) {
|
void Demo::onSimulation(RealTime rdt, SimTime sdt, SimTime idt) {
|
||||||
|
|
||||||
|
Instance* obj = dataModel->getGuiRoot()->findFirstChild("Delete");
|
||||||
|
if(obj != NULL)
|
||||||
|
{
|
||||||
|
ImageButtonInstance* button = (ImageButtonInstance*)obj;
|
||||||
|
if(g_selectedInstances.size() <= 0 || g_selectedInstances.at(0) == dataModel->getWorkspace())
|
||||||
|
button->disabled = true;
|
||||||
|
else
|
||||||
|
button->disabled = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if(dataModel->name != title)
|
if(dataModel->name != title)
|
||||||
{
|
{
|
||||||
title = dataModel->name;
|
title = dataModel->name;
|
||||||
std::string text = "Game \"" + title + "\"";
|
std::string text = "Game \"" + title + "\"";
|
||||||
SetWindowText(hWndMain, text.c_str());
|
SetWindowText(_hWndMain, text.c_str());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -796,8 +876,13 @@ bool IsHolding(int button)
|
|||||||
return (GetKeyState(button) >> 1)>0;
|
return (GetKeyState(button) >> 1)>0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOL GetKPBool(int VK) {
|
||||||
|
return (GetKeyState(VK) & 0x8000);
|
||||||
|
}
|
||||||
|
|
||||||
void Demo::onUserInput(UserInput* ui) {
|
void Demo::onUserInput(UserInput* ui) {
|
||||||
|
|
||||||
|
/*
|
||||||
if(GetHoldKeyState(VK_LCONTROL))
|
if(GetHoldKeyState(VK_LCONTROL))
|
||||||
{
|
{
|
||||||
if(GetHoldKeyState('D'))
|
if(GetHoldKeyState('D'))
|
||||||
@@ -806,15 +891,17 @@ void Demo::onUserInput(UserInput* ui) {
|
|||||||
if(debugMode())
|
if(debugMode())
|
||||||
message = "Debug Mode Disabled";
|
message = "Debug Mode Disabled";
|
||||||
else
|
else
|
||||||
message = "Debug Mode Enabled, Soon to be depricated";
|
message = "Debug Mode Enabled";
|
||||||
setDebugMode(!debugMode());
|
setDebugMode(!debugMode());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//if(ui->keyPressed(SDLK_F8))
|
*/
|
||||||
//{
|
if(GetHoldKeyState(VK_F8))
|
||||||
// messageTime = System::time();
|
{
|
||||||
// message = "FPS has been locked at " + Convert(FPSVal[index]);
|
messageTime = System::time();
|
||||||
//setDesiredFrameRate(FPSVal[index]);
|
message = "FOV Set to 10";
|
||||||
|
|
||||||
|
}
|
||||||
//}
|
//}
|
||||||
|
|
||||||
//dataModel->mousex = ui->getMouseX();
|
//dataModel->mousex = ui->getMouseX();
|
||||||
@@ -823,14 +910,15 @@ void Demo::onUserInput(UserInput* ui) {
|
|||||||
|
|
||||||
if (GetHoldKeyState(VK_LBUTTON)) {
|
if (GetHoldKeyState(VK_LBUTTON)) {
|
||||||
if (dragging) {
|
if (dragging) {
|
||||||
PhysicalInstance* part = (PhysicalInstance*) selectedInstance;
|
PhysicalInstance* part = NULL;
|
||||||
|
if(g_selectedInstances.size() > 0)
|
||||||
|
part = (PhysicalInstance*) g_selectedInstances.at(0);
|
||||||
Ray dragRay = cameraController.getCamera()->worldRay(dataModel->mousex, dataModel->mousey, renderDevice->getViewport());
|
Ray dragRay = cameraController.getCamera()->worldRay(dataModel->mousex, dataModel->mousey, renderDevice->getViewport());
|
||||||
std::vector<Instance*> instances = dataModel->getWorkspace()->getAllChildren();
|
std::vector<Instance*> instances = dataModel->getWorkspace()->getAllChildren();
|
||||||
for(size_t i = 0; i < instances.size(); i++)
|
for(size_t i = 0; i < instances.size(); i++)
|
||||||
{
|
{
|
||||||
if(instances.at(i)->getClassName() == "Part")
|
if(PhysicalInstance* moveTo = dynamic_cast<PhysicalInstance*>(instances.at(i)))
|
||||||
{
|
{
|
||||||
PhysicalInstance* moveTo = (PhysicalInstance*)instances.at(i);
|
|
||||||
float __time = testRay.intersectionTime(moveTo->getBox());
|
float __time = testRay.intersectionTime(moveTo->getBox());
|
||||||
float __nearest=std::numeric_limits<float>::infinity();
|
float __nearest=std::numeric_limits<float>::infinity();
|
||||||
if (__time != inf())
|
if (__time != inf())
|
||||||
@@ -847,16 +935,21 @@ void Demo::onUserInput(UserInput* ui) {
|
|||||||
Sleep(10);
|
Sleep(10);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Camera KB Handling {
|
||||||
|
if (GetKPBool(VK_OEM_COMMA)) //Left
|
||||||
|
usableApp->cameraController.panLeft();
|
||||||
|
else if (GetKPBool(VK_OEM_PERIOD)) // Right
|
||||||
|
usableApp->cameraController.panRight();
|
||||||
|
else if (GetKPBool(0x49)) // Zoom In (I)
|
||||||
|
usableApp->cameraController.Zoom(1);
|
||||||
|
else if (GetKPBool(0x4F)) // Zoom Out (O)
|
||||||
|
usableApp->cameraController.Zoom(-1);
|
||||||
|
// }
|
||||||
|
|
||||||
//readMouseGUIInput();
|
//readMouseGUIInput();
|
||||||
// Add other key handling here
|
// Add other key handling here
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void makeFlag(Vector3 &vec, RenderDevice* &rd)
|
void makeFlag(Vector3 &vec, RenderDevice* &rd)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -997,7 +1090,7 @@ void drawOutline(Vector3 from, Vector3 to, RenderDevice* rd, LightingParameters
|
|||||||
void Demo::exitApplication()
|
void Demo::exitApplication()
|
||||||
{
|
{
|
||||||
//endApplet = true;
|
//endApplet = true;
|
||||||
endProgram = true;
|
//endProgram = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1005,10 +1098,10 @@ void Demo::onGraphics(RenderDevice* rd) {
|
|||||||
|
|
||||||
G3D::uint8 num = 0;
|
G3D::uint8 num = 0;
|
||||||
POINT mousepos;
|
POINT mousepos;
|
||||||
bool mouseOnScreen = true;
|
mouseOnScreen = true;
|
||||||
if (GetCursorPos(&mousepos))
|
if (GetCursorPos(&mousepos))
|
||||||
{
|
{
|
||||||
if (ScreenToClient(hWndMain, &mousepos))
|
if (ScreenToClient(_hWndMain, &mousepos))
|
||||||
{
|
{
|
||||||
//mouseOnScreen = true;
|
//mouseOnScreen = true;
|
||||||
|
|
||||||
@@ -1016,20 +1109,25 @@ void Demo::onGraphics(RenderDevice* rd) {
|
|||||||
{
|
{
|
||||||
mouseOnScreen = false;
|
mouseOnScreen = false;
|
||||||
//ShowCursor(true);
|
//ShowCursor(true);
|
||||||
window()->setMouseVisible(true);
|
_window->setMouseVisible(true);
|
||||||
//rd->window()->setInputCaptureCount(0);
|
//rd->window()->setInputCaptureCount(0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mouseOnScreen = true;
|
mouseOnScreen = true;
|
||||||
//SetCursor(NULL);
|
//SetCursor(NULL);
|
||||||
window()->setMouseVisible(false);
|
_window->setMouseVisible(false);
|
||||||
//rd->window()->setInputCaptureCount(1);
|
//rd->window()->setInputCaptureCount(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(Globals::useMousePoint)
|
||||||
|
{
|
||||||
|
mousepos = Globals::mousepoint;
|
||||||
|
ScreenToClient(_hWndMain, &mousepos);
|
||||||
|
}
|
||||||
|
|
||||||
LightingParameters lighting(G3D::toSeconds(11, 00, 00, AM));
|
LightingParameters lighting(G3D::toSeconds(11, 00, 00, AM));
|
||||||
renderDevice->setProjectionAndCameraMatrix(*cameraController.getCamera());
|
renderDevice->setProjectionAndCameraMatrix(*cameraController.getCamera());
|
||||||
@@ -1055,12 +1153,17 @@ void Demo::onGraphics(RenderDevice* rd) {
|
|||||||
dataModel->getWorkspace()->render(rd);
|
dataModel->getWorkspace()->render(rd);
|
||||||
rd->afterPrimitive();
|
rd->afterPrimitive();
|
||||||
|
|
||||||
if(selectedInstance != NULL)
|
if(g_selectedInstances.size() > 0)
|
||||||
{
|
{
|
||||||
PhysicalInstance* part = (PhysicalInstance*)selectedInstance;
|
for(size_t i = 0; i < g_selectedInstances.size(); i++)
|
||||||
Vector3 size = part->getSize();
|
{
|
||||||
Vector3 pos = part->getPosition();
|
if(PhysicalInstance* part = dynamic_cast<PhysicalInstance*>(g_selectedInstances.at(i)))
|
||||||
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), part->getCFrameRenderBased());
|
{
|
||||||
|
Vector3 size = part->getSize();
|
||||||
|
Vector3 pos = part->getPosition();
|
||||||
|
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), part->getCFrameRenderBased());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1111,7 +1214,7 @@ void Demo::onGraphics(RenderDevice* rd) {
|
|||||||
rd->pushState();
|
rd->pushState();
|
||||||
rd->beforePrimitive();
|
rd->beforePrimitive();
|
||||||
|
|
||||||
if(showMouse && mouseOnScreen)
|
if(Globals::showMouse && mouseOnScreen)
|
||||||
{
|
{
|
||||||
glEnable( GL_TEXTURE_2D );
|
glEnable( GL_TEXTURE_2D );
|
||||||
glEnable(GL_BLEND);// you enable blending function
|
glEnable(GL_BLEND);// you enable blending function
|
||||||
@@ -1152,17 +1255,18 @@ void Demo::onKeyUp(int key)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Demo::onMouseLeftPressed(int x,int y)
|
void Demo::onMouseLeftPressed(HWND hwnd,int x,int y)
|
||||||
{
|
{
|
||||||
|
SetFocus(hwnd);
|
||||||
|
|
||||||
std::cout << "Click: " << x << "," << y << std::endl;
|
std::cout << "Click: " << x << "," << y << std::endl;
|
||||||
|
|
||||||
bool onGUI = false;
|
bool onGUI = false;
|
||||||
std::vector<Instance*> instances_2D = dataModel->getGuiRoot()->getAllChildren();
|
std::vector<Instance*> instances_2D = dataModel->getGuiRoot()->getAllChildren();
|
||||||
for(size_t i = 0; i < instances_2D.size(); i++)
|
for(size_t i = 0; i < instances_2D.size(); i++)
|
||||||
{
|
{
|
||||||
if(instances_2D.at(i)->getClassName() == "TextButton" || instances_2D.at(i)->getClassName() == "ImageButton")
|
if(BaseButtonInstance* button = dynamic_cast<BaseButtonInstance*>(instances_2D.at(i)))
|
||||||
{
|
{
|
||||||
BaseButtonInstance* button = (BaseButtonInstance*)instances_2D.at(i);
|
|
||||||
if(button->mouseInButton(x,y, renderDevice))
|
if(button->mouseInButton(x,y, renderDevice))
|
||||||
{
|
{
|
||||||
onGUI = true;
|
onGUI = true;
|
||||||
@@ -1172,29 +1276,55 @@ void Demo::onMouseLeftPressed(int x,int y)
|
|||||||
}
|
}
|
||||||
if(!onGUI)
|
if(!onGUI)
|
||||||
{
|
{
|
||||||
selectedInstance = NULL;
|
|
||||||
testRay = cameraController.getCamera()->worldRay(dataModel->mousex, dataModel->mousey, renderDevice->getViewport());
|
testRay = cameraController.getCamera()->worldRay(dataModel->mousex, dataModel->mousey, renderDevice->getViewport());
|
||||||
float nearest=std::numeric_limits<float>::infinity();
|
float nearest=std::numeric_limits<float>::infinity();
|
||||||
Vector3 camPos = cameraController.getCamera()->getCoordinateFrame().translation;
|
Vector3 camPos = cameraController.getCamera()->getCoordinateFrame().translation;
|
||||||
std::vector<Instance*> instances = dataModel->getWorkspace()->getAllChildren();
|
std::vector<Instance*> instances = dataModel->getWorkspace()->getAllChildren();
|
||||||
for(size_t i = 0; i < instances.size(); i++)
|
bool objFound = false;
|
||||||
|
for(size_t i = 0; i < instances.size(); i++)
|
||||||
{
|
{
|
||||||
if(instances.at(i)->getClassName() == "Part")
|
if(PhysicalInstance* test = dynamic_cast<PhysicalInstance*>(instances.at(i)))
|
||||||
{
|
{
|
||||||
PhysicalInstance* test = (PhysicalInstance*)instances.at(i);
|
|
||||||
float time = testRay.intersectionTime(test->getBox());
|
float time = testRay.intersectionTime(test->getBox());
|
||||||
|
|
||||||
if (time != inf())
|
if (time != inf())
|
||||||
{
|
{
|
||||||
|
objFound = true;
|
||||||
if (nearest>time)
|
if (nearest>time)
|
||||||
{
|
{
|
||||||
nearest=time;
|
nearest=time;
|
||||||
selectedInstance = test;
|
bool found = false;
|
||||||
|
for(size_t i = 0; i < g_selectedInstances.size(); i++)
|
||||||
|
{
|
||||||
|
if(g_selectedInstances.at(i) == test)
|
||||||
|
{
|
||||||
|
found = true;
|
||||||
|
ShowWindow(_propWindow->_hwndProp, SW_SHOW);
|
||||||
|
SetActiveWindow(_propWindow->_hwndProp);
|
||||||
|
SetForegroundWindow(_propWindow->_hwndProp);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(!found)
|
||||||
|
{while(g_selectedInstances.size() > 0)
|
||||||
|
g_selectedInstances.erase(g_selectedInstances.begin());
|
||||||
|
g_selectedInstances.push_back(test);
|
||||||
|
}
|
||||||
|
_propWindow->SetProperties(test);
|
||||||
//message = "Dragging = true.";
|
//message = "Dragging = true.";
|
||||||
//messageTime = System::time();
|
//messageTime = System::time();
|
||||||
//dragging = true;
|
//dragging = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if(!objFound)
|
||||||
|
{
|
||||||
|
while(g_selectedInstances.size() > 0)
|
||||||
|
g_selectedInstances.erase(g_selectedInstances.begin());
|
||||||
|
g_selectedInstances.push_back(dataModel->getWorkspace());
|
||||||
|
_propWindow->SetProperties(dataModel->getWorkspace());
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1209,9 +1339,8 @@ void Demo::onMouseLeftUp(int x,int y)
|
|||||||
std::vector<Instance*> instances = dataModel->getWorkspace()->getAllChildren();
|
std::vector<Instance*> instances = dataModel->getWorkspace()->getAllChildren();
|
||||||
for(size_t i = 0; i < instances_2D.size(); i++)
|
for(size_t i = 0; i < instances_2D.size(); i++)
|
||||||
{
|
{
|
||||||
if(instances_2D.at(i)->getClassName() == "TextButton" || instances_2D.at(i)->getClassName() == "ImageButton")
|
if(BaseButtonInstance* button = dynamic_cast<BaseButtonInstance*>(instances_2D[i]))
|
||||||
{
|
{
|
||||||
BaseButtonInstance* button = (BaseButtonInstance*)instances_2D.at(i);
|
|
||||||
if(button->mouseInButton(x, y, renderDevice))
|
if(button->mouseInButton(x, y, renderDevice))
|
||||||
{
|
{
|
||||||
button->onMouseClick();
|
button->onMouseClick();
|
||||||
@@ -1234,6 +1363,7 @@ void Demo::onMouseMoved(int x,int y)
|
|||||||
}
|
}
|
||||||
void Demo::onMouseWheel(int x,int y,short delta)
|
void Demo::onMouseWheel(int x,int y,short delta)
|
||||||
{
|
{
|
||||||
|
if (mouseOnScreen==true)
|
||||||
if (cameraController.onMouseWheel(x, y, delta))
|
if (cameraController.onMouseWheel(x, y, delta))
|
||||||
{
|
{
|
||||||
AudioPlayer::playSound(cameraSound);
|
AudioPlayer::playSound(cameraSound);
|
||||||
@@ -1262,7 +1392,67 @@ App::~App() {
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
void Boop()
|
||||||
|
{
|
||||||
|
OnError(1, "Test");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
|
{
|
||||||
|
Demo *app = (Demo *)GetWindowLongPtr(hwnd, GWL_USERDATA);
|
||||||
|
if (app==NULL)
|
||||||
|
{
|
||||||
|
return DefWindowProc(hwnd, msg, wParam, lParam);
|
||||||
|
}
|
||||||
|
switch(msg)
|
||||||
|
{
|
||||||
|
case WM_KEYDOWN:
|
||||||
|
if ((HIWORD(lParam)&0x4000)==0) // single key press
|
||||||
|
{
|
||||||
|
app->onKeyPressed(wParam);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case WM_KEYUP:
|
||||||
|
{
|
||||||
|
app->onKeyUp(wParam);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case WM_MOUSEWHEEL:
|
||||||
|
app->onMouseWheel(LOWORD(lParam),HIWORD(lParam),HIWORD(wParam));
|
||||||
|
break;
|
||||||
|
case WM_SIZE:
|
||||||
|
app->resizeWithParent(hwnd);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
return DefWindowProc(hwnd, msg, wParam, lParam);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
LRESULT CALLBACK ToolboxProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
|
{
|
||||||
|
//Demo *app = (Demo *)GetWindowLongPtr(hwnd, GWL_USERDATA);
|
||||||
|
MessageBox(NULL, (LPCSTR)wParam, (LPCSTR)lParam, 1);
|
||||||
|
//if (app==NULL)
|
||||||
|
//{
|
||||||
|
//return DefWindowProc(hwnd, msg, wParam, lParam);
|
||||||
|
//}
|
||||||
|
switch(msg)
|
||||||
|
{
|
||||||
|
case WM_SIZE:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
return DefWindowProc(hwnd, msg, wParam, lParam);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
LRESULT CALLBACK G3DProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
Demo *app = (Demo *)GetWindowLongPtr(hwnd, GWL_USERDATA);
|
Demo *app = (Demo *)GetWindowLongPtr(hwnd, GWL_USERDATA);
|
||||||
if (app==NULL)
|
if (app==NULL)
|
||||||
@@ -1277,22 +1467,8 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
|||||||
case WM_DESTROY:
|
case WM_DESTROY:
|
||||||
app->QuitApp();
|
app->QuitApp();
|
||||||
break;
|
break;
|
||||||
case WM_KEYDOWN:
|
|
||||||
if ((HIWORD(lParam)&0x4000)==0) // single key press
|
|
||||||
{
|
|
||||||
app->onKeyPressed(wParam);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case WM_KEYUP:
|
|
||||||
{
|
|
||||||
app->onKeyUp(wParam);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case WM_LBUTTONDOWN:
|
case WM_LBUTTONDOWN:
|
||||||
app->onMouseLeftPressed(LOWORD(lParam),HIWORD(lParam));
|
app->onMouseLeftPressed(hwnd,LOWORD(lParam),HIWORD(lParam));
|
||||||
break;
|
|
||||||
case WM_MOUSEMOVE:
|
|
||||||
app->onMouseMoved(LOWORD(lParam),HIWORD(lParam));
|
|
||||||
break;
|
break;
|
||||||
case WM_LBUTTONUP:
|
case WM_LBUTTONUP:
|
||||||
app->onMouseLeftUp(LOWORD(lParam),HIWORD(lParam));
|
app->onMouseLeftUp(LOWORD(lParam),HIWORD(lParam));
|
||||||
@@ -1303,16 +1479,11 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
|||||||
case WM_RBUTTONUP:
|
case WM_RBUTTONUP:
|
||||||
app->onMouseRightUp(LOWORD(lParam),HIWORD(lParam));
|
app->onMouseRightUp(LOWORD(lParam),HIWORD(lParam));
|
||||||
break;
|
break;
|
||||||
case WM_MOUSEWHEEL:
|
case WM_MOUSEMOVE:
|
||||||
app->onMouseWheel(LOWORD(lParam),HIWORD(lParam),HIWORD(wParam));
|
app->onMouseMoved(LOWORD(lParam),HIWORD(lParam));
|
||||||
break;
|
break;
|
||||||
case WM_SIZE:
|
case WM_SIZE:
|
||||||
{
|
{
|
||||||
int viewWidth = LOWORD(lParam);
|
|
||||||
int viewHeight = HIWORD(lParam);
|
|
||||||
app->renderDevice->notifyResize(viewWidth,viewHeight);
|
|
||||||
Rect2D viewportRect = Rect2D::xywh(0,0,viewWidth,viewHeight);
|
|
||||||
app->renderDevice->setViewport(viewportRect);
|
|
||||||
app->onGraphics(app->renderDevice);
|
app->onGraphics(app->renderDevice);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -1324,46 +1495,10 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
void Demo::run() {
|
||||||
LRESULT CALLBACK ToolProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
|
||||||
{
|
|
||||||
//Demo *app = (Demo *)GetWindowLongPtr(hwnd, GWL_USERDATA);
|
|
||||||
switch(msg)
|
|
||||||
{
|
|
||||||
case WM_SIZE:
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
{
|
|
||||||
return DefWindowProc(hwnd, msg, wParam, lParam);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool createWindowClass(const char* name,WNDPROC proc,HMODULE hInstance)
|
|
||||||
{
|
|
||||||
WNDCLASSEX wc;
|
|
||||||
wc.cbSize = sizeof(WNDCLASSEX);
|
|
||||||
wc.style = 0;
|
|
||||||
wc.lpfnWndProc = proc;
|
|
||||||
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);
|
|
||||||
wc.lpszMenuName = NULL;
|
|
||||||
wc.lpszClassName = name;
|
|
||||||
wc.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
|
|
||||||
if (!RegisterClassEx (&wc))
|
|
||||||
return false;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Demo::main() {
|
|
||||||
usableApp = this;
|
usableApp = this;
|
||||||
setDebugMode(false);
|
//setDebugMode(false);
|
||||||
debugController.setActive(false);
|
//debugController.setActive(false);
|
||||||
/*
|
/*
|
||||||
if (!createWindowClass("ToolWindowClass",ToolProc,GetModuleHandle(0)))
|
if (!createWindowClass("ToolWindowClass",ToolProc,GetModuleHandle(0)))
|
||||||
{
|
{
|
||||||
@@ -1378,13 +1513,12 @@ void Demo::main() {
|
|||||||
|
|
||||||
ShowWindow(propertyHWnd,SW_SHOW);
|
ShowWindow(propertyHWnd,SW_SHOW);
|
||||||
*/
|
*/
|
||||||
UpdateWindow(hWndMain);
|
UpdateWindow(_hWndMain);
|
||||||
|
|
||||||
// Load objects here=
|
// 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/cursor2.png"));
|
cursor = Texture::fromFile(GetFileInPath("/content/cursor2.png"));
|
||||||
|
Globals::surface = Texture::fromFile(GetFileInPath("/content/images/surfacebr.png"));
|
||||||
|
Globals::surfaceId = Globals::surface->getOpenGLID();
|
||||||
fntdominant = GFont::fromFile(GetFileInPath("/content/font/dominant.fnt"));
|
fntdominant = GFont::fromFile(GetFileInPath("/content/font/dominant.fnt"));
|
||||||
fntlighttrek = GFont::fromFile(GetFileInPath("/content/font/lighttrek.fnt"));
|
fntlighttrek = GFont::fromFile(GetFileInPath("/content/font/lighttrek.fnt"));
|
||||||
cameraSound = GetFileInPath("/content/sounds/SWITCH3.wav");
|
cameraSound = GetFileInPath("/content/sounds/SWITCH3.wav");
|
||||||
@@ -1402,13 +1536,13 @@ void Demo::main() {
|
|||||||
RealTime lastWaitTime=0;
|
RealTime lastWaitTime=0;
|
||||||
|
|
||||||
MSG messages;
|
MSG messages;
|
||||||
RECT cRect;
|
//RECT cRect;
|
||||||
GetClientRect(hWndMain,&cRect);
|
//GetClientRect(_hWndMain,&cRect);
|
||||||
|
//renderDevice->notifyResize(cRect.right,cRect.bottom);
|
||||||
renderDevice->notifyResize(cRect.right,cRect.bottom);
|
//Rect2D viewportRect = Rect2D::xywh(0,0,cRect.right,cRect.bottom);
|
||||||
Rect2D viewportRect = Rect2D::xywh(0,0,cRect.right,cRect.bottom);
|
//renderDevice->setViewport(viewportRect);
|
||||||
renderDevice->setViewport(viewportRect);
|
|
||||||
//window()->setInputCaptureCount(1);
|
//window()->setInputCaptureCount(1);
|
||||||
|
resizeWithParent(_hWndMain);
|
||||||
|
|
||||||
while (!quit)
|
while (!quit)
|
||||||
{
|
{
|
||||||
@@ -1419,7 +1553,7 @@ void Demo::main() {
|
|||||||
|
|
||||||
m_userInputWatch.tick();
|
m_userInputWatch.tick();
|
||||||
onUserInput(userInput);
|
onUserInput(userInput);
|
||||||
m_moduleManager->onUserInput(userInput);
|
//m_moduleManager->onUserInput(userInput);
|
||||||
m_userInputWatch.tock();
|
m_userInputWatch.tock();
|
||||||
|
|
||||||
m_simulationWatch.tick();
|
m_simulationWatch.tick();
|
||||||
@@ -1449,14 +1583,14 @@ void Demo::main() {
|
|||||||
renderDevice->pushState();
|
renderDevice->pushState();
|
||||||
onGraphics(renderDevice);
|
onGraphics(renderDevice);
|
||||||
renderDevice->popState();
|
renderDevice->popState();
|
||||||
renderDebugInfo();
|
//renderDebugInfo();
|
||||||
renderDevice->endFrame();
|
renderDevice->endFrame();
|
||||||
debugText.clear();
|
//debugText.clear();
|
||||||
m_graphicsWatch.tock();
|
m_graphicsWatch.tock();
|
||||||
|
|
||||||
while (PeekMessage (&messages, NULL, 0, 0,PM_REMOVE))
|
while (PeekMessage (&messages, NULL, 0, 0,PM_REMOVE))
|
||||||
{
|
{
|
||||||
if (IsDialogMessage(hWndMain, &messages) == 0)
|
if (IsDialogMessage(_hWndMain, &messages) == 0)
|
||||||
{
|
{
|
||||||
TranslateMessage(&messages);
|
TranslateMessage(&messages);
|
||||||
DispatchMessage(&messages);
|
DispatchMessage(&messages);
|
||||||
@@ -1465,18 +1599,55 @@ void Demo::main() {
|
|||||||
}
|
}
|
||||||
onCleanup();
|
onCleanup();
|
||||||
}
|
}
|
||||||
|
void Demo::resizeWithParent(HWND parentWindow)
|
||||||
|
{
|
||||||
|
RECT rect;
|
||||||
|
GetClientRect(parentWindow,&rect);
|
||||||
|
SetWindowPos(_hwndRenderer,NULL,0,0,rect.right,rect.bottom-60,SWP_NOMOVE);
|
||||||
|
SetWindowPos(_hwndToolbox,NULL,0,rect.bottom-60,rect.right,60,SWP_NOACTIVATE | SWP_SHOWWINDOW);
|
||||||
|
GetClientRect(_hwndRenderer,&rect);
|
||||||
|
int viewWidth=rect.right;
|
||||||
|
int viewHeight=rect.bottom;
|
||||||
|
renderDevice->notifyResize(viewWidth,viewHeight);
|
||||||
|
Rect2D viewportRect = Rect2D::xywh(0,0,viewWidth,viewHeight);
|
||||||
|
renderDevice->setViewport(viewportRect);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void Demo::QuitApp()
|
void Demo::QuitApp()
|
||||||
{
|
{
|
||||||
PostQuitMessage(0);
|
PostQuitMessage(0);
|
||||||
quit=true;
|
quit=true;
|
||||||
}
|
}
|
||||||
|
void Demo::onCreate(HWND parentWindow)
|
||||||
|
{
|
||||||
|
//SetWindowLongPtr(hwndRenderer,GWL_USERDATA,(LONG)this);
|
||||||
|
//SetWindowLongPtr(hwndToolbox,GWL_USERDATA,(LONG)this);
|
||||||
|
//SetWindowLongPtr(hwndMain,GWL_USERDATA,(LONG)&demo);
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char** argv) {
|
int main(int argc, char** argv) {
|
||||||
try{
|
try{
|
||||||
tempPath = ((std::string)getenv("temp")) + "/Dynamica";
|
hresult = OleInitialize(NULL);
|
||||||
|
if (!AXRegister())
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
|
||||||
|
INITCOMMONCONTROLSEX icc;
|
||||||
|
// WNDCLASSEX wcx;
|
||||||
|
|
||||||
|
/* Initialize common controls. Also needed for MANIFEST's */
|
||||||
|
|
||||||
|
icc.dwSize = sizeof(icc);
|
||||||
|
icc.dwICC = ICC_WIN95_CLASSES/*|ICC_COOL_CLASSES|ICC_DATE_CLASSES|
|
||||||
|
ICC_PAGESCROLLER_CLASS|ICC_USEREX_CLASSES*/;
|
||||||
|
InitCommonControlsEx(&icc);
|
||||||
|
|
||||||
|
tempPath = ((std::string)getenv("temp")) + "/"+PlaceholderName;
|
||||||
CreateDirectory(tempPath.c_str(), NULL);
|
CreateDirectory(tempPath.c_str(), NULL);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
message = tempPath;
|
message = tempPath;
|
||||||
messageTime = System::time();
|
messageTime = System::time();
|
||||||
AudioPlayer::init();
|
AudioPlayer::init();
|
||||||
@@ -1488,13 +1659,13 @@ int main(int argc, char** argv) {
|
|||||||
HMODULE hThisInstance = GetModuleHandle(NULL);
|
HMODULE hThisInstance = GetModuleHandle(NULL);
|
||||||
|
|
||||||
if (!createWindowClass("mainHWND",WndProc,hThisInstance))
|
if (!createWindowClass("mainHWND",WndProc,hThisInstance))
|
||||||
{
|
|
||||||
MessageBox(NULL, "Failed to register mainHWND","Dynamica Crash", MB_OK);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
if (!createWindowClass("toolboxHWND",ToolboxProc,hThisInstance))
|
||||||
|
return false;
|
||||||
|
if (!createWindowClass("G3DWindow",G3DProc,hThisInstance))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
HWND hwndMain = CreateWindowEx(
|
||||||
HWND hwndMain = CreateWindowEx(
|
|
||||||
WS_EX_ACCEPTFILES,
|
WS_EX_ACCEPTFILES,
|
||||||
"mainHWND",
|
"mainHWND",
|
||||||
"Main test",
|
"Main test",
|
||||||
@@ -1502,26 +1673,23 @@ int main(int argc, char** argv) {
|
|||||||
CW_USEDEFAULT,
|
CW_USEDEFAULT,
|
||||||
CW_USEDEFAULT,
|
CW_USEDEFAULT,
|
||||||
800,
|
800,
|
||||||
600,
|
660,
|
||||||
NULL, // parent
|
NULL, // parent
|
||||||
NULL, // menu
|
NULL, // menu
|
||||||
hThisInstance,
|
hThisInstance,
|
||||||
NULL
|
NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
if(hwndMain == NULL)
|
if(hwndMain == NULL)
|
||||||
{
|
{
|
||||||
MessageBox(NULL, "Failed to create HWND","Dynamica Crash", MB_OK);
|
MessageBox(NULL, "Failed to create HWND", (PlaceholderName + " Crash").c_str() , MB_OK);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
SendMessage(hwndMain, WM_SETICON, ICON_BIG,(LPARAM)LoadImage(GetModuleHandle(NULL), (LPCSTR)MAKEINTRESOURCEW(IDI_ICON1), IMAGE_ICON, 0, 0, LR_DEFAULTCOLOR | LR_DEFAULTSIZE));
|
SendMessage(hwndMain, WM_SETICON, ICON_BIG,(LPARAM)LoadImage(GetModuleHandle(NULL), (LPCSTR)MAKEINTRESOURCEW(IDI_ICON1), IMAGE_ICON, 0, 0, LR_DEFAULTCOLOR | LR_DEFAULTSIZE));
|
||||||
ShowWindow(hwndMain, SW_SHOW);
|
|
||||||
|
|
||||||
Win32Window* win32Window = Win32Window::create(settings.window,hwndMain);
|
|
||||||
Demo demo = Demo(settings,win32Window);
|
Demo demo = Demo(settings,hwndMain);
|
||||||
|
demo.run();
|
||||||
SetWindowLongPtr(hwndMain,GWL_USERDATA,(LONG)&demo);
|
|
||||||
demo.run();
|
|
||||||
}
|
}
|
||||||
catch(...)
|
catch(...)
|
||||||
{
|
{
|
||||||
|
|||||||
4439
propertyGrid.cpp
Normal file
4439
propertyGrid.cpp
Normal file
File diff suppressed because it is too large
Load Diff
392
propertyGrid.h
Normal file
392
propertyGrid.h
Normal file
@@ -0,0 +1,392 @@
|
|||||||
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
///
|
||||||
|
/// @file propertyGrid.h
|
||||||
|
///
|
||||||
|
/// @brief A property grid control in Win32 SDK C.
|
||||||
|
///
|
||||||
|
/// @author David MacDermot
|
||||||
|
///
|
||||||
|
/// @par Comments:
|
||||||
|
/// This source is distributed in the hope that it will be useful,
|
||||||
|
/// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
/// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
///
|
||||||
|
/// @date 2-27-16
|
||||||
|
///
|
||||||
|
/// @todo
|
||||||
|
///
|
||||||
|
/// @bug
|
||||||
|
///
|
||||||
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
//DWM 1.8: Added Message PG_FLATCHECKS and associated macroes
|
||||||
|
|
||||||
|
#ifndef PROPERTYGRID_H
|
||||||
|
#define PROPERTYGRID_H
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
// Public Messages
|
||||||
|
|
||||||
|
// List box message subset handled by the property grid.
|
||||||
|
|
||||||
|
// LB_ADDSTRING - PropGrid_AddItem()
|
||||||
|
// LB_DELETESTRING - PropGrid_DeleteItem()
|
||||||
|
// LB_GETCOUNT - PropGrid_GetCount()
|
||||||
|
// LB_GETCURSEL - PropGrid_GetCurSel()
|
||||||
|
// LB_GETHORIZONTALEXTENT - PropGrid_GetHorizontalExtent()
|
||||||
|
// LB_GETITEMDATA - PropGrid_GetItemData()
|
||||||
|
// LB_GETITEMHEIGHT - PropGrid_GetItemHeight()
|
||||||
|
// LB_GETITEMRECT - PropGrid_GetItemRect()
|
||||||
|
// LB_GETSEL - PropGrid_GetSel()
|
||||||
|
// LB_RESETCONTENT - PropGrid_ResetContent()
|
||||||
|
// LB_SETCURSEL - PropGrid_SetCurSel()
|
||||||
|
// LB_SETHORIZONTALEXTENT - PropGrid_SetHorizontalExtent()
|
||||||
|
// LB_SETITEMDATA - PropGrid_SetItemData()
|
||||||
|
// LB_SETITEMHEIGHT - PropGrid_SetItemHeight()
|
||||||
|
|
||||||
|
/// @name Property grid specific messages.
|
||||||
|
/// @{
|
||||||
|
#define PG_EXPANDCATALOGS WM_USER + 0x01 ///<PropGrid_ExpandCatalogs()
|
||||||
|
#define PG_COLLAPSECATALOGS WM_USER + 0x02 ///<PropGrid_CollapseCatalogs()
|
||||||
|
#define PG_SHOWTOOLTIPS WM_USER + 0x03 ///<PropGrid_ShowToolTips()
|
||||||
|
#define PG_SHOWPROPERTYDESC WM_USER + 0x04 ///<PropGrid_ShowPropertyDescriptions()
|
||||||
|
#define PG_FLATCHECKS WM_USER + 0x05 ///<PropGrid_SetFlatStyleChecks()
|
||||||
|
/// @}
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
// Property item types
|
||||||
|
|
||||||
|
#define PIT_EDIT 0 ///< Property item type: Edit
|
||||||
|
#define PIT_COMBO 1 ///< Property item type: Dropdownlist
|
||||||
|
#define PIT_EDITCOMBO 2 ///< Property item type: Dropdown(editable)
|
||||||
|
#define PIT_STATIC 3 ///< Property item type: Not editable text
|
||||||
|
#define PIT_COLOR 4 ///< Property item type: Color
|
||||||
|
#define PIT_FONT 5 ///< Property item type: Font
|
||||||
|
#define PIT_FILE 6 ///< Property item type: File select dialog
|
||||||
|
#define PIT_FOLDER 7 ///< Property item type: Folder select dialog
|
||||||
|
#define PIT_CHECK 8 ///< Property item type: BOOL
|
||||||
|
#define PIT_IP 9 ///< Property item type: IP Address
|
||||||
|
#define PIT_DATE 10 ///< Property item type: Date
|
||||||
|
#define PIT_TIME 11 ///< Property item type: Time
|
||||||
|
#define PIT_DATETIME 12 ///< Property item type: Date & Time
|
||||||
|
#define PIT_CATALOG 99 ///< Property item type: Catalog
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
// Public structures and notifications
|
||||||
|
|
||||||
|
/// @var PROPGRIDFDITEM
|
||||||
|
/// @brief A property grid file dialog item object
|
||||||
|
|
||||||
|
/// @var LPPROPGRIDFDITEM
|
||||||
|
/// @brief Pointer to a property grid file dialog item
|
||||||
|
|
||||||
|
/// @struct tagPROPGRIDFDITEM
|
||||||
|
/// @brief This is additional data associated with a property grid file dialog item
|
||||||
|
typedef struct tagPROPGRIDFDITEM {
|
||||||
|
LPTSTR lpszDlgTitle; ///< Dialog title
|
||||||
|
LPTSTR lpszFilePath; ///< Initial path
|
||||||
|
LPTSTR lpszFilter; ///< Double null terminated filter string
|
||||||
|
LPTSTR lpszDefExt; ///< Default extension
|
||||||
|
} PROPGRIDFDITEM, *LPPROPGRIDFDITEM;
|
||||||
|
|
||||||
|
/// @var PROPGRIDFONTITEM
|
||||||
|
/// @brief A property grid font item object
|
||||||
|
|
||||||
|
/// @var LPPROPGRIDFONTITEM
|
||||||
|
/// @brief Pointer to a property grid font item
|
||||||
|
|
||||||
|
/// @struct tagPROPGRIDFONTITEM
|
||||||
|
/// @brief This is additional data associated with a property grid font item
|
||||||
|
typedef struct tagPROPGRIDFONTITEM {
|
||||||
|
LOGFONT logFont; ///< Logical font struct
|
||||||
|
COLORREF crFont; ///< Text color
|
||||||
|
} PROPGRIDFONTITEM, *LPPROPGRIDFONTITEM;
|
||||||
|
|
||||||
|
/// @var PROPGRIDITEM
|
||||||
|
/// @brief A property grid item object
|
||||||
|
|
||||||
|
/// @var LPPROPGRIDITEM
|
||||||
|
/// @brief Pointer to a property grid item
|
||||||
|
|
||||||
|
/// @struct tagPROPGRIDITEM
|
||||||
|
/// @brief This is the data associated with a property grid item
|
||||||
|
typedef struct tagPROPGRIDITEM {
|
||||||
|
LPTSTR lpszCatalog; ///< Catalog (group) name
|
||||||
|
LPTSTR lpszPropName; ///< Property (item) name
|
||||||
|
LPTSTR lpszzCmbItems; ///< Double null terminated list of strings
|
||||||
|
LPTSTR lpszPropDesc; ///< Property (item) description
|
||||||
|
LPARAM lpCurValue; ///< Property (item) value
|
||||||
|
INT iItemType; ///< Property (item) type identifier
|
||||||
|
} PROPGRIDITEM, *LPPROPGRIDITEM;
|
||||||
|
|
||||||
|
/// @var NMPROPGRID
|
||||||
|
/// @brief A property grid notification message data object
|
||||||
|
|
||||||
|
/// @var LPNMPROPGRID
|
||||||
|
/// @brief Pointer to property grid notification message data
|
||||||
|
|
||||||
|
/// @struct tagNMPROPGRID
|
||||||
|
/// @brief This is the data associated with a property grid notification
|
||||||
|
typedef struct tagNMPROPGRID {
|
||||||
|
NMHDR hdr; ///< Notification message header
|
||||||
|
INT iIndex; ///< Index of a property grid item
|
||||||
|
} NMPROPGRID, *LPNMPROPGRID;
|
||||||
|
|
||||||
|
#define PGN_PROPERTYCHANGE WM_USER + 0x2A ///<property grid Property changed notification message
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
/// @name Macroes
|
||||||
|
/// @{
|
||||||
|
|
||||||
|
/// @def PropGrid_AddItem(hwndCtl,lpItem)
|
||||||
|
///
|
||||||
|
/// @brief Add an item to a property grid. Items are appended to their respective
|
||||||
|
/// catalogs.
|
||||||
|
///
|
||||||
|
/// @param hwndCtl The handle of a property grid.
|
||||||
|
/// @param lpItem Pointer to a property grid item.
|
||||||
|
///
|
||||||
|
/// @returns The zero-based index of the item in the list box. If an error occurs,
|
||||||
|
/// the return value is LB_ERR. If there is insufficient space to store
|
||||||
|
/// the new string, the return value is LB_ERRSPACE.
|
||||||
|
#define PropGrid_AddItem(hwndCtl,lpItem) ((int)(DWORD)SendMessage((hwndCtl),LB_ADDSTRING,0,(LPARAM)(lpItem)))
|
||||||
|
|
||||||
|
/// @def PropGrid_DeleteItem(hwndCtl,index)
|
||||||
|
///
|
||||||
|
/// @brief Deletes the item at the specified location in a property grid.
|
||||||
|
///
|
||||||
|
/// @param hwndCtl The handle of a property grid.
|
||||||
|
/// @param index The zero-based index of the item to delete.
|
||||||
|
///
|
||||||
|
/// @returns A count of the items remaining in the grid. The return value is
|
||||||
|
/// LB_ERR if the index parameter specifies an index greater than the
|
||||||
|
/// number of items in the list.
|
||||||
|
#define PropGrid_DeleteItem(hwndCtl,index) ((int)(DWORD)SendMessage((hwndCtl),LB_DELETESTRING,(WPARAM)(int)(index),0))
|
||||||
|
|
||||||
|
/// @def PropGrid_Enable(hwndCtl,fEnable)
|
||||||
|
///
|
||||||
|
/// @brief Enables or disables a property grid control.
|
||||||
|
///
|
||||||
|
/// @param hwndCtl The handle of a property grid.
|
||||||
|
/// @param fEnable TRUE to enable the control, or FALSE to disable it.
|
||||||
|
///
|
||||||
|
/// @returns No return value.
|
||||||
|
#define PropGrid_Enable(hwndCtl,fEnable) EnableWindow((hwndCtl),(fEnable))
|
||||||
|
|
||||||
|
/// @def PropGrid_GetCount(hwndCtl)
|
||||||
|
///
|
||||||
|
/// @brief Gets the number of items in a property grid.
|
||||||
|
///
|
||||||
|
/// @param hwndCtl The handle of a property grid.
|
||||||
|
///
|
||||||
|
/// @returns The number of items.
|
||||||
|
#define PropGrid_GetCount(hwndCtl) ((int)(DWORD)SendMessage((hwndCtl),LB_GETCOUNT,0,0))
|
||||||
|
|
||||||
|
/// @def PropGrid_GetCurSel(hwndCtl)
|
||||||
|
///
|
||||||
|
/// @brief Gets the index of the currently selected item in a property grid.
|
||||||
|
///
|
||||||
|
/// @param hwndCtl The handle of a property grid.
|
||||||
|
///
|
||||||
|
/// @returns The zero-based index of the selected item. If there is no selection,
|
||||||
|
/// the return value is LB_ERR.
|
||||||
|
#define PropGrid_GetCurSel(hwndCtl) ((int)(DWORD)SendMessage((hwndCtl),LB_GETCURSEL,0,0))
|
||||||
|
|
||||||
|
/// @def PropGrid_GetHorizontalExtent(hwndCtl)
|
||||||
|
///
|
||||||
|
/// @brief Gets the width that a property grid can be scrolled horizontally
|
||||||
|
/// (the scrollable width).
|
||||||
|
///
|
||||||
|
/// @param hwndCtl The handle of a property grid.
|
||||||
|
///
|
||||||
|
/// @returns The scrollable width, in pixels, of the property grid.
|
||||||
|
#define PropGrid_GetHorizontalExtent(hwndCtl) ((int)(DWORD)SendMessage((hwndCtl),LB_GETHORIZONTALEXTENT,0,0))
|
||||||
|
|
||||||
|
/// @def PropGrid_GetItemData(hwndCtl,index)
|
||||||
|
///
|
||||||
|
/// @brief Gets the PROPGRIDITEM associated with the specified property grid item.
|
||||||
|
///
|
||||||
|
/// @param hwndCtl The handle of a property grid.
|
||||||
|
/// @param index The zero-based index of the item.
|
||||||
|
///
|
||||||
|
/// @returns A pointer to a PROPGRIDITEM object.
|
||||||
|
#define PropGrid_GetItemData(hwndCtl,index) ((LPPROPGRIDITEM)(DWORD_PTR)SendMessage((hwndCtl),LB_GETITEMDATA,(WPARAM)(int)(index),0))
|
||||||
|
|
||||||
|
/// @def PropGrid_GetItemHeight(hwndCtl)
|
||||||
|
///
|
||||||
|
/// @brief Retrieves the height of all items in a property grid.
|
||||||
|
///
|
||||||
|
/// @param hwndCtl The handle of a property grid.
|
||||||
|
///
|
||||||
|
/// @returns The height, in pixels, of the items, or LB_ERR if an error occurs.
|
||||||
|
#define PropGrid_GetItemHeight(hwndCtl) ((int)(DWORD)SendMessage((hwndCtl),LB_GETITEMHEIGHT,(WPARAM)0,0))
|
||||||
|
|
||||||
|
/// @def PropGrid_GetItemRect(hwndCtl,index,lprc)
|
||||||
|
///
|
||||||
|
/// @brief Gets the dimensions of the rectangle that bounds a property grid item
|
||||||
|
/// as it is currently displayed in the property grid.
|
||||||
|
///
|
||||||
|
/// @param hwndCtl The handle of a property grid.
|
||||||
|
/// @param index The zero-based index of the item in the property grid.
|
||||||
|
/// @param lprc A pointer to a RECT structure that receives the client
|
||||||
|
/// coordinates for the item in the property grid.
|
||||||
|
///
|
||||||
|
/// @returns If an error occurs, the return value is LB_ERR.
|
||||||
|
#define PropGrid_GetItemRect(hwndCtl,index,lprc) ((int)(DWORD)SendMessage((hwndCtl),LB_GETITEMRECT,(WPARAM)(int)(index),(LPARAM)(RECT*)(lprc)))
|
||||||
|
|
||||||
|
/// @def PropGrid_GetSel(hwndCtl,index)
|
||||||
|
///
|
||||||
|
/// @brief Gets the selection state of an item.
|
||||||
|
///
|
||||||
|
/// @param hwndCtl The handle of a property grid.
|
||||||
|
/// @param index The zero-based index of the item.
|
||||||
|
///
|
||||||
|
/// @returns If the item is selected, the return value is greater than zero;
|
||||||
|
/// otherwise, it is zero. If an error occurs, the return value is LB_ERR.
|
||||||
|
#define PropGrid_GetSel(hwndCtl,index) ((int)(DWORD)SendMessage((hwndCtl),LB_GETSEL,(WPARAM)(int)(index),0))
|
||||||
|
|
||||||
|
/// @def PropGrid_ResetContent(hwndCtl)
|
||||||
|
///
|
||||||
|
/// @brief Removes all items from a property grid.
|
||||||
|
///
|
||||||
|
/// @param hwndCtl The handle of a property grid.
|
||||||
|
///
|
||||||
|
/// @returns The return value is not meaningful.
|
||||||
|
#define PropGrid_ResetContent(hwndCtl) ((BOOL)(DWORD)SendMessage((hwndCtl),LB_RESETCONTENT,0,0))
|
||||||
|
|
||||||
|
/// @def PropGrid_SetCurSel(hwndCtl,index)
|
||||||
|
///
|
||||||
|
/// @brief Sets the currently selected item in a property grid.
|
||||||
|
///
|
||||||
|
/// @param hwndCtl The handle of a property grid.
|
||||||
|
/// @param index The zero-based index of the item to select, or <20>1 to clear the selection.
|
||||||
|
///
|
||||||
|
/// @returns If an error occurs, the return value is LB_ERR. If the index
|
||||||
|
/// parameter is <20>1, the return value is LB_ERR even though no error occurred.
|
||||||
|
#define PropGrid_SetCurSel(hwndCtl,index) ((int)(DWORD)SendMessage((hwndCtl),LB_SETCURSEL,(WPARAM)(int)(index),0))
|
||||||
|
|
||||||
|
/// @def PropGrid_SetHorizontalExtent(hwndCtl,cxExtent)
|
||||||
|
///
|
||||||
|
/// @brief Set the width by which a property grid can be scrolled horizontally
|
||||||
|
/// (the scrollable width). If the width of the property grid is smaller
|
||||||
|
/// than this value, the horizontal scroll bar horizontally scrolls items
|
||||||
|
/// in the property grid. If the width of the property grid is equal to or
|
||||||
|
/// greater than this value, the horizontal scroll bar is hidden.
|
||||||
|
///
|
||||||
|
/// @param hwndCtl The handle of a property grid.
|
||||||
|
/// @param cxExtent The number of pixels by which the list box can be scrolled.
|
||||||
|
///
|
||||||
|
/// @returns No return value.
|
||||||
|
#define PropGrid_SetHorizontalExtent(hwndCtl,cxExtent) ((void)SendMessage((hwndCtl),LB_SETHORIZONTALEXTENT,(WPARAM)(int)(cxExtent),0))
|
||||||
|
|
||||||
|
/// @def PropGrid_SetItemData(hwndCtl,index,data)
|
||||||
|
///
|
||||||
|
/// @brief Sets the PROPGRIDITEM associated with the specified property grid item.
|
||||||
|
///
|
||||||
|
/// @param hwndCtl The handle of a property grid.
|
||||||
|
/// @param index The zero-based index of the item.
|
||||||
|
/// @param data The item data to set.
|
||||||
|
///
|
||||||
|
/// @returns If an error occurs, the return value is LB_ERR.
|
||||||
|
#define PropGrid_SetItemData(hwndCtl,index,data) ((int)(DWORD)SendMessage((hwndCtl),LB_SETITEMDATA,(WPARAM)(int)(index),(LPARAM)(data)))
|
||||||
|
|
||||||
|
/// @def PropGrid_SetItemHeight(hwndCtl,cy)
|
||||||
|
///
|
||||||
|
/// @brief Sets the height of all items in a property grid.
|
||||||
|
///
|
||||||
|
/// @param hwndCtl The handle of a property grid.
|
||||||
|
/// @param cy The height of the items, in pixels.
|
||||||
|
///
|
||||||
|
/// @returns If the height is invalid, the return value is LB_ERR.
|
||||||
|
#define PropGrid_SetItemHeight(hwndCtl,cy) ((int)(DWORD)SendMessage((hwndCtl),LB_SETITEMHEIGHT,(WPARAM)0,MAKELPARAM((cy),0)))
|
||||||
|
|
||||||
|
/// @def PropGrid_ExpandCatalogs(hwndCtl, lpszzCatalogs)
|
||||||
|
///
|
||||||
|
/// @brief Expand certain specified catalogs in a property grid.
|
||||||
|
///
|
||||||
|
/// @param hwndCtl The handle of a property grid.
|
||||||
|
/// @param lpszzCatalogs The list of catalog names each terminated by a null (\\0).
|
||||||
|
///
|
||||||
|
/// @returns No return value.
|
||||||
|
#define PropGrid_ExpandCatalogs(hwndCtl, lpszzCatalogs) ((void)SendMessage((hwndCtl),PG_EXPANDCATALOGS,(WPARAM)0,(LPARAM)(lpszzCatalogs)))
|
||||||
|
|
||||||
|
/// @def PropGrid_ExpandAllCatalogs(hwndCtl)
|
||||||
|
///
|
||||||
|
/// @brief Expand all catalogs in a property grid.
|
||||||
|
///
|
||||||
|
/// @param hwndCtl The handle of a property grid.
|
||||||
|
///
|
||||||
|
/// @returns No return value.
|
||||||
|
#define PropGrid_ExpandAllCatalogs(hwndCtl) ((void)SendMessage((hwndCtl),PG_EXPANDCATALOGS,(WPARAM)0,(LPARAM)NULL))
|
||||||
|
|
||||||
|
/// @def PropGrid_CollapseCatalogs(hwndCtl, lpszzCatalogs)
|
||||||
|
///
|
||||||
|
/// @brief Collapse certain specified catalogs in a property grid.
|
||||||
|
///
|
||||||
|
/// @param hwndCtl The handle of a property grid.
|
||||||
|
/// @param lpszzCatalogs The catalog names each terminated by a null (\\0).
|
||||||
|
///
|
||||||
|
/// @returns No return value.
|
||||||
|
#define PropGrid_CollapseCatalogs(hwndCtl, lpszzCatalogs) ((void)SendMessage((hwndCtl),PG_COLLAPSECATALOGS,(WPARAM)0,(LPARAM)(lpszzCatalogs)))
|
||||||
|
|
||||||
|
/// @def PropGrid_CollapseAllCatalogs(hwndCtl)
|
||||||
|
///
|
||||||
|
/// @brief Collapse all catalogs in a property grid.
|
||||||
|
///
|
||||||
|
/// @param hwndCtl The handle of a property grid.
|
||||||
|
///
|
||||||
|
/// @returns No return value.
|
||||||
|
#define PropGrid_CollapseAllCatalogs(hwndCtl) ((void)SendMessage((hwndCtl),PG_COLLAPSECATALOGS,(WPARAM)0,(LPARAM)NULL))
|
||||||
|
|
||||||
|
/// @def PropGrid_ShowToolTips(hwndCtl,fShow)
|
||||||
|
///
|
||||||
|
/// @brief Show or hide tooltips in the property grid.
|
||||||
|
///
|
||||||
|
/// @param hwndCtl The handle of a property grid.
|
||||||
|
/// @param fShow TRUE for tooltips; FALSE do not show tooltips.
|
||||||
|
///
|
||||||
|
/// @returns No return value.
|
||||||
|
#define PropGrid_ShowToolTips(hwndCtl,fShow) ((void)SendMessage((hwndCtl),PG_SHOWTOOLTIPS,(WPARAM)(fShow),(LPARAM)0L))
|
||||||
|
|
||||||
|
/// @def PropGrid_ShowPropertyDescriptions(hwndCtl,fShow)
|
||||||
|
///
|
||||||
|
/// @brief Show or hide the property discription pane in the property grid.
|
||||||
|
///
|
||||||
|
/// @param hwndCtl The handle of a property grid.
|
||||||
|
/// @param fShow TRUE for descriptions; FALSE do not show discription pane.
|
||||||
|
///
|
||||||
|
/// @returns No return value.
|
||||||
|
#define PropGrid_ShowPropertyDescriptions(hwndCtl,fShow) ((void)SendMessage((hwndCtl),PG_SHOWPROPERTYDESC,(WPARAM)(fShow),(LPARAM)0L))
|
||||||
|
|
||||||
|
/// @def PropGrid_SetFlatStyleChecks(hwndCtl, fFlat)
|
||||||
|
///
|
||||||
|
/// @brief Sets the appearance of the checkboxes.
|
||||||
|
///
|
||||||
|
/// @param hwndCtl The handle of a property grid.
|
||||||
|
/// @param fFlat TRUE for flat checkboxes, or FALSE for standard checkboxes.
|
||||||
|
///
|
||||||
|
/// @returns No return value.
|
||||||
|
#define PropGrid_SetFlatStyleChecks(hwndCtl, fFlat) \
|
||||||
|
((void)SendMessage((hwndCtl),PG_FLATCHECKS,(WPARAM)(BOOL) (fFlat),(LPARAM)0L))
|
||||||
|
|
||||||
|
/// @def PropGrid_ItemInit(pgi)
|
||||||
|
///
|
||||||
|
/// @brief Initialize an item struct.
|
||||||
|
///
|
||||||
|
/// @param pgi The PROPGRIDITEM struct.
|
||||||
|
///
|
||||||
|
/// @returns No return value.
|
||||||
|
#define PropGrid_ItemInit(pgi) \
|
||||||
|
(pgi.lpszCatalog = NULL, pgi.lpszPropName = NULL, \
|
||||||
|
pgi.lpszzCmbItems = NULL, pgi.lpszPropDesc = NULL, \
|
||||||
|
pgi.lpCurValue = 0, pgi.iItemType = 0)
|
||||||
|
|
||||||
|
/// @}
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
// Exported function prototypes
|
||||||
|
|
||||||
|
ATOM InitPropertyGrid(HINSTANCE hInstance);
|
||||||
|
HWND New_PropertyGrid(HWND hParent, DWORD dwID);
|
||||||
|
|
||||||
|
#endif //PROPERTYGRID_H
|
||||||
13
resource.h
13
resource.h
@@ -2,18 +2,17 @@
|
|||||||
// Microsoft Visual C++ generated include file.
|
// Microsoft Visual C++ generated include file.
|
||||||
// Used by Dialogs.rc
|
// Used by Dialogs.rc
|
||||||
//
|
//
|
||||||
#define IDD_ABOUT_DIALOG 102
|
#define IDI_ICON1 102
|
||||||
#define IDD_TOOLBOX 103
|
#define IDB_BITMAP1 103
|
||||||
#define IDI_ICON1 106
|
#define IDC_PROPERTYGRID 2000
|
||||||
#define IDC_TOOLBOX_BROWSER 1001
|
|
||||||
|
|
||||||
// Next default values for new objects
|
// Next default values for new objects
|
||||||
//
|
//
|
||||||
#ifdef APSTUDIO_INVOKED
|
#ifdef APSTUDIO_INVOKED
|
||||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||||
#define _APS_NEXT_RESOURCE_VALUE 107
|
#define _APS_NEXT_RESOURCE_VALUE 104
|
||||||
#define _APS_NEXT_COMMAND_VALUE 40004
|
#define _APS_NEXT_COMMAND_VALUE 40001
|
||||||
#define _APS_NEXT_CONTROL_VALUE 1002
|
#define _APS_NEXT_CONTROL_VALUE 1001
|
||||||
#define _APS_NEXT_SYMED_VALUE 101
|
#define _APS_NEXT_SYMED_VALUE 101
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user