1 Commits

Author SHA1 Message Date
andreja6
ae174c1fdc Test 2019-11-07 21:13:03 -08:00
158 changed files with 1831 additions and 9001 deletions

5
.gitignore vendored
View File

@@ -52,7 +52,6 @@ G3DTest.suo
G3DTest.suo
stderr.txt
desktop.ini
main.cpp
*.db
#Redist
!Installer/Redist/*
G3DTest.sln

View File

@@ -1,13 +1,12 @@
#include <G3DAll.h>
#include <initguid.h>
#include <iomanip>
#include "Instance.h"
#include "resource.h"
#include "DataModelV2/Instance.h"
#include "DataModelV2/PartInstance.h"
#include "DataModelV2/TextButtonInstance.h"
#include "DataModelV2/ImageButtonInstance.h"
#include "DataModelV2/DataModelInstance.h"
#include "DataModelV2/GuiRootInstance.h"
#include "PartInstance.h"
#include "TextButtonInstance.h"
#include "ImageButtonInstance.h"
#include "DataModelInstance.h"
#include "CameraController.h"
#include "AudioPlayer.h"
#include "Globals.h"
@@ -21,21 +20,24 @@
#include <string>
#include "ax.h"
#include <cguid.h>
#include "IEBrowser.h"
#include "PropertyWindow.h"
#include <commctrl.h>
#include "StringFunctions.h"
#include "GuiRoot.h"
#include "Listener/GUDButtonListener.h"
#include "Listener/ModeSelectionListener.h"
#include "Listener/DeleteListener.h"
#include "Listener/CameraButtonListener.h"
#include "Listener/RotateButtonListener.h"
#include "Faces.h"
#define LEGACY_LOAD_G3DFUN_LEVEL
//Ray testRay;
//static int cursorid = 0;
//static int cursorOvrid = 0;
//static int currentcursorid = 0;
#include "GUDButtonListener.h"
#include "ModeSelectionListener.h"
#include "DeleteListener.h"
#include "CameraButtonListener.h"
#include "RotateButtonListener.h"
Ray testRay;
static int cursorid = 0;
static int cursorOvrid = 0;
static int currentcursorid = 0;
static G3D::TextureRef cursor = NULL;
static G3D::TextureRef cursorOvr = NULL;
static bool mouseMovedBeginMotion = false;
static POINT oldGlobalMouse;
Vector2 oldMouse = Vector2(0,0);
@@ -69,7 +71,7 @@ void Application::setFocus(bool focus)
Application::Application(HWND parentWindow) : _propWindow(NULL) { //: GApp(settings,window) {
std::string tempPath = ((std::string)getenv("temp")) + "/"+g_appName;
std::string tempPath = ((std::string)getenv("temp")) + "/"+g_PlaceholderName;
CreateDirectory(tempPath.c_str(), NULL);
_hWndMain = parentWindow;
@@ -112,7 +114,7 @@ Application::Application(HWND parentWindow) : _propWindow(NULL) { //: GApp(setti
Win32Window* window = Win32Window::create(_settings.window,_hwndRenderer);
ShowWindow(_hwndRenderer, SW_SHOW);
ShowWindow(_hWndMain, SW_SHOW);
quit=false;
rightButtonHolding=false;
mouseOnScreen=false;
@@ -133,23 +135,10 @@ Application::Application(HWND parentWindow) : _propWindow(NULL) { //: GApp(setti
SetWindowLongPtr(_hWndMain,GWL_USERDATA,(LONG)this);
SetWindowLongPtr(_hwndRenderer,GWL_USERDATA,(LONG)this);
_propWindow = new PropertyWindow(0, 0, 200, 640, hThisInstance);
webBrowser = new IEBrowser(_hwndToolbox);
SetProp(_hwndToolbox,"Browser",(HANDLE)webBrowser);
//navigateToolbox("http://androdome.com/res/ClientToolbox.php");
navigateToolbox(GetFileInPath("/content/page/surface.html"));
//navigateToolbox(GetFileInPath("/content/page/controller.html"));
IEBrowser* webBrowser = new IEBrowser(_hwndToolbox);
webBrowser->navigateSyncURL(L"http://androdome.com/g3d/toolbox/");
}
void Application::navigateToolbox(std::string path)
{
int len = path.size() + 1;
wchar_t * nstr = new wchar_t[len];
MultiByteToWideChar(0, 0, path.c_str(), len, nstr, len);
webBrowser->navigateSyncURL(nstr);
delete[] nstr;
}
void Application::deleteInstance()
{
@@ -162,7 +151,8 @@ void Application::deleteInstance()
{
AudioPlayer::playSound(GetFileInPath("/content/sounds/pageturn.wav"));
Instance* selectedInstance = g_selectedInstances.at(0);
selectedInstance->setParent(NULL);
if(selectedInstance->getParent() != NULL)
selectedInstance->getParent()->removeChild(selectedInstance);
delete selectedInstance;
selectedInstance = NULL;
g_selectedInstances.erase(g_selectedInstances.begin());
@@ -177,14 +167,13 @@ void Application::deleteInstance()
g_usableApp->_propWindow->ClearProperties();
}
void Application::onInit() {
tool = new Tool();
// Called before Application::run() beings
cameraController.setFrame(Vector3(0,2,10));
_dataModel = new DataModelInstance();
_dataModel->setParent(NULL);
_dataModel->setName("undefined");
_dataModel->name = "undefined";
_dataModel->font = g_fntdominant;
g_dataModel = _dataModel;
@@ -197,70 +186,61 @@ void Application::onInit() {
test->setSize(Vector3(24,1,24));
test->setPosition(Vector3(0,0,0));
test->setCFrame(test->getCFrame() * Matrix3::fromEulerAnglesXYZ(0,toRadians(0),toRadians(0)));
test->setSurface(TOP, Enum::SurfaceType::Bumps);
test = makePart();
test->setParent(_dataModel->getWorkspace());
test->color = Color3(.5F,1,.5F);
test->setSize(Vector3(4,1,2));
test->setPosition(Vector3(-10,1,0));
test->setSurface(TOP, Enum::SurfaceType::Bumps);
test = makePart();
test->setParent(_dataModel->getWorkspace());
test->color = Color3(.5F,1,.5F);
test->setSize(Vector3(4,1,2));
test->setPosition(Vector3(10,1,0));
test->setSurface(TOP, Enum::SurfaceType::Bumps);
test = makePart();
test->setParent(_dataModel->getWorkspace());
test->color = Color3::gray();
test->setSize(Vector3(4,1,2));
test->setPosition(Vector3(7,2,0));
test->setSurface(TOP, Enum::SurfaceType::Bumps);
test = makePart();
test->setParent(_dataModel->getWorkspace());
test->color = Color3::gray();
test->setSize(Vector3(4,1,2));
test->setPosition(Vector3(-7,2,0));
test->setSurface(TOP, Enum::SurfaceType::Bumps);
test = makePart();
test->setParent(_dataModel->getWorkspace());
test->color = Color3::gray();
test->setSize(Vector3(4,1,2));
test->setPosition(Vector3(4,3,0));
test->setSurface(TOP, Enum::SurfaceType::Bumps);
test = makePart();
test->setParent(_dataModel->getWorkspace());
test->color = Color3::gray();
test->setSize(Vector3(4,1,2));
test->setPosition(Vector3(-5,3,0));
test->setSurface(TOP, Enum::SurfaceType::Bumps);
test = makePart();
test->setParent(_dataModel->getWorkspace());
test->color = Color3::gray();
test->setSize(Vector3(4,1,2));
test->setPosition(Vector3(1,4,0));
test->setSurface(TOP, Enum::SurfaceType::Bumps);
test = makePart();
test->setParent(_dataModel->getWorkspace());
test->color = Color3::gray();
test->setSize(Vector3(4,1,2));
test->setPosition(Vector3(-3,4,0));
test->setSurface(TOP, Enum::SurfaceType::Bumps);
test = makePart();
test->setParent(_dataModel->getWorkspace());
test->color = Color3::gray();
test->setSize(Vector3(4,1,2));
test->setPosition(Vector3(-2,5,0));
test->setSurface(TOP, Enum::SurfaceType::Bumps);
@@ -270,14 +250,12 @@ void Application::onInit() {
test->color = Color3::gray();
test->setSize(Vector3(4,1,2));
test->setPosition(Vector3(0,6,0));
test->setSurface(TOP, Enum::SurfaceType::Bumps);
test = makePart();
test->setParent(_dataModel->getWorkspace());
test->color = Color3::gray();
test->setSize(Vector3(4,1,2));
test->setPosition(Vector3(2,7,0));
test->setSurface(TOP, Enum::SurfaceType::Bumps);
#else
_dataModel->debugGetOpen();
#endif
@@ -306,74 +284,16 @@ void Application::onCleanup() {
/*
Class HyperSnapSolver
void Application::onLogic() {
// Add non-simulation game logic and AI code here
function getCollisionDepth(Part colliding, part collider);
function getFaceCollision(Part colliding, part collider);
function eject(Part colliding, Part collider)
{
if(!colliding.canCollide || !collider.canCollide)
return;
if(getCollisionDepth(colliding, collider) != 0) {
int ejectMultiplier, ejectMultipliery = 1-(collider.Friction+colliding.Friction), ejectMultiplierz = 1-(collider.Friction/2+colliding.Friction/2);
if(colliding.Anchored)
ejectMultiplier = collider.elasticity;
int faceCollided = getFaceCollision(colliding, collider);
if(faceCollided % 3 == 1)
{
ejectMultipliery = ejectMultiplier;
ejectMultiplier = 1-(collider.Friction+colliding.Friction/2);
}
else if(faceCollided % 3 == 2)
{
ejectMultiplierz = ejectMultiplier;
ejectMultiplier = 1-(collider.Friction+colliding.Friction/2);
}
collider.Velocity *= Vector3.new(colliding.Velocity.x*ejectMultiplier,colliding.Velocity.y*ejectMultipliery,colliding.Velocity.z)
}
}
*/
double grav = 0.32666666666666666666666666666667;
void simGrav(PartInstance * collider)
{
if(!collider->anchored)
{
collider->setPosition(collider->getPosition()+collider->getVelocity());
collider->setVelocity(collider->getVelocity()-Vector3(0,grav,0));
}
}
void eject(PartInstance * colliding, PartInstance * collider)
{
if(colliding == collider || !colliding->canCollide || !collider->canCollide)
return;
if(G3D::CollisionDetection::fixedSolidBoxIntersectsFixedSolidBox(collider->getBox(), colliding->getBox()))
collider->setVelocity(collider->getVelocity().reflectionDirection(colliding->getCFrame().upVector())/1.3F);
}
void Application::onLogic() {
//PhysicsStart
for_each (_dataModel->getWorkspace()->partObjects.begin(), _dataModel->getWorkspace()->partObjects.end(), simGrav);
for(size_t i = 0; i < _dataModel->getWorkspace()->partObjects.size(); i++)
{
for(size_t j = 0; j < _dataModel->getWorkspace()->partObjects.size(); j++)
{
eject(_dataModel->getWorkspace()->partObjects[i], _dataModel->getWorkspace()->partObjects[j]);
}
}
}
void Application::onNetwork() {
// Poll net messages here
}
@@ -390,8 +310,7 @@ std::vector<Instance*> Application::getSelection()
}
void Application::onSimulation(RealTime rdt, SimTime sdt, SimTime idt) {
if(_dataModel->isRunning())
onLogic();
_dataModel->getGuiRoot()->update();
@@ -426,11 +345,7 @@ bool IsHolding(int button)
*/
void Application::onUserInput(UserInput* ui) {
if(mouseMoveState)
{
mouseMoveState = false;
tool->onMouseMoved(mouse);
}
/*
if(GetHoldKeyState(VK_LCONTROL))
{
@@ -453,14 +368,14 @@ void Application::onUserInput(UserInput* ui) {
//_dataModel->mousex = ui->getMouseX();
//_dataModel->mousey = ui->getMouseY();
mouse.setMouseDown((GetKeyState(VK_LBUTTON) & 0x100) != 0);
_dataModel->mouseButton1Down = (GetKeyState(VK_LBUTTON) & 0x100) != 0;
if (GetHoldKeyState(VK_LBUTTON)) {
/* if (_dragging) {
if (_dragging) {
PartInstance* part = NULL;
if(g_selectedInstances.size() > 0)
part = (PartInstance*) g_selectedInstances.at(0);
Ray dragRay = cameraController.getCamera()->worldRay(mouse.x, mouse.y, renderDevice->getViewport());
Ray dragRay = cameraController.getCamera()->worldRay(_dataModel->mousex, _dataModel->mousey, renderDevice->getViewport());
std::vector<Instance*> instances = _dataModel->getWorkspace()->getAllChildren();
for(size_t i = 0; i < instances.size(); i++)
{
@@ -481,7 +396,7 @@ void Application::onUserInput(UserInput* ui) {
}
}
Sleep(10);
}*/
}
}
// Camera KB Handling {
if (GetKPBool(VK_OEM_COMMA)) //Left
@@ -498,28 +413,37 @@ void Application::onUserInput(UserInput* ui) {
// Add other key handling here
}
void Application::changeTool(Tool * newTool)
void Application::makeFlag(Vector3 &vec, RenderDevice* &rd)
{
tool->onDeselect(mouse);
delete tool;
if(newTool != NULL)
tool = newTool;
else
tool = new Tool(); //Nulltool
tool->onSelect(mouse);
Vector3 up = Vector3(vec.x, vec.y+3, vec.z);
rd->setColor(Color3::blue());
rd->beforePrimitive();
glBegin(GL_LINES);
glVertex3f(vec.x, vec.y, vec.z);
glVertex3f(up.x, up.y, up.z);
glEnd();
glBegin( GL_TRIANGLES );
glVertex3f(up.x, up.y-1, up.z);
glVertex3f(up.x, up.y-0.5, up.z-1);
glVertex3f(up.x, up.y, up.z);
glVertex3f(up.x, up.y, up.z);
glVertex3f(up.x, up.y-0.5, up.z-1);
glVertex3f(up.x, up.y-1, up.z);
glEnd();
rd->afterPrimitive();
rd->setColor(Color3::white());
//I know how i will approach this now
}
void Application::setMode(int mode)
{
_mode = mode;
}
void Application::unSetMode()
{
_mode = NULL;
}
int Application::getMode()
{
return _mode;
@@ -528,7 +452,7 @@ int Application::getMode()
void Application::drawOutline(Vector3 from, Vector3 to, RenderDevice* rd, LightingParameters lighting, Vector3 size, Vector3 pos, CoordinateFrame c)
{
rd->disableLighting();
Color3 outline = Color3::cyan();//Color3(0.098F,0.6F,1.0F);
float offsetSize = 0.05F;
//X
@@ -550,6 +474,8 @@ void Application::drawOutline(Vector3 from, Vector3 to, RenderDevice* rd, Lighti
if(_mode == ARROWS)
{
rd->setLight(0, NULL);
rd->setAmbientLightColor(Color3(1,1,1));
AABox box;
c.toWorldSpace(Box(from, to)).getBounds(box);
@@ -570,10 +496,14 @@ void Application::drawOutline(Vector3 from, Vector3 to, RenderDevice* rd, Lighti
rd->setAmbientLightColor(lighting.ambient);
rd->setLight(0, GLight::directional(lighting.lightDirection, lighting.lightColor));
}
else if(_mode == RESIZE)
{
Color3 sphereColor = outline;
rd->setLight(0, NULL);
rd->setAmbientLightColor(Color3(1,1,1));
Vector3 gamepoint = pos;
Vector3 camerapoint = rd->getCameraToWorldMatrix().translation;
float distance = pow(pow((double)gamepoint.x - (double)camerapoint.x, 2) + pow((double)gamepoint.y - (double)camerapoint.y, 2) + pow((double)gamepoint.z - (double)camerapoint.z, 2), 0.5);
@@ -583,23 +513,25 @@ void Application::drawOutline(Vector3 from, Vector3 to, RenderDevice* rd, Lighti
float multiplier = distance * 0.025F/2;
if(multiplier < 0.25F)
multiplier = 0.25F;
Vector3 position = pos + (c.lookVector()*((size.z)+1));
Vector3 position = pos + (c.lookVector()*((size.z/2)+1));
Draw::sphere(Sphere(position, multiplier), rd, sphereColor, Color4::clear());
position = pos - (c.lookVector()*((size.z)+1));
position = pos - (c.lookVector()*((size.z/2)+1));
Draw::sphere(Sphere(position, multiplier), rd, sphereColor, Color4::clear());
position = pos + (c.rightVector()*((size.x)+1));
position = pos + (c.rightVector()*((size.x/2)+1));
Draw::sphere(Sphere(position, multiplier), rd, sphereColor, Color4::clear());
position = pos - (c.rightVector()*((size.x)+1));
position = pos - (c.rightVector()*((size.x/2)+1));
Draw::sphere(Sphere(position, multiplier), rd, sphereColor, Color4::clear());
position = pos + (c.upVector()*((size.y)+1));
position = pos + (c.upVector()*((size.y/2)+1));
Draw::sphere(Sphere(position, multiplier), rd, sphereColor, Color4::clear());
position = pos - (c.upVector()*((size.y)+1));
position = pos - (c.upVector()*((size.y/2)+1));
Draw::sphere(Sphere(position, multiplier), rd, sphereColor, Color4::clear());
}
rd->setAmbientLightColor(lighting.ambient);
rd->setLight(0, GLight::directional(lighting.lightDirection, lighting.lightColor));
}
rd->enableLighting();
}
void Application::exitApplication()
@@ -609,8 +541,6 @@ void Application::exitApplication()
}
void Application::onGraphics(RenderDevice* rd) {
G3D::uint8 num = 0;
@@ -628,14 +558,14 @@ void Application::onGraphics(RenderDevice* rd) {
{
mouseOnScreen = false;
//ShowCursor(true);
//_window->setMouseVisible(true);
_window->setMouseVisible(true);
//rd->window()->setInputCaptureCount(0);
}
else
{
mouseOnScreen = true;
//SetCursor(NULL);
//_window->setMouseVisible(false);
_window->setMouseVisible(false);
//rd->window()->setInputCaptureCount(1);
}
@@ -648,8 +578,7 @@ void Application::onGraphics(RenderDevice* rd) {
ScreenToClient(_hWndMain, &mousepos);
}
LightingParameters lighting(G3D::toSeconds(2, 00, 00, PM));
lighting.ambient = Color3(0.6F,0.6F,0.6F);
LightingParameters lighting(G3D::toSeconds(11, 00, 00, AM));
renderDevice->setProjectionAndCameraMatrix(*cameraController.getCamera());
// Cyan background
@@ -666,43 +595,29 @@ void Application::onGraphics(RenderDevice* rd) {
renderDevice->setShadeMode(RenderDevice::SHADE_SMOOTH);
renderDevice->setAmbientLightColor(Color3(1,1,1));
renderDevice->setLight(0, GLight::directional(lighting.lightDirection, lighting.lightColor, true, true));
renderDevice->setLight(0, GLight::directional(lighting.lightDirection, lighting.lightColor));
renderDevice->setAmbientLightColor(lighting.ambient);
//renderDevice->setBlendFunc(RenderDevice::BLEND_ONE, RenderDevice::BLEND_ONE);
renderDevice->setShininess(70);
renderDevice->setSpecularCoefficient(Color3(0.1F, 0.1F, 0.1F));
//float lightAmbient[] = { 0.5F, 0.6F, 0.9F, 1.0F };
//float lightDiffuse[] = { 0.6F, 0.4F, 0.9F, 1.0F };
//float lightSpecular[] = { 0.8F, 0.6F, 1.0F, 1.0F };
//glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, lightAmbient);
//glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, lightDiffuse);
//glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, lightSpecular);
//glMateriali(GL_FRONT_AND_BACK, GL_SHININESS, 70);
rd->beforePrimitive();
CoordinateFrame forDraw = rd->getObjectToWorldMatrix();
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_COLOR_ARRAY);
glEnableClientState(GL_NORMAL_ARRAY);
//if(_dataModel->getWorkspace() != NULL)
_dataModel->getWorkspace()->render(rd);
//else throw std::exception("Workspace not found");
for (unsigned int i = 0; i < _dataModel->getWorkspace()->__pvVector.size(); i++)
{
_dataModel->getWorkspace()->__pvVector[i]->render(rd);
}
//_dataModel->getWorkspace()->render(rd);
glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_COLOR_ARRAY);
glDisableClientState(GL_NORMAL_ARRAY);
rd->setObjectToWorldMatrix(forDraw);
rd->afterPrimitive();
//Draw::box(G3D::Box(mouse.getPosition()-Vector3(2,0.5F,1),mouse.getPosition()+Vector3(2,0.5F,1)), rd, Color3::cyan(), Color4::clear());
if(g_selectedInstances.size() > 0)
{
for(size_t i = 0; i < g_selectedInstances.size(); i++)
@@ -711,7 +626,7 @@ void Application::onGraphics(RenderDevice* rd) {
{
Vector3 size = part->getSize();
Vector3 pos = part->getPosition();
drawOutline(Vector3(0+size.x/2, 0+size.y/2, 0+size.z/2) ,Vector3(0-size.x/2,0-size.y/2,0-size.z/2), rd, lighting, Vector3(size.x/2, size.y/2, size.z/2), Vector3(pos.x, pos.y, pos.z), part->getCFrame());
drawOutline(Vector3(0+size.x/2, 0+size.y/2, 0+size.z/2) ,Vector3(0-size.x/2,0-size.y/2,0-size.z/2), rd, lighting, Vector3(size.x/2, size.y/2, size.z/2), Vector3(pos.x, pos.y, pos.z), part->getCFrameRenderBased());
}
}
}
@@ -735,7 +650,7 @@ void Application::onGraphics(RenderDevice* rd) {
}
renderDevice->push2D();
_dataModel->getGuiRoot()->renderGUI(renderDevice, m_graphicsWatch.FPS());
/*rd->pushState();
rd->pushState();
rd->beforePrimitive();
if(Globals::showMouse && mouseOnScreen)
@@ -743,7 +658,7 @@ void Application::onGraphics(RenderDevice* rd) {
glEnable( GL_TEXTURE_2D );
glEnable(GL_BLEND);// you enable blending function
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
/*
std::vector<Instance*> instances = _dataModel->getWorkspace()->getAllChildren();
currentcursorid = cursorid;
for(size_t i = 0; i < instances.size(); i++)
@@ -760,8 +675,8 @@ void Application::onGraphics(RenderDevice* rd) {
}
}
*/
/*glBindTexture( GL_TEXTURE_2D, tool->getCursorId());
glBindTexture( GL_TEXTURE_2D, currentcursorid);
glBegin( GL_QUADS );
@@ -775,11 +690,11 @@ void Application::onGraphics(RenderDevice* rd) {
glVertex2f( mousepos.x-64, mousepos.y+64 );
glEnd();
glDisable( GL_TEXTURE_2D );*/
//}
glDisable( GL_TEXTURE_2D );
}
/*rd->afterPrimitive();
rd->popState();*/
rd->afterPrimitive();
rd->popState();
renderDevice->pop2D();
}
@@ -789,15 +704,17 @@ void Application::onKeyPressed(int key)
{
deleteInstance();
}
if ((GetHoldKeyState(VK_LCONTROL) || GetHoldKeyState(VK_RCONTROL)) && key=='O')
if (GetHoldKeyState(VK_RCONTROL))
{
if (key=='O')
{
_dataModel->getOpen();
}
}
tool->onKeyDown(key);
}
void Application::onKeyUp(int key)
{
tool->onKeyUp(key);
}
void Application::onMouseLeftPressed(HWND hwnd,int x,int y)
@@ -805,28 +722,64 @@ void Application::onMouseLeftPressed(HWND hwnd,int x,int y)
//Removed set focus
//std::cout << "Click: " << x << "," << y << std::endl;
std::cout << "Click: " << x << "," << y << std::endl;
bool onGUI = _dataModel->getGuiRoot()->mouseInGUI(renderDevice, x, y);
if(!onGUI)
{
tool->onButton1MouseDown(mouse);
testRay = cameraController.getCamera()->worldRay(_dataModel->mousex, _dataModel->mousey, renderDevice->getViewport());
float nearest=std::numeric_limits<float>::infinity();
Vector3 camPos = cameraController.getCamera()->getCoordinateFrame().translation;
std::vector<Instance*> instances = _dataModel->getWorkspace()->getAllChildren();
bool objFound = false;
for(size_t i = 0; i < instances.size(); i++)
{
if(PartInstance* test = dynamic_cast<PartInstance*>(instances.at(i)))
{
float time = testRay.intersectionTime(test->getBox());
if (time != inf())
{
objFound = true;
if (nearest>time)
{
nearest=time;
bool found = false;
for(size_t i = 0; i < g_selectedInstances.size(); i++)
{
if(g_selectedInstances.at(i) == test)
{
found = true;
//ShowWindow(_propWindow->_hwndProp, SW_SHOW);
//SetActiveWindow(_propWindow->_hwndProp);
//SetForegroundWindow(_propWindow->_hwndProp);
break;
}
}
if(!found)
{
g_selectedInstances.clear();
g_selectedInstances.push_back(test);
}
selectInstance(test, _propWindow);
//_message = "Dragging = true.";
//_messageTime = System::time();
//_dragging = true;
}
}
}
}
if(!objFound)
selectInstance(_dataModel,_propWindow);
}
}
void Application::selectInstance(Instance* selectedInstance, PropertyWindow* propWindow)
{
if(!GetHoldKeyState(VK_RCONTROL) && !GetHoldKeyState(VK_LCONTROL))
{
printf("No control key hold \n");
g_selectedInstances.clear();
}
else printf("Control held\n");
if(std::find(g_selectedInstances.begin(), g_selectedInstances.end(),selectedInstance)==g_selectedInstances.end())
g_selectedInstances.push_back(selectedInstance);
g_selectedInstances.clear();
g_selectedInstances.push_back(selectedInstance);
propWindow->UpdateSelected(selectedInstance);
}
@@ -840,7 +793,6 @@ void Application::onMouseLeftUp(G3D::RenderDevice* renderDevice, int x, int y)
//std::cout << "Release: " << x << "," << y << std::endl;
_dataModel->getGuiRoot()->onMouseLeftUp(renderDevice, x, y);
_dragging = false;
tool->onButton1MouseUp(mouse);
//_message = "Dragging = false.";
//_messageTime = System::time();
@@ -848,23 +800,15 @@ void Application::onMouseLeftUp(G3D::RenderDevice* renderDevice, int x, int y)
void Application::onMouseRightPressed(int x,int y)
{
tool->onButton2MouseDown(mouse);
}
void Application::onMouseRightUp(int x,int y)
{
tool->onButton2MouseUp(mouse);
}
void Application::onMouseMoved(int x,int y)
{
oldMouse = Vector2(mouse.x, mouse.y);
mouse.oldx = mouse.x;
mouse.oldy = mouse.y;
mouse.x = x;
mouse.y = y;
//tool->onMouseMoved(mouse);
mouseMoveState = true;
//_dataModel->mousex = x;
//_dataModel->mousey = y;
oldMouse = _dataModel->getMousePos();
_dataModel->mousex = x;
_dataModel->mousey = y;
}
void Application::onMouseWheel(int x,int y,short delta)
@@ -874,7 +818,6 @@ void Application::onMouseWheel(int x,int y,short delta)
{
AudioPlayer::playSound(cameraSound);
}
tool->onMouseScroll(mouse);
}
void Application::run() {
@@ -898,16 +841,20 @@ void Application::run() {
UpdateWindow(_hWndMain);
// Load objects here=
cursor = Texture::fromFile(GetFileInPath("/content/images/ArrowCursor.png"));
cursorOvr = Texture::fromFile(GetFileInPath("/content/images/DragCursor.png"));
Globals::surface = Texture::fromFile(GetFileInPath("/content/images/surfacebr.png"));
Globals::surfaceId = Globals::surface->getOpenGLID();
cameraSound = GetFileInPath("/content/sounds/SWITCH3.wav");
clickSound = GetFileInPath("/content/sounds/switch.wav");
dingSound = GetFileInPath("/content/sounds/electronicpingshort.wav");
sky = Sky::create(NULL, ExePath() + "/content/sky/");
cursorid = cursor->openGLID();
currentcursorid = cursorid;
cursorOvrid = cursorOvr->openGLID();
RealTime now=0, lastTime=0;
double simTimeRate = 1.0f;
float fps=30.0f;
float fps=3000.0f;
RealTime desiredFrameDuration=1.0/fps;
onInit();
@@ -921,7 +868,7 @@ void Application::run() {
//renderDevice->setViewport(viewportRect);
//window()->setInputCaptureCount(1);
resizeWithParent(_hWndMain);
glEnable(GL_CULL_FACE);
while (!quit)
{

View File

@@ -1,12 +1,9 @@
#pragma once
#include <G3DAll.h>
#include "PropertyWindow.h"
#include "DataModelV2/TextButtonInstance.h"
#include "DataModelV2/ImageButtonInstance.h"
#include "TextButtonInstance.h"
#include "ImageButtonInstance.h"
#include "CameraController.h"
#include "IEBrowser.h"
#include "Mouse.h"
#include "Tool/Tool.h"
//#include "GuiRoot.h"
class TextButtonInstance;
@@ -28,10 +25,10 @@ class Application { // : public GApp {
virtual void onUserInput(UserInput* ui);
virtual void onCleanup();
void clearInstances();
void navigateToolbox(std::string);
PartInstance* makePart();
void drawButtons(RenderDevice* rd);
void drawOutline(Vector3 from, Vector3 to, RenderDevice* rd, LightingParameters lighting, Vector3 size, Vector3 pos, CoordinateFrame c);
void makeFlag(Vector3 &vec, RenderDevice* &rd);
std::vector<Instance*> getSelection();
void deleteInstance();
void run();
@@ -48,7 +45,6 @@ class Application { // : public GApp {
void onMouseWheel(int x, int y, short delta);
void setFocus(bool isFocused);
int getMode();
void unSetMode();
CameraController cameraController;
UserInput* userInput;
PropertyWindow* _propWindow;
@@ -56,12 +52,7 @@ class Application { // : public GApp {
RenderDevice* getRenderDevice();
void selectInstance(Instance* selectedInstance,PropertyWindow* propWindow);
void setMode(int mode);
Tool * tool;
void changeTool(Tool *);
Mouse mouse;
private:
bool mouseMoveState;
RenderDevice* renderDevice;
//void initGUI();
HWND _hWndMain;
@@ -81,7 +72,6 @@ class Application { // : public GApp {
int _mode;
GAppSettings _settings;
double lightProjX, lightProjY, lightProjNear, lightProjFar;
IEBrowser* webBrowser;
protected:
Stopwatch m_graphicsWatch;
Stopwatch m_logicWatch;

View File

@@ -1,6 +1,5 @@
#include "DataModelV2/BaseButtonInstance.h"
#include "BaseButtonInstance.h"
#include "Globals.h"
#include "Application.h"
ButtonListener* listener = NULL;
@@ -14,18 +13,19 @@ BaseButtonInstance::BaseButtonInstance(void)
void BaseButtonInstance::render(RenderDevice* rd)
{
DataModelInstance* dataModel = g_dataModel;
Vector2 pos = Vector2(g_usableApp->mouse.x,g_usableApp->mouse.y);
drawObj(rd, pos, g_usableApp->mouse.isMouseDown());
Vector2 pos = Vector2(dataModel->mousex,dataModel->mousey);
drawObj(rd, pos, dataModel->mouseButton1Down);
Instance::render(rd);
}
BaseButtonInstance::~BaseButtonInstance(void)
{
delete listener;
}
void BaseButtonInstance::setButtonListener(ButtonListener& buttonListener)
void BaseButtonInstance::setButtonListener(ButtonListener* buttonListener)
{
listener = &buttonListener;
listener = buttonListener;
}
void BaseButtonInstance::drawObj(RenderDevice* rd, Vector2 mousePos, bool mouseDown){}
@@ -37,6 +37,7 @@ void BaseButtonInstance::onMouseClick()
if(listener != NULL)
{
listener->onButton1MouseClick(this);
}
}

View File

@@ -1,6 +1,6 @@
#pragma once
#include "Instance.h"
#include "Listener/ButtonListener.h"
#include "instance.h"
#include "ButtonListener.h"
class ButtonListener;
class Instance;
@@ -14,7 +14,7 @@ public:
virtual void drawObj(RenderDevice* rd, Vector2 mousePos, bool mouseDown);
virtual bool mouseInButton(float, float, RenderDevice* rd);
virtual void onMouseClick();
void setButtonListener(ButtonListener&);
void setButtonListener(ButtonListener*);
bool floatBottom;
bool floatRight;
bool floatCenter;

View File

@@ -1,909 +0,0 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="Blocks3D"
ProjectGUID="{6C4D6EEF-B1D1-456A-B850-92CAB17124BE}"
RootNamespace="Blocks3D"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Release|Win32"
OutputDirectory=".\Release"
IntermediateDirectory=".\Release"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
UseOfMFC="0"
UseOfATL="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="NDEBUG"
MkTypLibCompatible="true"
SuppressStartupBanner="true"
TargetEnvironment="1"
TypeLibraryName=".\Release/Blocks3D.tlb"
HeaderFileName=""
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="&quot;.\src\include&quot;"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
StringPooling="true"
RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
PrecompiledHeaderFile=".\Release/Blocks3D.pch"
AssemblerListingLocation=".\Release/"
ObjectFile=".\Release/"
ProgramDataBaseFileName=".\Release/"
WarningLevel="3"
SuppressStartupBanner="true"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="4105"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="Advapi32.lib Comctl32.lib Comdlg32.lib Shell32.lib"
OutputFile="./Blocks3D.exe"
LinkIncremental="1"
SuppressStartupBanner="true"
ProgramDatabaseFile=".\Release/Blocks3D.pdb"
SubSystem="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
SuppressStartupBanner="true"
OutputFile=".\Release/Blocks3D.bsc"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug|Win32"
OutputDirectory=".\Debug"
IntermediateDirectory=".\Debug"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
ManagedExtensions="0"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="_DEBUG"
MkTypLibCompatible="true"
SuppressStartupBanner="true"
TargetEnvironment="1"
TypeLibraryName=".\Debug/Blocks3D.tlb"
HeaderFileName=""
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="&quot;.\src\include&quot;"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
MinimalRebuild="false"
BasicRuntimeChecks="0"
RuntimeLibrary="3"
EnableFunctionLevelLinking="false"
PrecompiledHeaderFile=".\Debug/Blocks3D.pch"
AssemblerListingLocation=".\Debug/"
ObjectFile=".\Debug/"
ProgramDataBaseFileName=".\Debug/"
WarningLevel="3"
SuppressStartupBanner="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="4105"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="Advapi32.lib UxTheme.lib Comctl32.lib Comdlg32.lib Shell32.lib Urlmon.lib ole32.lib oleaut32.lib uuid.lib"
OutputFile="./Blocks3D-Debug.exe"
LinkIncremental="2"
SuppressStartupBanner="true"
GenerateDebugInformation="true"
ProgramDatabaseFile=".\Debug/Blocks3D.pdb"
SubSystem="1"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
SuppressStartupBanner="true"
OutputFile=".\Debug/Blocks3D.bsc"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
<AssemblyReference
RelativePath="System.dll"
AssemblyName="System, Version=2.0.0.0, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"
/>
<AssemblyReference
RelativePath="System.Data.dll"
AssemblyName="System.Data, Version=2.0.0.0, PublicKeyToken=b77a5c561934e089, processorArchitecture=x86"
/>
<AssemblyReference
RelativePath="System.Drawing.dll"
AssemblyName="System.Drawing, Version=2.0.0.0, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"
/>
<AssemblyReference
RelativePath="System.Windows.Forms.dll"
AssemblyName="System.Windows.Forms, Version=2.0.0.0, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"
/>
<AssemblyReference
RelativePath="System.XML.dll"
AssemblyName="System.Xml, Version=2.0.0.0, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"
/>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
>
<File
RelativePath=".\src\source\Application.cpp"
>
</File>
<File
RelativePath=".\src\source\AudioPlayer.cpp"
>
</File>
<File
RelativePath=".\src\source\ax.cpp"
>
</File>
<File
RelativePath=".\src\source\BrowserCallHandler.cpp"
>
</File>
<File
RelativePath=".\src\source\CameraController.cpp"
>
</File>
<File
RelativePath=".\src\source\ErrorFunctions.cpp"
>
</File>
<File
RelativePath=".\src\source\Globals.cpp"
>
</File>
<File
RelativePath=".\src\source\IEBrowser.cpp"
>
</File>
<File
RelativePath=".\src\source\IEDispatcher.cpp"
>
</File>
<File
RelativePath=".\src\source\main.cpp"
>
</File>
<File
RelativePath=".\src\source\Mouse.cpp"
>
</File>
<File
RelativePath=".\src\source\propertyGrid.cpp"
>
</File>
<File
RelativePath=".\src\source\PropertyWindow.cpp"
>
</File>
<File
RelativePath=".\src\source\Renderer.cpp"
>
</File>
<File
RelativePath=".\src\source\StringFunctions.cpp"
>
</File>
<File
RelativePath=".\src\source\TextureHandler.cpp"
>
</File>
<File
RelativePath=".\src\source\WindowFunctions.cpp"
>
</File>
<Filter
Name="Tool"
>
<File
RelativePath=".\src\source\Tool\ArrowTool.cpp"
>
</File>
<File
RelativePath=".\src\source\Tool\SurfaceTool.cpp"
>
</File>
<File
RelativePath=".\src\source\Tool\Tool.cpp"
>
</File>
</Filter>
<Filter
Name="Listener"
>
<File
RelativePath=".\src\source\Listener\ButtonListener.cpp"
>
</File>
<File
RelativePath=".\src\source\Listener\CameraButtonListener.cpp"
>
</File>
<File
RelativePath=".\src\source\Listener\DeleteListener.cpp"
>
</File>
<File
RelativePath=".\src\source\Listener\GUDButtonListener.cpp"
>
</File>
<File
RelativePath=".\src\source\Listener\MenuButtonListener.cpp"
>
</File>
<File
RelativePath=".\src\source\Listener\ModeSelectionListener.cpp"
>
</File>
<File
RelativePath=".\src\source\Listener\RotateButtonListener.cpp"
>
</File>
<File
RelativePath=".\src\source\Listener\ToolbarListener.cpp"
>
</File>
</Filter>
<Filter
Name="DataModelV2"
>
<File
RelativePath=".\src\source\DataModelV2\DataModelInstance.cpp"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\$(InputName)1.obj"
XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\$(InputName)1.obj"
XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
/>
</FileConfiguration>
</File>
<File
RelativePath=".\src\source\DataModelV2\GroupInstance.cpp"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\$(InputName)1.obj"
XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\$(InputName)1.obj"
XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
/>
</FileConfiguration>
</File>
<File
RelativePath=".\src\source\DataModelV2\Instance.cpp"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\$(InputName)1.obj"
XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\$(InputName)1.obj"
XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
/>
</FileConfiguration>
</File>
<File
RelativePath=".\src\source\DataModelV2\LevelInstance.cpp"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\$(InputName)1.obj"
XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\$(InputName)1.obj"
XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
/>
</FileConfiguration>
</File>
<File
RelativePath=".\src\source\DataModelV2\PartInstance.cpp"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\$(InputName)1.obj"
XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\$(InputName)1.obj"
XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
/>
</FileConfiguration>
</File>
<File
RelativePath=".\src\source\DataModelV2\PVInstance.cpp"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\$(InputName)1.obj"
XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\$(InputName)1.obj"
XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
/>
</FileConfiguration>
</File>
<File
RelativePath=".\src\source\DataModelV2\WorkspaceInstance.cpp"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\$(InputName)1.obj"
XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\$(InputName)1.obj"
XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
/>
</FileConfiguration>
</File>
<Filter
Name="Gui"
>
<File
RelativePath=".\src\source\DataModelV2\BaseButtonInstance.cpp"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\$(InputName)1.obj"
XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\$(InputName)1.obj"
XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
/>
</FileConfiguration>
</File>
<File
RelativePath=".\src\source\DataModelV2\BaseGuiInstance.cpp"
>
</File>
<File
RelativePath=".\src\source\DataModelV2\GuiRootInstance.cpp"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\$(InputName)1.obj"
XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\$(InputName)1.obj"
XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
/>
</FileConfiguration>
</File>
<File
RelativePath=".\src\source\DataModelV2\ImageButtonInstance.cpp"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\$(InputName)1.obj"
XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\$(InputName)1.obj"
XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
/>
</FileConfiguration>
</File>
<File
RelativePath=".\src\source\DataModelV2\TextButtonInstance.cpp"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\$(InputName)1.obj"
XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\$(InputName)1.obj"
XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
/>
</FileConfiguration>
</File>
<File
RelativePath=".\src\source\DataModelV2\ToggleImageButtonInstance.cpp"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\$(InputName)1.obj"
XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\$(InputName)1.obj"
XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
/>
</FileConfiguration>
</File>
</Filter>
</Filter>
<Filter
Name="Properties"
>
<File
RelativePath=".\src\source\Properties\BoolProperty.cpp"
>
</File>
<File
RelativePath=".\src\source\Properties\Property.cpp"
>
</File>
</Filter>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl"
>
<File
RelativePath=".\src\include\Application.h"
>
</File>
<File
RelativePath=".\src\include\AudioPlayer.h"
>
</File>
<File
RelativePath=".\src\include\ax.h"
>
</File>
<File
RelativePath=".\src\include\BrowserCallHandler.h"
>
</File>
<File
RelativePath=".\src\include\CameraController.h"
>
</File>
<File
RelativePath=".\src\include\Enum.h"
>
</File>
<File
RelativePath=".\src\include\ErrorFunctions.h"
>
</File>
<File
RelativePath=".\src\include\Faces.h"
>
</File>
<File
RelativePath=".\src\include\Globals.h"
>
</File>
<File
RelativePath=".\src\include\IEBrowser.h"
>
</File>
<File
RelativePath=".\src\include\IEDispatcher.h"
>
</File>
<File
RelativePath=".\src\include\Mouse.h"
>
</File>
<File
RelativePath=".\src\include\propertyGrid.h"
>
</File>
<File
RelativePath=".\src\include\PropertyWindow.h"
>
</File>
<File
RelativePath=".\src\include\Renderer.h"
>
</File>
<File
RelativePath=".\resource.h"
>
</File>
<File
RelativePath=".\src\include\StringFunctions.h"
>
</File>
<File
RelativePath=".\src\include\TextureHandler.h"
>
</File>
<File
RelativePath=".\src\include\win32Defines.h"
>
</File>
<File
RelativePath=".\src\include\WindowFunctions.h"
>
</File>
<Filter
Name="RapidXML"
>
<File
RelativePath=".\src\include\rapidxml\rapidxml.hpp"
>
</File>
<File
RelativePath=".\src\include\rapidxml\rapidxml_iterators.hpp"
>
</File>
<File
RelativePath=".\src\include\rapidxml\rapidxml_print.hpp"
>
</File>
<File
RelativePath=".\src\include\rapidxml\rapidxml_utils.hpp"
>
</File>
</Filter>
<Filter
Name="Listener"
>
<File
RelativePath=".\src\include\Listener\ButtonListener.h"
>
</File>
<File
RelativePath=".\src\include\Listener\CameraButtonListener.h"
>
</File>
<File
RelativePath=".\src\include\Listener\DeleteListener.h"
>
</File>
<File
RelativePath=".\src\include\Listener\GUDButtonListener.h"
>
</File>
<File
RelativePath=".\src\include\Listener\MenuButtonListener.h"
>
</File>
<File
RelativePath=".\src\include\Listener\ModeSelectionListener.h"
>
</File>
<File
RelativePath=".\src\include\Listener\RotateButtonListener.h"
>
</File>
<File
RelativePath=".\src\include\Listener\ToolbarListener.h"
>
</File>
<File
RelativePath=".\src\include\DataModel\WorkspaceInstance.h"
>
</File>
</Filter>
<Filter
Name="Tool"
>
<File
RelativePath=".\src\include\Tool\ArrowTool.h"
>
</File>
<File
RelativePath=".\src\include\Tool\SurfaceTool.h"
>
</File>
<File
RelativePath=".\src\include\Tool\Tool.h"
>
</File>
</Filter>
<Filter
Name="DataModelV2"
>
<File
RelativePath=".\src\include\DataModelV2\DataModelInstance.h"
>
</File>
<File
RelativePath=".\src\include\DataModelV2\GroupInstance.h"
>
</File>
<File
RelativePath=".\src\include\DataModelV2\Instance.h"
>
</File>
<File
RelativePath=".\src\include\DataModelV2\LevelInstance.h"
>
</File>
<File
RelativePath=".\src\include\DataModelV2\PartInstance.h"
>
</File>
<File
RelativePath=".\src\include\DataModelV2\PVInstance.h"
>
</File>
<File
RelativePath=".\src\include\DataModelV2\WorkspaceInstance.h"
>
</File>
<Filter
Name="Gui"
>
<File
RelativePath=".\src\include\DataModelV2\BaseButtonInstance.h"
>
</File>
<File
RelativePath=".\src\include\DataModelV2\BaseGuiInstance.h"
>
</File>
<File
RelativePath=".\src\include\DataModelV2\GuiRootInstance.h"
>
</File>
<File
RelativePath=".\src\include\DataModelV2\ImageButtonInstance.h"
>
</File>
<File
RelativePath=".\src\include\DataModelV2\TextButtonInstance.h"
>
</File>
<File
RelativePath=".\src\include\DataModelV2\ToggleImageButtonInstance.h"
>
</File>
</Filter>
</Filter>
<Filter
Name="Properties"
>
<File
RelativePath=".\src\include\Properties\BoolProperty.h"
>
</File>
<File
RelativePath=".\src\include\Properties\Property.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"
>
</File>
<File
RelativePath=".\Parts.bmp"
>
</File>
<File
RelativePath=".\roblox_RN1_icon.ico"
>
</File>
</Filter>
</Files>
<Globals>
<Global
Name="RESOURCE_FILE"
Value="Dialogs.rc"
/>
</Globals>
</VisualStudioProject>

View File

@@ -1,10 +1,9 @@
#include "DataModelV2/BaseButtonInstance.h"
#include "Listener/ButtonListener.h"
#include "BaseButtonInstance.h"
#include "ButtonListener.h"
ButtonListener::ButtonListener()
{
doDelete = true;
}
ButtonListener::~ButtonListener(void)

View File

@@ -1,6 +1,6 @@
#pragma once
//#include "Application.h"
#include "DataModelV2/BaseButtonInstance.h"
//#include "BaseButtonInstance.h"
class BaseButtonInstance;
@@ -10,7 +10,6 @@ class ButtonListener
ButtonListener();
~ButtonListener(void);
virtual void onButton1MouseClick(BaseButtonInstance*);
bool doDelete;
//virtual void onMouseOver(); //TODO
//virtual void onMouseOut(); //TODO
//virtual void onButton1MouseDown(); //TODO

View File

@@ -1,4 +1,4 @@
#include "Listener/CameraButtonListener.h"
#include "CameraButtonListener.h"
#include "Globals.h"
#include "AudioPlayer.h"
#include "Application.h"

View File

@@ -1,7 +1,7 @@
#include "CameraController.h"
#include "win32Defines.h"
#include <iostream>
#include "DataModelV2/PartInstance.h"
#include "PartInstance.h"
#include "Application.h"
#include "AudioPlayer.h"
@@ -57,35 +57,6 @@ void CameraController::refreshZoom(const CoordinateFrame& frame)
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);
}
void CameraController::panLock(CoordinateFrame* frame,float spdX, float spdY)
{
int sign = 0;
yaw = toDegrees(yaw);
if((((yaw - fmod(yaw, 45)) / 45) * 45) < 0)
{
sign = 1;
}
yaw = fabs(yaw);
yaw = ((yaw - fmod(yaw, 45)) / 45) * 45;
yaw = toRadians(yaw);
if(sign==1)
{
yaw = yaw * -1;
}
yaw+=spdX;
pitch+=spdY;
@@ -134,14 +105,14 @@ void CameraController::Zoom(short delta)
void CameraController::panLeft()
{
CoordinateFrame frame = g3dCamera.getCoordinateFrame();
panLock(&frame,toRadians(-45),0);
pan(&frame,toRadians(-45),0);
setFrame(frame);
}
void CameraController::panRight()
{
CoordinateFrame frame = g3dCamera.getCoordinateFrame();
panLock(&frame,toRadians(45),0);
pan(&frame,toRadians(45),0);
setFrame(frame);
}

View File

@@ -1,7 +1,7 @@
#pragma once
#include <G3DAll.h>
#include "DataModelV2/Instance.h"
#include "Instance.h"
#include "Globals.h"
#include <string>
@@ -19,7 +19,6 @@ class CameraController {
void lookAt(const Vector3& position);
void refreshZoom(const CoordinateFrame& frame);
void pan(CoordinateFrame* frame,float spdX,float spdY);
void panLock(CoordinateFrame* frame,float spdX,float spdY);
void update(Application* app);
void centerCamera(Instance* selection);
void panLeft();

View File

@@ -1,6 +1,6 @@
#include <string>
#include "DataModel/GuiRootInstance.h"
#include "DataModel/DataModelInstance.h"
#include "GuiRoot.h"
#include "DataModelInstance.h"
#include <fstream>
#include <iostream>
#include <sstream>
@@ -15,14 +15,14 @@ DataModelInstance::DataModelInstance(void)
{
Instance::Instance();
workspace = new WorkspaceInstance();
guiRoot = new GuiRootInstance();
guiRoot = new GuiRoot();
level = new LevelInstance();
//children.push_back(workspace);
//children.push_back(level);
className = "dataModel";
//mousex = 0;
//mousey = 0;
//mouseButton1Down = false;
mousex = 0;
mousey = 0;
mouseButton1Down = false;
showMessage = false;
canDelete = false;
_modY=0;
@@ -30,19 +30,9 @@ DataModelInstance::DataModelInstance(void)
level->setParent(this);
_loadedFileName="..//skooter.rbxm";
listicon = 5;
running = false;
}
void DataModelInstance::toggleRun()
{
running = !running;
}
bool DataModelInstance::isRunning()
{
return running;
}
DataModelInstance::~DataModelInstance(void)
{
}
@@ -267,7 +257,6 @@ bool DataModelInstance::scanXMLObject(xml_node<> * scanNode)
xml_node<> *propNode = node->first_node();
xml_node<> *cFrameNode=0;
xml_node<> *sizeNode=0;
xml_node<> *shapeNode=0;
xml_node<> *colorNode=0;
xml_node<> *brickColorNode=0;
xml_node<> *nameNode=0;
@@ -287,11 +276,6 @@ bool DataModelInstance::scanXMLObject(xml_node<> * scanNode)
{
nameNode = partPropNode;
}
if (xmlValue=="shape")
{
shapeNode = partPropNode;
_legacyLoad=false;
}
if (xmlValue=="Color")
{
colorNode=partPropNode;
@@ -313,16 +297,11 @@ bool DataModelInstance::scanXMLObject(xml_node<> * scanNode)
{
std::string xmlName = attr->name();
std::string xmlValue = attr->value();
if (xmlValue=="shape")
{
shapeNode = featureNode;
_legacyLoad=true;
}
if (xmlValue=="size")
{
sizeNode=featureNode;
_legacyLoad=true;
}
}
}
}
}
@@ -349,21 +328,7 @@ bool DataModelInstance::scanXMLObject(xml_node<> * scanNode)
B = getFloatValue(colorNode,"B");
}
Enum::Shape::Value partshape = Enum::Shape::Block;
std::string pshape = shapeNode->value();
if (shapeNode)
{
if(pshape == "0" || pshape == "Ball"){
partshape = Enum::Shape::Ball;
}
if(pshape == "1" || pshape == "Block"){
partshape = Enum::Shape::Block;
}
if(pshape == "2" || pshape == "Cylinder"){
partshape = Enum::Shape::Cylinder;
}
}
std::string newName = nameNode->value();
float X = getFloatValue(cFrameNode,"X");
float Y = getFloatValue(cFrameNode,"Y");
@@ -388,7 +353,6 @@ bool DataModelInstance::scanXMLObject(xml_node<> * scanNode)
PartInstance* test = makePart();
test->setParent(getWorkspace());
test->color = Color3(R,G,B);
test->shape = partshape;
if(brickColorNode)
{
test->color = bcToRGB(atoi(brickColorNode->value()));
@@ -452,7 +416,6 @@ bool DataModelInstance::load(const char* filename, bool clearObjects)
std::stringstream msg;
msg << "Failed to load file:" << std::endl << filename << std::endl << strerror(errno);
MessageBoxStr(msg.str());
return false;
}
}
@@ -587,7 +550,7 @@ WorkspaceInstance* DataModelInstance::getWorkspace()
{
return workspace;
}
/*Vector2 DataModelInstance::getMousePos()
Vector2 DataModelInstance::getMousePos()
{
return Vector2(mousex,mousey);
}
@@ -600,8 +563,8 @@ void DataModelInstance::setMousePos(Vector2 pos)
{
mousex=pos.x;
mousey=pos.y;
}*/
GuiRootInstance* DataModelInstance::getGuiRoot()
}
GuiRoot* DataModelInstance::getGuiRoot()
{
return guiRoot;
}

View File

@@ -3,9 +3,9 @@
#include "LevelInstance.h"
#include "PartInstance.h"
#include "rapidxml/rapidxml.hpp"
#include "GuiRootInstance.h"
#include "GuiRoot.h"
class GuiRootInstance;
class GuiRoot;
class DataModelInstance :
public Instance
@@ -22,22 +22,23 @@ public:
bool readXMLFileStream(std::ifstream* file);
void drawMessage(RenderDevice*);
WorkspaceInstance* getWorkspace();
WorkspaceInstance* workspace;
LevelInstance * level;
LevelInstance * getLevel();
GuiRoot* guiRoot;
std::string message;
std::string _loadedFileName;
bool showMessage;
G3D::GFontRef font;
GuiRootInstance* getGuiRoot();
//float mousex;
//float mousey;
//Vector2 getMousePos();
//void setMousePos(int x,int y);
//void setMousePos(Vector2 pos);
//bool mouseButton1Down;
GuiRoot* getGuiRoot();
float mousex;
float mousey;
Vector2 getMousePos();
void setMousePos(int x,int y);
void setMousePos(Vector2 pos);
bool mouseButton1Down;
PartInstance* makePart();
void clearLevel();
void toggleRun();
bool isRunning();
#if _DEBUG
void modXMLLevel(float modY);
#endif
@@ -50,8 +51,4 @@ private:
std::string _errMsg;
bool _legacyLoad;
float _modY;
WorkspaceInstance* workspace;
LevelInstance * level;
GuiRootInstance* guiRoot;
bool running;
};

View File

@@ -1,4 +1,4 @@
#include "Listener/DeleteListener.h"
#include "DeleteListener.h"
#include "Globals.h"
#include "Application.h"

BIN
Dialogs.aps Normal file

Binary file not shown.

View File

@@ -1,121 +1,43 @@
// Microsoft Visual C++ generated resource script.
//
// Generated by ResEdit 1.6.6
// Copyright (C) 2006-2015
// http://www.resedit.net
#include <windows.h>
#include <commctrl.h>
#include <richedit.h>
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
// Bitmap resources
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// Neutral resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEU)
#ifdef _WIN32
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
#pragma code_page(1252)
#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_ICON1 ICON "roblox_RN1_icon.ico"
#endif // Neutral resources
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// English (Canada) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENC)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_CAN
#pragma code_page(1252)
#endif //_WIN32
IDB_BITMAP1 BITMAP "Parts.bmp"
/////////////////////////////////////////////////////////////////////////////
//
// Bitmap
// Dialog resources
//
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
IDD_DIALOG1 DIALOG 0, 0, 295, 43
STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SETFOREGROUND | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_POPUP | WS_SYSMENU
EXSTYLE WS_EX_WINDOWEDGE
CAPTION "Insert Object"
FONT 8, "Ms Shell Dlg"
{
EDITTEXT IDE_EDIT, 35, 6, 195, 14, ES_AUTOHSCROLL, WS_EX_LEFT
LTEXT "Class:", 0, 10, 9, 20, 9, SS_LEFT, WS_EX_LEFT
PUSHBUTTON "Cancel", IDCANCEL, 237, 24, 50, 14, 0, WS_EX_LEFT
DEFPUSHBUTTON "OK", IDOK, 237, 6, 50, 14, 0, WS_EX_LEFT
}
IDB_BITMAP1 BITMAP "Parts.bmp"
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
// Icon resources
//
IDD_DIALOG1 DIALOGEX 0, 0, 304, 46
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Dialog"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
DEFPUSHBUTTON "OK",IDOK,247,7,50,14
PUSHBUTTON "Cancel",IDCANCEL,247,24,50,14
EDITTEXT IDC_EDIT1,68,7,162,14,ES_AUTOHSCROLL
LTEXT "Class:",-1,43,7,20,8
END
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
3 TEXTINCLUDE
BEGIN
"\r\n"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO
BEGIN
IDD_DIALOG1, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 297
TOPMARGIN, 7
BOTTOMMARGIN, 39
END
END
#endif // APSTUDIO_INVOKED
#endif // English (Canada) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_CAN
IDI_ICON1 ICON "icon1.ico"

17
Enum.h Normal file
View File

@@ -0,0 +1,17 @@
#pragma once
namespace Enum
{
namespace SurfaceType
{
enum Value {
Smooth, Snaps, Inlets, Glue, Weld, Spawn, Hinge, Motor, Bumps
};
}
namespace Shape
{
enum Value {
Ball = 0, Block = 1, Cylinder = 2
};
}
}

16
Enums.h Normal file
View File

@@ -0,0 +1,16 @@
#ifdef UENUMS
#ifndef ENUM_H
#define ENUM_H
static enum BinType {GameTool, Grab, Clone, Hammer};
static enum ControllerType {None, KeyboardRight, KeyboardLeft, Joypad1, Joypad2, Chase, Flee};
//static enum JointType {UNK0, WeldJoint, SnapJoint, UNK3, Rotate, RotateP, RotateV, GlueJoint, UNK8, UNK9, None};
static enum ActionType {Nothing, Pause, Lose, Draw, Win};
static enum AffectType {NoChange, Increase, Decrease};
static enum InputType {NoInput, LeftTread, RightTread, Steer, Throtle, UpDown, Action1, Action2, Action3, Action4, Action5, Constant, Sin};
//static enum SurfaceConstraint {None, Hinge, SteppingMotor, Motor};
static enum SurfaceType{Smooth, Snaps, Inlets, Glue, Weld, Spawn, Hinge, Motor, Bumps};
static enum SoundType {NoSound, Boing, Bomb, Break, Click, Clock, Slingshot, Page, Ping, Snap, Splat, Step, StepOn, Swoosh, Victory};
static enum PartType {Ball, Block, Cylinder};
static enum KeywordFilterType {Include, Exclude};
#endif
#endif

View File

@@ -3,13 +3,12 @@
#include "Globals.h"
void OnError(int err, std::string msg)
{
//g_usableApp->window()->setInputCaptureCount(0);
//g_usableApp->window()->setMouseVisible(true);
std::string emsg = "An unexpected error has occured and "+g_appName+" has to quit. We're sorry!" + msg;
std::string title = g_appName+" Crash";
std::string emsg = "An unexpected error has occured and "+g_PlaceholderName+" has to quit. We're sorry!" + msg;
std::string title = g_PlaceholderName+"Crash";
//clearInstances();
MessageBox(NULL, emsg.c_str(), title.c_str(), MB_OK);
exit(err);
@@ -18,13 +17,13 @@ void OnError(int err, std::string msg)
void MessageBoxStr(std::string msg)
{
std::string title = g_appName;
std::string title = g_PlaceholderName;
MessageBox(NULL, msg.c_str(), title.c_str(), MB_OK);
}
void MessageBoxStream(std::stringstream msg)
{
std::string strMsg = msg.str();
std::string title = g_appName;
std::string title = g_PlaceholderName;
MessageBox(NULL, strMsg.c_str(), title.c_str(), MB_OK);
}

BIN
G3DTest.aps Normal file

Binary file not shown.

View File

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

View File

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

BIN
G3DTest.opt Normal file

Binary file not shown.

32
G3DTest.plg Normal file
View File

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

View File

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

Microsoft Visual Studio Solution File, Format Version 9.00
# Visual C++ Express 2005
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Blocks3D", "Blocks3D.vcproj", "{6C4D6EEF-B1D1-456A-B850-92CAB17124BE}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "G3DTest", "G3DTest.vcproj", "{6C4D6EEF-B1D1-456A-B850-92CAB17124BE}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution

579
G3DTest.vcproj Normal file
View File

@@ -0,0 +1,579 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="G3DTest"
ProjectGUID="{6C4D6EEF-B1D1-456A-B850-92CAB17124BE}"
RootNamespace="G3DTest"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Release|Win32"
OutputDirectory=".\Release"
IntermediateDirectory=".\Release"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
UseOfMFC="0"
UseOfATL="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="NDEBUG"
MkTypLibCompatible="true"
SuppressStartupBanner="true"
TargetEnvironment="1"
TypeLibraryName=".\Release/G3DTest.tlb"
HeaderFileName=""
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
StringPooling="true"
RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
PrecompiledHeaderFile=".\Release/G3DTest.pch"
AssemblerListingLocation=".\Release/"
ObjectFile=".\Release/"
ProgramDataBaseFileName=".\Release/"
WarningLevel="3"
SuppressStartupBanner="true"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="4105"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="Advapi32.lib UxTheme.lib Comctl32.lib Comdlg32.lib Shell32.lib"
OutputFile="./G3DTest.exe"
LinkIncremental="1"
SuppressStartupBanner="true"
ProgramDatabaseFile=".\Release/G3DTest.pdb"
SubSystem="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
SuppressStartupBanner="true"
OutputFile=".\Release/G3DTest.bsc"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug|Win32"
OutputDirectory=".\Debug"
IntermediateDirectory=".\Debug"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
ManagedExtensions="0"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="_DEBUG"
MkTypLibCompatible="true"
SuppressStartupBanner="true"
TargetEnvironment="1"
TypeLibraryName=".\Debug/G3DTest.tlb"
HeaderFileName=""
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
MinimalRebuild="false"
BasicRuntimeChecks="0"
RuntimeLibrary="3"
EnableFunctionLevelLinking="false"
PrecompiledHeaderFile=".\Debug/G3DTest.pch"
AssemblerListingLocation=".\Debug/"
ObjectFile=".\Debug/"
ProgramDataBaseFileName=".\Debug/"
WarningLevel="3"
SuppressStartupBanner="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="4105"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="Advapi32.lib UxTheme.lib Comctl32.lib Comdlg32.lib Shell32.lib"
OutputFile="./G3DTest-Debug.exe"
LinkIncremental="2"
SuppressStartupBanner="true"
GenerateDebugInformation="true"
ProgramDatabaseFile=".\Debug/G3DTest.pdb"
SubSystem="1"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
SuppressStartupBanner="true"
OutputFile=".\Debug/G3DTest.bsc"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
<AssemblyReference
RelativePath="System.dll"
AssemblyName="System, Version=2.0.0.0, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"
/>
<AssemblyReference
RelativePath="System.Data.dll"
AssemblyName="System.Data, Version=2.0.0.0, PublicKeyToken=b77a5c561934e089, processorArchitecture=x86"
/>
<AssemblyReference
RelativePath="System.Drawing.dll"
AssemblyName="System.Drawing, Version=2.0.0.0, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"
/>
<AssemblyReference
RelativePath="System.Windows.Forms.dll"
AssemblyName="System.Windows.Forms, Version=2.0.0.0, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"
/>
<AssemblyReference
RelativePath="System.XML.dll"
AssemblyName="System.Xml, Version=2.0.0.0, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"
/>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
>
<File
RelativePath=".\Application.cpp"
>
</File>
<File
RelativePath=".\AudioPlayer.cpp"
>
</File>
<File
RelativePath=".\ax.cpp"
>
</File>
<File
RelativePath=".\BrowserCallHandler.cpp"
>
</File>
<File
RelativePath=".\ButtonListener.cpp"
>
</File>
<File
RelativePath=".\CameraController.cpp"
>
</File>
<File
RelativePath=".\ErrorFunctions.cpp"
>
</File>
<File
RelativePath=".\Globals.cpp"
>
</File>
<File
RelativePath=".\GroupInstance.cpp"
>
</File>
<File
RelativePath=".\GuiRoot.cpp"
>
</File>
<File
RelativePath=".\IEBrowser.cpp"
>
</File>
<File
RelativePath=".\IEDispatcher.cpp"
>
</File>
<File
RelativePath="main.cpp"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
PreprocessorDefinitions=""
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
PreprocessorDefinitions=""
/>
</FileConfiguration>
</File>
<File
RelativePath=".\propertyGrid.cpp"
>
</File>
<File
RelativePath=".\PropertyWindow.cpp"
>
</File>
<File
RelativePath=".\StringFunctions.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=".\LevelInstance.cpp"
>
</File>
<File
RelativePath=".\PartInstance.cpp"
>
</File>
<File
RelativePath=".\PVInstance.cpp"
>
</File>
<File
RelativePath=".\TextButtonInstance.cpp"
>
</File>
<File
RelativePath=".\WorkspaceInstance.cpp"
>
</File>
</Filter>
<Filter
Name="Listeners"
>
<File
RelativePath=".\CameraButtonListener.cpp"
>
</File>
<File
RelativePath=".\DeleteListener.cpp"
>
</File>
<File
RelativePath=".\GUDButtonListener.cpp"
>
</File>
<File
RelativePath=".\ModeSelectionListener.cpp"
>
</File>
<File
RelativePath=".\RotateButtonListener.cpp"
>
</File>
</Filter>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl"
>
<File
RelativePath=".\Application.h"
>
</File>
<File
RelativePath=".\AudioPlayer.h"
>
</File>
<File
RelativePath=".\ax.h"
>
</File>
<File
RelativePath=".\BrowserCallHandler.h"
>
</File>
<File
RelativePath=".\CameraController.h"
>
</File>
<File
RelativePath=".\Demo.h"
>
</File>
<File
RelativePath=".\Enum.h"
>
</File>
<File
RelativePath=".\Enums.h"
>
</File>
<File
RelativePath=".\ErrorFunctions.h"
>
</File>
<File
RelativePath=".\Globals.h"
>
</File>
<File
RelativePath=".\GuiRoot.h"
>
</File>
<File
RelativePath=".\IEBrowser.h"
>
</File>
<File
RelativePath=".\IEDispatcher.h"
>
</File>
<File
RelativePath=".\LevelInstance.h"
>
</File>
<File
RelativePath=".\propertyGrid.h"
>
</File>
<File
RelativePath=".\PropertyWindow.h"
>
</File>
<File
RelativePath=".\rapidxml\rapidxml.hpp"
>
</File>
<File
RelativePath=".\rapidxml\rapidxml_iterators.hpp"
>
</File>
<File
RelativePath=".\rapidxml\rapidxml_print.hpp"
>
</File>
<File
RelativePath=".\rapidxml\rapidxml_utils.hpp"
>
</File>
<File
RelativePath=".\resource.h"
>
</File>
<File
RelativePath=".\RotateButtonListener.h"
>
</File>
<File
RelativePath=".\StringFunctions.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=".\GroupInstance.h"
>
</File>
<File
RelativePath=".\ImageButtonInstance.h"
>
</File>
<File
RelativePath=".\Instance.h"
>
</File>
<File
RelativePath=".\PartInstance.h"
>
</File>
<File
RelativePath=".\PVInstance.h"
>
</File>
<File
RelativePath=".\TextButtonInstance.h"
>
</File>
<File
RelativePath=".\WorkspaceInstance.h"
>
</File>
</Filter>
<Filter
Name="Listeners"
>
<File
RelativePath=".\ButtonListener.h"
>
</File>
<File
RelativePath=".\CameraButtonListener.h"
>
</File>
<File
RelativePath=".\DeleteListener.h"
>
</File>
<File
RelativePath=".\GUDButtonListener.h"
>
</File>
<File
RelativePath=".\ModeSelectionListener.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"
>
</File>
<File
RelativePath=".\Parts.bmp"
>
</File>
</Filter>
</Files>
<Globals>
<Global
Name="RESOURCE_FILE"
Value="Dialogs.rc"
/>
</Globals>
</VisualStudioProject>

40
GUDButtonListener.cpp Normal file
View File

@@ -0,0 +1,40 @@
#include <G3DAll.h>
#include "Application.h"
#include "Globals.h"
#include "AudioPlayer.h"
#include "GUDButtonListener.h"
void GUDButtonListener::onButton1MouseClick(BaseButtonInstance* button)
{
bool cont = false;
for(size_t i = 0; i < g_selectedInstances.size(); i++)
if(g_selectedInstances.at(i)->canDelete)
{
cont = true;
break;
}
if(cont)
{
AudioPlayer::playSound(dingSound);
if(button->name == "Duplicate")
{
std::vector<Instance*> newinst;
for(size_t i = 0; i < g_selectedInstances.size(); i++)
{
if(g_selectedInstances.at(i)->canDelete)
{
Instance* tempinst = g_selectedInstances.at(i);
Instance* clonedInstance = g_selectedInstances.at(i)->clone();
newinst.push_back(tempinst);
}
/*tempinst->setPosition(Vector3(tempPos.x, tempPos.y + tempSize.y, tempPos.z));
g_usableApp->cameraController.centerCamera(g_selectedInstances.at(0));*/
}
g_selectedInstances = newinst;
if(g_selectedInstances.size() > 0)
g_usableApp->_propWindow->UpdateSelected(newinst.at(0));
}
}
}

View File

@@ -2,11 +2,11 @@
#include "Application.h"
int const Globals::gen = 0;
int const Globals::major = 100;
int const Globals::major = 0;
int const Globals::minor = 4;
int const Globals::patch = 3;
int const Globals::patch = 2;
int Globals::surfaceId = 2;
//bool Globals::showMouse = true;
bool Globals::showMouse = true;
bool Globals::useMousePoint = false;
std::vector<Instance*> postRenderStack = std::vector<Instance*>();
@@ -19,7 +19,6 @@ POINT Globals::mousepoint;
GFontRef g_fntdominant = NULL;
GFontRef g_fntlighttrek = NULL;
HWND Globals::mainHwnd = NULL;
Globals::Globals(void){}
@@ -29,6 +28,4 @@ std::string cameraSound="";
std::string clickSound="";
std::string dingSound="";
Application *g_usableApp = NULL;
COLORREF g_acrCustClr[16] = {RGB(255,255,255),RGB(255,255,255),RGB(255,255,255),RGB(255,255,255),RGB(255,255,255),RGB(255,255,255),RGB(255,255,255),RGB(255,255,255),RGB(255,255,255),RGB(255,255,255),RGB(255,255,255),RGB(255,255,255),RGB(255,255,255),RGB(255,255,255),RGB(255,255,255),RGB(255,255,255)};
Application *g_usableApp = NULL;

View File

@@ -1,6 +1,6 @@
#pragma once
#include "DataModelV2/DataModelInstance.h"
#include "DataModelInstance.h"
#include <G3DAll.h>
class Application;
@@ -10,7 +10,7 @@ public:
Globals(void);
~Globals(void);
static DataModelInstance* dataModel;
//static bool showMouse;
static bool showMouse;
static POINT mousepoint;
static bool useMousePoint;
static const int gen;
@@ -19,9 +19,7 @@ public:
static const int patch;
static G3D::TextureRef surface;
static int surfaceId;
static const std::string g_appName;
static COLORREF g_acrCustClr[16]; //Will be dynamic later
static HWND mainHwnd;
static const std::string g_PlaceholderName;
};
extern std::vector<Instance*> postRenderStack;
@@ -33,9 +31,7 @@ extern Application* g_usableApp;
extern GFontRef g_fntdominant;
extern GFontRef g_fntlighttrek;
extern COLORREF g_acrCustClr[16]; //Will be dynamic later
extern std::string cameraSound;
extern std::string clickSound;
extern std::string dingSound;
extern HWND mainHwnd;
const std::string g_appName = "Blocks3D";
const std::string g_PlaceholderName = "HyperCube";

30
GroupInstance.cpp Normal file
View File

@@ -0,0 +1,30 @@
#include "GroupInstance.h"
GroupInstance::GroupInstance(void)
{
PVInstance::PVInstance();
className = "GroupInstance";
listicon = 12;
}
GroupInstance::GroupInstance(const GroupInstance &oinst)
{
PVInstance::PVInstance(oinst);
listicon = 12;
}
GroupInstance::~GroupInstance(void)
{
}
std::vector<PROPGRIDITEM> GroupInstance::getProperties()
{
std::vector<PROPGRIDITEM> properties = PVInstance::getProperties();
return properties;
}
void GroupInstance::PropUpdate(LPPROPGRIDITEM &pItem)
{
PVInstance::PropUpdate(pItem);
}

View File

@@ -1,5 +1,5 @@
#pragma once
#include "PartInstance.h"
#include "PVInstance.h"
class GroupInstance :
public PVInstance
@@ -10,7 +10,5 @@ public:
GroupInstance(const GroupInstance &oinst);
virtual std::vector<PROPGRIDITEM> getProperties();
virtual void PropUpdate(LPPROPGRIDITEM &pItem);
std::vector<Instance *> unGroup();
PartInstance * primaryPart;
void render(RenderDevice * r);
};

