Compare commits
150 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6d1428ced9 | ||
|
|
0f700aeda5 | ||
|
|
7273ee9ce0 | ||
|
|
1a7cd2e250 | ||
|
|
99f78be344 | ||
|
|
ee528d1245 | ||
|
|
18b856602c | ||
|
|
0dcd054da3 | ||
|
|
268a0cd2ee | ||
|
|
c71dcb8a91 | ||
|
|
24306c04ec | ||
|
|
b986815fcb | ||
|
|
a70cc31d28 | ||
|
|
b097cb15e4 | ||
|
|
b18ebfb56f | ||
|
|
eade3d8e93 | ||
|
|
ccf440a65e | ||
|
|
551a0e4b9e | ||
|
|
4afe95ae26 | ||
|
|
c6151b58e2 | ||
|
|
6f91ad5881 | ||
|
|
09d9af492f | ||
|
|
bd37f8e22d | ||
|
|
c5485fbf55 | ||
|
|
f02272976a | ||
|
|
0b9429d1bd | ||
|
|
43e606f08e | ||
|
|
8fd2cb8f68 | ||
|
|
a19103c896 | ||
|
|
06660a9f46 | ||
|
|
aa1c2df26c | ||
|
|
03d696a8fa | ||
|
|
240b342870 | ||
|
|
ef9e6c798b | ||
|
|
a29c59f8d2 | ||
|
|
aa2e62d2b5 | ||
|
|
19f125dcc6 | ||
|
|
0f3ccb8045 | ||
|
|
2134c66124 | ||
|
|
5806b48bae | ||
|
|
507b0a9ace | ||
|
|
679dbe69b8 | ||
|
|
4f766d8617 | ||
|
|
90e74e5133 | ||
|
|
1c9b93d6ab | ||
|
|
5eafaa401a | ||
|
|
e0ba49a03c | ||
|
|
2725f6da58 | ||
|
|
8985579159 | ||
|
|
c03160c3fd | ||
|
|
9193dfcabb | ||
|
|
c4df4131df | ||
|
|
374d3d3627 | ||
|
|
fe65f8945c | ||
|
|
db4c46cf20 | ||
|
|
c00e52a9e2 | ||
|
|
c65ac42d64 | ||
|
|
95d041bf5e | ||
|
|
89d2d0b981 | ||
|
|
0417060c1b | ||
|
|
e7ea4c4b72 | ||
|
|
bbab248209 | ||
|
|
4401fb8773 | ||
|
|
3bbfeae228 | ||
|
|
4bb2098fe1 | ||
|
|
ee1258b177 | ||
|
|
341866b8bb | ||
|
|
dae6dd5390 | ||
|
|
03fd38aaa7 | ||
|
|
f99d18f6ae | ||
|
|
a47268830b | ||
|
|
838f69944e | ||
|
|
c6d6c3fd40 | ||
|
|
bf946ead54 | ||
|
|
2a2d6a777b | ||
|
|
5c90258546 | ||
|
|
018c4a1557 | ||
|
|
0bd49da8f4 | ||
|
|
1926dfa686 | ||
|
|
1c337b0cdc | ||
|
|
54b19ba659 | ||
|
|
336b978fd3 | ||
|
|
90c609d06d | ||
|
|
22e018e138 | ||
|
|
a676a44fea | ||
|
|
cd7785ce06 | ||
|
|
fb3513c6f6 | ||
|
|
0cf7813bea | ||
|
|
39f68e1acc | ||
|
|
be124fff75 | ||
|
|
db9e030b53 | ||
|
|
b1a7aac481 | ||
|
|
e03a438169 | ||
|
|
f934a3fa38 | ||
|
|
8f72e8e666 | ||
|
|
da9d64c56f | ||
|
|
e5f7c7d1cc | ||
|
|
08b4d062e9 | ||
|
|
a8bfa1b4cd | ||
|
|
312ea44922 | ||
|
|
6accc7e366 | ||
|
|
f16d626f0d | ||
|
|
636d39bd2d | ||
|
|
6730ddc7bc | ||
|
|
b66d676254 | ||
|
|
a6eb176ec3 | ||
|
|
8816e96ba3 | ||
|
|
5aaf134ba8 | ||
|
|
66391f69c4 | ||
|
|
b40a2559f6 | ||
|
|
741f4eaf14 | ||
|
|
be7e532ead | ||
|
|
72954be880 | ||
|
|
a16953c8a0 | ||
|
|
b2c0fb58da | ||
|
|
828c0dcb41 | ||
|
|
cd0f1617cb | ||
|
|
2607fc8551 | ||
|
|
1de2fb6811 | ||
|
|
c84a2173c8 | ||
|
|
c38ede1bd1 | ||
|
|
0f609662bb | ||
|
|
512655b448 | ||
|
|
4fea98467d | ||
|
|
29dad6bd8d | ||
|
|
e04f53c071 | ||
|
|
4b580ef5ad | ||
|
|
5232d5e97f | ||
|
|
011d817321 | ||
|
|
60c7a386f0 | ||
|
|
3ee06b6c62 | ||
|
|
57b407c894 | ||
|
|
9999eb62e4 | ||
|
|
930aee06dc | ||
|
|
e6ca1cd502 | ||
|
|
c875454b40 | ||
|
|
388962a5e7 | ||
|
|
9986f2ee5f | ||
|
|
529821ab9f | ||
|
|
d72d09f95d | ||
|
|
d810c213f6 | ||
|
|
2bdef97edf | ||
|
|
ce66ec6f5d | ||
|
|
df5076e90f | ||
|
|
faaa59f58b | ||
|
|
78ece8c2a2 | ||
|
|
8dff73d5f5 | ||
|
|
4bdb1d6939 | ||
|
|
59510383e6 | ||
|
|
f0f16a3a69 |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -51,3 +51,5 @@ log.txt
|
||||
G3DTest.suo
|
||||
G3DTest.suo
|
||||
stderr.txt
|
||||
desktop.ini
|
||||
main.cpp
|
||||
|
||||
4
ActionType.h
Normal file
4
ActionType.h
Normal file
@@ -0,0 +1,4 @@
|
||||
#ifndef ACTIONTYPE_H
|
||||
#define ACTIONTYPE_H
|
||||
static enum ActionType {Nothing, Pause, Lose, Draw, Win};
|
||||
#endif
|
||||
4
AffectType.h
Normal file
4
AffectType.h
Normal file
@@ -0,0 +1,4 @@
|
||||
#ifndef AFFECTTYPE_H
|
||||
#define AFFECTTYPE_H
|
||||
static enum AffectType {NoChange, Increase, Decrease};
|
||||
#endif
|
||||
@@ -32,7 +32,6 @@ void AudioPlayer::init()
|
||||
/* Open the audio device and start playing sound! */
|
||||
if ( SDL_OpenAudio(&fmt, NULL) < 0 ) {
|
||||
fprintf(stderr, "Unable to open audio: %s\n", SDL_GetError());
|
||||
exit(1);
|
||||
}
|
||||
SDL_PauseAudio(0);
|
||||
}
|
||||
@@ -58,7 +57,7 @@ void mixaudio(void *unused, Uint8 *stream, int len)
|
||||
}
|
||||
}
|
||||
|
||||
void AudioPlayer::PlaySound(std::string fileString)
|
||||
void AudioPlayer::playSound(std::string fileString)
|
||||
{
|
||||
|
||||
if(initiated)
|
||||
|
||||
@@ -6,6 +6,6 @@ class AudioPlayer
|
||||
public:
|
||||
AudioPlayer(void);
|
||||
~AudioPlayer(void);
|
||||
static void PlaySound(std::string);
|
||||
static void playSound(std::string);
|
||||
static void init();
|
||||
};
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "BaseButtonInstance.h"
|
||||
#include "Globals.h"
|
||||
|
||||
bool floatBottom = false;
|
||||
bool floatRight = false;
|
||||
@@ -12,6 +13,14 @@ BaseButtonInstance::BaseButtonInstance(void)
|
||||
listener = NULL;
|
||||
}
|
||||
|
||||
void BaseButtonInstance::render(RenderDevice* rd)
|
||||
{
|
||||
DataModelInstance* dataModel = Globals::dataModel;
|
||||
Vector2 pos = Vector2(dataModel->mousex,dataModel->mousey);
|
||||
drawObj(rd, pos, dataModel->mouseButton1Down);
|
||||
Instance::render(rd);
|
||||
}
|
||||
|
||||
BaseButtonInstance::~BaseButtonInstance(void)
|
||||
{
|
||||
delete listener;
|
||||
|
||||
@@ -8,6 +8,7 @@ class BaseButtonInstance : public Instance
|
||||
public:
|
||||
BaseButtonInstance(void);
|
||||
virtual ~BaseButtonInstance(void);
|
||||
virtual void render(RenderDevice* rd);
|
||||
virtual void drawObj(RenderDevice* rd, Vector2 mousePos, bool mouseDown);
|
||||
virtual bool mouseInButton(float, float, RenderDevice* rd);
|
||||
virtual void onMouseClick();
|
||||
|
||||
4
BinType.h
Normal file
4
BinType.h
Normal file
@@ -0,0 +1,4 @@
|
||||
#ifndef BINTYPE_H
|
||||
#define BINTYPE_H
|
||||
static enum ActionType {GameTool, Grab, Clone, Hammer};
|
||||
#endif
|
||||
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);
|
||||
};
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "ButtonListener.h"
|
||||
|
||||
|
||||
ButtonListener::ButtonListener(void)
|
||||
ButtonListener::ButtonListener()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
#pragma once
|
||||
#include "Demo.h"
|
||||
#include "BaseButtonInstance.h"
|
||||
class BaseButtonInstance;
|
||||
|
||||
class ButtonListener
|
||||
{
|
||||
public:
|
||||
ButtonListener(void);
|
||||
ButtonListener();
|
||||
~ButtonListener(void);
|
||||
virtual void onButton1MouseClick(BaseButtonInstance*);
|
||||
//virtual void onMouseOver(); //TODO
|
||||
|
||||
231
CameraController.cpp
Normal file
231
CameraController.cpp
Normal file
@@ -0,0 +1,231 @@
|
||||
#include "CameraController.h"
|
||||
#include "win32Defines.h"
|
||||
#include <iostream>
|
||||
#include "PhysicalInstance.h"
|
||||
#include "Demo.h"
|
||||
#include "AudioPlayer.h"
|
||||
|
||||
|
||||
|
||||
CameraController::CameraController(){
|
||||
yaw=0;
|
||||
pitch=0;
|
||||
moveRate=0.5f;
|
||||
forwards=false;
|
||||
backwards=false;
|
||||
left=false;
|
||||
right=false;
|
||||
zoom=7.f;
|
||||
rightButtonHolding=false;
|
||||
focusPosition=Vector3(0,0,0);
|
||||
}
|
||||
|
||||
GCamera* CameraController::getCamera()
|
||||
{
|
||||
return &g3dCamera;
|
||||
}
|
||||
|
||||
void CameraController::lookAt(const Vector3& position) {
|
||||
const Vector3 look = (position - g3dCamera.getCoordinateFrame().translation);
|
||||
yaw = aTan2(look.x, -look.z);
|
||||
|
||||
pitch = -aTan2(look.y, distance(look.x, look.z));
|
||||
CoordinateFrame frame = g3dCamera.getCoordinateFrame().translation;
|
||||
frame.rotation = Matrix3::fromEulerAnglesZYX(0, -yaw, -pitch);
|
||||
g3dCamera.setCoordinateFrame(frame);
|
||||
}
|
||||
|
||||
void CameraController::setFrame(const CoordinateFrame& cf) {
|
||||
Vector3 look = cf.getLookVector();
|
||||
g3dCamera.setCoordinateFrame(cf);
|
||||
lookAt(cf.translation + look);
|
||||
focusPosition=cf.translation+cf.lookVector()*zoom;
|
||||
}
|
||||
|
||||
CoordinateFrame CameraController::getCoordinateFrame() {
|
||||
CoordinateFrame cf;
|
||||
cf.translation=translation;
|
||||
cf.rotation = Matrix3::fromEulerAnglesZYX(0, -yaw, -pitch);
|
||||
return cf;
|
||||
}
|
||||
|
||||
void CameraController::refreshZoom(const CoordinateFrame& frame)
|
||||
{
|
||||
CoordinateFrame zoomFrame = focusPosition-frame.lookVector()*zoom;
|
||||
zoomFrame.lookAt(focusPosition);
|
||||
setFrame(zoomFrame);
|
||||
}
|
||||
|
||||
void CameraController::pan(CoordinateFrame* frame,float spdX, float spdY)
|
||||
{
|
||||
yaw+=spdX;
|
||||
pitch+=spdY;
|
||||
|
||||
if (pitch>1.4f) pitch=1.4f;
|
||||
if (pitch<-1.4f) pitch=-1.4f;
|
||||
frame->translation = Vector3(sin(-yaw)*zoom*cos(pitch),sin(pitch)*zoom,cos(-yaw)*zoom*cos(pitch))+focusPosition;
|
||||
frame->lookAt(focusPosition);
|
||||
}
|
||||
bool CameraController::onMouseWheel(int x, int y, short delta)
|
||||
{
|
||||
Zoom(delta);
|
||||
return true;
|
||||
}
|
||||
void CameraController::Zoom(short delta)
|
||||
{
|
||||
CoordinateFrame frame = g3dCamera.getCoordinateFrame();
|
||||
|
||||
if (delta>0) { // Mouse wheel up
|
||||
CoordinateFrame zoomFrame = frame+frame.lookVector()*(zoom/5);
|
||||
zoom=(zoomFrame.translation-focusPosition).magnitude();
|
||||
if (zoom>CAM_ZOOM_MIN)
|
||||
{
|
||||
setFrame(zoomFrame);
|
||||
}
|
||||
else
|
||||
{
|
||||
zoom=CAM_ZOOM_MIN;
|
||||
refreshZoom(frame);
|
||||
}
|
||||
}
|
||||
else {
|
||||
CoordinateFrame zoomFrame = frame-frame.lookVector()*(zoom/5);
|
||||
zoom=(zoomFrame.translation-focusPosition).magnitude();
|
||||
if (zoom<CAM_ZOOM_MAX)
|
||||
{
|
||||
setFrame(zoomFrame);
|
||||
}
|
||||
else
|
||||
{
|
||||
zoom=CAM_ZOOM_MAX;
|
||||
refreshZoom(frame);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CameraController::panLeft()
|
||||
{
|
||||
CoordinateFrame frame = g3dCamera.getCoordinateFrame();
|
||||
pan(&frame,toRadians(-45),0);
|
||||
setFrame(frame);
|
||||
|
||||
}
|
||||
void CameraController::panRight()
|
||||
{
|
||||
CoordinateFrame frame = g3dCamera.getCoordinateFrame();
|
||||
pan(&frame,toRadians(45),0);
|
||||
setFrame(frame);
|
||||
}
|
||||
|
||||
void CameraController::tiltUp()
|
||||
{
|
||||
|
||||
CoordinateFrame frame = CoordinateFrame(g3dCamera.getCoordinateFrame().rotation, g3dCamera.getCoordinateFrame().translation);
|
||||
pan(&frame,0,toRadians(25));
|
||||
setFrame(frame);
|
||||
}
|
||||
void CameraController::tiltDown()
|
||||
{
|
||||
CoordinateFrame frame = CoordinateFrame(g3dCamera.getCoordinateFrame().rotation, g3dCamera.getCoordinateFrame().translation);
|
||||
pan(&frame,0,toRadians(-25));
|
||||
setFrame(frame);
|
||||
}
|
||||
|
||||
void CameraController::centerCamera(Instance* selection)
|
||||
{
|
||||
CoordinateFrame frame = CoordinateFrame(g3dCamera.getCoordinateFrame().translation);
|
||||
if(selection == NULL)
|
||||
{
|
||||
lookAt(Vector3(0,0,0));
|
||||
focusPosition=Vector3(0,0,0);
|
||||
}
|
||||
else
|
||||
{
|
||||
Vector3 partPos = ((PhysicalInstance*)selection)->getPosition()/2;
|
||||
lookAt(partPos);
|
||||
focusPosition=partPos;
|
||||
zoom=((partPos-frame.translation).magnitude());
|
||||
}
|
||||
}
|
||||
|
||||
void CameraController::update(Demo* demo)
|
||||
{
|
||||
float offsetSize = 0.05F;
|
||||
|
||||
Vector3 cameraPos = g3dCamera.getCoordinateFrame().translation;
|
||||
CoordinateFrame frame = g3dCamera.getCoordinateFrame();
|
||||
bool moving=false;
|
||||
if(GetHoldKeyState('U')) {
|
||||
forwards = true;
|
||||
moving=true;
|
||||
}
|
||||
if(GetHoldKeyState('J')) {
|
||||
backwards = true;
|
||||
moving=true;
|
||||
}
|
||||
if(GetHoldKeyState('H')) {
|
||||
left = true;
|
||||
moving=true;
|
||||
}
|
||||
if(GetHoldKeyState('K')) {
|
||||
right = true;
|
||||
moving=true;
|
||||
}
|
||||
|
||||
if(forwards) {
|
||||
forwards = false;
|
||||
frame.translation += frame.lookVector()*moveRate;
|
||||
}
|
||||
else if(backwards) {
|
||||
backwards = false;
|
||||
frame.translation -= frame.lookVector()*moveRate;
|
||||
}
|
||||
if(left) {
|
||||
left = false;
|
||||
frame.translation += frame.leftVector()*moveRate;
|
||||
}
|
||||
else if(right) {
|
||||
right = false;
|
||||
frame.translation += frame.rightVector()*moveRate;
|
||||
}
|
||||
|
||||
if (moving)
|
||||
{
|
||||
zoom=7;
|
||||
focusPosition=frame.translation+frame.lookVector()*zoom;
|
||||
}
|
||||
|
||||
if(rightButtonHolding) {
|
||||
Globals::useMousePoint = true;
|
||||
Globals::mousepoint = oldDesktopMouse;
|
||||
POINT mouse;
|
||||
GetCursorPos(&mouse);
|
||||
pan(&frame,(mouse.x-oldDesktopMouse.x)/100.f,(mouse.y-oldDesktopMouse.y)/100.f);
|
||||
SetCursorPos(oldDesktopMouse.x,oldDesktopMouse.y);
|
||||
}
|
||||
else
|
||||
{
|
||||
Globals::useMousePoint = false;
|
||||
}
|
||||
|
||||
if(GetHoldKeyState(VK_RSHIFT) || GetHoldKeyState(VK_LSHIFT)) {
|
||||
moveRate = 1;
|
||||
}
|
||||
else {
|
||||
moveRate = 0.5;
|
||||
}
|
||||
|
||||
if(GetHoldKeyState(VK_RBUTTON))
|
||||
{
|
||||
if (rightButtonHolding==false)
|
||||
{
|
||||
GetCursorPos(&oldDesktopMouse);
|
||||
rightButtonHolding = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
rightButtonHolding = false;
|
||||
}
|
||||
g3dCamera.setCoordinateFrame(frame);
|
||||
}
|
||||
46
CameraController.h
Normal file
46
CameraController.h
Normal file
@@ -0,0 +1,46 @@
|
||||
#pragma once
|
||||
|
||||
#include <G3DAll.h>
|
||||
#include "Instance.h"
|
||||
#include "Globals.h"
|
||||
#include <string>
|
||||
|
||||
#define CAM_ZOOM_MIN 0.1f
|
||||
#define CAM_ZOOM_MAX 100.f
|
||||
|
||||
class Demo;
|
||||
|
||||
class CameraController {
|
||||
public:
|
||||
CameraController();
|
||||
G3D::CoordinateFrame getCoordinateFrame();
|
||||
|
||||
void setFrame(const CoordinateFrame& cf);
|
||||
void lookAt(const Vector3& position);
|
||||
void refreshZoom(const CoordinateFrame& frame);
|
||||
void pan(CoordinateFrame* frame,float spdX,float spdY);
|
||||
void update(Demo* demo);
|
||||
void centerCamera(Instance* selection);
|
||||
void panLeft();
|
||||
void panRight();
|
||||
void tiltUp();
|
||||
void tiltDown();
|
||||
void Zoom(short delta);
|
||||
bool onMouseWheel(int x, int y, short delta);
|
||||
GCamera* getCamera();
|
||||
private:
|
||||
Vector3 translation;
|
||||
Vector3 focusPosition;
|
||||
float yaw;
|
||||
float pitch;
|
||||
float moveRate;
|
||||
float zoom;
|
||||
bool forwards;
|
||||
bool backwards;
|
||||
bool left;
|
||||
bool right;
|
||||
bool rightButtonHolding;
|
||||
POINT oldDesktopMouse;
|
||||
GCamera g3dCamera;
|
||||
std::string cameraSound;
|
||||
};
|
||||
4
ControllerType.h
Normal file
4
ControllerType.h
Normal file
@@ -0,0 +1,4 @@
|
||||
#ifndef CONTROLLERTYPE_H
|
||||
#define CONTROLLERTYPE_H
|
||||
static enum ControllerType {None, KeyboardRight, KeyboardLeft, Joypad1, Joypad2, Chase, Flee};
|
||||
#endif
|
||||
69
DataModelInstance.cpp
Normal file
69
DataModelInstance.cpp
Normal file
@@ -0,0 +1,69 @@
|
||||
#include "DataModelInstance.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
DataModelInstance::DataModelInstance(void)
|
||||
{
|
||||
workspace = new WorkspaceInstance();
|
||||
guiRoot = new Instance();
|
||||
children.push_back(workspace);
|
||||
className = "dataModel";
|
||||
mousex = 0;
|
||||
mousey = 0;
|
||||
mouseButton1Down = false;
|
||||
showMessage = false;
|
||||
}
|
||||
|
||||
DataModelInstance::~DataModelInstance(void)
|
||||
{
|
||||
}
|
||||
|
||||
void DataModelInstance::setMessage(std::string msg)
|
||||
{
|
||||
message = msg;
|
||||
showMessage = true;
|
||||
}
|
||||
|
||||
void DataModelInstance::clearMessage()
|
||||
{
|
||||
showMessage = false;
|
||||
message = "";
|
||||
}
|
||||
|
||||
void DataModelInstance::drawMessage(RenderDevice* rd)
|
||||
{
|
||||
if(showMessage && !font.isNull())
|
||||
{
|
||||
int x = rd->getWidth()/2;
|
||||
int y = rd->getHeight()/2;
|
||||
int width = rd->getWidth()/2 + 100;
|
||||
int height = width / 3;
|
||||
Draw::box(Box(Vector3(x-(width/2), y-(height/2), 0), Vector3(x+(width/2), y+(height/2), 0)), rd, Color4::fromARGB(0x55B2B2B2), Color3::fromARGB(0xB2B2B2));
|
||||
font->draw2D(rd, message, Vector2(x,y), height/8, Color3::white(), Color4::clear(), GFont::XALIGN_CENTER, GFont::YALIGN_CENTER);
|
||||
}
|
||||
}
|
||||
|
||||
WorkspaceInstance* DataModelInstance::getWorkspace()
|
||||
{
|
||||
return workspace;
|
||||
}
|
||||
Vector2 DataModelInstance::getMousePos()
|
||||
{
|
||||
return Vector2(mousex,mousey);
|
||||
}
|
||||
void DataModelInstance::setMousePos(int x,int y)
|
||||
{
|
||||
mousex=x;
|
||||
mousey=y;
|
||||
}
|
||||
void DataModelInstance::setMousePos(Vector2 pos)
|
||||
{
|
||||
mousex=pos.x;
|
||||
mousey=pos.y;
|
||||
}
|
||||
Instance* DataModelInstance::getGuiRoot()
|
||||
{
|
||||
return guiRoot;
|
||||
}
|
||||
27
DataModelInstance.h
Normal file
27
DataModelInstance.h
Normal file
@@ -0,0 +1,27 @@
|
||||
#pragma once
|
||||
#include "instance.h"
|
||||
#include "WorkspaceInstance.h"
|
||||
|
||||
class DataModelInstance :
|
||||
public Instance
|
||||
{
|
||||
public:
|
||||
DataModelInstance(void);
|
||||
~DataModelInstance(void);
|
||||
void setMessage(std::string);
|
||||
void clearMessage();
|
||||
void drawMessage(RenderDevice*);
|
||||
WorkspaceInstance* getWorkspace();
|
||||
WorkspaceInstance* workspace;
|
||||
Instance* guiRoot;
|
||||
std::string message;
|
||||
bool showMessage;
|
||||
G3D::GFontRef font;
|
||||
Instance* getGuiRoot();
|
||||
float mousex;
|
||||
float mousey;
|
||||
Vector2 getMousePos();
|
||||
void setMousePos(int x,int y);
|
||||
void setMousePos(Vector2 pos);
|
||||
bool mouseButton1Down;
|
||||
};
|
||||
57
Demo.h
Normal file
57
Demo.h
Normal file
@@ -0,0 +1,57 @@
|
||||
#pragma once
|
||||
#include <G3DAll.h>
|
||||
#include "CameraController.h"
|
||||
#include "PropertyWindow.h"
|
||||
|
||||
class Demo { // : public GApp {
|
||||
public:
|
||||
Demo(const GAppSettings& settings,HWND parentWindow);
|
||||
void Boop();
|
||||
virtual ~Demo() {}
|
||||
virtual void exitApplication();
|
||||
virtual void onInit();
|
||||
virtual void onLogic();
|
||||
virtual void onNetwork();
|
||||
virtual void onSimulation(RealTime rdt, SimTime sdt, SimTime idt);
|
||||
virtual void onGraphics(RenderDevice* rd);
|
||||
virtual void onUserInput(UserInput* ui);
|
||||
virtual void onCleanup();
|
||||
|
||||
std::vector<Instance*> getSelection();
|
||||
void run();
|
||||
void QuitApp();
|
||||
void resizeWithParent(HWND parentWindow);
|
||||
void onCreate(HWND parentWindow);
|
||||
void onKeyPressed(int key);
|
||||
void onKeyUp(int key);
|
||||
void onMouseLeftPressed(HWND hwnd,int x, int y);
|
||||
void onMouseLeftUp(int x, int y);
|
||||
void onMouseRightPressed(int x, int y);
|
||||
void onMouseRightUp(int x, int y);
|
||||
void onMouseMoved(int x, int y);
|
||||
void onMouseWheel(int x, int y, short delta);
|
||||
|
||||
CameraController cameraController;
|
||||
RenderDevice* renderDevice;
|
||||
UserInput* userInput;
|
||||
private:
|
||||
void initGUI();
|
||||
HWND _hWndMain;
|
||||
SkyRef sky;
|
||||
bool quit;
|
||||
bool mouseOnScreen;
|
||||
bool rightButtonHolding;
|
||||
void main();
|
||||
GWindow* _window;
|
||||
HWND _hwndToolbox;
|
||||
HWND _buttonTest;
|
||||
HWND _hwndRenderer;
|
||||
PropertyWindow* _propWindow;
|
||||
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.
69
Dialogs.rc
69
Dialogs.rc
@@ -7,7 +7,7 @@
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 2 resource.
|
||||
//
|
||||
#include "afxres.h"
|
||||
#include "windows.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#undef APSTUDIO_READONLY_SYMBOLS
|
||||
@@ -34,7 +34,7 @@ END
|
||||
|
||||
2 TEXTINCLUDE
|
||||
BEGIN
|
||||
"#include ""afxres.h""\r\n"
|
||||
"#include ""windows.h""\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
@@ -46,37 +46,6 @@ END
|
||||
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Dialog
|
||||
//
|
||||
|
||||
IDD_TOOLBOX DIALOGEX 0, 0, 398, 64
|
||||
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
|
||||
FONT 8, "MS Shell Dlg", 0, 0, 0x0
|
||||
BEGIN
|
||||
CONTROL "",IDC_TOOLBOX_BROWSER,
|
||||
"{A8F8E829-06DA-11D2-8D70-00A0C98B28E2}",WS_TABSTOP,0,0,398,64
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Dialog Info
|
||||
//
|
||||
|
||||
IDD_TOOLBOX DLGINIT
|
||||
BEGIN
|
||||
IDC_TOOLBOX_BROWSER, 0x376, 76, 0
|
||||
0x0000, 0x0000, 0xb293, 0x0000, 0x0048, 0x0000, 0x0003, 0x0008, 0xf20b,
|
||||
0x4757, 0x0020, 0x0000, 0x005f, 0x0065, 0x0078, 0x0074, 0x0065, 0x006e,
|
||||
0x0074, 0x0078, 0x3db4, 0x0000, 0x0003, 0x0008, 0xf20a, 0x4757, 0xffe0,
|
||||
0xffff, 0x005f, 0x0065, 0x0078, 0x0074, 0x0065, 0x006e, 0x0074, 0x0079,
|
||||
0x0ac0, 0x0000,
|
||||
0
|
||||
END
|
||||
|
||||
#endif // English (U.S.) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -90,40 +59,6 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_CAN
|
||||
#pragma code_page(1252)
|
||||
#endif //_WIN32
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Dialog
|
||||
//
|
||||
|
||||
IDD_ABOUT_DIALOG DIALOGEX 0, 0, 226, 151
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | DS_FIXEDSYS | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "About"
|
||||
FONT 8, "MS Shell Dlg", 400, 0, 0x1
|
||||
BEGIN
|
||||
DEFPUSHBUTTON "OK",IDOK,169,130,50,14
|
||||
PUSHBUTTON "Cancel",IDCANCEL,112,130,50,14
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// DESIGNINFO
|
||||
//
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
GUIDELINES DESIGNINFO
|
||||
BEGIN
|
||||
IDD_ABOUT_DIALOG, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 219
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 144
|
||||
END
|
||||
END
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Icon
|
||||
|
||||
BIN
G3DTest.aps
Normal file
BIN
G3DTest.aps
Normal file
Binary file not shown.
188
G3DTest.vcproj
188
G3DTest.vcproj
@@ -21,6 +21,7 @@
|
||||
ConfigurationType="1"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
|
||||
UseOfMFC="0"
|
||||
UseOfATL="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||
CharacterSet="2"
|
||||
>
|
||||
@@ -73,6 +74,7 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="Advapi32.lib UxTheme.lib Comctl32.lib Comdlg32.lib Shell32.lib"
|
||||
OutputFile="./G3DTest.exe"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="true"
|
||||
@@ -145,7 +147,8 @@
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
|
||||
MinimalRebuild="false"
|
||||
BasicRuntimeChecks="0"
|
||||
RuntimeLibrary="2"
|
||||
RuntimeLibrary="3"
|
||||
EnableFunctionLevelLinking="false"
|
||||
PrecompiledHeaderFile=".\Debug/G3DTest.pch"
|
||||
AssemblerListingLocation=".\Debug/"
|
||||
ObjectFile=".\Debug/"
|
||||
@@ -167,6 +170,7 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="Advapi32.lib UxTheme.lib Comctl32.lib Comdlg32.lib Shell32.lib"
|
||||
OutputFile="./G3DTest-Debug.exe"
|
||||
LinkIncremental="2"
|
||||
SuppressStartupBanner="true"
|
||||
@@ -235,7 +239,11 @@
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\BaseButtonInstance.cpp"
|
||||
RelativePath=".\ax.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\BrowserCallHandler.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
@@ -243,15 +251,23 @@
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Dialogs.rc"
|
||||
RelativePath=".\CameraController.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\ImageButtonInstance.cpp"
|
||||
RelativePath=".\Globals.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Instance.cpp"
|
||||
RelativePath=".\IEBrowser.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\IEBrowser.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\IEDispatcher.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
@@ -275,24 +291,80 @@
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\PhysicalInstance.cpp"
|
||||
RelativePath=".\Property.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\TextButtonInstance.cpp"
|
||||
RelativePath=".\propertyGrid.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\PropertyWindow.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\WindowFunctions.cpp"
|
||||
>
|
||||
</File>
|
||||
<Filter
|
||||
Name="Instance"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\BaseButtonInstance.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\DataModelInstance.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\ImageButtonInstance.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Instance.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\PhysicalInstance.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\TextButtonInstance.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\WorkspaceInstance.cpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\ActionType.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\AffectType.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\AudioPlayer.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\BaseButtonInstance.h"
|
||||
RelativePath=".\ax.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\BinType.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\BrowserCallHandler.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
@@ -300,15 +372,51 @@
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\ImageButtonInstance.h"
|
||||
RelativePath=".\CameraController.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Instance.h"
|
||||
RelativePath=".\ControllerType.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\PhysicalInstance.h"
|
||||
RelativePath=".\Demo.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Globals.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\IEDispatcher.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\InputType.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\JointType.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\KeywordFilterType.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\PartType.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Property.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\propertyGrid.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\PropertyWindow.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
@@ -316,14 +424,70 @@
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\TextButtonInstance.h"
|
||||
RelativePath=".\SoundType.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Surface.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\SurfaceConstraint.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\SurfaceType.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\win32Defines.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\WindowFunctions.h"
|
||||
>
|
||||
</File>
|
||||
<Filter
|
||||
Name="Instance"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\BaseButtonInstance.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\DataModelInstance.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\ImageButtonInstance.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Instance.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\PhysicalInstance.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\TextButtonInstance.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\WorkspaceInstance.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Resource Files"
|
||||
Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\Dialogs.rc"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\icon1.ico"
|
||||
>
|
||||
|
||||
19
Globals.cpp
Normal file
19
Globals.cpp
Normal file
@@ -0,0 +1,19 @@
|
||||
#include "Globals.h"
|
||||
|
||||
DataModelInstance* Globals::dataModel = NULL;
|
||||
int const Globals::gen = 0;
|
||||
int const Globals::major = 0;
|
||||
int const Globals::minor = 4;
|
||||
int const Globals::patch = 2;
|
||||
int Globals::surfaceId = 2;
|
||||
bool Globals::showMouse = true;
|
||||
bool Globals::useMousePoint = false;
|
||||
|
||||
const std::string Globals::PlaceholderName = "Dynamica";
|
||||
|
||||
|
||||
G3D::TextureRef Globals::surface;
|
||||
POINT Globals::mousepoint;
|
||||
Globals::Globals(void){}
|
||||
|
||||
Globals::~Globals(void){}
|
||||
21
Globals.h
Normal file
21
Globals.h
Normal file
@@ -0,0 +1,21 @@
|
||||
#pragma once
|
||||
#include "DataModelInstance.h"
|
||||
#include <G3DAll.h>
|
||||
|
||||
class Globals
|
||||
{
|
||||
public:
|
||||
Globals(void);
|
||||
~Globals(void);
|
||||
static DataModelInstance* dataModel;
|
||||
static bool showMouse;
|
||||
static POINT mousepoint;
|
||||
static bool useMousePoint;
|
||||
static const int gen;
|
||||
static const int major;
|
||||
static const int minor;
|
||||
static const int patch;
|
||||
static G3D::TextureRef surface;
|
||||
static int surfaceId;
|
||||
static const std::string PlaceholderName;
|
||||
};
|
||||
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,14 +1,5 @@
|
||||
#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)
|
||||
{
|
||||
|
||||
@@ -118,8 +109,7 @@ void ImageButtonInstance::drawObj(RenderDevice* rd, Vector2 mousePos, bool mouse
|
||||
}
|
||||
|
||||
|
||||
rd->pushState();
|
||||
rd->beforePrimitive();
|
||||
|
||||
glEnable( GL_TEXTURE_2D );
|
||||
glEnable(GL_BLEND);// you enable blending function
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
@@ -135,8 +125,7 @@ void ImageButtonInstance::drawObj(RenderDevice* rd, Vector2 mousePos, bool mouse
|
||||
glVertex2f( positionRelative.x, positionRelative.y + size.y );
|
||||
glEnd();
|
||||
glDisable( GL_TEXTURE_2D );
|
||||
rd->afterPrimitive();
|
||||
rd->popState();
|
||||
|
||||
if(drawDisabledBox)
|
||||
{
|
||||
Draw::box(Box(Vector3(positionRelative.x, positionRelative.y, 0), Vector3(positionRelative.x+size.x, positionRelative.y+size.y, 0)), rd, Color4(0.7F,0.7F,0.7F,0.3F), Color4::clear());
|
||||
|
||||
4
InputType.h
Normal file
4
InputType.h
Normal file
@@ -0,0 +1,4 @@
|
||||
#ifndef INPUTTYPE_H
|
||||
#define INPUTTYPE_H
|
||||
static enum InputType {NoInput, LeftTread, RightTread, Steer, Throtle, UpDown, Action1, Action2, Action3, Action4, Action5, Constant, Sin};
|
||||
#endif
|
||||
142
Instance.cpp
142
Instance.cpp
@@ -2,21 +2,151 @@
|
||||
#include <G3DAll.h>
|
||||
#include "Instance.h"
|
||||
|
||||
std::string name;
|
||||
Instance* parent;
|
||||
static std::string className = "DataModel";
|
||||
|
||||
Instance::Instance(void)
|
||||
{
|
||||
parent = NULL;
|
||||
name = "Default Game Instance";
|
||||
className = "DataModel";
|
||||
className = "BaseInstance";
|
||||
}
|
||||
|
||||
Instance::Instance(const Instance &oinst)
|
||||
{
|
||||
setParent(oinst.parent);
|
||||
name = oinst.name;
|
||||
className = oinst.className;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Instance::render(RenderDevice* rd)
|
||||
{
|
||||
for(size_t i = 0; i < children.size(); i++)
|
||||
{
|
||||
children.at(i)->render(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(DWORD &addr, PROPGRIDITEM &pItem)
|
||||
{
|
||||
if((DWORD)&name == addr)
|
||||
{
|
||||
name = pItem.lpCurValue;
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<Property> Instance::getProperties()
|
||||
{
|
||||
std::vector<Property> properties;
|
||||
|
||||
|
||||
properties.push_back(Property(createPGI(
|
||||
"Properties",
|
||||
"Name",
|
||||
"The name of this instance",
|
||||
(LPARAM)name.c_str(),
|
||||
PIT_EDIT
|
||||
), (DWORD)&name));
|
||||
return properties;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Instance::~Instance(void)
|
||||
{
|
||||
name = "Default Game Instance";
|
||||
for(size_t i = 0; i < children.size(); i++)
|
||||
{
|
||||
delete children.at(i);
|
||||
}
|
||||
}
|
||||
|
||||
std::string Instance::getClassName()
|
||||
{
|
||||
return className;
|
||||
}
|
||||
|
||||
std::vector<Instance* > Instance::getChildren()
|
||||
{
|
||||
return children;
|
||||
}
|
||||
|
||||
std::vector<Instance* > Instance::getAllChildren()
|
||||
{
|
||||
if(!children.empty())
|
||||
{
|
||||
std::vector<Instance* > totalchildren = children;
|
||||
for(size_t i = 0; i < children.size(); i++)
|
||||
{
|
||||
std::vector<Instance* > subchildren = children.at(i)->getAllChildren();
|
||||
if(!subchildren.empty())
|
||||
totalchildren.insert(totalchildren.end(), subchildren.begin(), subchildren.end());
|
||||
}
|
||||
return totalchildren;
|
||||
}
|
||||
return children;
|
||||
}
|
||||
|
||||
void Instance::setParent(Instance* newParent)
|
||||
{
|
||||
if(parent != NULL)
|
||||
{
|
||||
parent->removeChild(this);
|
||||
}
|
||||
parent = newParent;
|
||||
if(newParent != NULL)
|
||||
{
|
||||
newParent->addChild(this);
|
||||
}
|
||||
}
|
||||
|
||||
Instance* Instance::getParent()
|
||||
{
|
||||
return parent;
|
||||
}
|
||||
|
||||
void Instance::addChild(Instance* newChild)
|
||||
{
|
||||
children.push_back(newChild);
|
||||
}
|
||||
|
||||
void Instance::removeChild(Instance* oldChild)
|
||||
{
|
||||
for(size_t i = 0; i < children.size(); i++)
|
||||
{
|
||||
if(children.at(i) == oldChild)
|
||||
{
|
||||
children.erase(children.begin() + i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Instance* Instance::findFirstChild(std::string name)
|
||||
{
|
||||
Instance* child = NULL;
|
||||
for(size_t i = 0; i < children.size(); i++)
|
||||
{
|
||||
if(children.at(i)->name == name)
|
||||
{
|
||||
child = children.at(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return child;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
24
Instance.h
24
Instance.h
@@ -1,12 +1,30 @@
|
||||
#include <G3DAll.h>
|
||||
#pragma once
|
||||
|
||||
#pragma once
|
||||
#include <G3DAll.h>
|
||||
#include "Property.h"
|
||||
class Instance
|
||||
{
|
||||
public:
|
||||
Instance(void);
|
||||
Instance(const Instance&);
|
||||
virtual ~Instance(void);
|
||||
std::string name;
|
||||
Instance* parent; // Another pointer.
|
||||
virtual void render(RenderDevice*);
|
||||
std::vector<Instance*> children; // All children.
|
||||
std::string getClassName();
|
||||
Instance* findFirstChild(std::string);
|
||||
std::vector<Instance* > getChildren();
|
||||
std::vector<Instance* > getAllChildren();
|
||||
void setParent(Instance*);
|
||||
void addChild(Instance*);
|
||||
void removeChild(Instance*);
|
||||
Instance* getParent();
|
||||
virtual Instance* clone() const { return new Instance(*this); }
|
||||
virtual std::vector<Property> getProperties();
|
||||
virtual void PropUpdate(DWORD &addr, PROPGRIDITEM &pItem);
|
||||
protected:
|
||||
std::string className;
|
||||
Instance* parent; // Another pointer.
|
||||
PROPGRIDITEM createPGI(LPSTR catalog, LPSTR propName, LPSTR propDesc, LPARAM curVal, INT type);
|
||||
|
||||
};
|
||||
|
||||
4
JointType.h
Normal file
4
JointType.h
Normal file
@@ -0,0 +1,4 @@
|
||||
#ifndef JOINTTYPE_H
|
||||
#define JOINTTYPE_H
|
||||
static enum ActionType {UNK0, Weld, Snap, UNK3, Rotate, RotateP, RotateV, Glue, UNK8, UNK9, None};
|
||||
#endif
|
||||
4
KeywordFilterType.h
Normal file
4
KeywordFilterType.h
Normal file
@@ -0,0 +1,4 @@
|
||||
#ifndef KEYWORDFILTERTYPE_H
|
||||
#define KEYWORDFILTERTYPE_H
|
||||
static enum KeywordFilterType {Include, Exclude};
|
||||
#endif
|
||||
4
PartType.h
Normal file
4
PartType.h
Normal file
@@ -0,0 +1,4 @@
|
||||
#ifndef PARTTYPE_H
|
||||
#define PARTTYPE_H
|
||||
static enum PartType {Ball, Block, Cylinder};
|
||||
#endif
|
||||
@@ -1,29 +1,78 @@
|
||||
#include "PhysicalInstance.h"
|
||||
bool canCollide = true;
|
||||
bool anchored = false;
|
||||
Vector3 size;
|
||||
Vector3 position;
|
||||
Vector3 velocity;
|
||||
Vector3 rotVelocity;
|
||||
CoordinateFrame cFrame;
|
||||
Color3 color;
|
||||
bool changed = true;
|
||||
Box itemBox = Box();
|
||||
#include "Globals.h"
|
||||
|
||||
|
||||
PhysicalInstance::PhysicalInstance(void)
|
||||
{
|
||||
name = "Default PhysicalInstance";
|
||||
name = "Default PhysicalInstance";
|
||||
className = "Part";
|
||||
canCollide = true;
|
||||
anchored = true;
|
||||
size = Vector3(2,1,4);
|
||||
position = Vector3(0,0,0);
|
||||
cFrame = CoordinateFrame(position);
|
||||
setCFrame(CoordinateFrame(Vector3(0,0,0)));
|
||||
color = Color3::gray();
|
||||
velocity = Vector3(0,0,0);
|
||||
rotVelocity = Vector3(0,0,0);
|
||||
top = Smooth;
|
||||
front = Smooth;
|
||||
right = Smooth;
|
||||
back = Smooth;
|
||||
left = Smooth;
|
||||
bottom = Smooth;
|
||||
}
|
||||
|
||||
PhysicalInstance::PhysicalInstance(const PhysicalInstance &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)
|
||||
{
|
||||
int minsize = 1;
|
||||
int maxsize = 512;
|
||||
changed = true;
|
||||
int sizex = (int)newSize.x;
|
||||
if(sizex <= 0)
|
||||
sizex = 1;
|
||||
if(sizex > 512)
|
||||
sizex = 512;
|
||||
|
||||
int sizey = (int)newSize.y;
|
||||
if(sizey <= 0)
|
||||
sizey = 1;
|
||||
if(sizey > 512)
|
||||
sizey = 512;
|
||||
|
||||
int sizez = (int)newSize.z;
|
||||
if(sizez <= 0)
|
||||
sizez = 1;
|
||||
if(sizez > 512)
|
||||
sizez = 512;
|
||||
|
||||
size = Vector3(sizex, sizey, sizez);
|
||||
|
||||
|
||||
|
||||
}
|
||||
Vector3 PhysicalInstance::getSize()
|
||||
{
|
||||
return size;
|
||||
}
|
||||
Vector3 PhysicalInstance::getPosition()
|
||||
{
|
||||
return position;
|
||||
@@ -57,14 +106,143 @@ Box PhysicalInstance::getBox()
|
||||
Box box = Box(Vector3(0+size.x/4, 0+size.y/4, 0+size.z/4) ,Vector3(0-size.x/4,0-size.y/4,0-size.z/4));
|
||||
CoordinateFrame c = getCFrameRenderBased();
|
||||
itemBox = c.toWorldSpace(box);
|
||||
Vector3 v0,v1,v2,v3;
|
||||
for (int f = 0; f < 6; f++) {
|
||||
itemBox.getFaceCorners(f, v0,v1,v2,v3);
|
||||
vertecies[f*16] = v0.x;
|
||||
vertecies[(f*16)+1] = v0.y;
|
||||
vertecies[(f*16)+2] = v0.z;
|
||||
vertecies[(f*16)+3] = v1.x;
|
||||
vertecies[(f*16)+4] = v1.y;
|
||||
vertecies[(f*16)+5] = v1.z;
|
||||
vertecies[(f*16)+6] = v2.x;
|
||||
vertecies[(f*16)+7] = v2.y;
|
||||
vertecies[(f*16)+8] = v2.z;
|
||||
vertecies[(f*16)+9] = v3.x;
|
||||
vertecies[(f*16)+10] = v3.y;
|
||||
vertecies[(f*16)+11] = v3.z;
|
||||
vertecies[(f*16)+12] = color.r;
|
||||
vertecies[(f*16)+13] = color.g;
|
||||
vertecies[(f*16)+14] = color.b;
|
||||
vertecies[(f*16)+15] = 1;
|
||||
}
|
||||
}
|
||||
return itemBox;
|
||||
}
|
||||
|
||||
bool PhysicalInstance::collides(Box box)
|
||||
{
|
||||
return CollisionDetection::fixedSolidBoxIntersectsFixedSolidBox(getBox(), box);
|
||||
}
|
||||
|
||||
void PhysicalInstance::render(RenderDevice* rd)
|
||||
{
|
||||
if(changed)
|
||||
Box box = getBox();
|
||||
|
||||
glColor(color);
|
||||
/*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)
|
||||
{
|
||||
double add = 0.8;
|
||||
Surface 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]);
|
||||
/*glNormal3fv((v1 - v0).cross(v3 - v0).direction());
|
||||
glTexCoord2f(0.0F,0.0F);
|
||||
glVertex3fv(v0);
|
||||
glTexCoord2f(1.0F,0.0F);
|
||||
glVertex3fv(v1);
|
||||
glTexCoord2f(1.0F,0.25F);
|
||||
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);
|
||||
glEnd();
|
||||
glDisable( GL_TEXTURE_2D );
|
||||
}
|
||||
/*glEnd();
|
||||
glDisable(GL_TEXTURE_2D);*/
|
||||
glColor(Color3::white());
|
||||
if(!children.empty())
|
||||
{
|
||||
for(size_t i = 0; i < children.size(); i++)
|
||||
{
|
||||
children.at(i)->render(rd);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
PhysicalInstance::~PhysicalInstance(void)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void PhysicalInstance::PropUpdate(DWORD &addr, PROPGRIDITEM &pItem)
|
||||
{
|
||||
if((DWORD)&name == addr)
|
||||
{
|
||||
name = pItem.lpCurValue;
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<Property> PhysicalInstance::getProperties()
|
||||
{
|
||||
std::vector<Property> properties;
|
||||
|
||||
|
||||
properties.push_back(Property(createPGI(
|
||||
"Properties",
|
||||
"Name",
|
||||
"The name of this instance",
|
||||
(LPARAM)name.c_str(),
|
||||
PIT_EDIT
|
||||
), (DWORD)&name));
|
||||
char pso[512];
|
||||
|
||||
properties.push_back(Property(createPGI(
|
||||
"Item",
|
||||
"Offset",
|
||||
"The position of the object in the workspace",
|
||||
(LPARAM)"Coming soon",
|
||||
PIT_EDIT
|
||||
), (DWORD)&name));
|
||||
return properties;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,15 +1,23 @@
|
||||
#pragma once
|
||||
#include "instance.h"
|
||||
#include "Surface.h"
|
||||
|
||||
class PhysicalInstance :
|
||||
public Instance
|
||||
{
|
||||
public:
|
||||
PhysicalInstance(void);
|
||||
PhysicalInstance(const PhysicalInstance &oinst);
|
||||
Instance* clone() const { return new PhysicalInstance(*this); }
|
||||
~PhysicalInstance(void);
|
||||
Vector3 size;
|
||||
virtual void render(RenderDevice*);
|
||||
Vector3 velocity;
|
||||
Vector3 rotvelocity;
|
||||
Surface top;
|
||||
Surface front;
|
||||
Surface right;
|
||||
Surface back;
|
||||
Surface left;
|
||||
Surface bottom;
|
||||
CoordinateFrame cFrame;
|
||||
Color3 color;
|
||||
Vector3 getPosition();
|
||||
@@ -17,7 +25,20 @@ public:
|
||||
CoordinateFrame getCFrame();
|
||||
void setCFrame(CoordinateFrame);
|
||||
Box getBox();
|
||||
Box getScaledBox();
|
||||
CoordinateFrame getCFrameRenderBased();
|
||||
Vector3 getSize();
|
||||
void setSize(Vector3);
|
||||
bool canCollide;
|
||||
bool anchored;
|
||||
Vector3 rotVelocity;
|
||||
bool collides(Box);
|
||||
virtual std::vector<Property> getProperties();
|
||||
virtual void PropUpdate(DWORD &addr, PROPGRIDITEM &pItem);
|
||||
private:
|
||||
Vector3 position;
|
||||
Vector3 size;
|
||||
GLfloat vertecies[96];
|
||||
bool changed;
|
||||
Box itemBox;
|
||||
};
|
||||
|
||||
15
Property.cpp
Normal file
15
Property.cpp
Normal file
@@ -0,0 +1,15 @@
|
||||
#include "Property.h"
|
||||
|
||||
Property::Property(PROPGRIDITEM item, DWORD addr)
|
||||
{
|
||||
this->addr = addr;
|
||||
this->item = item;
|
||||
}
|
||||
|
||||
Property::~Property(void)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
11
Property.h
Normal file
11
Property.h
Normal file
@@ -0,0 +1,11 @@
|
||||
#pragma once
|
||||
#include <windows.h>
|
||||
#include "propertyGrid.h"
|
||||
class Property
|
||||
{
|
||||
public:
|
||||
PROPGRIDITEM item;
|
||||
DWORD addr;
|
||||
Property(PROPGRIDITEM item, DWORD addr);
|
||||
~Property(void);
|
||||
};
|
||||
137
PropertyWindow.cpp
Normal file
137
PropertyWindow.cpp
Normal file
@@ -0,0 +1,137 @@
|
||||
#define _WINSOCKAPI_
|
||||
#include <windows.h>
|
||||
#include "WindowFunctions.h"
|
||||
#include "Property.h"
|
||||
#include "resource.h"
|
||||
#include "PropertyWindow.h"
|
||||
|
||||
/*typedef struct typPRGP {
|
||||
Instance* instance; // Declare member types
|
||||
Property ∝
|
||||
} PRGP;*/
|
||||
|
||||
//std::vector<PRGP> propvec;
|
||||
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_SIZE:
|
||||
{
|
||||
propWind->onResize();
|
||||
}
|
||||
case WM_NOTIFY:
|
||||
MessageBox(NULL,"Test","Test",0);
|
||||
break;
|
||||
break;
|
||||
default:
|
||||
return DefWindowProc(hwnd, msg, wParam, lParam);
|
||||
}
|
||||
return 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",
|
||||
"Prop Test",
|
||||
WS_VISIBLE | WS_POPUPWINDOW | WS_THICKFRAME | WS_CAPTION,
|
||||
CW_USEDEFAULT,
|
||||
CW_USEDEFAULT,
|
||||
300,
|
||||
660,
|
||||
NULL, // parent
|
||||
NULL, // menu
|
||||
hThisInstance,
|
||||
NULL
|
||||
);
|
||||
|
||||
_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);
|
||||
_redraw();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
PropertyWindow::PropertyWindow(int x, int y, int sx, int sy, HMODULE hThisInstance) {
|
||||
onCreate(x, y, sx, sy, hThisInstance);
|
||||
}
|
||||
|
||||
void PropertyWindow::onResize()
|
||||
{
|
||||
_redraw();
|
||||
}
|
||||
|
||||
void PropertyWindow::_redraw()
|
||||
{
|
||||
RECT rect;
|
||||
GetClientRect(_hwndProp,&rect);
|
||||
SetWindowPos(_propGrid, NULL, 0, 20, rect.right, rect.bottom-20, SWP_NOZORDER | SWP_NOACTIVATE);
|
||||
}
|
||||
|
||||
void PropertyWindow::SetProperties(Instance * instance)
|
||||
{
|
||||
PropGrid_ResetContent(_propGrid);
|
||||
std::vector<Property> prop = instance->getProperties();
|
||||
|
||||
for(size_t i = 0; i < prop.size(); i++)
|
||||
{
|
||||
::PROPGRIDITEM item = prop.at(i).item;
|
||||
PropGrid_AddItem(_propGrid, &item);
|
||||
//PRGP propgp;
|
||||
//propgp.instance = instance;
|
||||
//propgp.prop = prop.at(i);
|
||||
}
|
||||
PropGrid_ExpandAllCatalogs(_propGrid);
|
||||
SetWindowLongPtr(_propGrid,GWL_USERDATA,(LONG)this);
|
||||
_redraw();
|
||||
}
|
||||
13
PropertyWindow.h
Normal file
13
PropertyWindow.h
Normal file
@@ -0,0 +1,13 @@
|
||||
#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 onResize();
|
||||
private:
|
||||
HWND _propGrid;
|
||||
HWND _hwndProp;
|
||||
void _redraw();
|
||||
};
|
||||
20
README.md
20
README.md
@@ -1,14 +1,10 @@
|
||||
# G3D-Fun
|
||||
# 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.
|
||||
|
||||
Despite its name, this is actually a recreation of ROBLOX as it was in 2005. Early development. Uses roughly time-accurate development tools.
|
||||
## Features
|
||||
Equivalent to known features of 05 as it stood in October 2005 with the 'Morgan McGuire builds'
|
||||
|
||||
# COMPILE WITH
|
||||
|
||||
Graphics3D 6.10 (Released July 21, 2006)
|
||||
SDL 1.2.7 (1.2.9 could work as well)
|
||||
Visual Studio 2005 Professional or Visual Studio 2005 Express with Platform SDK
|
||||
|
||||
# NOTE
|
||||
|
||||
Please know that there currently is no documentation and minimal commenting. As such, it may be confusing to follow the code.
|
||||
Code for this project is written quickly at random intervals, where each individual thinks of a solution to a problem and adds it.
|
||||
## 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
|
||||
|
||||
4
SoundType.h
Normal file
4
SoundType.h
Normal file
@@ -0,0 +1,4 @@
|
||||
#ifndef SOUNDTYPE_H
|
||||
#define SOUNDTYPE_H
|
||||
static enum SoundType {NoSound, Boing, Bomb, Break, Click, Clock, Slingshot, Page, Ping, Snap, Splat, Step, StepOn, Swoosh, Victory};
|
||||
#endif
|
||||
4
Surface.h
Normal file
4
Surface.h
Normal file
@@ -0,0 +1,4 @@
|
||||
#ifndef SURFACE_H
|
||||
#define SURFACE_H
|
||||
static enum Surface {Smooth, Snaps, Inlets, Glue, Weld, Hinge, Motor};
|
||||
#endif
|
||||
4
SurfaceConstraint.h
Normal file
4
SurfaceConstraint.h
Normal file
@@ -0,0 +1,4 @@
|
||||
#ifndef SURFACECONSTRAINT_H
|
||||
#define SURFACECONSTRAINT_H
|
||||
static enum SurfaceConstraint {None, Hinge, SteppingMotor, Motor};
|
||||
#endif
|
||||
4
SurfaceType.h
Normal file
4
SurfaceType.h
Normal file
@@ -0,0 +1,4 @@
|
||||
#ifndef SURFACETYPE_H
|
||||
#define SURFACETYPE_H
|
||||
static enum SurfaceType {Smooth, Bumps, Weld, Snaps, Inlet};
|
||||
#endif
|
||||
@@ -1,25 +1,5 @@
|
||||
#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)
|
||||
{
|
||||
|
||||
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);
|
||||
13
WorkspaceInstance.cpp
Normal file
13
WorkspaceInstance.cpp
Normal file
@@ -0,0 +1,13 @@
|
||||
#include "WorkspaceInstance.h"
|
||||
|
||||
|
||||
WorkspaceInstance::WorkspaceInstance(void)
|
||||
{
|
||||
className = "Workspace";
|
||||
timer = 60.0F;
|
||||
score = 0;
|
||||
}
|
||||
|
||||
WorkspaceInstance::~WorkspaceInstance(void)
|
||||
{
|
||||
}
|
||||
12
WorkspaceInstance.h
Normal file
12
WorkspaceInstance.h
Normal file
@@ -0,0 +1,12 @@
|
||||
#pragma once
|
||||
#include "instance.h"
|
||||
|
||||
class WorkspaceInstance :
|
||||
public Instance
|
||||
{
|
||||
public:
|
||||
float timer;
|
||||
int score;
|
||||
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/font/arial-small.fnt
Normal file
BIN
content/font/arial-small.fnt
Normal file
Binary file not shown.
BIN
content/font/arial.fnt
Normal file
BIN
content/font/arial.fnt
Normal file
Binary file not shown.
BIN
content/font/arialblack-small.fnt
Normal file
BIN
content/font/arialblack-small.fnt
Normal file
Binary file not shown.
BIN
content/font/arialblack.fnt
Normal file
BIN
content/font/arialblack.fnt
Normal file
Binary file not shown.
BIN
content/font/arialround.fnt
Normal file
BIN
content/font/arialround.fnt
Normal file
Binary file not shown.
BIN
content/font/ariaround-small.fnt
Normal file
BIN
content/font/ariaround-small.fnt
Normal file
Binary file not shown.
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 |
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
|
||||
12
resource.h
12
resource.h
@@ -2,18 +2,16 @@
|
||||
// Microsoft Visual C++ generated include file.
|
||||
// Used by Dialogs.rc
|
||||
//
|
||||
#define IDD_ABOUT_DIALOG 102
|
||||
#define IDD_TOOLBOX 103
|
||||
#define IDI_ICON1 106
|
||||
#define IDC_TOOLBOX_BROWSER 1001
|
||||
#define IDI_ICON1 102
|
||||
#define IDC_PROPERTYGRID 2000
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 107
|
||||
#define _APS_NEXT_COMMAND_VALUE 40004
|
||||
#define _APS_NEXT_CONTROL_VALUE 1002
|
||||
#define _APS_NEXT_RESOURCE_VALUE 103
|
||||
#define _APS_NEXT_COMMAND_VALUE 40001
|
||||
#define _APS_NEXT_CONTROL_VALUE 1001
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
#endif
|
||||
|
||||
4
win32Defines.h
Normal file
4
win32Defines.h
Normal file
@@ -0,0 +1,4 @@
|
||||
#pragma once
|
||||
|
||||
#include <windows.h>
|
||||
#define GetHoldKeyState(nVirtKey) (GetKeyState(nVirtKey)>>1)
|
||||
Reference in New Issue
Block a user