View File

@@ -1,25 +1,22 @@
#include <iomanip>
#include <sstream>
#include "G3DAll.h"
#include "DataModel/BaseButtonInstance.h"
#include "DataModel/TextButtonInstance.h"
#include "DataModel/ImageButtonInstance.h"
#include "DataModel/ToggleImageButtonInstance.h"
#include "DataModel/GuiRootInstance.h"
#include "DataModel/ImageButtonInstance.h"
#include "BaseButtonInstance.h"
#include "TextButtonInstance.h"
#include "ImageButtonInstance.h"
#include "GuiRoot.h"
#include "Globals.h"
#include "StringFunctions.h"
#include "Listener/GUDButtonListener.h"
#include "Listener/ModeSelectionListener.h"
#include "Listener/MenuButtonListener.h"
#include "Listener/RotateButtonListener.h"
#include "Listener/CameraButtonListener.h"
#include "Listener/DeleteListener.h"
#include "Listener/ToolbarListener.h"
#include "GUDButtonListener.h"
#include "ModeSelectionListener.h"
#include "RotateButtonListener.h"
#include "CameraButtonListener.h"
#include "DeleteListener.h"
#include "ImageButtonInstance.h"
ImageButtonInstance* GuiRootInstance::makeImageButton(G3D::TextureRef newImage = NULL, G3D::TextureRef overImage = NULL, G3D::TextureRef downImage = NULL, G3D::TextureRef disableImage = NULL)
ImageButtonInstance* GuiRoot::makeImageButton(G3D::TextureRef newImage = NULL, G3D::TextureRef overImage = NULL, G3D::TextureRef downImage = NULL, G3D::TextureRef disableImage = NULL)
{
ImageButtonInstance* part = new ImageButtonInstance(newImage,overImage, downImage, disableImage);
// instances.push_back(part);
@@ -27,20 +24,17 @@ ImageButtonInstance* GuiRootInstance::makeImageButton(G3D::TextureRef newImage =
return part;
}
TextButtonInstance* GuiRootInstance::makeTextButton()
TextButtonInstance* GuiRoot::makeTextButton()
{
TextButtonInstance* part = new TextButtonInstance();
return part;
}
ToolbarListener * toolbar;
GuiRootInstance::GuiRootInstance() : _message(""), _messageTime(0)
GuiRoot::GuiRoot() : _message(""), _messageTime(0)
{
toolbar = new ToolbarListener();
toolbar->doDelete = false;
g_fntdominant = GFont::fromFile(GetFileInPath("/content/font/dominant.fnt"));
g_fntlighttrek = GFont::fromFile(GetFileInPath("/content/font/lighttrek.fnt"));
//Bottom Left
TextButtonInstance* button = makeTextButton();
button->boxBegin = Vector2(0, -24);
button->boxEnd = Vector2(80, 0);
@@ -52,11 +46,6 @@ GuiRootInstance::GuiRootInstance() : _message(""), _messageTime(0)
button->title = "Hopper";
button->fontLocationRelativeTo = Vector2(10, 3);
button->setAllColorsSame();
button->boxOutlineColorOvr = Color3(0,255,255);
button->boxColorDn = Color4(button->boxColor.r,button->boxColor.g,button->boxColor.b, 0.2F);
button->setButtonListener(toolbar);
toolbar->addButtonRef(button);
button = makeTextButton();
button->boxBegin = Vector2(0, -48);
@@ -69,10 +58,6 @@ GuiRootInstance::GuiRootInstance() : _message(""), _messageTime(0)
button->title = "Controller";
button->fontLocationRelativeTo = Vector2(10, 3);
button->setAllColorsSame();
button->boxOutlineColorOvr = Color3(0,255,255);
button->boxColorDn = Color4(button->boxColor.r,button->boxColor.g,button->boxColor.b, 0.2F);
button->setButtonListener(toolbar);
toolbar->addButtonRef(button);
button = makeTextButton();
button->boxBegin = Vector2(0, -72);
@@ -85,10 +70,6 @@ GuiRootInstance::GuiRootInstance() : _message(""), _messageTime(0)
button->title = "Color";
button->fontLocationRelativeTo = Vector2(10, 3);
button->setAllColorsSame();
button->boxOutlineColorOvr = Color3(0,255,255);
button->boxColorDn = Color4(button->boxColor.r,button->boxColor.g,button->boxColor.b, 0.2F);
button->setButtonListener(toolbar);
toolbar->addButtonRef(button);
button = makeTextButton();
button->boxBegin = Vector2(0, -96);
@@ -101,10 +82,6 @@ GuiRootInstance::GuiRootInstance() : _message(""), _messageTime(0)
button->title = "Surface";
button->fontLocationRelativeTo = Vector2(10, 3);
button->setAllColorsSame();
button->boxOutlineColorOvr = Color3(0,255,255);
button->boxColorDn = Color4(button->boxColor.r,button->boxColor.g,button->boxColor.b, 0.2F);
button->setButtonListener(toolbar);
toolbar->addButtonRef(button);
button = makeTextButton();
button->boxBegin = Vector2(0, -120);
@@ -113,16 +90,11 @@ GuiRootInstance::GuiRootInstance() : _message(""), _messageTime(0)
button->setParent(this);
button->font = g_fntlighttrek;
button->textColor = Color3(0,255,255);
button->boxOutlineColor = Color3(0,255,255);
button->title = "Model";
button->selected = true;
button->fontLocationRelativeTo = Vector2(10, 3);
button->setAllColorsSame();
button->boxOutlineColorOvr = Color3(0,255,255);
button->boxColorDn = Color4(button->boxColor.r,button->boxColor.g,button->boxColor.b, 0.2F);
button->setButtonListener(toolbar);
toolbar->addButtonRef(button);
//Top bar
button = makeTextButton();
button->boxBegin = Vector2(0, 0);
button->boxEnd = Vector2(125, 25);
@@ -135,9 +107,6 @@ GuiRootInstance::GuiRootInstance() : _message(""), _messageTime(0)
button->textSize = 16;
button->fontLocationRelativeTo = Vector2(10, 0);
button->setAllColorsSame();
button->boxColorOvr = Color4(0.6F,0.6F,0.6F,0.4F);
button->name = "file";
button->setButtonListener(new MenuButtonListener());
button = makeTextButton();
button->boxBegin = Vector2(125, 0);
@@ -151,7 +120,6 @@ GuiRootInstance::GuiRootInstance() : _message(""), _messageTime(0)
button->textSize = 16;
button->fontLocationRelativeTo = Vector2(10, 0);
button->setAllColorsSame();
button->boxColorOvr = Color4(0.6F,0.6F,0.6F,0.4F);
button = makeTextButton();
button->boxBegin = Vector2(250, 0);
@@ -165,7 +133,6 @@ GuiRootInstance::GuiRootInstance() : _message(""), _messageTime(0)
button->textSize = 16;
button->fontLocationRelativeTo = Vector2(10, 0);
button->setAllColorsSame();
button->boxColorOvr = Color4(0.6F,0.6F,0.6F,0.4F);
button = makeTextButton();
button->boxBegin = Vector2(375, 0);
@@ -179,7 +146,6 @@ GuiRootInstance::GuiRootInstance() : _message(""), _messageTime(0)
button->textSize = 16;
button->fontLocationRelativeTo = Vector2(10, 0);
button->setAllColorsSame();
button->boxColorOvr = Color4(0.6F,0.6F,0.6F,0.4F);
button = makeTextButton();
button->boxBegin = Vector2(500, 0);
@@ -193,10 +159,9 @@ GuiRootInstance::GuiRootInstance() : _message(""), _messageTime(0)
button->textSize = 16;
button->fontLocationRelativeTo = Vector2(10, 0);
button->setAllColorsSame();
button->boxColorOvr = Color4(0.6F,0.6F,0.6F,0.4F);
//Menu
button = makeTextButton();
button->boxBegin = Vector2(0,215);
button->boxEnd = Vector2(80,235);
@@ -211,7 +176,7 @@ GuiRootInstance::GuiRootInstance() : _message(""), _messageTime(0)
button->font = g_fntlighttrek;
button->fontLocationRelativeTo = Vector2(10, 0);
button->setParent(this);
button->setButtonListener(new GUDButtonListener());
button = makeTextButton();
button->boxBegin = Vector2(0,240);
@@ -227,7 +192,6 @@ GuiRootInstance::GuiRootInstance() : _message(""), _messageTime(0)
button->font = g_fntlighttrek;
button->fontLocationRelativeTo = Vector2(10, 0);
button->setParent(this);
button->setButtonListener(new GUDButtonListener());
button = makeTextButton();
button->boxBegin = Vector2(0,265);
@@ -245,16 +209,10 @@ GuiRootInstance::GuiRootInstance() : _message(""), _messageTime(0)
button->name = "Duplicate";
button->setButtonListener(new GUDButtonListener());
ImageButtonInstance* instance = new ToggleImageButtonInstance(
ImageButtonInstance* instance = makeImageButton(
Texture::fromFile(GetFileInPath("/content/images/Run.png")),
Texture::fromFile(GetFileInPath("/content/images/Run_ovr.png")),
Texture::fromFile(GetFileInPath("/content/images/Run_dn.png")),
NULL,
Texture::fromFile(GetFileInPath("/content/images/Stop.png")),
Texture::fromFile(GetFileInPath("/content/images/Stop_ovr.png")),
Texture::fromFile(GetFileInPath("/content/images/Stop_dn.png"))
);
instance->setButtonListener(new MenuButtonListener());
Texture::fromFile(GetFileInPath("/content/images/Run_dn.png")));
instance->name = "go";
instance->size = Vector2(65,65);
instance->position = Vector2(6.5, 25);
@@ -411,24 +369,24 @@ GuiRootInstance::GuiRootInstance() : _message(""), _messageTime(0)
}
void GuiRootInstance::drawButtons(RenderDevice* rd)
void GuiRoot::drawButtons(RenderDevice* rd)
{
rd->pushState();
rd->beforePrimitive();
//this->render(rd);
this->render(rd);
rd->afterPrimitive();
rd->popState();
}
void GuiRootInstance::setDebugMessage(std::string msg, G3D::RealTime msgTime)
void GuiRoot::setDebugMessage(std::string msg, G3D::RealTime msgTime)
{
_messageTime = msgTime;
_message = msg;
}
//void GuiRootInstance::render(G3D::RenderDevice* renderDevice) {}
//void GuiRoot::render(G3D::RenderDevice* renderDevice) {}
void GuiRootInstance::renderGUI(G3D::RenderDevice* rd, double fps)
void GuiRoot::renderGUI(G3D::RenderDevice* rd, double fps)
{
//TODO--Move these to their own instance
@@ -445,7 +403,7 @@ void GuiRootInstance::renderGUI(G3D::RenderDevice* rd, double fps)
#endif
//GUI Boxes
Draw::box(G3D::Box(Vector3(0,25,0),Vector3(80,355,0)),rd,Color4(0.6F,0.6F,0.6F,0.4F), Color4(0,0,0,0));
Draw::box(G3D::Box(Vector3(rd->getWidth() - 120,rd->getHeight() - 117,0),Vector3(rd->getWidth(),rd->getHeight(),0)),rd,Color4(0.6F,0.6F,0.6F,0.4F), Color4(0,0,0,0));
Draw::box(G3D::Box(Vector3(rd->getWidth() - 120,rd->getHeight() - 120,0),Vector3(rd->getWidth(),rd->getHeight(),0)),rd,Color4(0.6F,0.6F,0.6F,0.4F), Color4(0,0,0,0));
//Camera menu title
g_fntlighttrek->draw2D(rd, "CameraMenu", Vector2(rd->getWidth()-(g_fntlighttrek->get2DStringBounds("CameraMenu", 14).x+1),rd->getHeight() - 120), 14, Color3::white(), Color4(0.5F,0.5F,0.5F,0.5F));
@@ -455,7 +413,7 @@ void GuiRootInstance::renderGUI(G3D::RenderDevice* rd, double fps)
g_fntlighttrek->draw2D(rd,"MENU", Vector2(10,332), 14, Color3::white(), Color4(0.5F,0.5F,0.5F,0.5F));
//drawButtons(rd);
drawButtons(rd);
if(System::time() - 3 < _messageTime)
{
g_fntdominant->draw2D(rd, _message, Vector2((rd->getWidth()/2)-(g_fntdominant->get2DStringBounds(_message, 20).x/2),(rd->getHeight()/2)-(g_fntdominant->get2DStringBounds(_message, 20).y/2)), 20, Color3::yellow(), Color3::black());
@@ -465,7 +423,7 @@ void GuiRootInstance::renderGUI(G3D::RenderDevice* rd, double fps)
render(rd);
}
bool GuiRootInstance::mouseInGUI(G3D::RenderDevice* renderDevice,int x,int y)
bool GuiRoot::mouseInGUI(G3D::RenderDevice* renderDevice,int x,int y)
{
std::vector<Instance*> instances_2D = g_dataModel->getGuiRoot()->getAllChildren();
for(size_t i = 0; i < instances_2D.size(); i++)
@@ -481,7 +439,7 @@ bool GuiRootInstance::mouseInGUI(G3D::RenderDevice* renderDevice,int x,int y)
return false;
}
void GuiRootInstance::update()
void GuiRoot::update()
{
Instance * obj6 = this->findFirstChild("Delete");
Instance * obj = this->findFirstChild("Duplicate");
@@ -517,12 +475,7 @@ void GuiRootInstance::update()
}
}
GuiRootInstance::~GuiRootInstance()
{
delete toolbar;
}
void GuiRootInstance::onMouseLeftUp(G3D::RenderDevice* renderDevice, int x,int y)
void GuiRoot::onMouseLeftUp(G3D::RenderDevice* renderDevice, int x,int y)
{
std::vector<Instance*> instances_2D = this->getAllChildren();
for(size_t i = 0; i < instances_2D.size(); i++)

View File

@@ -5,11 +5,10 @@ class ImageButtonInstance;
class TextButtonInstance;
class GuiRootInstance : public Instance
class GuiRoot : public Instance
{
public:
GuiRootInstance();
GuiRootInstance::~GuiRootInstance();
GuiRoot();
TextButtonInstance* makeTextButton();
void drawButtons(RenderDevice* rd);
ImageButtonInstance* makeImageButton(G3D::TextureRef newImage, G3D::TextureRef overImage, G3D::TextureRef downImage, G3D::TextureRef disableImage);

105
IEBrowser.cpp Normal file
View File

@@ -0,0 +1,105 @@
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#include <windows.h>
#include "IEBrowser.h"
#include "Globals.h"
#include "ax.h"
//#include "IEDispatcher.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();
}
}
// Something goes here
int IEBrowser::setExternal(IDispatch** ext)
{
return 1;
}
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 (SUCCEEDED(hresult) && (spDocument != 0))
{
IOleObject* spOleObject;
if (SUCCEEDED(spDocument->QueryInterface(IID_IOleObject,(void**)&spOleObject)))
{
IOleClientSite* spClientSite;
hresult = spOleObject->GetClientSite(&spClientSite);
if (SUCCEEDED(hresult) && spClientSite)
{
m_spDefaultDocHostUIHandler = spClientSite;
ICustomDoc* spCustomDoc;
//IEDispatcher* spIEDispatcher;
if (SUCCEEDED(m_spDefaultDocHostUIHandler->QueryInterface(IID_IDocHostUIHandler,(void**)&m_spHandler)))
{
if (SUCCEEDED(spDocument->QueryInterface(IID_ICustomDoc,(void**)&spCustomDoc)))
{
spCustomDoc->SetUIHandler(m_spHandler);
m_spHandler->GetExternal(&m_spExternal);
}
}
}
}
return true;
}
}
}
else
{
MessageBox(NULL,"Cannot read IWebBrowser2...",(g_PlaceholderName+" Crash").c_str(),MB_OK);
}
return false;
}

23
IEBrowser.h Normal file
View File

@@ -0,0 +1,23 @@
//#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;
IHTMLDocument* spDocument2;
IDocHostUIHandler* m_spHandler;
IDispatch* m_spExternal;
IDispatch* m_newExternal;
IOleClientSite* m_spDefaultDocHostUIHandler;
int setExternal(IDispatch** ext);
};

View File

@@ -2,9 +2,11 @@
#include "oaidl.h"
//DEFINE_GUID(CLSID_G3d, 0xB323F8E0L, 0x2E68, 0x11D0, 0x90, 0xEA, 0x00, 0xAA, 0x00, 0x60, 0xF8, 0x6F);
/*
class IEDispatcher : public IDispatch
{
/*
*/
EXTERN_C const IID IID_IDispatch;
#if defined(__cplusplus) && !defined(CINTERFACE)
@@ -12,7 +14,6 @@ EXTERN_C const IID IID_IDispatch;
MIDL_INTERFACE("B323F8E0-2E68-11D0-90EA-00AA0060F86F")
IEDispatcher : public IDispatch
{
*/
public:
IEDispatcher(void);
~IEDispatcher(void);
@@ -26,4 +27,4 @@ public:
};
//#endif
#endif

View File

@@ -1,4 +1,4 @@
#include "DataModel/ImageButtonInstance.h"
#include "ImageButtonInstance.h"
ImageButtonInstance::ImageButtonInstance(G3D::TextureRef newImage, G3D::TextureRef overImage = NULL, G3D::TextureRef downImage = NULL, G3D::TextureRef disableImage = NULL)
{

Binary file not shown.

Binary file not shown.

View File

@@ -1,49 +0,0 @@
;InnoSetupVersion=5.5.7
[Setup]
AppName=Blocks3D
AppId={{4C5DF268-0208-4CDE-A7F0-65F7E2CB5067}
AppVersion=v0_0_104_4
AppPublisherURL=http://blocks3d.com/
AppSupportURL=http://blocks3d.com/
AppUpdatesURL=http://blocks3d.com/
DefaultDirName={%localappdata}\Blocks3D
OutputBaseFilename=Blocks3D_Setup_{#SetupSetting("AppVersion")}
Compression=lzma2
PrivilegesRequired=lowest
WizardImageFile=setup.bmp
DefaultGroupName=Blocks3D
[UninstallDelete]
Type: filesandordirs; Name: "{app}"
[Files]
Source: "Redist\vcredist_x86.exe"; DestDir: "{tmp}"; Flags: ignoreversion
Source: "Redist\vcredist_x64.exe"; DestDir: "{tmp}"; Check: "IsWin64"; Flags: ignoreversion
Source: "..\content\*"; DestDir: "{app}\content"; Flags: ignoreversion recursesubdirs
Source: "..\SDL.DLL"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs
Source: "..\Blocks3D.exe"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs
[Registry]
[Run]
Filename: "{tmp}\vcredist_x86.exe"; Parameters: "/q"; Tasks: instvc;
Filename: "{tmp}\vcredist_x64.exe"; Parameters: "/q"; Tasks: instvc; Check: "IsWin64";
Filename: "iexplore.exe"; Parameters: "http://www.blocks3d.com/FirstInstall"; Description: Start playing Blocks3D; Flags: shellexec postinstall nowait skipifsilent
[Icons]
Name: "{group}\Play Blocks3D"; Filename: "{%programfiles}\Internet Explorer\iexplore.exe"; Parameters: "http://www.blocks3d.com/Games"; IconFilename: "{app}\Blocks3D.exe"; Tasks: startscut;
Name: "{group}\Blocks3D Editor"; Filename: "{app}\Blocks3D.exe"; Tasks: startscut;
Name: "{userdesktop}\Play Blocks3D"; Filename: "{%programfiles}\Internet Explorer\iexplore.exe"; Parameters: "http://www.blocks3d.com/Games"; IconFilename: "{app}\Blocks3D.exe"; Tasks: startscut;
Name: "{userdesktop}\Blocks3D Editor"; Filename: "{app}\Blocks3D.exe"; Tasks: desktopicon
[Tasks]
Name: "instvc"; Description: "Install Visual C++ Redistributable 2005 SP1 (Requires elevated permissions)";
Name: "desktopicon"; Description: "Create Desktop Icons";
Name: "startscut"; Description: "Create Start Menu Icons";

Binary file not shown.

Before

Width:  |  Height:  |  Size: 151 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.4 KiB

View File

@@ -1,7 +1,6 @@
#define WINVER 0x0400
#include <G3DAll.h>
#include "DataModelV2/Instance.h"
#include "Instance.h"
Instance::Instance(void)
@@ -115,6 +114,21 @@ std::vector<Instance* > Instance::getAllChildren()
return children;
}
std::vector<Instance* > Instance::compileAndGetPVVector()
{
std::vector<Instance* > totalchildren;
if(!children.empty())
{
for(size_t i = 0; i < children.size(); i++)
{
std::vector<Instance* > subchildren = children.at(i)->compileAndGetPVVector();
if(!subchildren.empty())
totalchildren.insert(totalchildren.end(), subchildren.begin(), subchildren.end());
}
}
return totalchildren;
}
void Instance::setParent(Instance* newParent)
{
if(parent != NULL)
@@ -140,10 +154,6 @@ void Instance::addChild(Instance* newChild)
void Instance::clearChildren()
{
for (size_t i = 0; i < children.size(); i++)
{
delete children.at(i);
}
children.clear();
}
void Instance::removeChild(Instance* oldChild)

View File

@@ -1,8 +1,6 @@
#pragma once
#include <G3DAll.h>
#include "propertyGrid.h"
#include "map"
//#include "Properties/BoolProperty.h"
class Instance
{
@@ -14,11 +12,11 @@ public:
std::string name;
virtual void render(RenderDevice*);
virtual void update();
std::vector<Instance*> children; // All children.
std::string getClassName();
Instance* findFirstChild(std::string);
std::vector<Instance* > getChildren();
std::vector<Instance* > getAllChildren();
std::vector<Instance* > compileAndGetPVVector();
virtual void setParent(Instance*);
void setName(std::string newName);
void addChild(Instance*);
@@ -30,9 +28,9 @@ public:
virtual void PropUpdate(LPPROPGRIDITEM &pItem);
int listicon;
protected:
std::vector<Instance*> children; // All children.
std::string className;
Instance* parent; // Another pointer.
PROPGRIDITEM createPGI(LPSTR catalog, LPSTR propName, LPSTR propDesc, LPARAM curVal, INT type, TCHAR choices[] = NULL);
private:
static const std::map<std::string, Instance> g_logLevelsDescriptions;
};

View File

@@ -1,4 +1,4 @@
#include "DataModel/LevelInstance.h"
#include "LevelInstance.h"
LevelInstance::LevelInstance(void)
{

View File

@@ -1,8 +1,7 @@
#include "Globals.h"
#include "DataModelV2/Instance.h"
#include "Listener/ModeSelectionListener.h"
#include "Instance.h"
#include "ModeSelectionListener.h"
#include "Application.h"
#include "Tool/ArrowTool.h"
void ModeSelectionListener::onButton1MouseClick(BaseButtonInstance* button)
{
@@ -21,7 +20,7 @@ void ModeSelectionListener::onButton1MouseClick(BaseButtonInstance* button)
button->selected = true;
if(button->name == "Cursor")
g_usableApp->changeTool(new ArrowTool());
g_usableApp->setMode(CURSOR);
else if(button->name == "Resize")
g_usableApp->setMode(RESIZE);
else if(button->name == "Arrows")

80
PVInstance.cpp Normal file
View File

@@ -0,0 +1,80 @@
#include "PVInstance.h"
#include "WorkspaceInstance.h"
PVInstance::PVInstance(void)
{
Instance::Instance();
nameShown = false;
className = "PVInstance";
listicon = 0;
}
PVInstance::PVInstance(const PVInstance &oinst)
{
Instance::Instance(oinst);
}
PVInstance::~PVInstance(void)
{
}
void PVInstance::postRender(RenderDevice* rd)
{
}
void PVInstance::render(RenderDevice* rd)
{
}
void PVInstance::setParent(Instance* newParent)
{
if(parent != NULL)
{
Instance* workspace = parent;
while(workspace != NULL)
{
if(WorkspaceInstance* wsp = dynamic_cast<WorkspaceInstance*>(workspace))
{
wsp->removeFromPVector(this);
break;
}
workspace = workspace->getParent();
}
parent->removeChild(this);
}
parent = newParent;
if(newParent != NULL)
{
Instance* workspace = parent;
while(workspace != NULL)
{
if(WorkspaceInstance* wsp = dynamic_cast<WorkspaceInstance*>(workspace))
{
wsp->addToPVector(this);
break;
}
workspace = workspace->getParent();
}
newParent->addChild(this);
}
}
std::vector<PROPGRIDITEM> PVInstance::getProperties()
{
std::vector<PROPGRIDITEM> properties = Instance::getProperties();
properties.push_back(createPGI(
"Item",
"NameShown",
"This chooses whether the item name is shown",
nameShown,
PIT_CHECK));
return properties;
}
void PVInstance::PropUpdate(LPPROPGRIDITEM &pItem)
{
if(strcmp(pItem->lpszPropName, "NameShown") == 0)
{
nameShown = (bool)pItem->lpCurValue;
}
else Instance::PropUpdate(pItem);
}

17
PVInstance.h Normal file
View File

@@ -0,0 +1,17 @@
#pragma once
#include "instance.h"
class PVInstance :
public Instance
{
public:
PVInstance(void);
~PVInstance(void);
PVInstance(const PVInstance &oinst);
virtual void postRender(RenderDevice* rd);
virtual void setParent(Instance* newParent);
virtual std::vector<PROPGRIDITEM> getProperties();
virtual void PropUpdate(LPPROPGRIDITEM &pItem);
virtual void render(RenderDevice* rd);
bool nameShown;
};

View File

@@ -1,4 +1,4 @@
#include "DataModel/PartInstance.h"
#include "PartInstance.h"
#include "Globals.h"
#include <sstream>
#include <iomanip>
@@ -11,7 +11,7 @@ PartInstance::PartInstance(void) : _bevelSize(0.07f), _parseVert(0), _debugTimer
name = "Unnamed PVItem";
className = "Part";
canCollide = true;
anchored = false;
anchored = true;
size = Vector3(2,1,4);
setCFrame(CoordinateFrame(Vector3(0,0,0)));
color = Color3::gray();
@@ -26,25 +26,6 @@ PartInstance::PartInstance(void) : _bevelSize(0.07f), _parseVert(0), _debugTimer
shape = Enum::Shape::Block;
}
Vector3 PartInstance::getVelocity()
{
return velocity;
}
Vector3 PartInstance::getRotVelocity()
{
return rotVelocity;
}
void PartInstance::setVelocity(Vector3 v)
{
velocity = v;
}
void PartInstance::setRotVelocity(Vector3 v)
{
rotVelocity = v;
}
void PartInstance::postRender(RenderDevice *rd)
{
if(!nameShown)
@@ -76,31 +57,6 @@ void PartInstance::postRender(RenderDevice *rd)
}
}
void PartInstance::setParent(Instance* prnt)
{
Instance * cparent = getParent();
while(cparent != NULL)
{
if(WorkspaceInstance* workspace = dynamic_cast<WorkspaceInstance*>(cparent))
{
std::cout << "Removed from partarray " << std::endl;
workspace->partObjects.erase(std::remove(workspace->partObjects.begin(), workspace->partObjects.end(), this), workspace->partObjects.end());
break;
}
cparent = cparent->getParent();
}
Instance::setParent(prnt);
while(parent != NULL)
{
if(WorkspaceInstance* workspace = dynamic_cast<WorkspaceInstance*>(parent))
{
workspace->partObjects.push_back(this);
break;
}
parent = parent->getParent();
}
}
PartInstance::PartInstance(const PartInstance &oinst) : _bevelSize(0.07f), _parseVert(0), _debugTimer(0)
{
PVInstance::PVInstance(oinst);
@@ -189,7 +145,7 @@ void PartInstance::setShape(Enum::Shape::Value shape)
void PartInstance::setPosition(Vector3 pos)
{
position = pos;
cFrame = CoordinateFrame(cFrame.rotation, pos);
cFrame = CoordinateFrame(pos);
changed = true;
}
@@ -206,27 +162,8 @@ void PartInstance::setCFrame(CoordinateFrame coordinateFrame)
// Can probably be deleted
CoordinateFrame PartInstance::getCFrameRenderBased()
{
return cFrame;//CoordinateFrame(getCFrame().rotation,Vector3(getCFrame().translation.x, getCFrame().translation.y, getCFrame().translation.z));
return CoordinateFrame(getCFrame().rotation,Vector3(getCFrame().translation.x, getCFrame().translation.y, getCFrame().translation.z));
}
bool PartInstance::collides(PartInstance * part)
{
if(shape == Enum::Shape::Block)
{
if(part->shape == Enum::Shape::Block)
return G3D::CollisionDetection::fixedSolidBoxIntersectsFixedSolidBox(getBox(), part->getBox());
else
return G3D::CollisionDetection::fixedSolidSphereIntersectsFixedSolidBox(part->getSphere(), getBox());
}
else
{
if(part->shape == Enum::Shape::Block)
return G3D::CollisionDetection::fixedSolidSphereIntersectsFixedSolidBox(getSphere(), part->getBox());
else
return G3D::CollisionDetection::fixedSolidSphereIntersectsFixedSolidSphere(getSphere(), part->getSphere());
}
}
#ifdef NEW_BOX_RENDER
Box PartInstance::getBox()
{
@@ -235,13 +172,6 @@ Box PartInstance::getBox()
itemBox = c.toWorldSpace(box);
return itemBox;
}
Sphere PartInstance::getSphere()
{
Sphere sphere = Sphere(Vector3(0,0,0), size.y/2);
CoordinateFrame c = getCFrameRenderBased();
//itemBox = c.toWorldSpace(Sphere);
return sphere;//itemBox;
}
#else
Box PartInstance::getBox()
{
@@ -314,36 +244,22 @@ void PartInstance::addVertex(Vector3 vertexPos,Color3 color)
addSingularNormal(cross(v1-v3,v2-v3).direction());
}
void PartInstance::addQuad(Vector3 v1,Vector3 v2, Vector3 v3, Vector3 v4)
{
addTriangle(v1, v2, v3);
addTriangle(v1, v3, v4);
}
void PartInstance::genSmoothNormals(int count = -1)
{
if(count < 0)
{
}
}
void PartInstance::addSmoothTriangle(Vector3 v1, Vector3 v2, Vector3 v3)
void PartInstance::addSmoothTriangle(Vector3 v1,Vector3 v2,Vector3 v3)
{
addVertex(v1,color);
addVertex(v2,color);
addVertex(v3,color);
//addNormals(cross(v2-v1,v3-v1).direction());
//addSingularNormal(Vector3(cross(v2-v1,v3-v1) + cross(v3-v2,v1-v2) + cross(v1-v3,v2-v3)).direction());
addSingularNormal(v1.direction());
addSingularNormal(v2.direction());
addSingularNormal(v3.direction());
addSingularNormal(cross(v2-v1,v3-v1).direction());
addSingularNormal(cross(v3-v2,v1-v2).direction());
addSingularNormal(cross(v1-v3,v2-v3).direction());
}
void PartInstance::addPlus(Vector3 v1)
{
float renderY = max(size.z, max(size.x, size.y))/2 * 0.775;
float renderY = size.y/2 - 0.25f;
Vector3 vx1 = v1 + Vector3(0, -renderY, -0.1f);
Vector3 vx2 = v1 + Vector3(0, -renderY, 0.1f);
Vector3 vx3 = v1 + Vector3(0, renderY, 0.1f);
@@ -397,7 +313,7 @@ void PartInstance::addPlus(Vector3 v1)
void PartInstance::addPlus2(Vector3 v1)
{
float renderY = max(size.z, max(size.x, size.y))/2 * 0.775;
float renderY = max(size.z, max(size.x, size.y))/2 - 0.25f;
Vector3 vx3 = v1 + Vector3(0, -renderY, -0.1f);
Vector3 vx2 = v1 + Vector3(0, -renderY, 0.1f);
Vector3 vx1 = v1 + Vector3(0, renderY, 0.1f);
@@ -471,19 +387,6 @@ void PartInstance::addPlus2(Vector3 v1)
addTriangle(Vector3(_vertices[vertex1],_vertices[vertex1+1],_vertices[vertex1+2]),
Vector3(_vertices[vertex2],_vertices[vertex2+1],_vertices[vertex2+2]),
Vector3(_vertices[vertex3],_vertices[vertex3+1],_vertices[vertex3+2]));
}
void PartInstance::fromArrays(float verts[], float norms[], float ind[], unsigned int countVN, unsigned int countInd)
{
for(unsigned int i = 0; i < countVN; i++)
{
_vertices.push_back(verts[i]);
_normals.push_back(norms[i]);
}
for(unsigned int i = 0; i < countInd; i++)
{
_indices.push_back(ind[i]);
}
}
void PartInstance::makeSmoothFace(int vertex1,int vertex2, int vertex3)
{
@@ -502,12 +405,8 @@ bool PartInstance::isUniqueVertex(Vector3 pos)
}
return true;
}
//int rings = 15;
//int sectors = 15;
void PartInstance::render(RenderDevice* rd) {
int sectorCount = 12;
int stackCount = 12;
float radius = 0.5F;
//if(nameShown)
//postRenderStack.push_back(this);
if (changed)
@@ -523,17 +422,122 @@ void PartInstance::render(RenderDevice* rd) {
{
case Enum::Shape::Ball:
{
glNewList(glList, GL_COMPILE);
glColor(this->color);
glPushMatrix();
glScalef(renderSize.x, renderSize.y, renderSize.z);
gluSphere(gluNewQuadric(), 1, 20, 20);
glPopMatrix();
glEndList();
rd->setObjectToWorldMatrix(cFrame);
glCallList(glList);
changed = false;
return;
int obv = _bevelSize;
_bevelSize = this->size.y / 3.14159F;
// Front
addSmoothTriangle(Vector3(renderSize.x-_bevelSize,renderSize.y-_bevelSize,renderSize.z),
Vector3(-renderSize.x+_bevelSize,-renderSize.y+_bevelSize,renderSize.z),
Vector3(renderSize.x-_bevelSize,-renderSize.y+_bevelSize,renderSize.z)
);
addSmoothTriangle(Vector3(-renderSize.x+_bevelSize,renderSize.y-_bevelSize,renderSize.z),
Vector3(-renderSize.x+_bevelSize,-renderSize.y+_bevelSize,renderSize.z),
Vector3(renderSize.x-_bevelSize,renderSize.y-_bevelSize,renderSize.z)
);
// Top
addSmoothTriangle(Vector3(renderSize.x-_bevelSize,renderSize.y,renderSize.z-_bevelSize),
Vector3(renderSize.x-_bevelSize,renderSize.y,-renderSize.z+_bevelSize),
Vector3(-renderSize.x+_bevelSize,renderSize.y,renderSize.z-_bevelSize)
);
addSmoothTriangle(Vector3(-renderSize.x+_bevelSize,renderSize.y,renderSize.z-_bevelSize),
Vector3(renderSize.x-_bevelSize,renderSize.y,-renderSize.z+_bevelSize),
Vector3(-renderSize.x+_bevelSize,renderSize.y,-renderSize.z+_bevelSize)
);
// Back
addSmoothTriangle(Vector3(renderSize.x-_bevelSize,renderSize.y-_bevelSize,-renderSize.z),
Vector3(renderSize.x-_bevelSize,-renderSize.y+_bevelSize,-renderSize.z),
Vector3(-renderSize.x+_bevelSize,-renderSize.y+_bevelSize,-renderSize.z)
);
addSmoothTriangle(Vector3(renderSize.x-_bevelSize,renderSize.y-_bevelSize,-renderSize.z),
Vector3(-renderSize.x+_bevelSize,-renderSize.y+_bevelSize,-renderSize.z),
Vector3(-renderSize.x+_bevelSize,renderSize.y-_bevelSize,-renderSize.z)
);
// Bottom
addSmoothTriangle(Vector3(renderSize.x-_bevelSize,-renderSize.y,-renderSize.z+_bevelSize),
Vector3(renderSize.x-_bevelSize,-renderSize.y,renderSize.z-_bevelSize),
Vector3(-renderSize.x+_bevelSize,-renderSize.y,renderSize.z-_bevelSize)
);
addSmoothTriangle(Vector3(-renderSize.x+_bevelSize,-renderSize.y,renderSize.z-_bevelSize),
Vector3(-renderSize.x+_bevelSize,-renderSize.y,-renderSize.z+_bevelSize),
Vector3(renderSize.x-_bevelSize,-renderSize.y,-renderSize.z+_bevelSize)
);
// Left
addSmoothTriangle(Vector3(-renderSize.x,renderSize.y-_bevelSize,-renderSize.z+_bevelSize),
Vector3(-renderSize.x,-renderSize.y+_bevelSize,renderSize.z-_bevelSize),
Vector3(-renderSize.x,renderSize.y-_bevelSize,renderSize.z-_bevelSize)
);
addSmoothTriangle(Vector3(-renderSize.x,-renderSize.y+_bevelSize,renderSize.z-_bevelSize),
Vector3(-renderSize.x,renderSize.y-_bevelSize,-renderSize.z+_bevelSize),
Vector3(-renderSize.x,-renderSize.y+_bevelSize,-renderSize.z+_bevelSize)
);
// Right
addSmoothTriangle(Vector3(renderSize.x,renderSize.y-_bevelSize,renderSize.z-_bevelSize),
Vector3(renderSize.x,-renderSize.y+_bevelSize,renderSize.z-_bevelSize),
Vector3(renderSize.x,renderSize.y-_bevelSize,-renderSize.z+_bevelSize)
);
addSmoothTriangle(Vector3(renderSize.x,-renderSize.y+_bevelSize,-renderSize.z+_bevelSize),
Vector3(renderSize.x,renderSize.y-_bevelSize,-renderSize.z+_bevelSize),
Vector3(renderSize.x,-renderSize.y+_bevelSize,renderSize.z-_bevelSize)
);
// Bevel Top Front
makeSmoothFace(0,36,48);
makeSmoothFace(48,18,0);
// Bevel Left Front Corner
makeSmoothFace(18,156,162);
makeSmoothFace(24,18,162);
// Bevel Left Front Top Corner
makeSmoothFace(48,156,18);
// Bevel Left Front Bottom Corner
makeSmoothFace(120,6,150);
// Bevel Left Top
makeSmoothFace(48,66,156);
makeSmoothFace(144,156,66);
// Bevel Bottom
makeSmoothFace(6,120,114);
makeSmoothFace(114,12,6);
// Left Bottom
makeSmoothFace(120,150,174);
makeSmoothFace(174,132,120);
// Right Front Top Corner
makeSmoothFace(36,0,180);
// Right Front Corner
makeSmoothFace(180,0,12);
makeSmoothFace(186,180,12);
// Right Front Bottom Corner
makeSmoothFace(186,12,114);
// Right Bottom
makeSmoothFace(186,114,108);
makeSmoothFace(108,198,186);
// Right Top Corner
makeSmoothFace(180,192,36);
makeSmoothFace(192,42,36);
// Right Back Top Corner
makeSmoothFace(72,42,192);
// Right Back Bottom Corner
makeSmoothFace(78,198,108);
// Right Back Corner
makeSmoothFace(72,192,198);
makeSmoothFace(198,78,72);
// Back Bottom Corner
makeSmoothFace(78,108,132);
makeSmoothFace(132,84,78);
// Back Top
makeSmoothFace(42,72,102);
makeSmoothFace(102,66,42);
// Back Left Top Corner
makeSmoothFace(144,66,102);
// Back Left Corner
makeSmoothFace(144,102,84);
makeSmoothFace(84,174,144);
// Back Left Bottom Corner
makeSmoothFace(174,84,132);
_bevelSize = obv;
}
break;
case Enum::Shape::Block:
@@ -651,76 +655,71 @@ void PartInstance::render(RenderDevice* rd) {
makeFace(84,174,144);
// Back Left Bottom Corner
makeFace(174,84,132);
for (unsigned short i=0;i<_vertices.size()/6;i++) {
_indices.push_back(i);
}
}
break;
case Enum::Shape::Cylinder:
{
/*int fsize = renderSize.y/(pi()/2);
//makeFace(0,0,48);
// Front
addTriangle(Vector3(renderSize.x,renderSize.y-fsize,renderSize.z),
Vector3(-renderSize.x,-renderSize.y+fsize,renderSize.z),
Vector3(renderSize.x,-renderSize.y+fsize,renderSize.z)
addTriangle(Vector3(renderSize.x-_bevelSize,renderSize.y-_bevelSize,renderSize.z),
Vector3(-renderSize.x+_bevelSize,-renderSize.y+_bevelSize,renderSize.z),
Vector3(renderSize.x-_bevelSize,-renderSize.y+_bevelSize,renderSize.z)
);
addTriangle(Vector3(-renderSize.x,renderSize.y-fsize,renderSize.z),
Vector3(-renderSize.x,-renderSize.y+fsize,renderSize.z),
Vector3(renderSize.x,renderSize.y-fsize,renderSize.z)
addTriangle(Vector3(-renderSize.x+_bevelSize,renderSize.y-_bevelSize,renderSize.z),
Vector3(-renderSize.x+_bevelSize,-renderSize.y+_bevelSize,renderSize.z),
Vector3(renderSize.x-_bevelSize,renderSize.y-_bevelSize,renderSize.z)
);
// Top
addTriangle(Vector3(renderSize.x,renderSize.y,renderSize.z-fsize),
Vector3(renderSize.x,renderSize.y,-renderSize.z+fsize),
Vector3(-renderSize.x,renderSize.y,renderSize.z-fsize)
addTriangle(Vector3(renderSize.x-_bevelSize,renderSize.y,renderSize.z-_bevelSize),
Vector3(renderSize.x-_bevelSize,renderSize.y,-renderSize.z+_bevelSize),
Vector3(-renderSize.x+_bevelSize,renderSize.y,renderSize.z-_bevelSize)
);
addTriangle(Vector3(-renderSize.x,renderSize.y,renderSize.z-fsize),
Vector3(renderSize.x,renderSize.y,-renderSize.z+fsize),
Vector3(-renderSize.x,renderSize.y,-renderSize.z+fsize)
addTriangle(Vector3(-renderSize.x+_bevelSize,renderSize.y,renderSize.z-_bevelSize),
Vector3(renderSize.x-_bevelSize,renderSize.y,-renderSize.z+_bevelSize),
Vector3(-renderSize.x+_bevelSize,renderSize.y,-renderSize.z+_bevelSize)
);
// Back
addTriangle(Vector3(renderSize.x,renderSize.y-fsize,-renderSize.z),
Vector3(renderSize.x,-renderSize.y+fsize,-renderSize.z),
Vector3(-renderSize.x,-renderSize.y+fsize,-renderSize.z)
addTriangle(Vector3(renderSize.x-_bevelSize,renderSize.y-_bevelSize,-renderSize.z),
Vector3(renderSize.x-_bevelSize,-renderSize.y+_bevelSize,-renderSize.z),
Vector3(-renderSize.x+_bevelSize,-renderSize.y+_bevelSize,-renderSize.z)
);
addTriangle(Vector3(renderSize.x,renderSize.y-fsize,-renderSize.z),
Vector3(-renderSize.x,-renderSize.y+fsize,-renderSize.z),
Vector3(-renderSize.x,renderSize.y-fsize,-renderSize.z)
addTriangle(Vector3(renderSize.x-_bevelSize,renderSize.y-_bevelSize,-renderSize.z),
Vector3(-renderSize.x+_bevelSize,-renderSize.y+_bevelSize,-renderSize.z),
Vector3(-renderSize.x+_bevelSize,renderSize.y-_bevelSize,-renderSize.z)
);
// Bottom
addTriangle(Vector3(renderSize.x,-renderSize.y,-renderSize.z+fsize),
Vector3(renderSize.x,-renderSize.y,renderSize.z-fsize),
Vector3(-renderSize.x,-renderSize.y,renderSize.z-fsize)
addTriangle(Vector3(renderSize.x-_bevelSize,-renderSize.y,-renderSize.z+_bevelSize),
Vector3(renderSize.x-_bevelSize,-renderSize.y,renderSize.z-_bevelSize),
Vector3(-renderSize.x+_bevelSize,-renderSize.y,renderSize.z-_bevelSize)
);
addTriangle(Vector3(-renderSize.x,-renderSize.y,renderSize.z-fsize),
Vector3(-renderSize.x,-renderSize.y,-renderSize.z+fsize),
Vector3(renderSize.x,-renderSize.y,-renderSize.z+fsize)
addTriangle(Vector3(-renderSize.x+_bevelSize,-renderSize.y,renderSize.z-_bevelSize),
Vector3(-renderSize.x+_bevelSize,-renderSize.y,-renderSize.z+_bevelSize),
Vector3(renderSize.x-_bevelSize,-renderSize.y,-renderSize.z+_bevelSize)
);
// Left
/*addTriangle(Vector3(-renderSize.x,renderSize.y-fsize,-renderSize.z+fsize),
Vector3(-renderSize.x,-renderSize.y+fsize,renderSize.z-fsize),
Vector3(-renderSize.x,renderSize.y-fsize,renderSize.z-fsize)
addTriangle(Vector3(-renderSize.x,renderSize.y-_bevelSize,-renderSize.z+_bevelSize),
Vector3(-renderSize.x,-renderSize.y+_bevelSize,renderSize.z-_bevelSize),
Vector3(-renderSize.x,renderSize.y-_bevelSize,renderSize.z-_bevelSize)
);
addTriangle(Vector3(-renderSize.x,-renderSize.y+fsize,renderSize.z-fsize),
Vector3(-renderSize.x,renderSize.y-fsize,-renderSize.z+fsize),
Vector3(-renderSize.x,-renderSize.y+fsize,-renderSize.z+fsize)
addTriangle(Vector3(-renderSize.x,-renderSize.y+_bevelSize,renderSize.z-_bevelSize),
Vector3(-renderSize.x,renderSize.y-_bevelSize,-renderSize.z+_bevelSize),
Vector3(-renderSize.x,-renderSize.y+_bevelSize,-renderSize.z+_bevelSize)
);
// Right
addTriangle(Vector3(renderSize.x,renderSize.y-fsize,renderSize.z-fsize),
Vector3(renderSize.x,-renderSize.y+fsize,renderSize.z-fsize),
Vector3(renderSize.x,renderSize.y-fsize,-renderSize.z+fsize)
addTriangle(Vector3(renderSize.x,renderSize.y-_bevelSize,renderSize.z-_bevelSize),
Vector3(renderSize.x,-renderSize.y+_bevelSize,renderSize.z-_bevelSize),
Vector3(renderSize.x,renderSize.y-_bevelSize,-renderSize.z+_bevelSize)
);
addTriangle(Vector3(renderSize.x,-renderSize.y+_bevelSize,-renderSize.z+_bevelSize),
Vector3(renderSize.x,renderSize.y-_bevelSize,-renderSize.z+_bevelSize),
Vector3(renderSize.x,-renderSize.y+_bevelSize,renderSize.z-_bevelSize)
);
addTriangle(Vector3(renderSize.x,-renderSize.y+fsize,-renderSize.z+fsize),
Vector3(renderSize.x,renderSize.y-fsize,-renderSize.z+fsize),
Vector3(renderSize.x,-renderSize.y+fsize,renderSize.z-fsize)
);//*/
/*// Bevel Top Front
// Bevel Top Front
makeFace(0,36,48);
makeFace(48,18,0);
// Bevel Left Front Corner
@@ -771,112 +770,29 @@ void PartInstance::render(RenderDevice* rd) {
makeFace(144,102,84);
makeFace(84,174,144);
// Back Left Bottom Corner
makeFace(174,84,132);*/
/*float radius = renderSize.y + (renderSize.y * (1 - cos(pi() / 12)));
Vector2 xy[13];
for(int i = 0; i < 13; i++)
{
//Get the next point
float y = radius * cos(((double)i-G3D::toRadians(29)) * pi()/6);
float z = radius * sin(((double)i-G3D::toRadians(29)) * pi()/6);
xy[i] = Vector2(y,z);
}
for(int i = 0; i < 12; i++)
{
//Create a Quad for the face (i to i+1)
addSmoothTriangle(
Vector3(renderSize.x, xy[i].x, xy[i].y),
Vector3(-renderSize.x, xy[i].x, xy[i].y),
Vector3(-renderSize.x, xy[i+1].x, xy[i+1].y));
addSmoothTriangle(
Vector3(renderSize.x, xy[i].x, xy[i].y),
Vector3(-renderSize.x, xy[i+1].x, xy[i+1].y),
Vector3(renderSize.x, xy[i+1].x, xy[i+1].y));
//Cap on the right
addTriangle(
Vector3(renderSize.x, xy[0].x, xy[0].y),
Vector3(renderSize.x, xy[i].x, xy[i].y),
Vector3(renderSize.x, xy[i+1].x, xy[i+1].y));
//Cap on the left
addTriangle(
Vector3(-renderSize.x, xy[i+1].x, xy[i+1].y),
Vector3(-renderSize.x, xy[i].x, xy[i].y),
Vector3(-renderSize.x, xy[0].x, xy[0].y));
}*/
/*float facetRatio = renderSize.x / (pi() * 0.5F);
addQuad(
Vector3(renderSize.x, renderSize.y, renderSize.z-facetRatio),
Vector3(renderSize.x, renderSize.y, -renderSize.z+facetRatio),
Vector3(-renderSize.x, renderSize.y, -renderSize.z+facetRatio),
Vector3(-renderSize.x, renderSize.y, renderSize.z-facetRatio));
makeFace(174,84,132);
addQuad(
Vector3(renderSize.x, renderSize.y-facetRatio, renderSize.z),
Vector3(-renderSize.x, renderSize.y-facetRatio, renderSize.z),
Vector3(-renderSize.x, -renderSize.y+facetRatio, renderSize.z),
Vector3(renderSize.x, -renderSize.y+facetRatio, renderSize.z));
addQuad(
Vector3(-renderSize.x, -renderSize.y, renderSize.z-facetRatio),
Vector3(-renderSize.x, -renderSize.y, -renderSize.z+facetRatio),
Vector3(renderSize.x, -renderSize.y, -renderSize.z+facetRatio),
Vector3(renderSize.x, -renderSize.y, renderSize.z-facetRatio));
addQuad(
Vector3(renderSize.x, -renderSize.y+facetRatio, -renderSize.z),
Vector3(-renderSize.x, -renderSize.y+facetRatio, -renderSize.z),
Vector3(-renderSize.x, renderSize.y-facetRatio, -renderSize.z),
Vector3(renderSize.x, renderSize.y-facetRatio, -renderSize.z));*/
/*addPlus(Vector3(-renderSize.x-0.01,0,0));
addPlus(Vector3(-renderSize.x-0.01,0,0));
addPlus2(Vector3(renderSize.x+0.01,0,0));
for (unsigned short i=0;i<_vertices.size()/6;i++) {
_indices.push_back(i);
}
//std::reverse(_vertices.begin(), _vertices.end());
//std::reverse(_normals.begin(), _normals.end());
)*/
GLUquadric* q = gluNewQuadric();
addPlus(Vector3(-renderSize.x-0.01,0,0));
addPlus2(Vector3(renderSize.x+0.01,0,0));
for (unsigned short i=0;i<_vertices.size()/6;i++) {
_indices.push_back(i);
}
glVertexPointer(3, GL_FLOAT,6 * sizeof(GLfloat), &_vertices[0]);
glColorPointer(3, GL_FLOAT,6 * sizeof(GLfloat), &_vertices[3]);
glNormalPointer(GL_FLOAT,3 * sizeof(GLfloat), &_normals[0]);
glNewList(glList, GL_COMPILE);
glColor(this->color);
glPushMatrix();
glRotatef(90, 0, 1, 0);
glScalef(renderSize.x, renderSize.y, renderSize.z);
glTranslatef(0,0,1);
gluDisk(q, 0, 1, 12, 12);
glTranslatef(0,0,-2);
gluCylinder(q, 1, 1, 2, 12, 1);
glRotatef(180, 1, 0, 0);
gluDisk(q, 0, 1, 12, 12);
glPopMatrix();
glDrawElements(GL_TRIANGLES, _indices.size(), GL_UNSIGNED_SHORT, &_indices[0]);
glEndList();
rd->setObjectToWorldMatrix(cFrame);
glCallList(glList);
changed = false;
return;
}
break;
}
for (unsigned short i=0;i<_vertices.size()/6;i++) {
_indices.push_back(i);
}
changed=false;
glNewList(glList, GL_COMPILE);
glVertexPointer(3, GL_FLOAT,6 * sizeof(GLfloat), &_vertices[0]);
glColorPointer(3, GL_FLOAT,6 * sizeof(GLfloat), &_vertices[3]);
glNormalPointer(GL_FLOAT,3 * sizeof(GLfloat), &_normals[0]);
glNewList(glList, GL_COMPILE);
//glPushMatrix();
glPushMatrix();
//glTranslatef(2,7,0);
glDrawElements(GL_TRIANGLES, _indices.size(), GL_UNSIGNED_SHORT, &_indices[0]);
//glPopMatrix();
glPopMatrix();
glEndList();
}
rd->setObjectToWorldMatrix(cFrame);
@@ -993,7 +909,6 @@ static TCHAR* enumStr(int shape)
case Enum::Shape::Cylinder:
return "Cylinder";
}
return "Block";
}
void PartInstance::PropUpdate(LPPROPGRIDITEM &item)
@@ -1003,11 +918,6 @@ void PartInstance::PropUpdate(LPPROPGRIDITEM &item)
color = Color3(GetRValue(item->lpCurValue)/255.0F,GetGValue(item->lpCurValue)/255.0F,GetBValue(item->lpCurValue)/255.0F);
changed=true;
}
if(strcmp(item->lpszPropName, "Anchored") == 0)
{
anchored= item->lpCurValue == TRUE;
changed=true;
}
else if(strcmp(item->lpszPropName, "Offset") == 0)
{
std::string str = (LPTSTR)item->lpCurValue;
@@ -1087,14 +997,8 @@ std::vector<PROPGRIDITEM> PartInstance::getProperties()
RGB((color.r*255),(color.g*255),(color.b*255)),
PIT_COLOR
));
properties.push_back(createPGI(
"Item",
"Anchored",
"Whether the block can move or not",
(LPARAM)anchored,
PIT_CHECK
));
sprintf_s(pto, "%g, %g, %g", position.x, position.y, position.z);
sprintf_s(pto, "%g, %g, %g", cFrame.translation.x, cFrame.translation.y, cFrame.translation.z);
properties.push_back(createPGI(
"Item",
"Offset",

View File

@@ -1,23 +1,19 @@
#pragma once
#include "PVInstance.h"
#include "Enum.h"
#define _USE_MATH_DEFINES
#include <cmath>
#define NEW_BOX_RENDER
class PartInstance : public PVInstance
{
public:
PartInstance(void);
PartInstance(const PartInstance &oinst);
~PartInstance(void);
Instance* clone() const { return new PartInstance(*this); }
//Rendering
virtual void PartInstance::postRender(RenderDevice* rd);
~PartInstance(void);
virtual void render(RenderDevice*);
//Surfaces
Vector3 velocity;
Enum::SurfaceType::Value top;
Enum::SurfaceType::Value front;
Enum::SurfaceType::Value right;
@@ -25,45 +21,51 @@ public:
Enum::SurfaceType::Value left;
Enum::SurfaceType::Value bottom;
Enum::Shape::Value shape;
//Variables
CoordinateFrame cFrame;
Color3 color;
bool canCollide;
bool anchored;
//Getters
Vector3 getPosition();
Vector3 getVelocity();
Vector3 getRotVelocity();
Vector3 getSize();
Box getBox();
Sphere getSphere();
Box getScaledBox();
CoordinateFrame getCFrame();
//Setters
void setParent(Instance* parent);
void setPosition(Vector3);
void setVelocity(Vector3);
void setRotVelocity(Vector3);
CoordinateFrame getCFrame();
void setCFrame(CoordinateFrame);
Box getBox();
Box getScaledBox();
CoordinateFrame getCFrameRenderBased();
Vector3 getSize();
void setSize(Vector3);
void setShape(Enum::Shape::Value shape);
void setChanged();
void setSurface(int face, Enum::SurfaceType::Value surface);
//Collision
bool collides(PartInstance * part);
bool canCollide;
bool anchored;
Vector3 rotVelocity;
bool collides(Box);
//Properties
virtual std::vector<PROPGRIDITEM> getProperties();
virtual void PropUpdate(LPPROPGRIDITEM &pItem);
#ifdef NEW_BOX_RENDER
void addVertex(Vector3 vertexPos,Color3 color);
void addNormals(Vector3 normal);
void addSingularNormal(Vector3 normal);
void addTriangle(Vector3 vertexPos,Vector3 vertexPos2, Vector3 vertexPos3);
void addSmoothTriangle(Vector3 vertexPos,Vector3 vertexPos2, Vector3 vertexPos3);
void makeSmoothFace(int vertex1, int vertex2, int vertex3);
void addPlus(Vector3 v1);
void addPlus2(Vector3 v1);
void debugPrintVertexIDs(RenderDevice* rd, GFontRef font, Matrix3 camRot);
void makeFace(int vertex1, int vertex2, int vertex3);
bool isUniqueVertex(Vector3 pos);
#endif
private:
Vector3 position;
Vector3 size;
Vector3 velocity;
Vector3 rotVelocity;
float _bevelSize;
int _parseVert;
int _debugTimer;
std::vector<Vector3> _debugUniqueVertices;
#ifdef NEW_BOX_RENDER
std::vector<GLfloat> _vertices;
std::vector<GLfloat> _normals;
#else
GLfloat _vertices[96];
#endif
std::vector<GLushort> _indices;
bool changed;
Box itemBox;
GLuint glList;

View File

@@ -1,5 +1,5 @@
#pragma once
#include "DataModelV2/Instance.h"
#include "Instance.h"
class PropertyWindow {
public:

View File

@@ -1,5 +1,5 @@
#include "DataModelV2/BaseButtonInstance.h"
#include "Listener/RotateButtonListener.h"
#include "BaseButtonInstance.h"
#include "RotateButtonListener.h"
#include "Globals.h"
#include "AudioPlayer.h"

9
ShapeRenderer.cpp Normal file
View File

@@ -0,0 +1,9 @@
#include "ShapeRenderer.h"
ShapeRenderer::ShapeRenderer(void)
{
}
ShapeRenderer::~ShapeRenderer(void)
{
}

View File

@@ -2,6 +2,7 @@
#include <sstream>
#include "ErrorFunctions.h"
#include "StringFunctions.h"
#include <windows.h>
std::string Convert (float number)
{

View File

@@ -1,4 +1,4 @@
#include "DataModelV2/TextButtonInstance.h"
#include "TextButtonInstance.h"
TextButtonInstance::TextButtonInstance(void)
@@ -98,7 +98,12 @@ void TextButtonInstance::drawObj(RenderDevice* rd, Vector2 mousePos, bool mouseD
Draw::box(Box(point1, point2), rd, boxColorDn, boxOutlineColorDn);
font->draw2D(rd, title, RelativeTo, textSize, textColorDn, textOutlineColorDn);
}
else if(selected || mouseInArea(point1.x, point1.y, point2.x, point2.y, mousePos.x, mousePos.y))
else if(mouseInArea(point1.x, point1.y, point2.x, point2.y, mousePos.x, mousePos.y))
{
Draw::box(Box(point1, point2), rd, boxColorOvr, boxOutlineColorOvr);
font->draw2D(rd, title, RelativeTo, textSize, textColorOvr, textOutlineColorOvr);
}
else if(selected)
{
Draw::box(Box(point1, point2), rd, boxColorOvr, boxOutlineColorOvr);
font->draw2D(rd, title, RelativeTo, textSize, textColorOvr, textOutlineColorOvr);

View File

@@ -1,6 +1,7 @@
#include "WindowFunctions.h"
#include <sstream>
#include <string>
using namespace std;
@@ -23,7 +24,7 @@ bool createWindowClass(const char* name,WNDPROC proc,HMODULE hInstance)
{
stringstream errMsg;
errMsg<<"Failed to register " << name;
MessageBox(NULL, errMsg.str().c_str(),"Blocks3D Crash", MB_OK);
MessageBox(NULL, errMsg.str().c_str(),"Dynamica Crash", MB_OK);
return false;
}
return true;

View File

@@ -1,5 +1,4 @@
#pragma once
#include <windows.h>
bool createWindowClass(const char* name,WNDPROC proc,HMODULE hInstance);

23
WorkspaceInstance.cpp Normal file
View File

@@ -0,0 +1,23 @@
#include "WorkspaceInstance.h"
WorkspaceInstance::WorkspaceInstance(void)
{
GroupInstance::GroupInstance();
name = "Workspace";
className = "Workspace";
canDelete = false;
}
WorkspaceInstance::~WorkspaceInstance(void)
{
}
void WorkspaceInstance::removeFromPVector(PVInstance * instance)
{
__pvVector.erase(std::remove(__pvVector.begin(), __pvVector.end(), instance), __pvVector.end());
}
void WorkspaceInstance::addToPVector(PVInstance * instance)
{
__pvVector.push_back(instance);
}

15
WorkspaceInstance.h Normal file
View File

@@ -0,0 +1,15 @@
#pragma once
#include "GroupInstance.h"
#include <set>
class WorkspaceInstance :
public GroupInstance
{
public:
WorkspaceInstance(void);
~WorkspaceInstance(void);
void removeFromPVector(PVInstance *);
void addToPVector(PVInstance *);
std::vector<PVInstance*> __pvVector;
std::vector<PVInstance*>* getPVVector();
};

View File

@@ -1,13 +1,17 @@
// AX.CPP
#include <windows.h>
#include <comdef.h>
#include <exdisp.h>
#include <oledlg.h>
#include "ax.h"
#include "AudioPlayer.h"
#include "Enum.h"
#pragma warning (disable: 4311)
#pragma warning (disable: 4312)
#pragma warning (disable: 4244)
#pragma warning (disable: 4800)
// AXClientSite class
// ------- Implement member functions
AXClientSite :: AXClientSite()
@@ -22,89 +26,10 @@ AXClientSite :: ~AXClientSite()
}
STDMETHODIMP AXClientSite :: ShowContextMenu(DWORD dwID, POINT *ppt, IUnknown *pcmdtReserved, IDispatch *pdispReserved)
{
return E_NOTIMPL;
}
STDMETHODIMP AXClientSite :: GetHostInfo(DOCHOSTUIINFO *pInfo)
{
return E_NOTIMPL;
}
STDMETHODIMP AXClientSite :: ShowUI( DWORD dwID, IOleInPlaceActiveObject *pActiveObject, IOleCommandTarget *pCommandTarget, IOleInPlaceFrame *pFrame, IOleInPlaceUIWindow *pDoc)
{
return E_NOTIMPL;
}
STDMETHODIMP AXClientSite :: HideUI( void)
{
return E_NOTIMPL;
}
STDMETHODIMP AXClientSite :: UpdateUI( void)
{
return E_NOTIMPL;
}
STDMETHODIMP AXClientSite :: OnDocWindowActivate(BOOL fActivate)
{
return E_NOTIMPL;
}
STDMETHODIMP AXClientSite :: OnFrameWindowActivate(BOOL fActivate)
{
return E_NOTIMPL;
}
STDMETHODIMP AXClientSite :: ResizeBorder( LPCRECT prcBorder, IOleInPlaceUIWindow *pUIWindow, BOOL fRameWindow)
{
return E_NOTIMPL;
}
STDMETHODIMP AXClientSite :: TranslateAccelerator( LPMSG lpMsg, const GUID *pguidCmdGroup, DWORD nCmdID)
{
return E_NOTIMPL;
}
STDMETHODIMP AXClientSite :: GetOptionKeyPath( LPOLESTR *pchKey, DWORD dw)
{
return E_NOTIMPL;
}
STDMETHODIMP AXClientSite :: GetDropTarget( IDropTarget *pDropTarget, IDropTarget **ppDropTarget)
{
return E_NOTIMPL;
}
STDMETHODIMP AXClientSite :: GetExternal(IDispatch **ppDispatch)
{
//IDispatch* disp = ax->GetExternalDispatch();
*ppDispatch = this;
/* if (disp!=NULL)
{
*ppDispatch = this;
return S_OK;
} */
return S_OK;
}
STDMETHODIMP AXClientSite ::TranslateUrl( DWORD dwTranslate, OLECHAR *pchURLIn, OLECHAR **ppchURLOut)
{
return E_NOTIMPL;
}
STDMETHODIMP AXClientSite :: FilterDataObject( IDataObject *pDO, IDataObject **ppDORet)
{
return E_NOTIMPL;
}
// IUnknown methods
STDMETHODIMP AXClientSite :: QueryInterface(REFIID iid,void**ppvObject)
{
*ppvObject = 0;
// if (iid == IID_IOleInPlaceSite)
// *ppvObject = (IOleInPlaceSite*)this;
if (iid == IID_IOleClientSite)
*ppvObject = (IOleClientSite*)this;
if (iid == IID_IUnknown)
@@ -113,7 +38,7 @@ STDMETHODIMP AXClientSite :: QueryInterface(REFIID iid,void**ppvObject)
*ppvObject = (IAdviseSink*)this;
if (iid == IID_IDispatch)
*ppvObject = (IDispatch*)this;
//if (ExternalPlace == false)
if (ExternalPlace == false)
{
if (iid == IID_IOleInPlaceSite)
*ppvObject = (IOleInPlaceSite*)this;
@@ -121,8 +46,6 @@ STDMETHODIMP AXClientSite :: QueryInterface(REFIID iid,void**ppvObject)
*ppvObject = (IOleInPlaceFrame*)this;
if (iid == IID_IOleInPlaceUIWindow)
*ppvObject = (IOleInPlaceUIWindow*)this;
if (iid == IID_IDocHostUIHandler)
*ppvObject = (IDocHostUIHandler*)this;
}
//* Log Call
@@ -306,9 +229,9 @@ STDMETHODIMP AXClientSite :: SetActiveObject(IOleInPlaceActiveObject*pV,LPCOLEST
STDMETHODIMP AXClientSite :: SetStatusText(LPCOLESTR t)
{
{
return E_NOTIMPL;
}
}
STDMETHODIMP AXClientSite :: EnableModeless(BOOL f)
{
@@ -328,21 +251,14 @@ HRESULT _stdcall AXClientSite :: GetTypeInfoCount(
HRESULT _stdcall AXClientSite :: GetTypeInfo(
unsigned int iTInfo,
LCID lcid,
ITypeInfo FAR* FAR* ppTInfo)
{
return E_NOTIMPL;
}
ITypeInfo FAR* FAR* ppTInfo) {return E_NOTIMPL;}
HRESULT _stdcall AXClientSite :: GetIDsOfNames(
REFIID riid,
OLECHAR FAR* FAR* ext_function_name,
OLECHAR FAR* FAR*,
unsigned int cNames,
LCID lcid,
DISPID FAR* )
{
m_lastExternalName = *ext_function_name;
return S_OK;
}
DISPID FAR* ) {return E_NOTIMPL;}
// Other Methods
@@ -368,6 +284,8 @@ AX :: AX(char* cls)
Init(cls);
}
void AX :: Clean()
{
if (Site.InPlace == true)
@@ -504,12 +422,9 @@ HRESULT _stdcall AXClientSite :: Invoke(
VARIANT FAR* pVarResult,
EXCEPINFO FAR* pExcepInfo,
unsigned int FAR* puArgErr)
{
IEBrowser * browser = (IEBrowser *)GetProp(Window,"Browser");
return browser->doExternal(m_lastExternalName,dispIdMember, riid, lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
//return S_OK;
}
{
return E_NOTIMPL;
}
void _stdcall AXClientSite :: OnDataChange(FORMATETC *pFormatEtc,STGMEDIUM *pStgmed)
@@ -616,6 +531,7 @@ LRESULT CALLBACK AXWndProc(HWND hh,UINT mm,WPARAM ww,LPARAM ll)
return true;
}
if (mm == AX_GETAXINTERFACE)
{
AX* ax = (AX*)GetWindowLong(hh,GWL_USERDATA);

View File

@@ -1,10 +1,4 @@
// AX.H
#pragma once
#include "Globals.h"
#include <mshtmhst.h>
#include <string>
#pragma once
#include "IEBrowser.h"
// messages
#define AX_QUERYINTERFACE (WM_USER + 1)
@@ -15,6 +9,7 @@
#define AX_SETDATAADVISE (WM_USER + 6)
#define AX_DOVERB (WM_USER + 7)
// Registration function
ATOM AXRegister();
@@ -25,8 +20,7 @@ class AXClientSite :
public IDispatch,
public IAdviseSink,
public IOleInPlaceSite,
public IOleInPlaceFrame,
public IDocHostUIHandler
public IOleInPlaceFrame
{
protected:
@@ -34,6 +28,7 @@ class AXClientSite :
public:
HWND Window;
HWND Parent;
HMENU Menu;
@@ -42,6 +37,7 @@ class AXClientSite :
bool CalledCanInPlace;
class AX* ax;
// MyClientSite Methods
AXClientSite();
virtual ~AXClientSite();
@@ -59,64 +55,7 @@ class AXClientSite :
STDMETHODIMP ShowObject();
STDMETHODIMP OnShowWindow(BOOL f);
STDMETHODIMP RequestNewObjectLayout();
// IDDocHandler methods
STDMETHODIMP ShowContextMenu(
/* [in] */ DWORD dwID,
/* [in] */ POINT *ppt,
/* [in] */ IUnknown *pcmdtReserved,
/* [in] */ IDispatch *pdispReserved);
STDMETHODIMP GetHostInfo(
/* [out][in] */ DOCHOSTUIINFO *pInfo);
STDMETHODIMP ShowUI(
/* [in] */ DWORD dwID,
/* [in] */ IOleInPlaceActiveObject *pActiveObject,
/* [in] */ IOleCommandTarget *pCommandTarget,
/* [in] */ IOleInPlaceFrame *pFrame,
/* [in] */ IOleInPlaceUIWindow *pDoc);
STDMETHODIMP HideUI( void);
STDMETHODIMP UpdateUI( void);
STDMETHODIMP OnDocWindowActivate(
/* [in] */ BOOL fActivate);
STDMETHODIMP OnFrameWindowActivate(
/* [in] */ BOOL fActivate);
STDMETHODIMP ResizeBorder(
/* [in] */ LPCRECT prcBorder,
/* [in] */ IOleInPlaceUIWindow *pUIWindow,
/* [in] */ BOOL fRameWindow);
STDMETHODIMP TranslateAccelerator(
/* [in] */ LPMSG lpMsg,
/* [in] */ const GUID *pguidCmdGroup,
/* [in] */ DWORD nCmdID);
STDMETHODIMP GetOptionKeyPath(
/* [out] */ LPOLESTR *pchKey,
/* [in] */ DWORD dw);
STDMETHODIMP GetDropTarget(
/* [in] */ IDropTarget *pDropTarget,
/* [out] */ IDropTarget **ppDropTarget);
STDMETHODIMP GetExternal(
/* [out] */ IDispatch **ppDispatch);
STDMETHODIMP TranslateUrl(
/* [in] */ DWORD dwTranslate,
/* [in] */ OLECHAR *pchURLIn,
/* [out] */ OLECHAR **ppchURLOut);
STDMETHODIMP FilterDataObject(
/* [in] */ IDataObject *pDO,
/* [out] */ IDataObject **ppDORet);
// IAdviseSink methods
STDMETHODIMP_(void) OnDataChange(FORMATETC *pFormatEtc,STGMEDIUM *pStgmed);
@@ -151,13 +90,14 @@ class AXClientSite :
STDMETHODIMP EnableModeless(BOOL f);
STDMETHODIMP TranslateAccelerator(LPMSG,WORD);
std::wstring m_lastExternalName;
// 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
};
@@ -187,9 +127,13 @@ class AX
//AX_CONNECTSTRUCT* tcs;
bool AddMenu;
DWORD AdviseToken;
DWORD DAdviseToken[100];
DWORD DAdviseToken[100];
private:
CLSID clsid;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 950 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -1,122 +0,0 @@
<html>
<script>
</script>
<style>
img{
height: 100%;
}
.container
{
height: 47px;
width: 50px;
margin-right: 10px;
}
.color
{
border-style: inset;
border-width: 2px;
width:16px;
height:16px;
font-size: 0;
display:inline-block;
*display:inline;
*zoom:1;
}
#currentcolor
{
width; 80%;
height: 80%;
border-style: inset;
border-width: 2px;
}
.colorPicker
{
width: 32px;
height: 32px;
}
</style>
<script>
var currentcolor = "white"; //This will be queried from the application later
function setColor(btn)
{
var color = btn.style.backgroundColor;
var clInt = parseInt(color.replace("#","0x"));
document.getElementById("currentcolor").style.backgroundColor = color;
window.external.SetColor(clInt);
}
function decimalColorToHTMLcolor(number) {
//Found at https://bytes.com/topic/javascript/insights/636088-function-convert-decimal-color-number-into-html-hex-color-string
var intnumber = number - 0;
var red, green, blue;
var template = "#000000";
red = (intnumber&0x0000ff) << 16;
green = intnumber&0x00ff00;
blue = (intnumber&0xff0000) >>> 16;
intnumber = red|green|blue;
var HTMLcolor = intnumber.toString(16);
HTMLcolor = template.substring(0,7 - HTMLcolor.length) + HTMLcolor;
return HTMLcolor;
}
function hex2decInt(hex)
{
return parseInt(hex, 16);
}
function queryColor()
{
var color = window.external.ChooseColor();
if(color != null)
{
color = decimalColorToHTMLcolor(color);
document.getElementById("currentcolor").style.backgroundColor = color;
}
}
</script>
<body style="background-color: ButtonFace; margin: 0; padding: 5px; overflow: hidden; border: outset 2px;">
<table height="100%">
<tr>
<th>
<div class="color" onclick="setColor(this)" style="background-color: #000000"></div>
<div class="color" onclick="setColor(this)" style="background-color: #808080"></div>
<div class="color" onclick="setColor(this)" style="background-color: #800000"></div>
<div class="color" onclick="setColor(this)" style="background-color: #808000"></div>
<div class="color" onclick="setColor(this)" style="background-color: #008000"></div>
<div class="color" onclick="setColor(this)" style="background-color: #008080"></div>
<div class="color" onclick="setColor(this)" style="background-color: #000080"></div>
<div class="color" onclick="setColor(this)" style="background-color: #800080"></div>
<div class="color" onclick="setColor(this)" style="background-color: #808040"></div>
<div class="color" onclick="setColor(this)" style="background-color: #004040"></div>
<div class="color" onclick="setColor(this)" style="background-color: #0080FF"></div>
<div class="color" onclick="setColor(this)" style="background-color: #004080"></div>
<div class="color" onclick="setColor(this)" style="background-color: #8000FF"></div>
<div class="color" onclick="setColor(this)" style="background-color: #804000"></div><br>
<div class="color" onclick="setColor(this)" style="background-color: #FFFFFF"></div>
<div class="color" onclick="setColor(this)" style="background-color: #C0C0C0"></div>
<div class="color" onclick="setColor(this)" style="background-color: #FF0000"></div>
<div class="color" onclick="setColor(this)" style="background-color: #FFFF00"></div>
<div class="color" onclick="setColor(this)" style="background-color: #00FF00"></div>
<div class="color" onclick="setColor(this)" style="background-color: #00FFFF"></div>
<div class="color" onclick="setColor(this)" style="background-color: #0000FF"></div>
<div class="color" onclick="setColor(this)" style="background-color: #FF00FF"></div>
<div class="color" onclick="setColor(this)" style="background-color: #FFFF80"></div>
<div class="color" onclick="setColor(this)" style="background-color: #00FF80"></div>
<div class="color" onclick="setColor(this)" style="background-color: #80FFFF"></div>
<div class="color" onclick="setColor(this)" style="background-color: #8080FF"></div>
<div class="color" onclick="setColor(this)" style="background-color: #FF0080"></div>
<div class="color" onclick="setColor(this)" style="background-color: #FF8040"></div>
</th>
<td>
<button onclick="queryColor();" class='colorPicker'>
<div id='currentcolor' style="background-color:white;">
</button>
</td>
</tr>
</table>
</body>
</html>

View File

@@ -1,21 +0,0 @@
<html>
<script>
function toolOvr(image)
{
if(image.src.indexOf("_dn.png") == -1)
image.src = image.src.replace(".png", "_dn.png");
}
function toolOut(image)
{
if(image.src.indexOf("_dn.png") != -1)
image.src = image.src.replace("_dn.png",".png");
}
</script>
<body style="background-color: ButtonFace; margin: 0; padding: 5px; overflow: hidden; border: outset 2px;">
<img src="../images/Controller1Tool.png" onclick="window.external.SetController(1)" onmousedown="toolOvr(this)" onmouseup="toolOut(this)"/>
<img src="../images/Controller2Tool.png" onclick="window.external.SetController(2)" onmousedown="toolOvr(this)" onmouseup="toolOut(this)"/>
<img src="../images/ControllerAI1Tool.png" onclick="window.external.SetController(5)" onmousedown="toolOvr(this)" onmouseup="toolOut(this)"/>
<img src="../images/ControllerAI2Tool.png" onclick="window.external.SetController(6)" onmousedown="toolOvr(this)" onmouseup="toolOut(this)"/>
<img src="../images/ControllerNoneTool.png" onclick="window.external.SetController(0)" onmousedown="toolOvr(this)" onmouseup="toolOut(this)"/>
</body>
</html>

View File

@@ -1,47 +0,0 @@
<html>
<script>
function toolOvr(image)
{
image.style.backgroundColor = "#cccccc";
}
function toolOut(image)
{
image.style.backgroundColor = "transparent";
}
</script>
<style>
img{
height: 100%;
}
.container
{
height: 47px;
width: 50px;
margin-right: 10px;
}
</style>
<body style="background-color: ButtonFace; margin: 0; padding: 5px; overflow: hidden; border: outset 2px;">
<span class="container" onmousedown="toolOvr(this)" onmouseup="toolOut(this)" onmouseout="toolOut(this)" onclick="alert(window.external.ToggleHopperBin(0))">
<img src="../images/GameTool.png" />
</span>
<span class="container" onmousedown="toolOvr(this)" onmouseup="toolOut(this)" onmouseout="toolOut(this)" onclick="window.external.ToggleHopperBin(1)">
<img src="../images/Grab.png" />
</span>
<span class="container" onmousedown="toolOvr(this)" onmouseup="toolOut(this)" onmouseout="toolOut(this)" onclick="window.external.ToggleHopperBin(2)">
<img src="../images/Clone.png" />
</span>
<span class="container" onmousedown="toolOvr(this)" onmouseup="toolOut(this)" onmouseout="toolOut(this)" onclick="window.external.ToggleHopperBin(3)">
<img src="../images/Hammer.png" />
</span>
<span class="container" onmousedown="toolOvr(this)" onmouseup="toolOut(this)" onmouseout="toolOut(this)" onclick="window.external.ToggleHopperBin(4)">
<img src="../images/Slingshot.png" />
</span>
<span class="container" onmousedown="toolOvr(this)" onmouseup="toolOut(this)" onmouseout="toolOut(this)" onclick="window.external.ToggleHopperBin(5)">
<img src="../images/Rocket.png" />
</span>
<span class="container" onmousedown="toolOvr(this)" onmouseup="toolOut(this)" onmouseout="toolOut(this)" onclick="window.external.ToggleHopperBin(6)">
<img src="../images/Laser.png" />
</span>
</body>
</html>

View File

@@ -1,23 +0,0 @@
<html>
<script>
function toolOvr(image)
{
if(image.src.indexOf("_dn.png") == -1)
image.src = image.src.replace(".png", "_dn.png");
}
function toolOut(image)
{
if(image.src.indexOf("_dn.png") != -1)
image.src = image.src.replace("_dn.png",".png");
}
</script>
<body style="background-color: ButtonFace; margin: 0; padding: 5px; overflow: hidden; border: outset 2px;">
<img src="../images/FlatTool.png" onmouseout="toolOut(this)" onclick="window.external.SetSurface(0, 0)" onmousedown="toolOvr(this)" onmouseup="toolOut(this)"/>
<img src="../images/BumpTool.png" onmouseout="toolOut(this)" onclick="window.external.SetSurface(1, 0)" onmousedown="toolOvr(this)" onmouseup="toolOut(this)"/>
<img src="../images/HingeTool.png" onmouseout="toolOut(this)" onclick="window.external.SetSurface(2, 0)" onmousedown="toolOvr(this)" onmouseup="toolOut(this)"/>
<img src="../images/LeftMotorTool.png" onmouseout="toolOut(this)" onclick="window.external.SetSurface(3, 1)" onmousedown="toolOvr(this)" onmouseup="toolOut(this)"/>
<img src="../images/LeftMotorFastTool.png" onmouseout="toolOut(this)" onclick="window.external.SetSurface(3, 2)" onmousedown="toolOvr(this)" onmouseup="toolOut(this)"/>
<img src="../images/RightMotorTool.png" onmouseout="toolOut(this)" onclick="window.external.SetSurface(3, 3)" onmousedown="toolOvr(this)" onmouseup="toolOut(this)"/>
<img src="../images/RightMotorFastTool.png" onmouseout="toolOut(this)" onclick="window.external.SetSurface(3, 4)" onmousedown="toolOvr(this)" onmouseup="toolOut(this)"/>
</body>
</html>

View File

@@ -1,223 +1,235 @@
// TODO: Move toolbar buttons with resized window.
#define _WIN32_WINNT 0x0400
#define _WIN32_WINDOWS 0x0400
#define WINVER 0x0400
#define _CRTBLD
#include "resource.h"
#include "Application.h"
#include "WindowFunctions.h"
#include "ax.h"
#include <commctrl.h>
#include "ErrorFunctions.h"
#if G3D_VER < 61000
#error Requires G3D 6.10
#endif
HWND hwnd;
HRESULT hresult;
OLECHAR dat = ((OLECHAR)"SayHello");
OLECHAR * szMember = &dat;
DISPID dispid;
DISPPARAMS dispparamsNoArgs = {NULL, NULL, 0, 0};
EXCEPINFO excepinfo;
UINT nArgErr;
LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
Application *app = (Application *)GetWindowLongPtr(hwnd, GWL_USERDATA);
if (app==NULL)
{
return DefWindowProc(hwnd, msg, wParam, lParam);
}
switch(msg)
{
case WM_KEYDOWN:
if ((HIWORD(lParam)&0x4000)==0) // single key press
{
app->onKeyPressed(wParam);
}
break;
case WM_KEYUP:
{
app->onKeyUp(wParam);
}
break;
case WM_MOUSEWHEEL:
app->onMouseWheel(LOWORD(lParam),HIWORD(lParam),HIWORD(wParam));
break;
case WM_SIZE:
app->resizeWithParent(hwnd);
break;
case WM_ACTIVATE:
if(wParam > WA_INACTIVE) app->setFocus(false);
else app->setFocus(true);
default:
{
return DefWindowProc(hwnd, msg, wParam, lParam);
}
}
return 0;
}
LRESULT CALLBACK ToolboxProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
//Application *app = (Application *)GetWindowLongPtr(hwnd, GWL_USERDATA);
MessageBox(NULL, (LPCSTR)wParam, (LPCSTR)lParam, 1);
//if (app==NULL)
//{
//return DefWindowProc(hwnd, msg, wParam, lParam);
//}
switch(msg)
{
case WM_SIZE:
break;
default:
{
return DefWindowProc(hwnd, msg, wParam, lParam);
}
}
return 0;
}
LRESULT CALLBACK G3DProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
Application *app = (Application *)GetWindowLongPtr(hwnd, GWL_USERDATA);
if (app==NULL)
{
return DefWindowProc(hwnd, msg, wParam, lParam);
}
switch(msg)
{
case WM_QUIT:
app->QuitApp();
break;
case WM_DESTROY:
app->QuitApp();
break;
case WM_LBUTTONDOWN:
app->onMouseLeftPressed(hwnd,LOWORD(lParam),HIWORD(lParam));
break;
case WM_LBUTTONUP:
app->onMouseLeftUp(app->getRenderDevice(),LOWORD(lParam),HIWORD(lParam));
break;
case WM_RBUTTONDOWN:
app->onMouseRightPressed(LOWORD(lParam),HIWORD(lParam));
break;
case WM_RBUTTONUP:
app->onMouseRightUp(LOWORD(lParam),HIWORD(lParam));
break;
case WM_MOUSEMOVE:
app->onMouseMoved(LOWORD(lParam),HIWORD(lParam));
break;
case WM_KEYDOWN:
if ((HIWORD(lParam)&0x4000)==0) // single key press
{
app->onKeyPressed(wParam);
}
break;
case WM_KEYUP:
{
app->onKeyUp(wParam);
}
break;
case WM_SYSKEYDOWN:
if ((HIWORD(lParam)&0x4000)==0) // single key press
{
app->onKeyPressed(wParam);
}
break;
case WM_SYSKEYUP:
{
app->onKeyUp(wParam);
}
case WM_SIZE:
{
app->onGraphics(app->getRenderDevice());
}
break;
default:
{
return DefWindowProc(hwnd, msg, wParam, lParam);
}
}
return 0;
}
int main(int argc, char** argv) {
try{
hresult = OleInitialize(NULL);
/* IInternetSecurityManager *pSecurityMgr;
IInternetZoneManager *pZoneMgr;
LPCWSTR site1 = SysAllocString(L"http://www.androdome.com");
hr = CoCreateInstance(CLSID_InternetSecurityManager, NULL, CLSCTX_INPROC_SERVER, IID_IInternetSecurityManager, (void**)&pSecurityMgr);
pSecurityMgr->SetZoneMapping((DWORD)2, site1, (DWORD)0); // 2 = Trusted Site, site1 is the URL to add, and 0 is to create the entry.
*/
if (!AXRegister())
return 0;
INITCOMMONCONTROLSEX icc;
// WNDCLASSEX wcx;
/* Initialize common controls. Also needed for MANIFEST's */
icc.dwSize = sizeof(icc);
icc.dwICC = ICC_WIN95_CLASSES/*|ICC_COOL_CLASSES|ICC_DATE_CLASSES|
ICC_PAGESCROLLER_CLASS|ICC_USEREX_CLASSES*/;
InitCommonControlsEx(&icc);
AudioPlayer::init();
/* GAppSettings settings;
settings.window.resizable = true;
settings.writeLicenseFile = false;
settings.window.center = true; */
HMODULE hThisInstance = GetModuleHandle(NULL);
if (!createWindowClass("mainHWND",WndProc,hThisInstance))
return false;
if (!createWindowClass("toolboxHWND",ToolboxProc,hThisInstance))
return false;
if (!createWindowClass("G3DWindow",G3DProc,hThisInstance))
return false;
HWND hwndMain = CreateWindowEx(
WS_EX_APPWINDOW,
"mainHWND",
"Main test",
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,
CW_USEDEFAULT,
800,
660,
NULL, // parent
NULL, // menu
hThisInstance,
NULL
);
if(hwndMain == NULL)
{
MessageBox(NULL, "Critical error loading: Failed to create HWND, must exit", (g_appName + " Crash").c_str() , MB_OK);
return 0;
}
SendMessage(hwndMain, WM_SETICON, ICON_BIG,(LPARAM)LoadImage(GetModuleHandle(NULL), (LPCSTR)MAKEINTRESOURCEW(IDI_ICON1), IMAGE_ICON, 0, 0, LR_DEFAULTCOLOR | LR_DEFAULTSIZE));
Globals::mainHwnd = hwndMain;
Application app = Application(hwndMain);
app.run();
}
catch(...)
{
OnError(-1);
}
return 0;
}
/**
Licensed under GPLv2
Based on G3D 6.10 © 2000-2006 Morgan McGuire.
*/
// TODO: Move toolbar buttons with resized window.
#define _WIN32_WINNT 0x0400
#include <G3DAll.h>
#include <initguid.h>
#include <iomanip>
#include "Instance.h"
#include "resource.h"
#include "PartInstance.h"
#include "TextButtonInstance.h"
#include "ImageButtonInstance.h"
#include "DataModelInstance.h"
#include "CameraController.h"
#include "AudioPlayer.h"
#include "Globals.h"
#include "Application.h"
#include "win32Defines.h"
#include "WindowFunctions.h"
#include <limits.h>
#include <mshtml.h>
#include <exdisp.h>
#include <vector>
#include <string>
#include "ax.h"
#include <cguid.h>
#include "IEBrowser.h"
#include "PropertyWindow.h"
#include <commctrl.h>
#include "ErrorFunctions.h"
#if G3D_VER < 61000
#error Requires G3D 6.10
#endif
HWND hwnd;
HRESULT hresult;
OLECHAR dat = ((OLECHAR)"SayHello");
OLECHAR * szMember = &dat;
DISPID dispid;
DISPPARAMS dispparamsNoArgs = {NULL, NULL, 0, 0};
EXCEPINFO excepinfo;
UINT nArgErr;
LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
Application *app = (Application *)GetWindowLongPtr(hwnd, GWL_USERDATA);
if (app==NULL)
{
return DefWindowProc(hwnd, msg, wParam, lParam);
}
switch(msg)
{
case WM_KEYDOWN:
if ((HIWORD(lParam)&0x4000)==0) // single key press
{
app->onKeyPressed(wParam);
}
break;
case WM_KEYUP:
{
app->onKeyUp(wParam);
}
break;
case WM_MOUSEWHEEL:
app->onMouseWheel(LOWORD(lParam),HIWORD(lParam),HIWORD(wParam));
break;
case WM_SIZE:
app->resizeWithParent(hwnd);
break;
case WM_ACTIVATE:
if(wParam > WA_INACTIVE) app->setFocus(false);
else app->setFocus(true);
default:
{
return DefWindowProc(hwnd, msg, wParam, lParam);
}
}
return 0;
}
LRESULT CALLBACK ToolboxProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
//Application *app = (Application *)GetWindowLongPtr(hwnd, GWL_USERDATA);
MessageBox(NULL, (LPCSTR)wParam, (LPCSTR)lParam, 1);
//if (app==NULL)
//{
//return DefWindowProc(hwnd, msg, wParam, lParam);
//}
switch(msg)
{
case WM_SIZE:
break;
default:
{
return DefWindowProc(hwnd, msg, wParam, lParam);
}
}
return 0;
}
LRESULT CALLBACK G3DProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
Application *app = (Application *)GetWindowLongPtr(hwnd, GWL_USERDATA);
if (app==NULL)
{
return DefWindowProc(hwnd, msg, wParam, lParam);
}
switch(msg)
{
case WM_QUIT:
app->QuitApp();
break;
case WM_DESTROY:
app->QuitApp();
break;
case WM_LBUTTONDOWN:
app->onMouseLeftPressed(hwnd,LOWORD(lParam),HIWORD(lParam));
break;
case WM_LBUTTONUP:
app->onMouseLeftUp(app->getRenderDevice(),LOWORD(lParam),HIWORD(lParam));
break;
case WM_RBUTTONDOWN:
app->onMouseRightPressed(LOWORD(lParam),HIWORD(lParam));
break;
case WM_RBUTTONUP:
app->onMouseRightUp(LOWORD(lParam),HIWORD(lParam));
break;
case WM_MOUSEMOVE:
app->onMouseMoved(LOWORD(lParam),HIWORD(lParam));
break;
case WM_KEYDOWN:
if ((HIWORD(lParam)&0x4000)==0) // single key press
{
app->onKeyPressed(wParam);
}
break;
case WM_KEYUP:
{
app->onKeyUp(wParam);
}
break;
case WM_SYSKEYDOWN:
if ((HIWORD(lParam)&0x4000)==0) // single key press
{
app->onKeyPressed(wParam);
}
break;
case WM_SYSKEYUP:
{
app->onKeyUp(wParam);
}
case WM_SIZE:
{
app->onGraphics(app->getRenderDevice());
}
break;
default:
{
return DefWindowProc(hwnd, msg, wParam, lParam);
}
}
return 0;
}
int main(int argc, char** argv) {
try{
hresult = OleInitialize(NULL);
if (!AXRegister())
return 0;
INITCOMMONCONTROLSEX icc;
// WNDCLASSEX wcx;
/* Initialize common controls. Also needed for MANIFEST's */
icc.dwSize = sizeof(icc);
icc.dwICC = ICC_WIN95_CLASSES/*|ICC_COOL_CLASSES|ICC_DATE_CLASSES|
ICC_PAGESCROLLER_CLASS|ICC_USEREX_CLASSES*/;
InitCommonControlsEx(&icc);
AudioPlayer::init();
/* GAppSettings settings;
settings.window.resizable = true;
settings.writeLicenseFile = false;
settings.window.center = true; */
HMODULE hThisInstance = GetModuleHandle(NULL);
if (!createWindowClass("mainHWND",WndProc,hThisInstance))
return false;
if (!createWindowClass("toolboxHWND",ToolboxProc,hThisInstance))
return false;
if (!createWindowClass("G3DWindow",G3DProc,hThisInstance))
return false;
HWND hwndMain = CreateWindowEx(
WS_EX_ACCEPTFILES,
"mainHWND",
"Main test",
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,
CW_USEDEFAULT,
800,
660,
NULL, // parent
NULL, // menu
hThisInstance,
NULL
);
if(hwndMain == NULL)
{
MessageBox(NULL, "Critical error loading: Failed to create HWND, must exit", (g_PlaceholderName + " Crash").c_str() , MB_OK);
return 0;
}
SendMessage(hwndMain, WM_SETICON, ICON_BIG,(LPARAM)LoadImage(GetModuleHandle(NULL), (LPCSTR)MAKEINTRESOURCEW(IDI_ICON1), IMAGE_ICON, 0, 0, LR_DEFAULTCOLOR | LR_DEFAULTSIZE));
Application app = Application(hwndMain);
app.run();
}
catch(...)
{
OnError(-1);
}
return 0;
}

Some files were not shown because too many files have changed in this diff Show More