It's alive\!\!\!... almost, still crashes on exit lol

This commit is contained in:
Vulpovile
2023-11-08 23:47:10 -08:00
parent 70bace117c
commit 0fb941bf07
90 changed files with 248 additions and 5297 deletions

View File

@@ -329,36 +329,6 @@
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
@@ -374,71 +344,6 @@
RelativePath=".\src\include\Tool\Tool.h">
</File>
</Filter>
<Filter
Name="DataModelV2"
Filter="">
<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\LightingInstance.h">
</File>
<File
RelativePath=".\src\include\DataModelV2\PartInstance.h">
</File>
<File
RelativePath=".\src\include\DataModelV2\PVInstance.h">
</File>
<File
RelativePath=".\src\include\DataModelV2\SelectionService.h">
</File>
<File
RelativePath=".\src\include\DataModelV2\SoundInstance.h">
</File>
<File
RelativePath=".\src\include\DataModelV2\SoundService.h">
</File>
<File
RelativePath=".\src\include\DataModelV2\ThumbnailGeneratorInstance.h">
</File>
<File
RelativePath=".\src\include\DataModelV2\WorkspaceInstance.h">
</File>
<File
RelativePath=".\src\include\XplicitNgine\XplicitNgine.h">
</File>
<Filter
Name="Gui"
Filter="">
<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="Helpers">
<File
@@ -596,224 +501,6 @@
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"
Filter="">
<File
RelativePath=".\src\source\DataModelV2\DataModelInstance.cpp">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)/$(InputName)1.obj"/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)/$(InputName)1.obj"/>
</FileConfiguration>
<FileConfiguration
Name="Relese (Dec ALPHA)|Win32">
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)/$(InputName)1.obj"/>
</FileConfiguration>
</File>
<File
RelativePath=".\src\source\DataModelV2\GroupInstance.cpp">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)/$(InputName)1.obj"/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)/$(InputName)1.obj"/>
</FileConfiguration>
<FileConfiguration
Name="Relese (Dec ALPHA)|Win32">
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)/$(InputName)1.obj"/>
</FileConfiguration>
</File>
<File
RelativePath=".\src\source\DataModelV2\Instance.cpp">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)/$(InputName)1.obj"/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)/$(InputName)1.obj"/>
</FileConfiguration>
<FileConfiguration
Name="Relese (Dec ALPHA)|Win32">
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)/$(InputName)1.obj"/>
</FileConfiguration>
</File>
<File
RelativePath=".\src\source\DataModelV2\LevelInstance.cpp">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)/$(InputName)1.obj"/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)/$(InputName)1.obj"/>
</FileConfiguration>
<FileConfiguration
Name="Relese (Dec ALPHA)|Win32">
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)/$(InputName)1.obj"/>
</FileConfiguration>
</File>
<File
RelativePath=".\src\source\DataModelV2\LightingInstance.cpp">
</File>
<File
RelativePath=".\src\source\DataModelV2\PartInstance.cpp">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)/$(InputName)1.obj"/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)/$(InputName)1.obj"/>
</FileConfiguration>
<FileConfiguration
Name="Relese (Dec ALPHA)|Win32">
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)/$(InputName)1.obj"/>
</FileConfiguration>
</File>
<File
RelativePath=".\src\source\DataModelV2\PVInstance.cpp">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)/$(InputName)1.obj"/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)/$(InputName)1.obj"/>
</FileConfiguration>
<FileConfiguration
Name="Relese (Dec ALPHA)|Win32">
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)/$(InputName)1.obj"/>
</FileConfiguration>
</File>
<File
RelativePath=".\src\source\DataModelV2\SelectionService.cpp">
</File>
<File
RelativePath=".\src\source\DataModelV2\SoundInstance.cpp">
</File>
<File
RelativePath=".\src\source\DataModelV2\SoundService.cpp">
</File>
<File
RelativePath=".\src\source\DataModelV2\ThumbnailGeneratorInstance.cpp">
</File>
<File
RelativePath=".\src\source\DataModelV2\WorkspaceInstance.cpp">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)/$(InputName)1.obj"/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)/$(InputName)1.obj"/>
</FileConfiguration>
<FileConfiguration
Name="Relese (Dec ALPHA)|Win32">
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)/$(InputName)1.obj"/>
</FileConfiguration>
</File>
<Filter
Name="Gui"
Filter="">
<File
RelativePath=".\src\source\DataModelV2\BaseButtonInstance.cpp">
</File>
<File
RelativePath=".\src\source\DataModelV2\BaseGuiInstance.cpp">
</File>
<File
RelativePath=".\src\source\DataModelV2\GuiRootInstance.cpp">
</File>
<File
RelativePath=".\src\source\DataModelV2\ImageButtonInstance.cpp">
</File>
<File
RelativePath=".\src\source\DataModelV2\TextButtonInstance.cpp">
</File>
<File
RelativePath=".\src\source\DataModelV2\ToggleImageButtonInstance.cpp">
</File>
<File
RelativePath=".\src\source\XplicitNgine\XplicitNgine.cpp">
</File>
</Filter>
</Filter>
<Filter
Name="Helpers">
<File

View File

@@ -335,346 +335,6 @@
>
</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\LightingInstance.cpp"
>
</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\SelectionService.cpp"
>
</File>
<File
RelativePath=".\src\source\DataModelV2\SoundInstance.cpp"
>
</File>
<File
RelativePath=".\src\source\DataModelV2\SoundService.cpp"
>
</File>
<File
RelativePath=".\ThumbnailGeneratorInstance.cpp"
>
</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
Name="XplicitNgine"
>
<File
RelativePath=".\src\source\XplicitNgine\XplicitNgine.cpp"
>
</File>
</Filter>
</Filter>
<Filter
Name="Helpers"
>
@@ -1000,46 +660,6 @@
>
</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"
>
@@ -1060,94 +680,6 @@
>
</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\LightingInstance.h"
>
</File>
<File
RelativePath=".\src\include\DataModelV2\PartInstance.h"
>
</File>
<File
RelativePath=".\src\include\DataModelV2\PVInstance.h"
>
</File>
<File
RelativePath=".\src\include\DataModelV2\SelectionService.h"
>
</File>
<File
RelativePath=".\src\include\DataModelV2\SoundInstance.h"
>
</File>
<File
RelativePath=".\src\include\DataModelV2\SoundService.h"
>
</File>
<File
RelativePath=".\src\include\DataModelV2\ThumbnailGeneratorInstance.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
Name="XplicitNgine"
>
<File
RelativePath=".\src\include\XplicitNgine\XplicitNgine.h"
>
</File>
</Filter>
</Filter>
<Filter
Name="Helpers"
>

View File

@@ -1,16 +1,16 @@
#pragma once
#include <G3DAll.h>
#include "PropertyWindow.h"
#include "DataModelV2/TextButtonInstance.h"
#include "DataModelV2/ImageButtonInstance.h"
#include "DataModelV3/Gui/TextButtonInstance.h"
#include "DataModelV3/Gui/ImageButtonInstance.h"
#include "CameraController.h"
#include "IEBrowser.h"
#include "Mouse.h"
#include "Tool/Tool.h"
class TextButtonInstance;
class ImageButtonInstance;
class PartInstance;
class B3D::TextButtonInstance;
class B3D::ImageButtonInstance;
class B3D::PartInstance;
class CameraController;
class Application { // : public GApp {

View File

@@ -1,7 +1,7 @@
#pragma once
#include <G3DAll.h>
#include "DataModelV2/Instance.h"
#include "DataModelV3/Instance.h"
#include "Globals.h"
#include <string>

View File

@@ -1,26 +0,0 @@
#pragma once
#include "Instance.h"
#include "Listener/ButtonListener.h"
class ButtonListener;
class Instance;
class BaseButtonInstance : public Instance
{
public:
BaseButtonInstance(void);
virtual ~BaseButtonInstance(void);
virtual void render(RenderDevice* rd);
virtual void drawObj(RenderDevice* rd, Vector2 mousePos, bool mouseDown);
virtual bool mouseInButton(float, float, RenderDevice* rd);
virtual void onMouseClick();
void setButtonListener(ButtonListener&);
bool floatBottom;
bool floatRight;
bool floatCenter;
volatile bool disabled;
bool selected;
protected:
bool mouseInArea(float, float, float, float, float, float);
class ButtonListener* listener;
};

View File

@@ -1,57 +0,0 @@
#pragma once
#include "Instance.h"
struct UDim
{
float scale;
float offset;
UDim()
{
scale = offset = 0;
}
UDim(float scale_, float offset_)
{
scale = scale_;
offset = offset_;
}
};
struct UDim2
{
UDim x;
UDim y;
UDim2(UDim x_, UDim y_)
{
x = x_;
y = y_;
}
UDim2(float scale_x, float offset_x, float scale_y, float offset_y)
{
x = UDim(scale_x, offset_x);
y = UDim(scale_y, offset_y);
}
};
class Instance;
class BaseGuiInstance : public Instance
{
public:
BaseGuiInstance(void);
virtual ~BaseGuiInstance(void);
virtual void render(RenderDevice* rd);
virtual bool mouseHovered(float, float, RenderDevice* rd);
UDim2 position;
UDim2 size;
static G3D::Color4 translucentBackdrop()
{
return G3D::Color4(0.60000002F, 0.60000002F, 0.60000002F, 0.60000002F);
}
static G3D::Color4 disabledFill()
{
return G3D::Color4(0.69999999F, 0.69999999F, 0.69999999F, 0.5F);
}
protected:
bool mouseInArea(float, float, float, float, float, float);
class ButtonListener* listener;
};

View File

@@ -1,79 +0,0 @@
#pragma once
// Instances
#include "WorkspaceInstance.h"
#include "LevelInstance.h"
#include "PartInstance.h"
#include "SelectionService.h"
#include "GuiRootInstance.h"
#include "ThumbnailGeneratorInstance.h"
#include "XplicitNgine/XplicitNgine.h"
#include "SoundService.h"
#include "LightingInstance.h"
// Libraries
#include "rapidxml/rapidxml.hpp"
class GuiRootInstance;
class DataModelInstance :
public Instance
{
public:
DataModelInstance(void);
~DataModelInstance(void);
void setMessage(std::string);
void setMessageBrickCount();
void clearMessage();
bool debugGetOpen();
bool getOpen();
bool getOpenModel();
bool load(const char* filename,bool clearObjects);
bool loadModel(const char* filename);
bool readXMLFileStream(std::ifstream* file);
void drawMessage(RenderDevice*);
// Instance getters
WorkspaceInstance* getWorkspace();
LevelInstance* getLevel();
XplicitNgine* getEngine();
ThumbnailGeneratorInstance* getThumbnailGenerator();
SoundService* getSoundService();
LightingInstance* getLighting();
std::string message;
std::string _loadedFileName;
bool showMessage;
G3D::GFontRef font;
GuiRootInstance* getGuiRoot();
SelectionService* getSelectionService();
PartInstance* makePart();
void clearLevel();
void toggleRun();
bool isRunning();
void resetEngine();
#if _DEBUG
void modXMLLevel(float modY);
#endif
private:
bool isBrickCount;
bool scanXMLObject(rapidxml::xml_node<>* node);
rapidxml::xml_node<>* getNode(rapidxml::xml_node<> * node,const char* name );
float getFloatValue(rapidxml::xml_node<> * node,const char* name);
bool _successfulLoad;
std::string _errMsg;
bool _legacyLoad;
float _modY;
// Instances
WorkspaceInstance* workspace;
LevelInstance* level;
GuiRootInstance* guiRoot;
SelectionService* selectionService;
ThumbnailGeneratorInstance* thumbnailGenerator;
XplicitNgine* xplicitNgine;
SoundService* soundService;
LightingInstance* lightingInstance;
bool running;
};

View File

@@ -1,16 +0,0 @@
#pragma once
#include "PartInstance.h"
class GroupInstance :
public PVInstance
{
public:
GroupInstance(void);
~GroupInstance(void);
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,26 +0,0 @@
#pragma once
#include "Instance.h"
class ImageButtonInstance;
class TextButtonInstance;
class GuiRootInstance : public Instance
{
public:
GuiRootInstance();
GuiRootInstance::~GuiRootInstance();
TextButtonInstance* makeTextButton();
void drawButtons(RenderDevice* rd);
ImageButtonInstance* makeImageButton(G3D::TextureRef newImage, G3D::TextureRef overImage, G3D::TextureRef downImage, G3D::TextureRef disableImage);
void renderGUI(G3D::RenderDevice* rd, double fps);
void setDebugMessage(std::string msg, G3D::RealTime msgTime);
void update();
bool mouseInGUI(G3D::RenderDevice* renderDevice,int x,int y);
void onMouseLeftUp(G3D::RenderDevice* renderDevice, int x,int y);
void hideGui(bool doHide);
private:
std::string _message;
G3D::RealTime _messageTime;
bool _hideGui;
};

View File

@@ -1,27 +0,0 @@
#pragma once
#include "BaseButtonInstance.h"
class BaseButtonInstance;
class ImageButtonInstance : public BaseButtonInstance
{
public:
//ImageButtonInstance(G3D::TextureRef);
//ImageButtonInstance(G3D::TextureRef,G3D::TextureRef);
//ImageButtonInstance(G3D::TextureRef,G3D::TextureRef,G3D::TextureRef);
ImageButtonInstance(G3D::TextureRef,G3D::TextureRef,G3D::TextureRef,G3D::TextureRef);
~ImageButtonInstance(void);
void drawObj(RenderDevice*, Vector2, bool);
Vector2 size;
Vector2 position;
G3D::TextureRef image;
int openGLID;
G3D::TextureRef image_ovr;
int openGLID_ovr;
G3D::TextureRef image_dn;
int openGLID_dn;
G3D::TextureRef image_ds;
int openGLID_ds;
bool mouseInButton(float, float, RenderDevice*);
};

View File

@@ -1,38 +0,0 @@
#pragma once
#include <G3DAll.h>
#include "propertyGrid.h"
#include "map"
class Instance
{
public:
bool canDelete;
Instance(void);
Instance(const Instance&);
virtual ~Instance(void);
std::string name;
virtual void render(RenderDevice*);
virtual void renderName(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();
virtual void setParent(Instance*);
void setName(std::string newName);
void addChild(Instance*);
void removeChild(Instance*);
void clearChildren();
Instance* getParent();
virtual Instance* clone() const { return new Instance(*this); }
virtual std::vector<PROPGRIDITEM> getProperties();
virtual void PropUpdate(LPPROPGRIDITEM &pItem);
int listicon;
protected:
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,25 +0,0 @@
#pragma once
#include "instance.h"
class LevelInstance :
public Instance
{
public:
LevelInstance(void);
~LevelInstance(void);
bool HighScoreIsGood;
Enum::ActionType::Value TimerUpAction;
Enum::AffectType::Value TimerAffectsScore;
bool RunOnOpen;
float timer;
int score;
virtual std::vector<PROPGRIDITEM> getProperties();
std::string winMessage;
std::string loseMessage;
virtual void PropUpdate(LPPROPGRIDITEM &pItem);
void winCondition();
void loseCondition();
void pauseCondition();
void drawCondition();
void Step(SimTime sdt);
};

View File

@@ -1,43 +0,0 @@
#pragma once
#include "Instance.h"
class LightingInstance :
public Instance
{
public:
LightingInstance(void);
~LightingInstance(void);
// Getters
G3D::Color3 getTopAmbient();
G3D::Color3 getBottomAmbient();
G3D::Color3 getSpotLight();
G3D::Color4 getClearColor();
G3D::SkyRef getSky();
G3D::LightingParameters getLightingParameters();
// Setters
void setTopAmbient(G3D::Color3 newValue);
void setBottomAmbient(G3D::Color3 newValue);
void setSpotLight(G3D::Color3 newValue);
void setClearColor(G3D::Color4 clearColor);
// Functions
void drawSky();
void suppressSky(bool doSuppress);
void update();
void drawEffects();
// Properties
void PropUpdate(LPPROPGRIDITEM &pItem);
std::vector<PROPGRIDITEM> getProperties();
private:
G3D::Color3 topAmbient;
G3D::Color3 bottomAmbient;
G3D::Color3 spotLight;
G3D::Color4 clearColor;
G3D::SkyRef sky;
G3D::LightingParameters lighting;
bool _hideSky;
};

View File

@@ -1,36 +0,0 @@
#pragma once
#include "instance.h"
#include "enum.h"
#include <ode/ode.h>
class PVInstance :
public Instance
{
public:
PVInstance(void);
~PVInstance(void);
PVInstance(const PVInstance &oinst);
virtual void postRender(RenderDevice* rd);
virtual std::vector<PROPGRIDITEM> getProperties();
virtual void PropUpdate(LPPROPGRIDITEM &pItem);
bool nameShown;
bool controllerFlagShown;
Enum::Controller::Value controller;
protected:
CoordinateFrame cFrame;
static G3D::Color3 getControllerColor(int controller)
{
switch(controller)
{
case Enum::Controller::KeyboardLeft:
return Color3::red();
case Enum::Controller::KeyboardRight:
return Color3::blue();
case Enum::Controller::Chase:
return Color3::black();
case Enum::Controller::Flee:
return Color3::yellow();
}
return Color3::gray();
}
};

View File

@@ -1,103 +0,0 @@
#pragma once
#include "PVInstance.h"
#include "Enum.h"
#define _USE_MATH_DEFINES
#include <cmath>
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);
virtual void render(RenderDevice*);
virtual void renderName(RenderDevice*);
//Surfaces
Enum::SurfaceType::Value top;
Enum::SurfaceType::Value front;
Enum::SurfaceType::Value right;
Enum::SurfaceType::Value back;
Enum::SurfaceType::Value left;
Enum::SurfaceType::Value bottom;
//Shapes
Enum::Shape::Value shape;
//OnTocuh
Enum::ActionType::Value OnTouchAction;
Enum::Sound::Value OnTouchSound;
//Variables
Color3 color;
bool canCollide;
dBodyID physBody;
dGeomID physGeom[3];
//Getters
Vector3 getPosition();
Vector3 getVelocity();
Vector3 getRotVelocity();
Vector3 getSize();
Box getBox();
Sphere getSphere();
Box getScaledBox();
CoordinateFrame getCFrame();
//OnTouch Getters
bool isSingleShot();
int getTouchesToTrigger();
int getUniqueObjectsToTrigger();
int getChangeScore();
float getChangeTimer();
//Setters
void setParent(Instance* parent);
void setPosition(Vector3);
void setVelocity(Vector3);
void setRotVelocity(Vector3);
void setCFrame(CoordinateFrame);
void setCFrameNoSync(CoordinateFrame);
void setSize(Vector3);
void setShape(Enum::Shape::Value shape);
void setChanged();
void setSurface(int face, Enum::SurfaceType::Value surface);
void setAnchored(bool anchored);
bool isAnchored();
float getMass();
bool isDragging();
void setDragging(bool value);
//Collision
bool collides(PartInstance * part);
bool collides(Box);
// onTouch
void onTouch();
std::vector<PROPGRIDITEM> getProperties();
void PropUpdate(LPPROPGRIDITEM &item);
private:
bool anchored;
Vector3 position;
Vector3 size;
Vector3 velocity;
Vector3 rotVelocity;
bool changed;
bool dragging;
Box itemBox;
GLuint glList;
// OnTouch
bool singleShot;
int touchesToTrigger;
int uniqueObjectsToTrigger;
int changeScore;
float changeTimer;
bool _touchedOnce;
};

View File

@@ -1,22 +0,0 @@
#pragma once
#include "Instance.h"
#include "PropertyWindow.h"
class SelectionService : public Instance
{
public:
SelectionService(void);
~SelectionService(void);
SelectionService(const SelectionService &oinst);
std::vector<Instance *> getSelection();
void clearSelection();
bool isSelected(Instance * instance);
void addSelected(Instance * instance);
void removeSelected(Instance * instance);
void addSelected(const std::vector<Instance *> &instances);
void setPropertyWindow(PropertyWindow * propertyWindow);
void render(RenderDevice * rd);
private:
std::vector<Instance *> selection;
PropertyWindow * propertyWindow;
};

View File

@@ -1,30 +0,0 @@
#pragma once
#include "Instance.h"
class SoundInstance :
public Instance
{
public:
SoundInstance(void);
~SoundInstance(void);
// Getters
float getSoundVolume();
std::string getSoundId();
bool isPlayedOnRemove();
bool isLooped();
// Setters
void setSoundVolume(float newVolume);
void setSoundId(std::string newSoundId);
void setIsPlayedOnRemove(bool isPlayed);
void setIsLooped(bool isLooped);
// Functions
void play();
private:
float soundVolume;
std::string soundId;
bool playOnRemove;
bool looped;
};

View File

@@ -1,16 +0,0 @@
#pragma once
#include "Instance.h"
#include "SoundInstance.h"
class SoundService :
public Instance
{
public:
SoundService(void);
~SoundService(void);
float getMusicVolume();
void playSound(Instance* sound);
private:
float musicVolume;
};

View File

@@ -1,35 +0,0 @@
#pragma once
#include "BaseButtonInstance.h"
class TextButtonInstance : public BaseButtonInstance
{
public:
TextButtonInstance(void);
~TextButtonInstance(void);
void setAllColorsSame();
Vector2 boxBegin;
Vector2 boxEnd;
Vector2 fontLocationRelativeTo;
Color4 textColor;
Color4 textOutlineColor;
Color4 boxColor;
Color4 boxOutlineColor;
Color4 textColorOvr;
Color4 textOutlineColorOvr;
Color4 boxColorOvr;
Color4 boxOutlineColorOvr;
Color4 textColorDn;
Color4 textOutlineColorDn;
Color4 boxColorDn;
Color4 boxOutlineColorDn;
Color4 textColorDis;
Color4 textOutlineColorDis;
Color4 boxColorDis;
Color4 boxOutlineColorDis;
bool centeredWithinBox;
std::string title;
G3D::GFontRef font;
bool visible;
int textSize;
void drawObj(RenderDevice*, Vector2, bool);
bool mouseInButton(float, float, RenderDevice*);
};

View File

@@ -1,14 +0,0 @@
#pragma once
#include "instance.h"
class ThumbnailGeneratorInstance :
public Instance
{
public:
// Constructor / Destructor
ThumbnailGeneratorInstance(void);
~ThumbnailGeneratorInstance(void);
// Functions
std::string click(std::string fileType, int cx, int cy, bool hideSky);
};

View File

@@ -1,29 +0,0 @@
#pragma once
#include "imagebuttoninstance.h"
class ToggleImageButtonInstance : public ImageButtonInstance
{
public:
//ImageButtonInstance(G3D::TextureRef);
//ImageButtonInstance(G3D::TextureRef,G3D::TextureRef);
//ImageButtonInstance(G3D::TextureRef,G3D::TextureRef,G3D::TextureRef);
ToggleImageButtonInstance(G3D::TextureRef newImage,G3D::TextureRef overImage = NULL,
G3D::TextureRef downImage = NULL,
G3D::TextureRef disableImage = NULL,
G3D::TextureRef newImage2 = NULL,
G3D::TextureRef overImage2 = NULL,
G3D::TextureRef downImage2 = NULL,
G3D::TextureRef disableImage2 = NULL);
~ToggleImageButtonInstance(void);
void drawObj(RenderDevice*, Vector2, bool);
bool checked;
G3D::TextureRef image2;
int openGLID2;
G3D::TextureRef image_ovr2;
int openGLID2_ovr;
G3D::TextureRef image_dn2;
int openGLID2_dn;
G3D::TextureRef image_ds2;
int openGLID2_ds;
};

View File

@@ -1,14 +0,0 @@
#pragma once
#include "GroupInstance.h"
#include "PartInstance.h"
class WorkspaceInstance :
public GroupInstance
{
public:
WorkspaceInstance(void);
~WorkspaceInstance(void);
void clearChildren();
void zoomToExtents();
std::vector<PartInstance *> partObjects;
};

View File

@@ -1,6 +1,6 @@
#pragma once
#include "DataModelV2/DataModelInstance.h"
#include "XplicitNgine/XplicitNgine.h"
#include "DataModelV3/DataModelInstance.h"
#include "DataModelV3/XplicitNgine/XplicitNgine.h"
class Application;

View File

@@ -1,12 +1,12 @@
#pragma once
#include "DataModelV2/PartInstance.h"
#include "DataModelV3/PartInstance.h"
#pragma once
#include "DataModelV2/WorkspaceInstance.h"
#include "DataModelV3/WorkspaceInstance.h"
struct MousePoint{
Vector3 position;
PartInstance * target;
MousePoint(Vector3 pos, PartInstance * targ)
B3D::PartInstance * target;
MousePoint(Vector3 pos, B3D::PartInstance * targ)
{
position = pos;
target = targ;
@@ -21,9 +21,9 @@ public:
~Mouse(void);
int x, y;
int oldx, oldy;
PartInstance * getTarget();
MousePoint getPositionAndPart(std::vector<Instance *> ignore = std::vector<Instance *>());
Vector3 getPosition(std::vector<Instance *> ignore = std::vector<Instance *>());
B3D::PartInstance * getTarget();
MousePoint getPositionAndPart(std::vector<B3D::Instance *> ignore = std::vector<B3D::Instance *>());
Vector3 getPosition(std::vector<B3D::Instance *> ignore = std::vector<B3D::Instance *>());
bool isMouseOnScreen();
bool isMouseDown();
void setMouseDown(bool mouseDown);

View File

@@ -1,14 +1,14 @@
#pragma once
#include "DataModelV2/Instance.h"
#include "DataModelV3/Instance.h"
class PropertyWindow {
public:
PropertyWindow(int x, int y, int sx, int sy, HMODULE hThisInstance);
bool onCreate(int x, int y, int sx, int sy, HMODULE hThisInstance);
void UpdateSelected(std::vector<Instance *> selection);
void UpdateSelected(std::vector<B3D::Instance *> selection);
void ClearProperties();
void onResize();
void refreshExplorer(std::vector<Instance *> selection);
void refreshExplorer(std::vector<B3D::Instance *> selection);
HWND _hwndProp;
private:
HWND _propGrid;

View File

@@ -14,7 +14,7 @@ namespace B3D{
public:
//Could be private?
std::string key;
T * value;
T value;
ReflectionType type;
ReflectionProperty(std::string key, T * valuePtr, ReflectionType type, ReflectionDataTable * containerTable, void* extData = NULL, bool archivable = true, bool locked = false, bool propertyHidden = false);
ReflectionProperty(std::string key, T defaultValue, ReflectionType type, ReflectionDataTable * containerTable, void* extData = NULL, bool archivable = true, bool locked = false, bool propertyHidden = false);

View File

@@ -3,7 +3,8 @@ using namespace B3D::Reflection;
template<class T>
ReflectionProperty<T>::ReflectionProperty(std::string key, T * value, ReflectionType type, ReflectionDataTable * containerTable, void* extData = NULL, bool archivable = true, bool locked = false, bool propertyHidden = false)
{
this->value = value;
this->key = key;
this->value = T(value);
this->type = type;
this->containerTable = containerTable;
this->locked = locked;
@@ -16,7 +17,8 @@ ReflectionProperty<T>::ReflectionProperty(std::string key, T * value, Reflection
template<class T>
ReflectionProperty<T>::ReflectionProperty(std::string key, T value, ReflectionType type, ReflectionDataTable * containerTable, void* extData = NULL, bool archivable = true, bool locked = false, bool propertyHidden = false)
{
this->value = new T(value);
this->key = key;
this->value = T(value);
this->type = type;
this->containerTable = containerTable;
this->locked = locked;
@@ -40,9 +42,9 @@ ReflectionProperty<T>::~ReflectionProperty(void)
template<class T>
void ReflectionProperty<T>::dispose()
{
delete value;
value = NULL;
if(this->extData != NULL)
//delete value;
//value = NULL;
if(extData)
{
delete extData;
extData = NULL;
@@ -58,16 +60,16 @@ T ReflectionProperty<T>::getValueClone()
template<class T>
T ReflectionProperty<T>::getValue()
{
return *value;
return value;
}
template<class T>
T* ReflectionProperty<T>::getValuePtr()
{
return value;
return &value;
}
template<class T>
void ReflectionProperty<T>::setValue(T value){
this=value;
value=T(value);
}

View File

@@ -1,175 +1,175 @@
//Operator Overloads
T operator()()
{
return *value;
return value;
}
//Assignment Operators
T operator=(T nVal)
{
(*value) = nVal;
return *value;
value = nVal;
return value;
}
T operator+=(T nVal)
{
(*value) += nVal;
return *value;
value += nVal;
return value;
}
T operator-=(T nVal)
{
(*value)-= nVal;
return *value;
value -= nVal;
return value;
}
T operator/=(T nVal)
{
(*value) /= nVal;
return *value;
value /= nVal;
return value;
}
T operator*=(T nVal)
{
(*value) *= nVal;
return *value;
value *= nVal;
return value;
}
T operator%=(T nVal)
{
(*value) %= nVal;
return *value;
value %= nVal;
return value;
}
T operator^=(T nVal)
{
(*value) ^= nVal;
return *value;
value) ^= nVal;
return value;
}
T operator&=(T nVal)
{
(*value) &= nVal;
return *value;
value &= nVal;
return value;
}
T operator|=(T nVal)
{
(*value) |= nVal;
return *value;
value |= nVal;
return value;
}
T operator>>=(T nVal)
{
(*value) >>= nVal;
return *value;
value >>= nVal;
return value;
}
T operator<<=(T nVal)
{
(*value) <<= nVal;
return *value;
value <<= nVal;
return value;
}
//Mathematical Operations
T operator+(T nVal)
{
return (*value) + nVal;
return value + nVal;
}
T operator-(T nVal)
{
return (*value) - nVal;
return value - nVal;
}
T operator*(T nVal)
{
return (*value) - nVal;
return value - nVal;
}
T operator/(T nVal)
{
return (*value) / nVal;
return value / nVal;
}
T operator%(T nVal)
{
return (*value) % nVal;
return value % nVal;
}
//Boolean operations
bool operator==(T nVal)
{
return (*value) == nVal;
return value == nVal;
}
bool operator!=(T nVal)
{
return (*value) != nVal;
return value != nVal;
}
bool operator<(T nVal)
{
return (*value) < nVal;
return value < nVal;
}
bool operator<=(T nVal)
{
return (*value) <= nVal;
return value <= nVal;
}
bool operator>(T nVal)
{
return (*value) > nVal;
return value > nVal;
}
bool operator>=(T nVal)
{
return (*value) >= nVal;
return value >= nVal;
}
T operator&&(T nVal)
{
return (*value) && nVal;
return value && nVal;
}
T operator||(T nVal)
{
return (*value) && nVal;
return value && nVal;
}
T operator!()
{
return !(*value);
return !value;
}
//Bitwise operations
T operator&(T nVal)
{
return (*value) && nVal;
return value && nVal;
}
T operator|(T nVal)
{
return (*value) && nVal;
return value && nVal;
}
T operator>>(T nVal)
{
return (*value) >> nVal;
return value >> nVal;
}
T operator<<(T nVal)
{
return (*value) << nVal;
return value << nVal;
}
T operator^(T nVal)
{
return (*value) ^ nVal;
return value ^ nVal;
}
T operator~()
{
return ~(*value);
return ~value;
}

View File

@@ -1,7 +1,7 @@
#ifndef RENDERUTIL
#define RENDERUTIL
#include "Enum.h"
#include "DataModelV2/Instance.h"
#include "DataModelV3/Instance.h"
void renderShape(const Enum::Shape::Value& shape, const Vector3& size, const Color3& ncolor);
void renderSurface(const char face, const Enum::SurfaceType::Value& surface, const Vector3& size, const Enum::Controller::Value& controller, const Color3& color);
#endif

View File

@@ -1,8 +1,7 @@
#pragma once
#include "tool.h"
class ArrowTool :
public Tool
namespace B3D {
class ArrowTool : public Tool
{
public:
ArrowTool(void); //OnSelect?
@@ -23,3 +22,4 @@ private:
bool mouseDown;
Vector3 draggingPartOffset;
};
}

View File

@@ -1,8 +1,7 @@
#pragma once
#include "ArrowTool.h"
class DraggerTool :
public ArrowTool
namespace B3D{
class DraggerTool : public ArrowTool
{
public:
DraggerTool(void);
@@ -23,3 +22,4 @@ private:
Vector3 centerOffset;
Sphere handles[6];
};
}

View File

@@ -1,9 +1,8 @@
#pragma once
#include "tool.h"
#include "Enum.h"
class SurfaceTool :
public Tool
namespace B3D {
class SurfaceTool : public Tool
{
public:
SurfaceTool(int surface, int extraParam); //OnSelect?
@@ -18,3 +17,4 @@ private:
int surface;
int param;
};
}

View File

@@ -9,6 +9,7 @@
#pragma once
#include "StringFunctions.h"
#pragma once
namespace B3D{
class Tool
{
public:
@@ -33,3 +34,4 @@ protected:
private:
//std::string cursorString;
};
}

View File

@@ -2,14 +2,14 @@
#include <initguid.h>
#include <iomanip>
#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 "DataModelV2/SoundService.h"
#include "XplicitNgine/XplicitNgine.h"
#include "DataModelV3/Instance.h"
#include "DataModelV3/PartInstance.h"
#include "DataModelV3/Gui/TextButtonInstance.h"
#include "DataModelV3/Gui/ImageButtonInstance.h"
#include "DataModelV3/DataModelInstance.h"
#include "DataModelV3/Gui/GuiRootInstance.h"
#include "DataModelV3/SoundService.h"
#include "DataModelV3/XplicitNgine/XplicitNgine.h"
#include "CameraController.h"
#include "AudioPlayer.h"
#include "Globals.h"
@@ -27,11 +27,6 @@
#include <commctrl.h>
#include "StringFunctions.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
@@ -41,6 +36,8 @@ Vector2 oldMouse = Vector2(0,0);
float moveRate = 0.5;
float wasPropShown = 0;
using namespace B3D;
void Application::clearInstances()
{
delete _dataModel;
@@ -347,7 +344,7 @@ void Application::onSimulation(RealTime rdt, SimTime sdt, SimTime idt) {
if(_dataModel->name != _title)
{
_title = _dataModel->name;
_title = _dataModel->name.getValue();
std::string text = "Game \"" + _title + "\"";
SetWindowText(_hWndMain, text.c_str());
@@ -444,7 +441,7 @@ void Application::onGraphics(RenderDevice* rd) {
renderDevice->setProjectionAndCameraMatrix(*cameraController.getCamera());
// Moved a lot of code to lighting
g_dataModel->getLighting()->update();
_dataModel->getLighting()->update(renderDevice);
renderDevice->push2D();
_dataModel->getGuiRoot()->renderGUI(renderDevice, m_graphicsWatch.FPS());
@@ -459,7 +456,8 @@ void Application::onKeyPressed(int key)
}
if ((GetHoldKeyState(VK_LCONTROL) || GetHoldKeyState(VK_RCONTROL)) && key=='O')
{
_dataModel->getOpen();
MessageBoxA(_hWndMain, "Implement this!!!", "Not Implemented", MB_ICONHAND | MB_OK);
// _dataModel->getOpen();
}
tool->onKeyDown(key);
}

View File

@@ -1,10 +1,11 @@
#include "CameraController.h"
#include "win32Defines.h"
#include <iostream>
#include "DataModelV2/PartInstance.h"
#include "DataModelV3/PartInstance.h"
#include "Application.h"
#include "AudioPlayer.h"
using namespace B3D;
CameraController::CameraController() :

View File

@@ -1,56 +0,0 @@
#include "DataModelV2/BaseButtonInstance.h"
#include "Globals.h"
#include "Application.h"
ButtonListener* listener = NULL;
BaseButtonInstance::BaseButtonInstance(void)
{
Instance::Instance();
listener = NULL;
}
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());
Instance::render(rd);
}
BaseButtonInstance::~BaseButtonInstance(void)
{
}
void BaseButtonInstance::setButtonListener(ButtonListener& buttonListener)
{
listener = &buttonListener;
}
void BaseButtonInstance::drawObj(RenderDevice* rd, Vector2 mousePos, bool mouseDown){}
bool BaseButtonInstance::mouseInButton(float mousex, float mousey, RenderDevice* rd){return false;}
void BaseButtonInstance::onMouseClick()
{
if(listener != NULL)
{
listener->onButton1MouseClick(this);
}
}
bool BaseButtonInstance::mouseInArea(float point1x, float point1y, float point2x, float point2y, float mousex, float mousey)
{
if(mousex >= point1x && mousey >= point1y)
{
if(mousex < point2x && mousey < point2y)
{
return true;
}
}
return false;
}

View File

@@ -1 +0,0 @@
#include "DataModelV2/BaseGuiInstance.h"

View File

@@ -1,722 +0,0 @@
#include <string>
// Instances
#include "DataModelV2/GuiRootInstance.h"
#include "DataModelV2/ToggleImageButtonInstance.h"
#include "DataModelV2/DataModelInstance.h"
#include "DataModelV2/ThumbnailGeneratorInstance.h"
#include "DataModelV2/LightingInstance.h"
#include <fstream>
#include <iostream>
#include <sstream>
#include <commdlg.h>
#include "ErrorFunctions.h"
#include "Globals.h"
#include "Application.h"
using namespace std;
using namespace rapidxml;
DataModelInstance::DataModelInstance(void)
{
// Instances
Instance::Instance();
workspace = new WorkspaceInstance();
guiRoot = new GuiRootInstance();
level = new LevelInstance();
thumbnailGenerator = new ThumbnailGeneratorInstance();
soundService = new SoundService();
lightingInstance = new LightingInstance();
selectionService = new SelectionService();
selectionService->setPropertyWindow(g_usableApp->_propWindow);
className = "dataModel";
showMessage = false;
canDelete = false;
_modY=0;
// Parent stuff
workspace->setParent(this);
level->setParent(this);
soundService->setParent(this);
lightingInstance->setParent(this);
_loadedFileName="..//skooter.rbxm";
listicon = 5;
running = false;
xplicitNgine = NULL;
resetEngine();
}
void DataModelInstance::resetEngine()
{
if(xplicitNgine != NULL)
delete xplicitNgine;
xplicitNgine = new XplicitNgine();
g_xplicitNgine = xplicitNgine;
for(size_t i = 0; i < getWorkspace()->partObjects.size(); i++)
{
PartInstance* partInstance = getWorkspace()->partObjects[i];
partInstance->physBody = NULL;
}
}
XplicitNgine * DataModelInstance::getEngine()
{
return xplicitNgine;
}
void DataModelInstance::toggleRun()
{
running = !running;
//if(!running)
//resetEngine();
}
bool DataModelInstance::isRunning()
{
return running;
}
DataModelInstance::~DataModelInstance(void)
{
delete xplicitNgine;
}
#ifdef _DEBUG
void DataModelInstance::modXMLLevel(float modY)
{
_modY += modY;
clearLevel();
debugGetOpen();
}
#endif
void DataModelInstance::clearLevel()
{
running = false;
Instance * goButton = this->getGuiRoot()->findFirstChild("go");
if(goButton != NULL){
if(ToggleImageButtonInstance* goButtonReal = dynamic_cast<ToggleImageButtonInstance*>(goButton))
{
goButtonReal->checked = false;
}
}
selectionService->clearSelection();
selectionService->addSelected(this);
workspace->clearChildren();
}
PartInstance* DataModelInstance::makePart()
{
PartInstance* part = new PartInstance();
return part;
}
rapidxml::xml_node<>* DataModelInstance::getNode(xml_node<> * node,const char* name)
{
xml_node<> * tempNode = node->first_node(name);
if (!tempNode)
{
_errMsg = "Expected <";
_errMsg += name;
_errMsg+="> tag.";
_successfulLoad=false;
return 0;
}
return tempNode;
}
float DataModelInstance::getFloatValue(xml_node<> * node,const char* name)
{
xml_node<> * tempNode = node->first_node(name);
if (!tempNode)
{
_errMsg = "Expected <";
_errMsg += name;
_errMsg+="> tag.";
_successfulLoad=false;
return 0;
}
float newFloat;
stringstream converter;
converter << tempNode->value();
converter >> newFloat;
return newFloat;
}
Color3 bcToRGB(short bc)
{
switch(bc)
{
case 1: return Color3(0.94901967048645F,0.95294123888016F,0.95294123888016F);
case 2: return Color3(0.63137257099152F,0.64705884456635F,0.63529413938522F);
case 3: return Color3(0.9764706492424F,0.91372555494308F,0.60000002384186F);
case 5: return Color3(0.84313732385635F,0.77254909276962F,0.60392159223557F);
case 6: return Color3(0.7607843875885F,0.85490202903748F,0.72156864404678F);
case 9: return Color3(0.90980398654938F,0.7294117808342F,0.78431379795074F);
case 11: return Color3(0.50196081399918F,0.73333334922791F,0.85882359743118F);
case 12: return Color3(0.79607850313187F,0.51764708757401F,0.258823543787F);
case 18: return Color3(0.80000007152557F,0.55686277151108F,0.41176474094391F);
case 21: return Color3(0.76862752437592F,0.15686275064945F,0.10980392992496F);
case 22: return Color3(0.76862752437592F,0.43921571969986F,0.62745100259781F);
case 23: return Color3(0.050980396568775F,0.41176474094391F,0.6745098233223F);
case 24: return Color3(0.96078437566757F,0.80392163991928F,0.18823531270027F);
case 25: return Color3(0.38431376218796F,0.27843138575554F,0.19607844948769F);
case 26: return Color3(0.10588236153126F,0.16470588743687F,0.20784315466881F);
case 27: return Color3(0.42745101451874F,0.43137258291245F,0.42352944612503F);
case 28: return Color3(0.15686275064945F,0.49803924560547F,0.27843138575554F);
case 29: return Color3(0.63137257099152F,0.76862752437592F,0.54901963472366F);
case 36: return Color3(0.95294123888016F,0.8117647767067F,0.60784316062927F);
case 37: return Color3(0.29411765933037F,0.59215688705444F,0.29411765933037F);
case 38: return Color3(0.62745100259781F,0.37254902720451F,0.20784315466881F);
case 39: return Color3(0.75686281919479F,0.79215693473816F,0.8705883026123F);
case 40: return Color3(0.92549026012421F,0.92549026012421F,0.92549026012421F);
case 41: return Color3(0.80392163991928F,0.32941177487373F,0.29411765933037F);
case 42: return Color3(0.75686281919479F,0.87450987100601F,0.94117653369904F);
case 43: return Color3(0.48235297203064F,0.71372550725937F,0.90980398654938F);
case 44: return Color3(0.96862751245499F,0.94509810209274F,0.55294120311737F);
case 45: return Color3(0.70588237047195F,0.82352948188782F,0.89411771297455F);
case 47: return Color3(0.85098046064377F,0.52156865596771F,0.42352944612503F);
case 48: return Color3(0.51764708757401F,0.71372550725937F,0.55294120311737F);
case 49: return Color3(0.97254908084869F,0.94509810209274F,0.51764708757401F);
case 50: return Color3(0.92549026012421F,0.90980398654938F,0.8705883026123F);
case 100: return Color3(0.93333339691162F,0.76862752437592F,0.71372550725937F);
case 101: return Color3(0.85490202903748F,0.52549022436142F,0.47843140363693F);
case 102: return Color3(0.43137258291245F,0.60000002384186F,0.79215693473816F);
case 103: return Color3(0.78039222955704F,0.75686281919479F,0.71764707565308F);
case 104: return Color3(0.41960787773132F,0.19607844948769F,0.48627454042435F);
case 105: return Color3(0.88627457618713F,0.60784316062927F,0.25098040699959F);
case 106: return Color3(0.85490202903748F,0.52156865596771F,0.2549019753933F);
case 107: return Color3(0,0.56078433990479F,0.61176472902298F);
case 108: return Color3(0.4078431725502F,0.36078432202339F,0.26274511218071F);
case 110: return Color3(0.26274511218071F,0.32941177487373F,0.57647061347961F);
case 111: return Color3(0.74901962280273F,0.71764707565308F,0.69411766529083F);
case 112: return Color3(0.4078431725502F,0.45490199327469F,0.6745098233223F);
case 113: return Color3(0.89411771297455F,0.678431391716F,0.78431379795074F);
case 115: return Color3(0.78039222955704F,0.82352948188782F,0.23529413342476F);
case 116: return Color3(0.33333334326744F,0.64705884456635F,0.68627452850342F);
case 118: return Color3(0.71764707565308F,0.84313732385635F,0.83529418706894F);
case 119: return Color3(0.64313727617264F,0.74117648601532F,0.27843138575554F);
case 120: return Color3(0.85098046064377F,0.89411771297455F,0.65490198135376F);
case 121: return Color3(0.90588241815567F,0.6745098233223F,0.34509804844856F);
case 123: return Color3(0.82745105028152F,0.43529415130615F,0.29803922772408F);
case 124: return Color3(0.57254904508591F,0.22352942824364F,0.47058826684952F);
case 125: return Color3(0.91764712333679F,0.72156864404678F,0.57254904508591F);
case 126: return Color3(0.64705884456635F,0.64705884456635F,0.79607850313187F);
case 127: return Color3(0.86274516582489F,0.73725491762161F,0.50588238239288F);
case 128: return Color3(0.68235296010971F,0.47843140363693F,0.34901961684227F);
case 131: return Color3(0.61176472902298F,0.63921570777893F,0.65882354974747F);
case 133: return Color3(0.83529418706894F,0.45098042488098F,0.23921570181847F);
case 134: return Color3(0.84705889225006F,0.8666667342186F,0.33725491166115F);
case 135: return Color3(0.45490199327469F,0.52549022436142F,0.61568629741669F);
case 136: return Color3(0.52941179275513F,0.48627454042435F,0.56470590829849F);
case 137: return Color3(0.87843143939972F,0.59607845544815F,0.39215689897537F);
case 138: return Color3(0.58431375026703F,0.54117649793625F,0.45098042488098F);
case 140: return Color3(0.12549020349979F,0.22745099663734F,0.33725491166115F);
case 141: return Color3(0.15294118225574F,0.27450981736183F,0.17647059261799F);
case 143: return Color3(0.8117647767067F,0.88627457618713F,0.96862751245499F);
case 145: return Color3(0.47450983524323F,0.53333336114883F,0.63137257099152F);
case 146: return Color3(0.58431375026703F,0.55686277151108F,0.63921570777893F);
case 147: return Color3(0.57647061347961F,0.52941179275513F,0.40392160415649F);
case 148: return Color3(0.34117648005486F,0.34509804844856F,0.34117648005486F);
case 149: return Color3(0.086274512112141F,0.11372549831867F,0.19607844948769F);
case 150: return Color3(0.67058825492859F,0.678431391716F,0.6745098233223F);
case 151: return Color3(0.47058826684952F,0.56470590829849F,0.50980395078659F);
case 153: return Color3(0.58431375026703F,0.47450983524323F,0.46666669845581F);
case 154: return Color3(0.48235297203064F,0.1803921610117F,0.1843137294054F);
case 157: return Color3(1,0.96470594406128F,0.48235297203064F);
case 158: return Color3(0.88235300779343F,0.64313727617264F,0.7607843875885F);
case 168: return Color3(0.4588235616684F,0.42352944612503F,0.38431376218796F);
case 176: return Color3(0.59215688705444F,0.41176474094391F,0.35686275362968F);
case 178: return Color3(0.70588237047195F,0.51764708757401F,0.33333334326744F);
case 179: return Color3(0.53725492954254F,0.52941179275513F,0.53333336114883F);
case 180: return Color3(0.84313732385635F,0.66274511814117F,0.29411765933037F);
case 190: return Color3(0.9764706492424F,0.83921575546265F,0.1803921610117F);
case 191: return Color3(0.90980398654938F,0.67058825492859F,0.17647059261799F);
case 192: return Color3(0.41176474094391F,0.25098040699959F,0.15686275064945F);
case 193: return Color3(0.8117647767067F,0.37647062540054F,0.14117647707462F);
case 195: return Color3(0.27450981736183F,0.40392160415649F,0.64313727617264F);
case 196: return Color3(0.13725490868092F,0.27843138575554F,0.54509806632996F);
case 198: return Color3(0.55686277151108F,0.258823543787F,0.52156865596771F);
case 199: return Color3(0.38823533058167F,0.37254902720451F,0.38431376218796F);
case 200: return Color3(0.50980395078659F,0.54117649793625F,0.3647058904171F);
case 208: return Color3(0.89803928136826F,0.89411771297455F,0.87450987100601F);
case 209: return Color3(0.69019609689713F,0.55686277151108F,0.26666668057442F);
case 210: return Color3(0.43921571969986F,0.58431375026703F,0.47058826684952F);
case 211: return Color3(0.47450983524323F,0.70980393886566F,0.70980393886566F);
case 212: return Color3(0.6235294342041F,0.76470595598221F,0.91372555494308F);
case 213: return Color3(0.42352944612503F,0.50588238239288F,0.71764707565308F);
case 216: return Color3(0.56078433990479F,0.29803922772408F,0.16470588743687F);
case 217: return Color3(0.48627454042435F,0.36078432202339F,0.27450981736183F);
case 218: return Color3(0.58823531866074F,0.43921571969986F,0.6235294342041F);
case 219: return Color3(0.41960787773132F,0.38431376218796F,0.60784316062927F);
case 220: return Color3(0.65490198135376F,0.66274511814117F,0.80784320831299F);
case 221: return Color3(0.80392163991928F,0.38431376218796F,0.59607845544815F);
case 222: return Color3(0.89411771297455F,0.678431391716F,0.78431379795074F);
case 223: return Color3(0.86274516582489F,0.56470590829849F,0.58431375026703F);
case 224: return Color3(0.94117653369904F,0.83529418706894F,0.62745100259781F);
case 225: return Color3(0.9215686917305F,0.72156864404678F,0.49803924560547F);
case 226: return Color3(0.99215692281723F,0.91764712333679F,0.55294120311737F);
case 232: return Color3(0.49019610881805F,0.73333334922791F,0.8666667342186F);
case 268: return Color3(0.2039215862751F,0.16862745583057F,0.4588235616684F);
case 1001: return Color3(0.97254908084869F,0.97254908084869F,0.97254908084869F);
case 1002: return Color3(0.80392163991928F,0.80392163991928F,0.80392163991928F);
case 1003: return Color3(0.066666670143604F,0.066666670143604F,0.066666670143604F);
case 1004: return Color3(1,0,0);
case 1005: return Color3(1,0.68627452850342F,0);
case 1006: return Color3(0.70588237047195F,0.50196081399918F,1);
case 1007: return Color3(0.63921570777893F,0.29411765933037F,0.29411765933037F);
case 1008: return Color3(0.75686281919479F,0.74509805440903F,0.258823543787F);
case 1009: return Color3(1,1,0);
case 1010: return Color3(0,0,1);
case 1011: return Color3(0,0.12549020349979F,0.37647062540054F);
case 1012: return Color3(0.1294117718935F,0.32941177487373F,0.72549021244049F);
case 1013: return Color3(0.015686275437474F,0.68627452850342F,0.92549026012421F);
case 1014: return Color3(0.66666668653488F,0.33333334326744F,0);
case 1015: return Color3(0.66666668653488F,0,0.66666668653488F);
case 1016: return Color3(1,0.40000003576279F,0.80000007152557F);
case 1017: return Color3(1,0.68627452850342F,0);
case 1018: return Color3(0.070588238537312F,0.93333339691162F,0.83137261867523F);
case 1019: return Color3(0,1,1);
case 1020: return Color3(0,1,0);
case 1021: return Color3(0.22745099663734F,0.49019610881805F,0.082352943718433F);
case 1022: return Color3(0.49803924560547F,0.55686277151108F,0.39215689897537F);
case 1023: return Color3(0.54901963472366F,0.35686275362968F,0.6235294342041F);
case 1024: return Color3(0.68627452850342F,0.8666667342186F,1);
case 1025: return Color3(1,0.78823536634445F,0.78823536634445F);
case 1026: return Color3(0.69411766529083F,0.65490198135376F,1);
case 1027: return Color3(0.6235294342041F,0.95294123888016F,0.91372555494308F);
case 1028: return Color3(0.80000007152557F,1,0.80000007152557F);
case 1029: return Color3(1,1,0.80000007152557F);
case 1030: return Color3(1,0.80000007152557F,0.60000002384186F);
case 1031: return Color3(0.38431376218796F,0.14509804546833F,0.81960791349411F);
case 1032: return Color3(1,0,0.74901962280273F);
default: return Color3::gray();
}
}
bool DataModelInstance::scanXMLObject(xml_node<> * scanNode)
{
xml_node<> * watchFirstNode = scanNode->first_node();
for (xml_node<> *node = scanNode->first_node();node; node = node->next_sibling())
{
if (strncmp(node->name(),"Item",4)==0)
{
xml_attribute<> *classAttr = node->first_attribute("class");
std::string className = classAttr->value();
if (className=="Part") {
xml_node<> *propNode = node->first_node();
xml_node<> *cFrameNode=0;
xml_node<> *sizeNode=0;
xml_node<> *anchoredNode=0;
xml_node<> *shapeNode=0;
xml_node<> *colorNode=0;
xml_node<> *brickColorNode=0;
xml_node<> *nameNode=0;
for (xml_node<> *partPropNode = propNode->first_node();partPropNode; partPropNode = partPropNode->next_sibling())
{
for (xml_attribute<> *attr = partPropNode->first_attribute();attr; attr = attr->next_attribute())
{
std::string xmlName = attr->name();
std::string xmlValue = attr->value();
if (xmlValue=="CFrame" | xmlValue=="CoordinateFrame")
{
cFrameNode = partPropNode;
}
if (xmlValue=="Anchored")
{
anchoredNode = partPropNode;
}
if (xmlValue=="Name")
{
nameNode = partPropNode;
}
if (xmlValue=="shape")
{
shapeNode = partPropNode;
_legacyLoad=false;
}
if (xmlValue=="Color")
{
colorNode=partPropNode;
}
if (xmlValue=="BrickColor")
{
brickColorNode=partPropNode;
}
if (xmlValue=="size")
{
sizeNode = partPropNode;
_legacyLoad=false;
}
if (xmlValue=="Part")
{
for (xml_node<> *featureNode = partPropNode->first_node();featureNode; featureNode = featureNode->next_sibling())
{
for (xml_attribute<> *attr = featureNode->first_attribute();attr; attr = attr->next_attribute())
{
std::string xmlName = attr->name();
std::string xmlValue = attr->value();
if (xmlValue=="shape")
{
shapeNode = featureNode;
_legacyLoad=true;
}
if (xmlValue=="size")
{
sizeNode=featureNode;
_legacyLoad=true;
}
}
}
}
}
}
if (!cFrameNode) {
_errMsg="CFrame is missing in Part";
return false;
}
if (!sizeNode) {
_errMsg="Size is missing in Part";
return false;
}
float R=1;
float G=1;
float B=1;
if (colorNode)
{
R = getFloatValue(colorNode,"R");
G = getFloatValue(colorNode,"G");
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");
float Z = getFloatValue(cFrameNode,"Z");
float R00 = getFloatValue(cFrameNode,"R00");
float R01 = getFloatValue(cFrameNode,"R01");
float R02 = getFloatValue(cFrameNode,"R02");
float R10 = getFloatValue(cFrameNode,"R10");
float R11 = getFloatValue(cFrameNode,"R11");
float R12 = getFloatValue(cFrameNode,"R12");
float R20 = getFloatValue(cFrameNode,"R20");
float R21 = getFloatValue(cFrameNode,"R21");
float R22 = getFloatValue(cFrameNode,"R22");
float sizeX = getFloatValue(sizeNode,"X");
float sizeY = getFloatValue(sizeNode,"Y");
float sizeZ = getFloatValue(sizeNode,"Z");
//sizeX=1;
//sizeY=1;
//sizeZ=1;
if (_successfulLoad) {
PartInstance* test = makePart();
test->setParent(getWorkspace());
test->color = Color3(R,G,B);
test->shape = partshape;
if(brickColorNode)
{
test->color = bcToRGB(atoi(brickColorNode->value()));
}
if(anchoredNode)
{
test->setAnchored(stricmp(anchoredNode->value(), "true") == 0);
}
test->setSize(Vector3(sizeX,sizeY+_modY,sizeZ));
test->setName(newName);
CoordinateFrame cf;
if (_legacyLoad)
{
cf = CoordinateFrame(Vector3(-X,Y,Z))*CoordinateFrame(Vector3(-sizeX/2,(sizeY+_modY)/2,sizeZ/2)*Matrix3(R00,R01,R02,R10,R11,R12,R20,R21,R22));
cf.rotation = Matrix3(R00,R01,R02,R10,R11,R12,R20,R21,R22);
}
else
{
cf.translation = Vector3(X,Y,Z);
cf.rotation = Matrix3(R00,R01,R02,R10,R11,R12,R20,R21,R22);
}
test->setCFrame(cf);
}
else
{
return false;
}
}
}
/*
for (xml_attribute<> *attr = node->first_attribute();attr; attr = attr->next_attribute())
{
std::string xmlName = attr->name();
std::string xmlValue = attr->value();
}
*/
scanXMLObject(node);
}
return true;
}
bool DataModelInstance::load(const char* filename, bool clearObjects)
{
ifstream levelFile(filename,ios::binary);
if (levelFile)
{
if (clearObjects)
clearLevel();
readXMLFileStream(&levelFile);
std::string sfilename = std::string(filename);
std::size_t begin = sfilename.rfind('\\') + 1;
std::size_t end = sfilename.find(".rbx");
std::string hname = sfilename.substr(begin);
std::string tname = hname.substr(0, hname.length() - 5);
name = tname;
resetEngine();
selectionService->clearSelection();
selectionService->addSelected(this);
return true;
}
else
{
std::stringstream msg;
msg << "Failed to load file:" << std::endl << filename << std::endl << strerror(errno);
MessageBoxStr(msg.str());
return false;
}
}
bool DataModelInstance::loadModel(const char* filename)
{
ifstream levelFile(filename,ios::binary);
if (levelFile)
{
readXMLFileStream(&levelFile);
//resetEngine();
selectionService->clearSelection();
selectionService->addSelected(this);
return true;
}
else
{
std::stringstream msg;
msg << "Failed to load file:" << std::endl << filename << std::endl << strerror(errno);
MessageBoxStr(msg.str());
return false;
}
}
bool DataModelInstance::readXMLFileStream(std::ifstream* file)
{
file->seekg(0,file->end);
int length = file->tellg();
if (length<0)
{
MessageBoxStr("File is empty");
file->close();
return false;
}
file->seekg(0,file->beg);
char * buffer = new char[length+1];
buffer[length]=0;
file->read(buffer,length);
file->close();
if (!file)
{
stringstream msg;
msg << "Something went wrong." << endl << strerror(errno);
MessageBoxStr(msg.str());
return false;
}
_successfulLoad = true;
xml_document<> doc;
doc.parse<0>(buffer);
xml_node<> *mainNode = doc.first_node();
_legacyLoad=false;
//std::string xmlName = mainNode->name();
//node = node->first_node();
//xmlName = node->name();
scanXMLObject(mainNode);
delete[] buffer;
return true;
}
bool DataModelInstance::debugGetOpen()
{
ifstream levelFile(_loadedFileName.c_str(),ios::binary);
if (levelFile)
readXMLFileStream(&levelFile);
else
getOpen();
return true;
}
bool DataModelInstance::getOpen()
{
_modY=0;
OPENFILENAME of;
ZeroMemory( &of , sizeof( of));
of.lStructSize = sizeof(OPENFILENAME);
of.lpstrFilter = "Roblox Files\0*.rbxm;*.rbxl\0\0";
char szFile[512];
of.lpstrFile = szFile ;
of.lpstrFile[0]='\0';
of.nMaxFile=500;
of.lpstrTitle="Open";
of.Flags = OFN_FILEMUSTEXIST;
ShowCursor(TRUE);
BOOL file = GetOpenFileName(&of);
if (file)
{
_loadedFileName = of.lpstrFile;
load(of.lpstrFile,true);
}
return true;
}
bool DataModelInstance::getOpenModel()
{
_modY=0;
OPENFILENAME of;
ZeroMemory( &of , sizeof( of));
of.lStructSize = sizeof(OPENFILENAME);
of.lpstrFilter = "Roblox Files\0*.rbxm;*.rbxl\0\0";
char szFile[512];
of.lpstrFile = szFile ;
of.lpstrFile[0]='\0';
of.nMaxFile=500;
of.lpstrTitle="Open";
of.Flags = OFN_FILEMUSTEXIST;
ShowCursor(TRUE);
BOOL file = GetOpenFileName(&of);
if (file)
{
_loadedFileName = of.lpstrFile;
loadModel(of.lpstrFile);
}
return true;
}
void DataModelInstance::setMessage(std::string msg)
{
message = msg;
isBrickCount = false;
showMessage = true;
}
void DataModelInstance::clearMessage()
{
showMessage = false;
isBrickCount = false;
message = "";
}
void DataModelInstance::setMessageBrickCount()
{
isBrickCount = true;
showMessage = true;
}
void DataModelInstance::drawMessage(RenderDevice* rd)
{
if(isBrickCount)
{
int brickCount = 0;
int instCount = 0;
std::vector<Instance*> inst = getAllChildren();
for(size_t i = 0; i < inst.size(); i++)
{
if(PartInstance* moveTo = dynamic_cast<PartInstance*>(inst.at(i)))
{
brickCount++;
}
else
{
instCount++;
}
}
char brkc[12];
_snprintf(brkc, 12, "%d", brickCount);
char instc[12];
_snprintf(instc, 12, "%d", instCount);
message = "Bricks: ";
message += brkc;
message += " Snaps: ";
message += instc;
}
if(showMessage && !font.isNull())
{
int x = rd->getWidth()/2;
int y = rd->getHeight()/2;
int width = rd->getWidth()/2 + 100;
int height = width / 3;
Draw::box(Box(Vector3(x-(width/2), y-(height/2), 0), Vector3(x+(width/2), y+(height/2), 0)), rd, Color4::fromARGB(0x55B2B2B2), Color3::fromARGB(0xB2B2B2));
font->draw2D(rd, message, Vector2(x,y), height/8, Color3::white(), Color4::clear(), GFont::XALIGN_CENTER, GFont::YALIGN_CENTER);
}
}
WorkspaceInstance* DataModelInstance::getWorkspace()
{
return workspace;
}
GuiRootInstance* DataModelInstance::getGuiRoot()
{
return guiRoot;
}
SelectionService* DataModelInstance::getSelectionService()
{
return selectionService;
}
LevelInstance* DataModelInstance::getLevel()
{
return level;
}
ThumbnailGeneratorInstance* DataModelInstance::getThumbnailGenerator()
{
return thumbnailGenerator;
}
SoundService* DataModelInstance::getSoundService()
{
return soundService;
}
LightingInstance* DataModelInstance::getLighting()
{
return lightingInstance;
}

View File

@@ -1,75 +0,0 @@
#include "DataModelV2/GroupInstance.h"
GroupInstance::GroupInstance(void)
{
PVInstance::PVInstance();
name = "Model";
className = "GroupInstance";
listicon = 12;
primaryPart = NULL;
}
GroupInstance::GroupInstance(const GroupInstance &oinst)
{
PVInstance::PVInstance(oinst);
name = "Model";
className = "GroupInstance";
listicon = 12;
primaryPart = NULL;
}
GroupInstance::~GroupInstance(void)
{
}
std::vector<PROPGRIDITEM> GroupInstance::getProperties()
{
std::vector<PROPGRIDITEM> properties = PVInstance::getProperties();
return properties;
}
void GroupInstance::PropUpdate(LPPROPGRIDITEM &pItem)
{
PVInstance::PropUpdate(pItem);
}
std::vector<Instance *> GroupInstance::unGroup()
{
while(children.size() > 0)
{
children[0]->setParent(parent);
}
return std::vector<Instance *>();
}
void GroupInstance::render(RenderDevice * rd)
{
Instance::render(rd);
if(primaryPart != NULL && controllerFlagShown && getControllerColor(controller) != Color3::gray())
{
rd->disableLighting();
Vector3 vec = Vector3(0,0,0);
Vector3 up = Vector3(0,8,0);
rd->setColor(getControllerColor(controller));
rd->setObjectToWorldMatrix(primaryPart->getCFrame());
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-2, up.z);
glVertex3f(up.x, up.y-1, up.z-2);
glVertex3f(up.x, up.y, up.z);
glVertex3f(up.x, up.y, up.z);
glVertex3f(up.x, up.y-1, up.z-2);
glVertex3f(up.x, up.y-2, up.z);
glEnd();
rd->afterPrimitive();
rd->setColor(Color3::white());
rd->enableLighting();
}
}

View File

@@ -1,473 +0,0 @@
#include <iomanip>
#include <sstream>
#include "G3DAll.h"
#include "DataModelV2/BaseButtonInstance.h"
#include "DataModelV2/TextButtonInstance.h"
#include "DataModelV2/ImageButtonInstance.h"
#include "DataModelV2/ToggleImageButtonInstance.h"
#include "DataModelV2/GuiRootInstance.h"
#include "DataModelV2/SelectionService.h"
#include "DataModelV2/ImageButtonInstance.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"
#ifndef _DEBUG
#if _MSC_VER== 1310
#define VS03_WORKAROUND &
#else
#define VS03_WORKAROUND
#endif
#else
#define VS03_WORKAROUND
#endif
MenuButtonListener menuListener = MenuButtonListener();
ToolbarListener toolbar = ToolbarListener();
GUDButtonListener gud = GUDButtonListener();
ModeSelectionListener msl = ModeSelectionListener();
RotateButtonListener rbl = RotateButtonListener();
DeleteListener delet = DeleteListener();
CameraButtonListener cam = CameraButtonListener();
ImageButtonInstance* GuiRootInstance::makeImageButton(G3D::TextureRef newImage = NULL, G3D::TextureRef overImage = NULL, G3D::TextureRef downImage = NULL, G3D::TextureRef disableImage = NULL)
{
ImageButtonInstance* part = new ImageButtonInstance(newImage,overImage, downImage, disableImage);
// instances.push_back(part);
// instances_2D.push_back(part);
return part;
}
TextButtonInstance* GuiRootInstance::makeTextButton()
{
TextButtonInstance* part = new TextButtonInstance();
return part;
}
// Modnark here, I'm not a fan of having these functions, but until we make a proper "factory" it'll have to do.
TextButtonInstance* makeBaseTextButton(std::string title, Vector2 boxBegin, Vector2 boxEnd) {
TextButtonInstance* button = new TextButtonInstance();
button->boxBegin = boxBegin;
button->boxEnd = boxEnd;
button->title = title;
button->font = GFont::fromFile(GetFileInPath("/content/font/lighttrek.fnt"));
return button;
}
TextButtonInstance* makeMenuTextButton(std::string title, Vector2 boxBegin, Vector2 boxEnd) {
TextButtonInstance* button = makeBaseTextButton(title, boxBegin, boxEnd);
button->floatBottom = true;
button->textColor = Color3(0,255,255);
button->textOutlineColor = Color4::clear();
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);
return button;
}
TextButtonInstance* makeToolbarTextButton(std::string title, std::string name, Vector2 boxBegin, Vector2 boxEnd) {
TextButtonInstance* button = makeBaseTextButton(title, boxBegin, boxEnd);
button->textColor = Color3::white();
button->boxColor = Color4::clear();
button->textOutlineColor = Color4(0.5F,0.5F,0.5F,0.5F);
button->name = name;
button->textSize = 16;
button->setAllColorsSame();
button->fontLocationRelativeTo = Vector2(10, 0);
button->boxColorOvr = Color4(0.6F,0.6F,0.6F,0.4F);
button->setButtonListener(menuListener);
return button;
}
TextButtonInstance* makeLeftMenuTextButton(std::string title, Vector2 boxBegin, Vector2 boxEnd) {
TextButtonInstance* button = makeBaseTextButton(title, boxBegin, boxEnd);
button->textOutlineColor = Color4(0.6F,0.6F,0.6F,0.5F);
button->textColor = Color3(0,1,1);
button->boxColor = Color4::clear();
button->textSize = 12;
button->name = title;
button->setAllColorsSame();
button->textColorDis = Color3(0.65F,0.65F,0.65F);
button->boxColorOvr = Color4(0.6F,0.6F,0.6F,0.4F);
button->fontLocationRelativeTo = Vector2(10, 0);
button->setButtonListener(gud);
return button;
}
GuiRootInstance::GuiRootInstance() : _message(""), _messageTime(0)
{
g_fntdominant = GFont::fromFile(GetFileInPath("/content/font/dominant.fnt"));
g_fntlighttrek = GFont::fromFile(GetFileInPath("/content/font/lighttrek.fnt"));
_hideGui = false;
//Bottom Left
TextButtonInstance* button = makeMenuTextButton("Hopper", Vector2(0, -24), Vector2(80, 0));
button->setParent(this);
button = makeMenuTextButton("Controller", Vector2(0, -48), Vector2(80, -24));
button->setParent(this);
button = makeMenuTextButton("Color", Vector2(0, -72), Vector2(80, -48));
button->setParent(this);
button = makeMenuTextButton("Surface", Vector2(0, -96), Vector2(80, -72));
button->setParent(this);
button = makeMenuTextButton("Model", Vector2(0, -120), Vector2(80, -96));
button->setParent(this);
//Top bar
button = makeToolbarTextButton("File", "file", Vector2(0, 0), Vector2(125, 25));
button->setParent(this);
button = makeToolbarTextButton("Edit", "edit", Vector2(125, 0), Vector2(250, 25));
button->setParent(this);
button = makeToolbarTextButton("View", "view", Vector2(250, 0), Vector2(375, 25));
button->setParent(this);
button = makeToolbarTextButton("Insert", "insert", Vector2(375, 0), Vector2(500, 25));
button->setParent(this);
button = makeToolbarTextButton("Format", "format", Vector2(500, 0), Vector2(625, 25));
button->setParent(this);
//Menu
button = makeLeftMenuTextButton("Group", Vector2(0, 215), Vector2(80, 235));
button->setParent(this);
button = makeLeftMenuTextButton("UnGroup", Vector2(0, 240), Vector2(80, 260));
button->setParent(this);
button = makeLeftMenuTextButton("Duplicate", Vector2(0, 265), Vector2(80, 285));
button->setParent(this);
button = makeBaseTextButton("MENU", Vector2(0,332), Vector2(80,352));
button->textOutlineColor = Color4(0.5F,0.5F,0.5F,0.5F);
button->textColor = Color3::white();
button->boxColor = Color4::clear();
button->textSize = 14;
button->setAllColorsSame();
button->boxColorOvr = Color4(0.6F,0.6F,0.6F,0.4F);
button->font = g_fntlighttrek;
button->fontLocationRelativeTo = Vector2(10, 0);
button->setParent(this);
button->name = "MENU";
button->setButtonListener(menuListener);
ImageButtonInstance* instance = new ToggleImageButtonInstance(
Texture::fromFile(VS03_WORKAROUND GetFileInPath("/content/images/Run.png")),
Texture::fromFile(VS03_WORKAROUND GetFileInPath("/content/images/Run_ovr.png")),
Texture::fromFile(VS03_WORKAROUND GetFileInPath("/content/images/Run_dn.png")),
NULL,
Texture::fromFile(VS03_WORKAROUND GetFileInPath("/content/images/Stop.png")),
Texture::fromFile(VS03_WORKAROUND GetFileInPath("/content/images/Stop_ovr.png")),
Texture::fromFile(VS03_WORKAROUND GetFileInPath("/content/images/Stop_dn.png"))
);
instance->setButtonListener(menuListener);
instance->name = "go";
instance->size = Vector2(65,65);
instance->position = Vector2(6.5, 25);
instance->setParent(this);
instance = makeImageButton(
Texture::fromFile(VS03_WORKAROUND GetFileInPath("/content/images/ArrowTool.png")),
Texture::fromFile(VS03_WORKAROUND GetFileInPath("/content/images/ArrowTool_ovr.png")),
Texture::fromFile(VS03_WORKAROUND GetFileInPath("/content/images/ArrowTool_dn.png")),
Texture::fromFile(VS03_WORKAROUND GetFileInPath("/content/images/ArrowTool_ds.png")));
instance->size = Vector2(50,50);
instance->position = Vector2(15, 90);
instance->setParent(this);
instance->name = "Cursor";
instance->setButtonListener(msl);
instance = makeImageButton(Texture::fromFile(VS03_WORKAROUND GetFileInPath("/content/images/ScaleTool.png")),Texture::fromFile(VS03_WORKAROUND GetFileInPath("/content/images/ScaleTool_ovr.png")),Texture::fromFile(VS03_WORKAROUND GetFileInPath("/content/images/ScaleTool_dn.png")),Texture::fromFile(VS03_WORKAROUND GetFileInPath("/content/images/ScaleTool_ds.png")));
instance->size = Vector2(40,40);
instance->position = Vector2(0, 140);
instance->setParent(this);
instance->name = "Resize";
instance->setButtonListener(msl);
instance = makeImageButton(
Texture::fromFile(VS03_WORKAROUND GetFileInPath("/content/images/MoveTool.png")),
Texture::fromFile(VS03_WORKAROUND GetFileInPath("/content/images/MoveTool_ovr.png")),
Texture::fromFile(VS03_WORKAROUND GetFileInPath("/content/images/MoveTool_dn.png")),
Texture::fromFile(VS03_WORKAROUND GetFileInPath("/content/images/MoveTool_ds.png")));
instance->size = Vector2(40,40);
instance->position = Vector2(40, 140);
instance->setParent(this);
instance->name = "Arrows";
instance->setButtonListener(msl);
instance = makeImageButton(
Texture::fromFile(VS03_WORKAROUND GetFileInPath("/content/images/SelectionRotate.png")),
Texture::fromFile(VS03_WORKAROUND GetFileInPath("/content/images/SelectionRotate_ovr.png")),
NULL,
Texture::fromFile(VS03_WORKAROUND GetFileInPath("/content/images/SelectionRotate_ds.png")));
instance->size = Vector2(27,27);
instance->position = Vector2(17, 180);
instance->setParent(this);
instance->name = "Rotate";
instance->setButtonListener(rbl);
instance = makeImageButton(
Texture::fromFile(VS03_WORKAROUND GetFileInPath("/content/images/SelectionTilt.png")),
Texture::fromFile(VS03_WORKAROUND GetFileInPath("/content/images/SelectionTilt_ovr.png")),
NULL,
Texture::fromFile(VS03_WORKAROUND GetFileInPath("/content/images/SelectionTilt_ds.png")));
instance->size = Vector2(20 ,20);
instance->position = Vector2(42, 183);
instance->setParent(this);
instance->name = "Tilt";
instance->setButtonListener(rbl);
instance = makeImageButton(
Texture::fromFile(VS03_WORKAROUND GetFileInPath("/content/images/Delete.png")),
Texture::fromFile(VS03_WORKAROUND GetFileInPath("/content/images/Delete_ovr.png")),
Texture::fromFile(VS03_WORKAROUND GetFileInPath("/content/images/Delete_dn.png")),
Texture::fromFile(VS03_WORKAROUND GetFileInPath("/content/images/Delete_ds.png")));
instance->size = Vector2(40,46);
instance->position = Vector2(20, 284);
instance->setParent(this);
instance->name = "Delete";
instance->setButtonListener(delet);
instance = makeImageButton(
Texture::fromFile(VS03_WORKAROUND GetFileInPath("/content/images/CameraZoomIn.png")),
Texture::fromFile(VS03_WORKAROUND GetFileInPath("/content/images/CameraZoomIn_ovr.png")),
Texture::fromFile(VS03_WORKAROUND GetFileInPath("/content/images/CameraZoomIn_dn.png")));
instance->size = Vector2(34,25);
instance->floatBottom = true;
instance->floatRight = true;
instance->position = Vector2(-77, -90);
instance->setParent(this);
instance->name = "ZoomIn";
instance->setButtonListener(cam);
instance = makeImageButton(
Texture::fromFile(VS03_WORKAROUND GetFileInPath("/content/images/CameraZoomOut.png")),
Texture::fromFile(VS03_WORKAROUND GetFileInPath("/content/images/CameraZoomOut_ovr.png")),
Texture::fromFile(VS03_WORKAROUND GetFileInPath("/content/images/CameraZoomOut_dn.png")));
instance->size = Vector2(34,26);
instance->floatBottom = true;
instance->floatRight = true;
instance->position = Vector2(-77, -31);
instance->setParent(this);
instance->name = "ZoomOut";
instance->setButtonListener(cam);
instance = makeImageButton(
Texture::fromFile(VS03_WORKAROUND GetFileInPath("/content/images/CameraPanLeft.png")),
Texture::fromFile(VS03_WORKAROUND GetFileInPath("/content/images/CameraPanLeft_ovr.png")),
Texture::fromFile(VS03_WORKAROUND GetFileInPath("/content/images/CameraPanLeft_dn.png")));
instance->size = Vector2(34,34);
instance->floatBottom = true;
instance->floatRight = true;
instance->position = Vector2(-110, -50);
instance->setParent(this);
instance->name = "PanLeft";
instance->setButtonListener(cam);
instance = makeImageButton(
Texture::fromFile(VS03_WORKAROUND GetFileInPath("/content/images/CameraPanRight.png")),
Texture::fromFile(VS03_WORKAROUND GetFileInPath("/content/images/CameraPanRight_ovr.png")),
Texture::fromFile(VS03_WORKAROUND GetFileInPath("/content/images/CameraPanRight_dn.png")));
instance->size = Vector2(34,34);
instance->floatBottom = true;
instance->floatRight = true;
instance->position = Vector2(-45, -50);
instance->setParent(this);
instance->name = "PanRight";
instance->setButtonListener(cam);
instance = makeImageButton(
Texture::fromFile(VS03_WORKAROUND GetFileInPath("/content/images/CameraCenter.png")),
Texture::fromFile(VS03_WORKAROUND GetFileInPath("/content/images/CameraCenter_ovr.png")),
Texture::fromFile(VS03_WORKAROUND GetFileInPath("/content/images/CameraCenter_dn.png")));
instance->size = Vector2(34,20);
instance->floatBottom = true;
instance->floatRight = true;
instance->position = Vector2(-77, -60);
instance->setParent(this);
instance->name = "CenterCam";
instance->setButtonListener(cam);
instance = makeImageButton(
Texture::fromFile(VS03_WORKAROUND GetFileInPath("/content/images/CameraTiltUp.png")),
Texture::fromFile(VS03_WORKAROUND GetFileInPath("/content/images/CameraTiltUp_ovr.png")),
Texture::fromFile(VS03_WORKAROUND GetFileInPath("/content/images/CameraTiltUp_dn.png")));
instance->size = Vector2(24,24);
instance->floatBottom = true;
instance->floatRight = true;
instance->position = Vector2(-105, -75);
instance->setParent(this);
instance->name = "TiltUp";
instance->setButtonListener(cam);
instance = makeImageButton(
Texture::fromFile(VS03_WORKAROUND GetFileInPath("/content/images/CameraTiltDown.png")),
Texture::fromFile(VS03_WORKAROUND GetFileInPath("/content/images/CameraTiltDown_ovr.png")),
Texture::fromFile(VS03_WORKAROUND GetFileInPath("/content/images/CameraTiltDown_dn.png")));
instance->size = Vector2(24,24);
instance->floatBottom = true;
instance->floatRight = true;
instance->position = Vector2(-40, -75);
instance->setParent(this);
instance->name = "TiltDown";
instance->setButtonListener(cam);
}
void GuiRootInstance::drawButtons(RenderDevice* rd)
{
rd->pushState();
rd->beforePrimitive();
//this->render(rd);
rd->afterPrimitive();
rd->popState();
}
void GuiRootInstance::setDebugMessage(std::string msg, G3D::RealTime msgTime)
{
_messageTime = msgTime;
_message = msg;
}
//void GuiRootInstance::render(G3D::RenderDevice* renderDevice) {}
void GuiRootInstance::renderGUI(G3D::RenderDevice* rd, double fps)
{
if(_hideGui) return;
//TODO--Move these to their own instance
std::stringstream stream;
stream << std::fixed << std::setprecision(1) << g_dataModel->getLevel()->timer;
g_fntdominant->draw2D(rd, "Timer: " + stream.str(), Vector2(rd->getWidth() - 120, 25), 20, Color3::fromARGB(0x81C518), Color3::black());
g_fntdominant->draw2D(rd, "Score: " + Convert(g_dataModel->getLevel()->score), Vector2(rd->getWidth() - 120, 50), 20, Color3::fromARGB(0x81C518), Color3::black());
//FPS
#ifdef _DEBUG
stream.str("");
stream.clear();
stream << std::fixed << std::setprecision(3) << fps;
g_fntdominant->draw2D(rd, "FPS: " + stream.str(), Vector2(120, 25), 10, Color3::fromARGB(0xFFFF00), Color3::black());
#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));
//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));
//Tools menu
Draw::box(G3D::Box(Vector3(5, 210,0),Vector3(75, 210,0)),rd,Color4(0.6F,0.6F,0.6F,0.4F), Color4(0.6F,0.6F,0.6F,0.4F));
//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());
}
g_dataModel->drawMessage(rd);
render(rd);
}
bool GuiRootInstance::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++)
{
if(BaseButtonInstance* button = dynamic_cast<BaseButtonInstance*>(instances_2D.at(i)))
{
if(button->mouseInButton(x,y, renderDevice))
{
return true;
}
}
}
return false;
}
//Oh eww...
void GuiRootInstance::update()
{
Instance * obj6 = this->findFirstChild("Delete");
Instance * obj = this->findFirstChild("Duplicate");
Instance * obj2 = this->findFirstChild("Group");
Instance * obj3 = this->findFirstChild("UnGroup");
Instance * obj4 = this->findFirstChild("Rotate");
Instance * obj5 = this->findFirstChild("Tilt");
SelectionService* getSelectionService = g_dataModel->getSelectionService();
if(obj != NULL && obj2 != NULL && obj3 != NULL && obj4 !=NULL && obj5 != NULL && obj6 != NULL)
{
BaseButtonInstance* button = (BaseButtonInstance*)obj;
BaseButtonInstance* button2 = (BaseButtonInstance*)obj2;
BaseButtonInstance* button3 = (BaseButtonInstance*)obj3;
BaseButtonInstance* button4 = (BaseButtonInstance*)obj4;
BaseButtonInstance* button5 = (BaseButtonInstance*)obj5;
BaseButtonInstance* button6 = (BaseButtonInstance*)obj6;
button->disabled = true;
button2->disabled = true;
button3->disabled = true;
button4->disabled = true;
button5->disabled = true;
button6->disabled = true;
for(size_t i = 0; i < getSelectionService->getSelection().size(); i++)
if(getSelectionService->getSelection()[i]->canDelete)
{
button->disabled = false;
button4->disabled = false;
button5->disabled = false;
button6->disabled = false;
if (getSelectionService->getSelection().size() > 1){
button2->disabled = false;
}
if (dynamic_cast<GroupInstance*>(getSelectionService->getSelection()[i])){
button3->disabled = false;
}
break;
}
}
}
GuiRootInstance::~GuiRootInstance()
{
}
void GuiRootInstance::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++)
{
if(BaseButtonInstance* button = dynamic_cast<BaseButtonInstance*>(instances_2D[i]))
{
if(button->mouseInButton(x, y, renderDevice))
{
button->onMouseClick();
}
}
}
}
void GuiRootInstance::hideGui(bool doHide) {
_hideGui = doHide;
}

View File

@@ -1,132 +0,0 @@
#include "DataModelV2/ImageButtonInstance.h"
ImageButtonInstance::ImageButtonInstance(G3D::TextureRef newImage, G3D::TextureRef overImage = NULL, G3D::TextureRef downImage = NULL, G3D::TextureRef disableImage = NULL)
{
BaseButtonInstance::BaseButtonInstance();
image = newImage;
openGLID = image->getOpenGLID();
image_ovr = overImage;
if(!image_ovr.isNull())
openGLID_ovr = image_ovr->getOpenGLID();
image_dn = downImage;
if(!image_dn.isNull())
openGLID_dn = image_dn->getOpenGLID();
image_ds = disableImage;
if(!image_ds.isNull())
openGLID_ds = image_ds->getOpenGLID();
Vector2 size = Vector2(0,0);
Vector2 position = Vector2(0,0);
floatCenter = false;
floatBottom = false;
floatRight = false;
disabled = false;
className = "ImageButton";
}
ImageButtonInstance::~ImageButtonInstance(void)
{
//Delete everything on destruction
image.~ReferenceCountedPointer();
delete image.getPointer();
image_ovr.~ReferenceCountedPointer();
delete image_ovr.getPointer();
image_ds.~ReferenceCountedPointer();
delete image_ds.getPointer();
image_dn.~ReferenceCountedPointer();
delete image_dn.getPointer();
image = NULL;
image_ovr = NULL;
image_ds = NULL;
image_dn = NULL;
listener = NULL;
selected = false;
}
bool ImageButtonInstance::mouseInButton(float mousex, float mousey, RenderDevice* rd)
{
Vector2 positionRelative = position;
if(floatRight && floatBottom)
{
positionRelative = Vector2(rd->getWidth() + position.x, rd->getHeight() + position.y);
}
else if(floatBottom)
{
positionRelative = Vector2(position.x, rd->getHeight() + position.y);
}
else if(floatRight)
{
positionRelative = Vector2(rd->getWidth() + position.x, position.y);
}
if(mousex >= positionRelative.x && mousey >= positionRelative.y)
{
if(mousex < positionRelative.x + size.x && mousey < positionRelative.y + size.y)
{
return true;
}
}
return false;
}
void ImageButtonInstance::drawObj(RenderDevice* rd, Vector2 mousePos, bool mouseDown)
{
bool drawDisabledBox = false;
Vector2 positionRelative = position;
if(floatRight && floatBottom)
{
positionRelative = Vector2(rd->getWidth() + position.x, rd->getHeight() + position.y);
}
else if(floatBottom)
{
positionRelative = Vector2(position.x, rd->getHeight() + position.y);
}
else if(floatRight)
{
positionRelative = Vector2(rd->getWidth() + position.x, position.y);
}
int renderimage = openGLID;
if(selected == true && !image_dn.isNull() && !disabled)
{
renderimage = openGLID_dn;
}
else if(disabled)
{
if(!image_ds.isNull())
renderimage = openGLID_ds;
else
drawDisabledBox = true;
}
else if(mouseInArea(positionRelative.x, positionRelative.y, positionRelative.x + size.x, positionRelative.y + size.y, mousePos.x, mousePos.y))
{
if(mouseDown && !image_dn.isNull())
{
renderimage = openGLID_dn;
}
else if(!image_ovr.isNull())
{
renderimage = openGLID_ovr;
}
}
glEnable( GL_TEXTURE_2D );
glEnable(GL_BLEND);// you enable blending function
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glBindTexture( GL_TEXTURE_2D, renderimage);
glBegin( GL_QUADS );
glTexCoord2d(0.0,0.0);
glVertex2f( positionRelative.x, positionRelative.y );
glTexCoord2d( 1.0,0.0 );
glVertex2f( positionRelative.x + size.x, positionRelative.y );
glTexCoord2d( 1.0,1.0 );
glVertex2f( positionRelative.x + size.x, positionRelative.y + size.y );
glTexCoord2d( 0.0,1.0 );
glVertex2f( positionRelative.x, positionRelative.y + size.y );
glEnd();
glDisable( GL_TEXTURE_2D );
if(drawDisabledBox)
{
Draw::box(Box(Vector3(positionRelative.x, positionRelative.y, 0), Vector3(positionRelative.x+size.x, positionRelative.y+size.y, 0)), rd, Color4(0.7F,0.7F,0.7F,0.3F), Color4::clear());
}
}

View File

@@ -1,178 +0,0 @@
#define WINVER 0x0400
#include <G3DAll.h>
#include "DataModelV2/Instance.h"
Instance::Instance(void)
{
parent = NULL;
name = "Default Game Instance";
className = "BaseInstance";
listicon = 1;
canDelete = true;
}
Instance::Instance(const Instance &oinst)
{
name = oinst.name;
className = oinst.className;
canDelete = oinst.canDelete;
listicon = oinst.listicon;
}
void Instance::render(RenderDevice* rd)
{
for(size_t i = 0; i < children.size(); i++)
{
children[i]->render(rd);
}
}
void Instance::renderName(RenderDevice* rd)
{
for(size_t i = 0; i < children.size(); i++)
{
children[i]->renderName(rd);
}
}
void Instance::update()
{
}
PROPGRIDITEM Instance::createPGI(LPSTR catalog, LPSTR propName, LPSTR propDesc, LPARAM curVal, INT type, TCHAR choices[])
{
PROPGRIDITEM pItem;
PropGrid_ItemInit(pItem);
pItem.lpszCatalog=catalog;
pItem.lpszPropName=propName;
pItem.lpszPropDesc=propDesc;
pItem.lpCurValue=curVal;
pItem.iItemType=type;
if(choices != NULL)
pItem.lpszzCmbItems = choices;
return pItem;
}
void Instance::PropUpdate(LPPROPGRIDITEM &item)
{
if(strcmp(item->lpszPropName, "Name") == 0)
{
name = (LPSTR)item->lpCurValue;
}
}
std::vector<PROPGRIDITEM> Instance::getProperties()
{
std::vector<PROPGRIDITEM> properties;
properties.push_back(createPGI(
"Properties",
"Name",
"The name of this instance",
(LPARAM)name.c_str(),
PIT_EDIT
));
return properties;
}
Instance::~Instance(void)
{
for(size_t i = 0; i < children.size(); i++)
{
delete children.at(i);
}
}
void Instance::setName(std::string newName)
{
name = newName;
}
std::string Instance::getClassName()
{
return className;
}
std::vector<Instance* > Instance::getChildren()
{
return children;
}
std::vector<Instance* > Instance::getAllChildren()
{
if(!children.empty())
{
std::vector<Instance* > totalchildren = children;
for(size_t i = 0; i < children.size(); i++)
{
std::vector<Instance* > subchildren = children.at(i)->getAllChildren();
if(!subchildren.empty())
totalchildren.insert(totalchildren.end(), subchildren.begin(), subchildren.end());
}
return totalchildren;
}
return children;
}
void Instance::setParent(Instance* newParent)
{
if(parent != NULL)
{
parent->removeChild(this);
}
parent = newParent;
if(newParent != NULL)
{
newParent->addChild(this);
}
}
Instance* Instance::getParent()
{
return parent;
}
void Instance::addChild(Instance* newChild)
{
children.push_back(newChild);
}
void Instance::clearChildren()
{
for (size_t i = 0; i < children.size(); i++)
{
delete children.at(i);
}
children.clear();
}
void Instance::removeChild(Instance* oldChild)
{
for(size_t i = 0; i < children.size(); i++)
{
if(children.at(i) == oldChild)
{
children.erase(children.begin() + i);
}
}
}
Instance* Instance::findFirstChild(std::string name)
{
for(size_t i = 0; i < children.size(); i++)
{
if(children.at(i)->name.compare(name) == 0)
{
return children.at(i);
}
}
return NULL;
}

View File

@@ -1,245 +0,0 @@
#include "DataModelV2/DataModelInstance.h"
#include "DataModelV2/LevelInstance.h"
LevelInstance::LevelInstance(void)
{
Instance::Instance();
name = "Level";
className = "LevelService";
winMessage = "You Won!";
loseMessage = "You Lost. Try Again";
timer = 60.0F;
score = 0;
canDelete = false;
}
LevelInstance::~LevelInstance(void)
{
}
static TCHAR* strActionType(int option)
{
switch(option)
{
case Enum::ActionType::Nothing:
return "Nothing";
case Enum::ActionType::Pause:
return "Pause";
case Enum::ActionType::Lose:
return "Lose";
case Enum::ActionType::Draw:
return "Draw";
case Enum::ActionType::Win:
return "Win";
}
return "Nothing";
}
static Enum::ActionType::Value EnumActionType(TCHAR* option)
{
if(strcmp("Nothing", option) == 0)
return Enum::ActionType::Nothing;
if(strcmp("Pause", option) == 0)
return Enum::ActionType::Pause;
if(strcmp("Lose", option) == 0)
return Enum::ActionType::Lose;
if(strcmp("Draw", option) == 0)
return Enum::ActionType::Draw;
return Enum::ActionType::Win;
}
static TCHAR* strAffectType(int option)
{
switch(option)
{
case Enum::AffectType::NoChange:
return "NoChange";
case Enum::AffectType::Increase:
return "Increase";
case Enum::AffectType::Decrease:
return "Decrease";
}
return "NoChange";
}
static Enum::AffectType::Value EnumAffectType(TCHAR* option)
{
if(strcmp("NoChange", option) == 0)
return Enum::AffectType::NoChange;
if(strcmp("Increase", option) == 0)
return Enum::AffectType::Increase;
return Enum::AffectType::Decrease;
}
char timerTxt[12];
char scoreTxt[12];
std::vector<PROPGRIDITEM> LevelInstance::getProperties()
{
std::vector<PROPGRIDITEM> properties = Instance::getProperties();
properties.push_back(createPGI("Messages",
"WinMessage",
"The message that shows when the player wins.",
(LPARAM)winMessage.c_str(),
PIT_EDIT));
properties.push_back(createPGI("Messages",
"LoseMessage",
"The message that shows when the player loses.",
(LPARAM)loseMessage.c_str(),
PIT_EDIT));
properties.push_back(createPGI(
"Gameplay",
"HighScoreIsGood",
"Some temporary string here",
(LPARAM)HighScoreIsGood,
PIT_CHECK
));
properties.push_back(createPGI(
"Gameplay",
"RunOnOpen",
"Some temporary string here",
(LPARAM)RunOnOpen,
PIT_CHECK
));
_snprintf(timerTxt, 12, "%g", timer);
_snprintf(scoreTxt, 12, "%d", score);
properties.push_back(createPGI("Gameplay",
"InitialTimerValue",
"The amount of time in seconds the player has to complete this level.\r\n\r\nPut 0 if time is limitless.",
(LPARAM)timerTxt,
PIT_EDIT));
properties.push_back(createPGI("Gameplay",
"InitialScoreValue",
"The amount of points the player starts with.",
(LPARAM)scoreTxt,
PIT_EDIT));
properties.push_back(createPGI("Gameplay",
"TimerUpAction",
"Some temporary string here",
(LPARAM)strActionType(TimerUpAction),
PIT_COMBO,
TEXT("Nothing\0Pause\0Lose\0Draw\0Win\0")
));
properties.push_back(createPGI("Gameplay",
"TimerAffectsScore",
"Some temporary string here",
(LPARAM)strAffectType(TimerAffectsScore),
PIT_COMBO,
TEXT("NoChange\0Increase\0Decrease\0")
));
return properties;
}
void LevelInstance::PropUpdate(LPPROPGRIDITEM &pItem)
{
if(strcmp(pItem->lpszPropName, "InitialTimerValue") == 0)
{
timer = atoi((LPSTR)pItem->lpCurValue);
}
if(strcmp(pItem->lpszPropName, "InitialScoreValue") == 0)
{
score = atof((LPSTR)pItem->lpCurValue);
}
if(strcmp(pItem->lpszPropName, "LoseMessage") == 0)
{
loseMessage = (LPSTR)pItem->lpCurValue;
}
if(strcmp(pItem->lpszPropName, "WinMessage") == 0)
{
winMessage = (LPSTR)pItem->lpCurValue;
}
else if(strcmp(pItem->lpszPropName, "TimerUpAction") == 0)
{
TimerUpAction = EnumActionType((TCHAR*)pItem->lpCurValue);
}
else if(strcmp(pItem->lpszPropName, "TimerAffectsScore") == 0)
{
TimerAffectsScore = EnumAffectType((TCHAR*)pItem->lpCurValue);
}
else if(strcmp(pItem->lpszPropName, "HighScoreIsGood") == 0)
{
HighScoreIsGood = pItem->lpCurValue == TRUE;
}
else if(strcmp(pItem->lpszPropName, "RunOnOpen") == 0)
{
RunOnOpen = pItem->lpCurValue == TRUE;
}
else
Instance::PropUpdate(pItem);
}
void LevelInstance::winCondition()
{
DataModelInstance* DataModel = (DataModelInstance*)getParent(); //If level parent gets changed to something other than Datamodel it could cause nasty data corruption bugs
DataModel->setMessage(winMessage);
DataModel->toggleRun();
}
void LevelInstance::loseCondition()
{
DataModelInstance* DataModel = (DataModelInstance*)getParent();
DataModel->setMessage(loseMessage);
DataModel->toggleRun();
}
void LevelInstance::pauseCondition()
{
DataModelInstance* DataModel = (DataModelInstance*)getParent();
DataModel->toggleRun();
}
void LevelInstance::drawCondition()
{
DataModelInstance* DataModel = (DataModelInstance*)getParent();
DataModel->toggleRun();
}
void LevelInstance::Step(SimTime sdt)
{
switch(TimerAffectsScore)
{
case Enum::AffectType::NoChange:
break;
case Enum::AffectType::Increase:
score += 1;
break;
case Enum::AffectType::Decrease:
if (score > 0)
score -= 1;
break;
}
if (timer >= sdt){
timer -= sdt;
}
else{
timer = 0.0f;
switch(TimerUpAction)
{
case Enum::ActionType::Nothing:
break;
case Enum::ActionType::Pause:
pauseCondition();
break;
case Enum::ActionType::Lose:
loseCondition();
break;
case Enum::ActionType::Draw:
drawCondition();
break;
case Enum::ActionType::Win:
winCondition();
break;
}
}
}

View File

@@ -1,175 +0,0 @@
#include "DataModelV2/LightingInstance.h"
#include "Application.h"
#include "Globals.h"
#include "StringFunctions.h"
#include "Listener/ModeSelectionListener.h"
LightingInstance::LightingInstance(void)
{
Instance::Instance();
name = "Lighting";
className = "Lighting";
listicon = 10;
canDelete = false;
_hideSky = false;
lighting.setTime(G3D::toSeconds(2, 00, 00, PM));
// Maybe this is Top and Bottom Ambient?
lighting.ambient = Color3(0.5F, 0.5F, 0.5F);
lighting.lightColor = Color3(0.8F, 0.8F, 0.8F);
sky = Sky::create(NULL, ExePath() + "/content/sky/");
clearColor = Color4(0.0F, 0.0F, 0.0F, 0.0F);
}
LightingInstance::~LightingInstance(void)
{
sky->~Sky();
}
// Getters
G3D::SkyRef LightingInstance::getSky()
{
return sky;
}
G3D::LightingParameters LightingInstance::getLightingParameters()
{
return lighting;
}
std::vector<PROPGRIDITEM> LightingInstance::getProperties()
{
std::vector<PROPGRIDITEM> properties = Instance::getProperties();
properties.push_back(createPGI("Appearance",
"TopAmbient",
"The color of the TopAmbient for 3D Objects",
RGB((topAmbient.r*255),(topAmbient.g*255),(topAmbient.b*255)),
PIT_COLOR
));
properties.push_back(createPGI("Appearance",
"BottomAmbient",
"The color of the BottomAmbient for 3D Objects",
RGB((bottomAmbient.r*255),(bottomAmbient.g*255),(bottomAmbient.b*255)),
PIT_COLOR
));
properties.push_back(createPGI("Appearance",
"SpotLight",
"The color of the SpotLight",
RGB((spotLight.r*255),(spotLight.g*255),(spotLight.b*255)),
PIT_COLOR
));
properties.push_back(createPGI("Appearance",
"ClearColor",
"",
RGB((clearColor.r*255),(clearColor.g*255),(clearColor.b*255)),
PIT_COLOR
));
return properties;
}
void LightingInstance::PropUpdate(LPPROPGRIDITEM &item)
{
if(strcmp(item->lpszPropName, "TopAmbient") == 0)
{
topAmbient = Color3(
GetRValue(item->lpCurValue)/255.0F,
GetGValue(item->lpCurValue)/255.0F,
GetBValue(item->lpCurValue)/255.0F
);
}
if(strcmp(item->lpszPropName, "BottomAmbient") == 0)
{
bottomAmbient = Color3(
GetRValue(item->lpCurValue)/255.0F,
GetGValue(item->lpCurValue)/255.0F,
GetBValue(item->lpCurValue)/255.0F
);
}
if(strcmp(item->lpszPropName, "SpotLight") == 0)
{
spotLight = Color3(
GetRValue(item->lpCurValue)/255.0F,
GetGValue(item->lpCurValue)/255.0F,
GetBValue(item->lpCurValue)/255.0F
);
}
if(strcmp(item->lpszPropName, "ClearColor") == 0)
{
clearColor = Color3(
GetRValue(item->lpCurValue)/255.0F,
GetGValue(item->lpCurValue)/255.0F,
GetBValue(item->lpCurValue)/255.0F
);
}
else
Instance::PropUpdate(item);
}
// Functions
void LightingInstance::suppressSky(bool doSuppress)
{
_hideSky = doSuppress;
}
void LightingInstance::update()
{
RenderDevice* rd = g_usableApp->getRenderDevice();
if(!_hideSky) {
rd->clear(sky.isNull(), true, true);
if (sky.notNull()) sky->render(rd, lighting);
} else {
rd->setColorClearValue(clearColor);
rd->clear(true, true, true);
suppressSky(false);
}
// Setup lighting
rd->enableLighting();
rd->setShadeMode(RenderDevice::SHADE_SMOOTH);
rd->setAmbientLightColor(Color3(1,1,1));
rd->setLight(0, GLight::directional(lighting.lightDirection, lighting.lightColor, true, true));
rd->setAmbientLightColor(lighting.ambient);
rd->beforePrimitive();
CoordinateFrame forDraw = rd->getObjectToWorldMatrix();
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_COLOR_ARRAY);
glEnableClientState(GL_NORMAL_ARRAY);
g_dataModel->getWorkspace()->render(rd);
g_dataModel->getWorkspace()->renderName(rd);
glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_COLOR_ARRAY);
glDisableClientState(GL_NORMAL_ARRAY);
rd->setObjectToWorldMatrix(forDraw);
rd->afterPrimitive();
g_dataModel->getSelectionService()->render(rd);
g_usableApp->tool->render(rd, g_usableApp->mouse);
rd->disableLighting();
drawEffects();
}
void LightingInstance::drawEffects()
{
RenderDevice* rd = g_usableApp->getRenderDevice();
if (sky.notNull()) {
sky->renderLensFlare(rd, lighting);
}
}

View File

@@ -1,108 +0,0 @@
#include "DataModelV2/PVInstance.h"
PVInstance::PVInstance(void)
{
Instance::Instance();
nameShown = false;
controllerFlagShown = true;
className = "PVInstance";
listicon = 0;
controller = (Enum::Controller::Value)0;
}
PVInstance::PVInstance(const PVInstance &oinst)
{
Instance::Instance(oinst);
}
PVInstance::~PVInstance(void)
{
}
void PVInstance::postRender(RenderDevice* rd)
{
}
static TCHAR* enumStr(int controller)
{
switch(controller)
{
case Enum::Controller::None:
return "None";
case Enum::Controller::KeyboardLeft:
return "KeyboardLeft";
case Enum::Controller::KeyboardRight:
return "KeyboardRight";
case Enum::Controller::Joypad1:
return "Joypad1";
case Enum::Controller::Joypad2:
return "Joypad2";
case Enum::Controller::Chase:
return "Joypad1";
case Enum::Controller::Flee:
return "Joypad2";
}
return "None";
}
static Enum::Controller::Value strEnum(TCHAR * tval)
{
if(strcmp(tval, "KeyboardLeft") == 0)
return Enum::Controller::KeyboardLeft;
if(strcmp(tval, "KeyboardRight") == 0)
return Enum::Controller::KeyboardRight;
if(strcmp(tval, "Joypad1") == 0)
return Enum::Controller::Joypad1;
if(strcmp(tval, "Joypad2") == 0)
return Enum::Controller::Joypad2;
if(strcmp(tval, "Chase") == 0)
return Enum::Controller::Chase;
if(strcmp(tval, "Flee") == 0)
return Enum::Controller::Flee;
return Enum::Controller::None;
}
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));
properties.push_back(createPGI(
"Item",
"ControllerFlagShown",
"This chooses whether the item's ControllerFlag is shown",
controllerFlagShown,
PIT_CHECK));
properties.push_back(createPGI(
"Behaviour",
"Controller",
"This chooses what type of controller is used",
(LPARAM)enumStr(controller),
PIT_COMBO,
TEXT("None\0KeyboardRight\0KeyboardLeft\0Joypad1\0Joypad2\0Chase\0Flee")
));
return properties;
}
void PVInstance::PropUpdate(LPPROPGRIDITEM &pItem)
{
if(strcmp(pItem->lpszPropName, "NameShown") == 0)
{
nameShown = pItem->lpCurValue == TRUE;
}
if(strcmp(pItem->lpszPropName, "ControllerFlagShown") == 0)
{
controllerFlagShown = pItem->lpCurValue == TRUE;
}
if(strcmp(pItem->lpszPropName, "Controller") == 0)
{
controller = strEnum((TCHAR *)pItem->lpCurValue);
}
else Instance::PropUpdate(pItem);
}

View File

@@ -1,783 +0,0 @@
#include "DataModelV2/PartInstance.h"
#include "Globals.h"
#include "Renderer.h"
#include <sstream>
#include <iomanip>
#include "Faces.h"
#include "AudioPlayer.h"
#include "StringFunctions.h"
PartInstance::PartInstance(void)
{
PVInstance::PVInstance();
physBody = NULL;
glList = glGenLists(1);
name = "Unnamed PVItem";
className = "Part";
canCollide = true;
anchored = false;
dragging = false;
size = Vector3(2,1,4);
setCFrame(CoordinateFrame(Vector3(0,0,0)));
color = Color3::gray();
velocity = Vector3(0,0,0);
rotVelocity = Vector3(0,0,0);
top = Enum::SurfaceType::Smooth;
front = Enum::SurfaceType::Smooth;
right = Enum::SurfaceType::Smooth;
back = Enum::SurfaceType::Smooth;
left = Enum::SurfaceType::Smooth;
bottom = Enum::SurfaceType::Smooth;
shape = Enum::Shape::Block;
_touchedOnce = false;
// OnTouch
singleShot = true;
touchesToTrigger = 1;
uniqueObjectsToTrigger = 1;
changeScore = 0;
changeTimer = 0;
singleShot = true;
}
bool PartInstance::isDragging()
{
return dragging;
}
void PartInstance::setDragging(bool value)
{
if (dragging != value)
{
dragging = value;
g_dataModel->getEngine()->resetBody(this);
}
}
float PartInstance::getMass()
{
if(shape == Enum::Shape::Block)
return size.x*size.y*size.z*0.7F;
else
return 1.3333333333333333333333333333333F*(size.x/2)*(size.y/2)*(size.z/2)*0.7F;
}
Vector3 PartInstance::getVelocity()
{
return velocity;
}
Vector3 PartInstance::getRotVelocity()
{
return rotVelocity;
}
// OnTouch
bool PartInstance::isSingleShot()
{
return singleShot;
}
int PartInstance::getTouchesToTrigger()
{
return touchesToTrigger;
}
int PartInstance::getUniqueObjectsToTrigger()
{
return uniqueObjectsToTrigger;
}
int PartInstance::getChangeScore()
{
return changeScore;
}
float PartInstance::getChangeTimer()
{
return changeTimer;
}
void PartInstance::setVelocity(Vector3 v)
{
velocity = v;
}
void PartInstance::setRotVelocity(Vector3 v)
{
rotVelocity = v;
}
void PartInstance::postRender(RenderDevice *rd)
{
// possibly descard this function...
}
void PartInstance::renderName(RenderDevice *rd)
{
if(!nameShown)
return;
G3D::GFontRef fnt = NULL;
Instance* dm = parent;
while(dm != NULL)
{
if(DataModelInstance* mod = dynamic_cast<DataModelInstance*>(dm))
{
fnt = mod->font;
break;
}
dm = dm->getParent();
}
if(!fnt.isNull())
{
Vector3 gamepoint = position + Vector3(0,1.5,0);
Vector3 camerapoint = rd->getCameraToWorldMatrix().translation;
float distance = pow(pow((double)gamepoint.x - (double)camerapoint.x, 2) + pow((double)gamepoint.y - (double)camerapoint.y, 2) + pow((double)gamepoint.z - (double)camerapoint.z, 2), 0.5);
if(distance < 100 && distance > -100)
{
if(distance < 0)
distance = distance*-1;
glDisable(GL_DEPTH_TEST);
fnt->draw3D(rd, name, CoordinateFrame(rd->getCameraToWorldMatrix().rotation, gamepoint), 0.03*distance, Color3::yellow(), Color3::black(), G3D::GFont::XALIGN_CENTER, G3D::GFont::YALIGN_CENTER);
glEnable(GL_DEPTH_TEST);
}
}
}
void PartInstance::setChanged()
{
changed = true;
}
void PartInstance::setSurface(int face, Enum::SurfaceType::Value surface)
{
switch(face)
{
case TOP:
top = surface;
break;
case BOTTOM:
bottom = surface;
break;
case LEFT:
left = surface;
break;
case RIGHT:
right = surface;
break;
case FRONT:
front = surface;
break;
default:
back = surface;
}
changed = true;
}
void PartInstance::setParent(Instance* prnt)
{
if(this->physBody != NULL)
{
g_dataModel->getEngine()->deleteBody(this);
}
Instance * cparent = getParent();
while(cparent != NULL)
{
if(WorkspaceInstance* workspace = dynamic_cast<WorkspaceInstance*>(cparent))
{
workspace->partObjects.erase(std::remove(workspace->partObjects.begin(), workspace->partObjects.end(), this), workspace->partObjects.end());
}
cparent = cparent->getParent();
}
Instance::setParent(prnt);
cparent = getParent();
while(cparent != NULL)
{
if(WorkspaceInstance* workspace = dynamic_cast<WorkspaceInstance*>(cparent))
{
workspace->partObjects.push_back(this);
break;
}
cparent = cparent->getParent();
}
}
PartInstance::PartInstance(const PartInstance &oinst)
{
PVInstance::PVInstance(oinst);
physBody = NULL;
glList = glGenLists(1);
name = oinst.name;
canCollide = oinst.canCollide;
setParent(oinst.parent);
anchored = oinst.anchored;
size = oinst.size;
setCFrameNoSync(oinst.cFrame);
color = oinst.color;
velocity = oinst.velocity;
rotVelocity = oinst.rotVelocity;
top = oinst.top;
front = oinst.front;
right = oinst.right;
back = oinst.back;
left = oinst.left;
bottom = oinst.bottom;
shape = oinst.shape;
changed = true;
// OnTouch
singleShot = oinst.singleShot;
touchesToTrigger = oinst.touchesToTrigger;
uniqueObjectsToTrigger = oinst.uniqueObjectsToTrigger;
changeScore = oinst.changeScore;
changeTimer = oinst.changeTimer;
OnTouchAction = oinst.OnTouchAction;
OnTouchSound = oinst.OnTouchSound;
singleShot = oinst.singleShot;
_touchedOnce = false;
}
void PartInstance::setSize(Vector3 newSize)
{
int minsize = 1;
int maxsize = 512;
changed = true;
int sizex = (int)newSize.x;
if(sizex <= 0)
sizex = 1;
if(sizex > 512)
sizex = 512;
int sizey = (int)newSize.y;
if(sizey <= 0)
sizey = 1;
if(sizey > 512)
sizey = 512;
int sizez = (int)newSize.z;
if(sizez <= 0)
sizez = 1;
if(sizez > 512)
sizez = 512;
if(shape != Enum::Shape::Block)
{
int max = sizex;
if(sizey > max)
max = sizey;
if(sizez > max)
max = sizez;
sizex = sizey = sizez = max;
}
size = Vector3(sizex, sizey, sizez);
if(this->physBody != NULL)
g_dataModel->getEngine()->resetBody(this);
}
Vector3 PartInstance::getSize()
{
return size;
}
Vector3 PartInstance::getPosition()
{
return position;
}
void PartInstance::setShape(Enum::Shape::Value shape)
{
switch(shape)
{
case Enum::Shape::Block:
this->shape = shape;
break;
default:
this->shape = shape;
this->setSize(this->getSize());
}
if(this->physBody != NULL)
g_dataModel->getEngine()->resetBody(this);
changed = true;
}
void PartInstance::setPosition(Vector3 pos)
{
position = pos;
setCFrame(CoordinateFrame(cFrame.rotation, pos));
if (anchored)
g_dataModel->getEngine()->resetBody(this);
}
void PartInstance::setAnchored(bool anchored)
{
this->anchored = anchored;
if(this->physBody != NULL)
g_dataModel->getEngine()->resetBody(this);
}
bool PartInstance::isAnchored()
{
return this->anchored;
}
CoordinateFrame PartInstance::getCFrame()
{
return cFrame;
}
void PartInstance::setCFrame(CoordinateFrame coordinateFrame)
{
setCFrameNoSync(coordinateFrame);
g_dataModel->getEngine()->updateBody(this);
}
void PartInstance::setCFrameNoSync(CoordinateFrame coordinateFrame)
{
cFrame = coordinateFrame;
position = coordinateFrame.translation;
}
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());
}
}
Box PartInstance::getBox()
{
Box box = Box(Vector3(size.x/2, size.y/2, size.z/2) ,Vector3(-size.x/2,-size.y/2,-size.z/2));
CoordinateFrame c = getCFrame();
itemBox = c.toWorldSpace(box);
return itemBox;
}
Sphere PartInstance::getSphere()
{
Sphere sphere = Sphere(Vector3(0,0,0), size.y/2);
CoordinateFrame c = getCFrame();
return sphere;
}
bool PartInstance::collides(Box box)
{
return CollisionDetection::fixedSolidBoxIntersectsFixedSolidBox(getBox(), box);
}
void PartInstance::render(RenderDevice* rd) {
if (changed)
{
changed=false;
Vector3 renderSize = size/2;
glNewList(glList, GL_COMPILE);
renderShape(this->shape, renderSize, color);
renderSurface(TOP, this->top, renderSize, this->controller, color);
renderSurface(FRONT, this->front, renderSize, this->controller, color);
renderSurface(RIGHT, this->right, renderSize, this->controller, color);
renderSurface(BACK, this->back, renderSize, this->controller, color);
renderSurface(LEFT, this->left, renderSize, this->controller, color);
renderSurface(BOTTOM, this->bottom, renderSize, this->controller, color);
glEndList();
}
rd->setObjectToWorldMatrix(cFrame);
glCallList(glList);
postRender(rd);
}
PartInstance::~PartInstance(void)
{
glDeleteLists(glList, 1);
/*
// Causes some weird ODE error
// Someone, please look into this
dBodyDestroy(physBody);
for (int i = 0; i < 3; i++) {
if (physGeom[i] != NULL)
dGeomDestroy(physGeom[i]);
}
*/
}
char pto[512];
char pto2[512];
#include <sstream>
// Shape
static Enum::Shape::Value strEnum(TCHAR* shape)
{
if(strcmp("Block", shape) == 0)
return Enum::Shape::Block;
if(strcmp("Cylinder", shape) == 0)
return Enum::Shape::Cylinder;
return Enum::Shape::Ball;
}
static TCHAR* enumStr(int shape)
{
switch(shape)
{
case Enum::Shape::Block:
return "Block";
case Enum::Shape::Ball:
return "Ball";
case Enum::Shape::Cylinder:
return "Cylinder";
}
return "Block";
}
// ActionType
static TCHAR* strActionType(int option)
{
switch(option)
{
case Enum::ActionType::Nothing:
return "Nothing";
case Enum::ActionType::Pause:
return "Pause";
case Enum::ActionType::Lose:
return "Lose";
case Enum::ActionType::Draw:
return "Draw";
case Enum::ActionType::Win:
return "Win";
}
return "Nothing";
}
static Enum::ActionType::Value EnumOnTouchActionType(TCHAR* option)
{
if(strcmp("Nothing", option) == 0)
return Enum::ActionType::Nothing;
if(strcmp("Pause", option) == 0)
return Enum::ActionType::Pause;
if(strcmp("Lose", option) == 0)
return Enum::ActionType::Lose;
if(strcmp("Draw", option) == 0)
return Enum::ActionType::Draw;
return Enum::ActionType::Win;
}
// SoundType
static TCHAR* strSoundType(int option)
{
switch(option)
{
case Enum::Sound::NoSound:
return "NoSound";
case Enum::Sound::Victory:
return "Victory";
case Enum::Sound::Boing:
return "Boing";
case Enum::Sound::Splat:
return "Splat";
case Enum::Sound::Snap:
return "Snap";
case Enum::Sound::Bomb:
return "Bomb";
case Enum::Sound::Break:
return "Break";
case Enum::Sound::Ping:
return "Ping";
case Enum::Sound::Swoosh:
return "Swoosh";
case Enum::Sound::Page:
return "Page";
case Enum::Sound::Click:
return "Click";
case Enum::Sound::Clock:
return "Clock";
case Enum::Sound::Step:
return "Step";
case Enum::Sound::StepOn:
return "StepOn";
}
return "NoSound";
}
static Enum::Sound::Value EnumOnTouchSoundType(TCHAR* option)
{
if(strcmp("Nothing", option) == 0)
return Enum::Sound::NoSound;
if(strcmp("Victory", option) == 0)
return Enum::Sound::Victory;
if(strcmp("Boing", option) == 0)
return Enum::Sound::Boing;
if(strcmp("Splat", option) == 0)
return Enum::Sound::Splat;
if(strcmp("Bomb", option) == 0)
return Enum::Sound::Bomb;
if(strcmp("Break", option) == 0)
return Enum::Sound::Break;
if(strcmp("Swoosh", option) == 0)
return Enum::Sound::Swoosh;
if(strcmp("Page", option) == 0)
return Enum::Sound::Page;
if(strcmp("Ping", option) == 0)
return Enum::Sound::Ping;
if(strcmp("Snap", option) == 0)
return Enum::Sound::Snap;
if(strcmp("Click", option) == 0)
return Enum::Sound::Click;
if(strcmp("Clock", option) == 0)
return Enum::Sound::Clock;
if(strcmp("Step", option) == 0)
return Enum::Sound::Step;
if(strcmp("StepOn", option) == 0)
return Enum::Sound::StepOn;
return Enum::Sound::NoSound;
}
void PartInstance::onTouch()
{
if(singleShot && _touchedOnce)
return;
if(singleShot && !_touchedOnce)
_touchedOnce = true;
g_dataModel->getLevel()->score += changeScore;
g_dataModel->getLevel()->timer += changeTimer;
switch(OnTouchAction)
{
case Enum::ActionType::Nothing:
break;
case Enum::ActionType::Pause:
break;
case Enum::ActionType::Lose:
g_dataModel->getLevel()->loseCondition();
break;
case Enum::ActionType::Draw:
break;
case Enum::ActionType::Win:
g_dataModel->getLevel()->winCondition();
break;
}
SoundService* sndService = g_dataModel->getSoundService();
switch(OnTouchSound)
{
case Enum::Sound::NoSound:
break;
case Enum::Sound::Victory:
sndService->playSound(sndService->findFirstChild("Victory"));
break;
case Enum::Sound::Boing:
sndService->playSound(sndService->findFirstChild("Boing"));
break;
case Enum::Sound::Break:
sndService->playSound(sndService->findFirstChild("Break"));
break;
case Enum::Sound::Snap:
sndService->playSound(sndService->findFirstChild("Snap"));
break;
case Enum::Sound::Bomb:
sndService->playSound(sndService->findFirstChild("Bomb"));
break;
case Enum::Sound::Splat:
sndService->playSound(sndService->findFirstChild("Splat"));
break;
case Enum::Sound::Page:
sndService->playSound(sndService->findFirstChild("Page"));
break;
case Enum::Sound::Ping:
sndService->playSound(sndService->findFirstChild("Ping"));
break;
case Enum::Sound::Swoosh:
sndService->playSound(sndService->findFirstChild("Swoosh"));
break;
case Enum::Sound::Click:
sndService->playSound(sndService->findFirstChild("Click"));
break;
case Enum::Sound::Clock:
sndService->playSound(sndService->findFirstChild("Clock"));
break;
case Enum::Sound::Step:
sndService->playSound(sndService->findFirstChild("Step"));
break;
case Enum::Sound::StepOn:
sndService->playSound(sndService->findFirstChild("StepOn"));
break;
}
}
void PartInstance::PropUpdate(LPPROPGRIDITEM &item)
{
setChanged();
if(strcmp(item->lpszPropName, "Color3") == 0)
{
color = Color3(
GetRValue(item->lpCurValue)/255.0F,
GetGValue(item->lpCurValue)/255.0F,
GetBValue(item->lpCurValue)/255.0F
);
}
else if(strcmp(item->lpszPropName, "Anchored") == 0)
{
setAnchored(item->lpCurValue == TRUE);
}
else if(strcmp(item->lpszPropName, "Offset") == 0)
{
std::string str = (LPTSTR)item->lpCurValue;
std::vector<float> vect;
std::stringstream ss(str);
float i;
while (ss >> i)
{
vect.push_back(i);
if (ss.peek() == ',')
ss.ignore();
}
if(vect.size() == 3)
{
Vector3 pos(vect.at(0),vect.at(1),vect.at(2));
setPosition(pos);
}
}
else if(strcmp(item->lpszPropName, "Size") == 0)
{
std::string str = (LPTSTR)item->lpCurValue;
std::vector<float> vect;
std::stringstream ss(str);
float i;
while (ss >> i)
{
vect.push_back(i);
if (ss.peek() == ',')
ss.ignore();
}
if(vect.size() == 3)
{
Vector3 size(vect.at(0),vect.at(1),vect.at(2));
setSize(size);
}
}
else if(strcmp(item->lpszPropName, "Shape") == 0)
{
printf("%s", enumStr(strEnum((TCHAR*)item->lpCurValue)));
setShape(strEnum((TCHAR*)item->lpCurValue));
}
else if(strcmp(item->lpszPropName, "Action") == 0)
{
OnTouchAction = EnumOnTouchActionType((TCHAR*)item->lpCurValue);
}
else if (strcmp(item->lpszPropName, "Sound") == 0)
{
OnTouchSound = EnumOnTouchSoundType((TCHAR*)item->lpCurValue);
}
else if (strcmp(item->lpszPropName, "ChangeScore") == 0)
{
changeScore = atoi((LPSTR)item->lpCurValue);
}
else if (strcmp(item->lpszPropName, "ChangeTimer") == 0)
{
changeTimer = atof((LPSTR)item->lpCurValue);
}
else if (strcmp(item->lpszPropName, "SingleShot") == 0)
{
singleShot = item->lpCurValue == TRUE;
}
else PVInstance::PropUpdate(item);
}
// This needs to be changed, buffer size of 12 is way too small
// Crash occurs if you put a huge number in
char changeTimerTxt[12];
char changeScoreTxt[12];
std::vector<PROPGRIDITEM> PartInstance::getProperties()
{
std::vector<PROPGRIDITEM> properties = PVInstance::getProperties();
properties.push_back(createPGI("Properties",
"Color3",
"The color of the selected part",
RGB((color.r*255),(color.g*255),(color.b*255)),
PIT_COLOR
));
properties.push_back(createPGI("Item",
"Anchored",
"Whether the block can move or not",
(LPARAM)anchored,
PIT_CHECK
));
_snprintf(pto, 512, "%g, %g, %g", position.x, position.y, position.z);
properties.push_back(createPGI("Item",
"Offset",
"The position of the object in the workspace",
(LPARAM)pto,
PIT_EDIT
));
_snprintf(pto2, 512, "%g, %g, %g", size.x, size.y, size.z);
properties.push_back(createPGI("Item",
"Size",
"The size of the object in the workspace",
(LPARAM)pto2,
PIT_EDIT
));
properties.push_back(createPGI("Item",
"Shape",
"The shape of the object in the workspace",
(LPARAM)enumStr(shape),
PIT_COMBO,
TEXT("Ball\0Block\0Cylinder\0")
));
properties.push_back(createPGI("OnTouch",
"Action",
"What action is taken when touched",
(LPARAM)strActionType(OnTouchAction),
PIT_COMBO,
TEXT("Nothing\0Pause\0Lose\0Draw\0Win\0")
));
properties.push_back(createPGI("OnTouch",
"Sound",
"What sound plays when touched",
(LPARAM)strSoundType(OnTouchSound),
PIT_COMBO,
TEXT("NoSound\0Victory\0Boing\0Break\0Snap\0Bomb\0Splat\0Page\0Ping\0Swoosh\0Click\0Clock\0Step\0StepOn")
));
_snprintf(changeScoreTxt, 12, "%d", changeScore);
_snprintf(changeTimerTxt, 12, "%g", changeTimer);
properties.push_back(createPGI("OnTouch",
"ChangeScore",
"How the score is affected when touched",
(LPARAM)changeScoreTxt,
PIT_EDIT));
properties.push_back(createPGI("OnTouch",
"ChangeTimer",
"How the timer is affected when touched",
(LPARAM)changeTimerTxt,
PIT_EDIT));
properties.push_back(createPGI("OnTouch",
"SingleShot",
"Whether or not Action happens only once",
(LPARAM)singleShot,
PIT_CHECK
));
return properties;
}

View File

@@ -1,159 +0,0 @@
#include "DataModelV2/SelectionService.h"
#include "DataModelV2/PartInstance.h"
//This is absolutely disgusting, and will not last long
#include "Application.h"
#include "Globals.h"
#define CURSOR 0
#define ARROWS 1
#define RESIZE 2
SelectionService::SelectionService(void){
Instance::Instance();
propertyWindow = NULL;
}
SelectionService::~SelectionService(void){
}
SelectionService::SelectionService(const SelectionService &oinst){
Instance::Instance(oinst);
propertyWindow = NULL;
}
std::vector<Instance *> SelectionService::getSelection(){
return this->selection;
}
void SelectionService::clearSelection(){
this->selection.clear();
if(propertyWindow != NULL)
propertyWindow->ClearProperties();
printf("selectionSize: %d\n", selection.size());
}
bool SelectionService::isSelected(Instance * instance){
return std::find(selection.begin(), selection.end(), instance) != selection.end();
}
void SelectionService::addSelected(Instance * instance){
if(!isSelected(instance))
this->selection.push_back(instance);
if(propertyWindow != NULL)
propertyWindow->UpdateSelected(selection);
printf("selectionSize: %d\n", selection.size());
}
void SelectionService::removeSelected(Instance * instance){
selection.erase(std::remove(selection.begin(), selection.end(), instance), selection.end());
if(propertyWindow != NULL)
propertyWindow->UpdateSelected(selection);
printf("selectionSize: %d\n", selection.size());
}
void SelectionService::addSelected(const std::vector<Instance *> &instances){
for(size_t i = 0; i < instances.size(); i++)
{
if(!isSelected(instances[i]))
this->selection.push_back(instances[i]);
}
if(propertyWindow != NULL)
propertyWindow->UpdateSelected(selection);
printf("selectionSize: %d\n", selection.size());
}
void SelectionService::setPropertyWindow(PropertyWindow * propertyWindow)
{
this->propertyWindow = propertyWindow;
if(propertyWindow != NULL)
propertyWindow->ClearProperties();
printf("selectionSize: %d\n", selection.size());
}
void drawOutline(Vector3 from, Vector3 to, RenderDevice* rd, Vector3 size, Vector3 pos, CoordinateFrame c);
void SelectionService::render(RenderDevice * rd)
{
for(size_t i = 0; i < selection.size(); i++)
{
if(PartInstance* part = dynamic_cast<PartInstance*>(selection[i]))
{
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, Vector3(size.x/2, size.y/2, size.z/2), Vector3(pos.x, pos.y, pos.z), part->getCFrame());
}
}
}
void drawOutline(Vector3 from, Vector3 to, RenderDevice* rd, Vector3 size, Vector3 pos, CoordinateFrame c)
{
Color3 outline = Color3::cyan();//Color3(0.098F,0.6F,1.0F);
float offsetSize = 0.1F;
//X
Draw::box(c.toWorldSpace(Box(Vector3(from.x - offsetSize, from.y + offsetSize, from.z + offsetSize), Vector3(to.x + offsetSize, from.y - offsetSize, from.z - offsetSize))), rd, outline, Color4::clear());
Draw::box(c.toWorldSpace(Box(Vector3(from.x - offsetSize, to.y + offsetSize, from.z + offsetSize), Vector3(to.x + offsetSize, to.y - offsetSize, from.z - offsetSize))), rd, outline, Color4::clear());
Draw::box(c.toWorldSpace(Box(Vector3(from.x - offsetSize, to.y + offsetSize, to.z + offsetSize), Vector3(to.x + offsetSize, to.y - offsetSize, to.z - offsetSize))), rd, outline, Color4::clear());
Draw::box(c.toWorldSpace(Box(Vector3(from.x - offsetSize, from.y + offsetSize, to.z + offsetSize), Vector3(to.x + offsetSize, from.y - offsetSize, to.z - offsetSize))), rd, outline, Color4::clear());
//Y
Draw::box(c.toWorldSpace(Box(Vector3(from.x + offsetSize, from.y - offsetSize + 0.2, from.z + offsetSize), Vector3(from.x - offsetSize, to.y + offsetSize - 0.2, from.z - offsetSize))), rd, outline, Color4::clear());
Draw::box(c.toWorldSpace(Box(Vector3(to.x + offsetSize, from.y - offsetSize + 0.2, from.z + offsetSize), Vector3(to.x - offsetSize, to.y + offsetSize - 0.2, from.z - offsetSize))), rd, outline, Color4::clear());
Draw::box(c.toWorldSpace(Box(Vector3(to.x + offsetSize, from.y - offsetSize + 0.2, to.z + offsetSize), Vector3(to.x - offsetSize, to.y + offsetSize-0.2, to.z - offsetSize))), rd, outline, Color4::clear());
Draw::box(c.toWorldSpace(Box(Vector3(from.x + offsetSize, from.y - offsetSize + 0.2, to.z + offsetSize), Vector3(from.x - offsetSize, to.y + offsetSize - 0.2, to.z - offsetSize))), rd, outline, Color4::clear());
//Z
Draw::box(c.toWorldSpace(Box(Vector3(from.x + offsetSize, from.y + offsetSize, from.z - offsetSize), Vector3(from.x - offsetSize, from.y - offsetSize, to.z + offsetSize))), rd, outline, Color4::clear());
Draw::box(c.toWorldSpace(Box(Vector3(from.x + offsetSize, to.y + offsetSize, from.z - offsetSize), Vector3(from.x - offsetSize, to.y - offsetSize, to.z + offsetSize))), rd, outline, Color4::clear());
Draw::box(c.toWorldSpace(Box(Vector3(to.x + offsetSize, from.y + offsetSize, from.z - offsetSize), Vector3(to.x - offsetSize, from.y - offsetSize, to.z + offsetSize))), rd, outline, Color4::clear());
Draw::box(c.toWorldSpace(Box(Vector3(to.x + offsetSize, to.y + offsetSize, from.z - offsetSize), Vector3(to.x - offsetSize, to.y - offsetSize, to.z + offsetSize))), rd, outline, Color4::clear());
if(g_usableApp->getMode() == ARROWS)
{
AABox box;
c.toWorldSpace(Box(from, to)).getBounds(box);
float max = box.high().y - pos.y;
Draw::arrow(pos, Vector3(0, 1.5+max, 0), rd);
Draw::arrow(pos, Vector3(0, (-1.5)-max, 0), rd);
max = box.high().x - pos.x;
Draw::arrow(pos, Vector3(1.5+max, 0, 0), rd);
Draw::arrow(pos, Vector3((-1.5)-max, 0, 0), rd);
max = box.high().z - pos.z;
Draw::arrow(pos, Vector3(0, 0, 1.5+max), rd);
Draw::arrow(pos, Vector3(0, 0, (-1.5)-max), rd);
}
else if(g_usableApp->getMode()== RESIZE)
{
Color3 sphereColor = outline;
Vector3 gamepoint = pos;
Vector3 camerapoint = rd->getCameraToWorldMatrix().translation;
float distance = pow(pow((double)gamepoint.x - (double)camerapoint.x, 2) + pow((double)gamepoint.y - (double)camerapoint.y, 2) + pow((double)gamepoint.z - (double)camerapoint.z, 2), 0.5);
if(distance < 200)
{
float multiplier = distance * 0.050F/2;
if(multiplier < 0.50F)
multiplier = 0.50F;
Vector3 position = pos + (c.lookVector()*((size.z)+2));
Draw::sphere(Sphere(position, multiplier), rd, sphereColor, Color4::clear());
position = pos - (c.lookVector()*((size.z)+2));
Draw::sphere(Sphere(position, multiplier), rd, sphereColor, Color4::clear());
position = pos + (c.rightVector()*((size.x)+2));
Draw::sphere(Sphere(position, multiplier), rd, sphereColor, Color4::clear());
position = pos - (c.rightVector()*((size.x)+2));
Draw::sphere(Sphere(position, multiplier), rd, sphereColor, Color4::clear());
position = pos + (c.upVector()*((size.y)+2));
Draw::sphere(Sphere(position, multiplier), rd, sphereColor, Color4::clear());
position = pos - (c.upVector()*((size.y)+2));
Draw::sphere(Sphere(position, multiplier), rd, sphereColor, Color4::clear());
}
}
}

View File

@@ -1,53 +0,0 @@
#include "DataModelV2/SoundInstance.h"
#include "Globals.h"
SoundInstance::SoundInstance()
{
name = "Sound";
className = "Sound";
listicon = 8;
soundVolume = 0.5;
soundId = "";
playOnRemove = false;
looped = false;
}
SoundInstance::~SoundInstance(void)
{
if(isPlayedOnRemove())
play();
}
// Functions
void SoundInstance::play()
{
g_dataModel->getSoundService()->playSound(this);
}
// Getters
float SoundInstance::getSoundVolume()
{
return soundVolume;
}
bool SoundInstance::isPlayedOnRemove()
{
return playOnRemove;
}
std::string SoundInstance::getSoundId()
{
return soundId;
}
bool SoundInstance::isLooped()
{
return looped;
}
// Setters
void SoundInstance::setSoundId(std::string newSoundId)
{
soundId = newSoundId;
}

View File

@@ -1,114 +0,0 @@
#include "DataModelV2/SoundService.h"
#include "StringFunctions.h"
#include "AudioPlayer.h"
#include "Globals.h"
SoundService::SoundService()
{
name = "SoundService";
className = "SoundService";
musicVolume = 0.3f;
listicon = 8;
canDelete = false;
// Create stock sounds
SoundInstance* stockSound = new SoundInstance();
// Victory
stockSound = new SoundInstance();
stockSound->setName("Victory");
stockSound->setSoundId("/content/sounds/victory.wav");
stockSound->setParent(this);
// Boing
stockSound = new SoundInstance();
stockSound->setName("Boing");
stockSound->setSoundId("/content/sounds/bass.wav");
stockSound->setParent(this);
// Bomb
stockSound = new SoundInstance();
stockSound->setName("Bomb");
stockSound->setSoundId("/content/sounds/collide.wav");
stockSound->setParent(this);
// Ping
stockSound = new SoundInstance();
stockSound->setName("Ping");
stockSound->setSoundId("/content/sounds/electronicpingshort.wav");
stockSound->setParent(this);
// Break
stockSound = new SoundInstance();
stockSound->setName("Break");
stockSound->setSoundId("/content/sounds/glassbreak.wav");
stockSound->setParent(this);
// Splat
stockSound = new SoundInstance();
stockSound->setName("Splat");
stockSound->setSoundId("/content/sounds/splat.wav");
stockSound->setParent(this);
// Swoosh
stockSound = new SoundInstance();
stockSound->setName("Swoosh");
stockSound->setSoundId("/content/sounds/swoosh.wav");
stockSound->setParent(this);
// Snap
stockSound = new SoundInstance();
stockSound->setName("Snap");
stockSound->setSoundId("/content/sounds/snap.wav");
stockSound->setParent(this);
// Page
stockSound = new SoundInstance();
stockSound->setName("Page");
stockSound->setSoundId("/content/sounds/pageturn.wav");
stockSound->setParent(this);
// Click
stockSound = new SoundInstance();
stockSound->setName("Click");
stockSound->setSoundId("/content/sounds/switch.wav");
stockSound->setParent(this);
// Clock
stockSound = new SoundInstance();
stockSound->setName("Clock");
stockSound->setSoundId("/content/sounds/clickfast.wav");
stockSound->setParent(this);
// Step
stockSound = new SoundInstance();
stockSound->setName("Step");
stockSound->setSoundId("/content/sounds/SWITCH3.wav");
stockSound->setParent(this);
// StepOn
stockSound = new SoundInstance();
stockSound->setName("StepOn");
stockSound->setSoundId("/content/sounds/flashbulb.wav");
stockSound->setParent(this);
}
SoundService::~SoundService(void)
{
}
void SoundService::playSound(Instance* sound)
{
// Try to dynamic_cast it to SoundInstance
SoundInstance* sndInst = dynamic_cast<SoundInstance*>(sound);
if(sndInst != NULL)
{
std::string soundId = sndInst->getSoundId();
AudioPlayer::playSound(GetFileInPath(soundId));
}
}
float SoundService::getMusicVolume()
{
return musicVolume;
}

View File

@@ -1,117 +0,0 @@
#include "DataModelV2/TextButtonInstance.h"
#include "DataModelV2/BaseGuiInstance.h"
TextButtonInstance::TextButtonInstance(void)
{
BaseButtonInstance::BaseButtonInstance();
boxBegin = Vector2(0,0);
boxEnd = Vector2(0,0);
fontLocationRelativeTo = Vector2(0,0);
centeredWithinBox = false;
title = "TextBox";
textColor = Color4(1, 1, 1, 1);
textOutlineColor = Color4(0, 0, 0, 0);
boxColor = BaseGuiInstance::translucentBackdrop();
boxOutlineColor = Color4(0, 0, 0, 0);
setAllColorsSame();
textSize = 12;
floatBottom = false;
floatRight = false;
floatCenter = false;
visible = true;
className = "TextButton";
disabled = false;
selected = false;
}
bool TextButtonInstance::mouseInButton(float mousex, float mousey, RenderDevice* rd)
{
Vector3 point1;
Vector3 point2;
if(floatBottom)
{
point1 = Vector3(boxBegin.x, rd->getHeight() + boxBegin.y,0);
point2 = Vector3(boxEnd.x, rd->getHeight() + boxEnd.y,0);
}
else
{
point1 = Vector3(boxBegin.x, boxBegin.y,0);
point2 = Vector3(boxEnd.x, boxEnd.y,0);
}
if(mousex >= point1.x && mousey >= point1.y)
{
if(mousex < point2.x && mousey < point2.y)
{
return true;
}
}
return false;
}
void TextButtonInstance::setAllColorsSame()
{
textColorOvr = textColor;
textOutlineColorOvr = textOutlineColor;
boxColorOvr = boxColor;
boxOutlineColorOvr = boxOutlineColor;
textColorDn = textColor;
textOutlineColorDn = textOutlineColor;
boxColorDn = boxColor;
boxOutlineColorDn = boxOutlineColor;
textColorDis = textColor;
textOutlineColorDis = textOutlineColor;
boxColorDis = boxColor;
boxOutlineColorDis = boxOutlineColor;
}
TextButtonInstance::~TextButtonInstance(void)
{
}
void TextButtonInstance::drawObj(RenderDevice* rd, Vector2 mousePos, bool mouseDown)
{
Vector3 point1;
Vector3 point2;
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glDisableClientState(GL_COLOR_ARRAY);
if(floatBottom)
{
point1 = Vector3(boxBegin.x, rd->getHeight() + boxBegin.y,0);
point2 = Vector3(boxEnd.x, rd->getHeight() + boxEnd.y,0);
}
else
{
point1 = Vector3(boxBegin.x, boxBegin.y,0);
point2 = Vector3(boxEnd.x, boxEnd.y,0);
}
Vector2 RelativeTo = Vector2(point1.x + fontLocationRelativeTo.x, point1.y + fontLocationRelativeTo.y);
if(disabled)
{
Draw::box(Box(point1, point2), rd, boxColorDis, boxOutlineColorDis);
font->draw2D(rd, title, RelativeTo, textSize, textColorDis, textOutlineColorDis);
}
else if(mouseInArea(point1.x, point1.y, point2.x, point2.y, mousePos.x, mousePos.y) && mouseDown)
{
Draw::box(Box(point1, point2), rd, boxColorDn, boxOutlineColorDn);
font->draw2D(rd, title, RelativeTo, textSize, textColorDn, textOutlineColorDn);
}
else if(selected || mouseInArea(point1.x, point1.y, point2.x, point2.y, mousePos.x, mousePos.y))
{
Draw::box(Box(point1, point2), rd, boxColorOvr, boxOutlineColorOvr);
font->draw2D(rd, title, RelativeTo, textSize, textColorOvr, textOutlineColorOvr);
}
else
{
Draw::box(Box(point1, point2), rd, boxColor, boxOutlineColor);
font->draw2D(rd, title, RelativeTo, textSize, textColor, textOutlineColor);
}
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
glEnableClientState(GL_COLOR_ARRAY);
}
void doNullCheck()
{
}

View File

@@ -1,56 +0,0 @@
#include "DataModelV2/ThumbnailGeneratorInstance.h"
#include "Application.h"
#include "Globals.h"
#include "base64.h"
#include <fstream>
ThumbnailGeneratorInstance::ThumbnailGeneratorInstance(void)
{
Instance::Instance();
name = "ThumbnailGenerator";
className = "ThumbnailGenerator";
canDelete = false;
}
ThumbnailGeneratorInstance::~ThumbnailGeneratorInstance(void) {}
/*
* TODO:
* Move functions like toggleSky into their own "Lighting" instance
* Make this headless, and allow for resolutions greater than the screen resolution
*/
std::string ThumbnailGeneratorInstance::click(std::string fileType, int cx, int cy, bool hideSky)
{
if(!G3D::GImage::supportedFormat(fileType)) {
printf("%s is not a valid fileType.", fileType);
return "";
}
RenderDevice* rd = g_usableApp->getRenderDevice();
GuiRootInstance* guiRoot = g_dataModel->getGuiRoot();
const G3D::GImage::Format format = G3D::GImage::stringToFormat(fileType);
int prevWidth = rd->width();
int prevHeight = rd->height();
G3D::GImage imgBuffer(cx, cy, 4);
G3D::BinaryOutput binOut;
guiRoot->hideGui(true);
g_usableApp->resize3DView(cx, cy);
if(hideSky)
g_dataModel->getLighting()->suppressSky(true);
g_usableApp->onGraphics(rd);
rd->screenshotPic(imgBuffer, true, hideSky);
imgBuffer.encode(format, binOut);
// Convert to Base64 string
std::string base64ImgStr = base64_encode(reinterpret_cast<const unsigned char*>(binOut.getCArray()), binOut.length(), false);
guiRoot->hideGui(false);
g_usableApp->resize3DView(prevWidth, prevHeight);
return base64ImgStr;
}

View File

@@ -1,138 +0,0 @@
#include "DataModelV2/ToggleImageButtonInstance.h"
ToggleImageButtonInstance::ToggleImageButtonInstance(G3D::TextureRef newImage,
G3D::TextureRef overImage,
G3D::TextureRef downImage,
G3D::TextureRef disableImage,
G3D::TextureRef newImage2,
G3D::TextureRef overImage2,
G3D::TextureRef downImage2,
G3D::TextureRef disableImage2) : ImageButtonInstance(newImage, overImage, downImage, disableImage)
{
image2 = newImage2;
openGLID2 = image2->getOpenGLID();
image_ovr2 = overImage2;
if(!image_ovr2.isNull())
openGLID2_ovr = image_ovr2->getOpenGLID();
image_dn2 = downImage2;
if(!image_dn2.isNull())
openGLID2_dn = image_dn2->getOpenGLID();
image_ds2 = disableImage2;
if(!image_ds2.isNull())
openGLID2_ds = image_ds2->getOpenGLID();
checked = false;
className = "ToggleImageButton";
}
ToggleImageButtonInstance::~ToggleImageButtonInstance(void)
{
//Delete everything on destruction
image2.~ReferenceCountedPointer();
delete image2.getPointer();
image_ovr2.~ReferenceCountedPointer();
delete image_ovr2.getPointer();
image_ds2.~ReferenceCountedPointer();
delete image_ds2.getPointer();
image_dn2.~ReferenceCountedPointer();
delete image_dn2.getPointer();
image = NULL;
image_ovr = NULL;
image_ds = NULL;
image_dn = NULL;
listener = NULL;
selected = false;
}
void ToggleImageButtonInstance::drawObj(RenderDevice* rd, Vector2 mousePos, bool mouseDown)
{
bool drawDisabledBox = false;
Vector2 positionRelative = position;
if(floatRight && floatBottom)
{
positionRelative = Vector2(rd->getWidth() + position.x, rd->getHeight() + position.y);
}
else if(floatBottom)
{
positionRelative = Vector2(position.x, rd->getHeight() + position.y);
}
else if(floatRight)
{
positionRelative = Vector2(rd->getWidth() + position.x, position.y);
}
int renderimage = openGLID;
if(checked)
{
renderimage = openGLID2;
if(selected == true && !image_dn2.isNull() && !disabled)
{
renderimage = openGLID2_dn;
}
else if(disabled)
{
if(!image_ds2.isNull())
renderimage = openGLID2_ds;
else
drawDisabledBox = true;
}
else if(mouseInArea(positionRelative.x, positionRelative.y, positionRelative.x + size.x, positionRelative.y + size.y, mousePos.x, mousePos.y))
{
if(mouseDown && !image_dn2.isNull())
{
renderimage = openGLID2_dn;
}
else if(!image_ovr2.isNull())
{
renderimage = openGLID2_ovr;
}
}
}
else
{
if(selected == true && !image_dn.isNull() && !disabled)
{
renderimage = openGLID_dn;
}
else if(disabled)
{
if(!image_ds.isNull())
renderimage = openGLID_ds;
else
drawDisabledBox = true;
}
else if(mouseInArea(positionRelative.x, positionRelative.y, positionRelative.x + size.x, positionRelative.y + size.y, mousePos.x, mousePos.y))
{
if(mouseDown && !image_dn.isNull())
{
renderimage = openGLID_dn;
}
else if(!image_ovr.isNull())
{
renderimage = openGLID_ovr;
}
}
}
glEnable( GL_TEXTURE_2D );
glEnable(GL_BLEND);// you enable blending function
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glBindTexture( GL_TEXTURE_2D, renderimage);
glBegin( GL_QUADS );
glTexCoord2d(0.0,0.0);
glVertex2f( positionRelative.x, positionRelative.y );
glTexCoord2d( 1.0,0.0 );
glVertex2f( positionRelative.x + size.x, positionRelative.y );
glTexCoord2d( 1.0,1.0 );
glVertex2f( positionRelative.x + size.x, positionRelative.y + size.y );
glTexCoord2d( 0.0,1.0 );
glVertex2f( positionRelative.x, positionRelative.y + size.y );
glEnd();
glDisable( GL_TEXTURE_2D );
if(drawDisabledBox)
{
Draw::box(Box(Vector3(positionRelative.x, positionRelative.y, 0), Vector3(positionRelative.x+size.x, positionRelative.y+size.y, 0)), rd, Color4(0.7F,0.7F,0.7F,0.3F), Color4::clear());
}
}

View File

@@ -1,26 +0,0 @@
#include "DataModelV2/WorkspaceInstance.h"
#include "Globals.h"
#include "Application.h"
WorkspaceInstance::WorkspaceInstance(void)
{
GroupInstance::GroupInstance();
name = "Workspace";
className = "Workspace";
canDelete = false;
}
void WorkspaceInstance::clearChildren()
{
partObjects.clear();
Instance::clearChildren();
}
void WorkspaceInstance::zoomToExtents()
{
g_usableApp->cameraController.zoomExtents();
}
WorkspaceInstance::~WorkspaceInstance(void)
{
}

View File

@@ -1,10 +1,10 @@
#include "DataModelV3/DataModelInstance.h"
using namespace B3D;
DataModelInstance::DataModelInstance(void)
DataModelInstance::DataModelInstance(void) : Instance("DataModel")
{
// Instances
Instance::Instance("DataModel");
printf("I am DataModel and I will be created!\n");
name = "Level";
parentDataModel = this;

View File

@@ -3,16 +3,16 @@
using namespace B3D;
GroupInstance::GroupInstance(std::string className)
GroupInstance::GroupInstance(std::string className) : PVInstance(className)
{
PVInstance::PVInstance(className);
name = "Model";
primaryPart = NULL;
}
GroupInstance::GroupInstance(void)
GroupInstance::GroupInstance(void) : PVInstance("GroupInstance")
{
GroupInstance::GroupInstance("Model");
name = "Model";
primaryPart = NULL;
}
GroupInstance::~GroupInstance(void)

View File

@@ -1,9 +1,8 @@
#include "DataModelV3/Gui/BaseButtonInstance.h"
using namespace B3D;
BaseButtonInstance::BaseButtonInstance(void)
BaseButtonInstance::BaseButtonInstance(void) : Instance()
{
Instance::Instance();
actionCode = 0;
}

View File

@@ -89,7 +89,7 @@ TextButtonInstance* GuiRootInstance::makeTextButton()
TextButtonInstance* part = new TextButtonInstance();
return part;
}
GuiRootInstance::GuiRootInstance() : _message(""), _messageTime(0)
GuiRootInstance::GuiRootInstance() : Instance(), _message(""), _messageTime(0)
{
//AAAAAAA
fntdominant = GFont::fromFile(GetFileInPath("/content/font/dominant.fnt"));

View File

@@ -2,9 +2,8 @@
//TODO ***what the hell***
using namespace B3D;
ImageButtonInstance::ImageButtonInstance(G3D::TextureRef newImage, G3D::TextureRef overImage = NULL, G3D::TextureRef downImage = NULL, G3D::TextureRef disableImage = NULL)
ImageButtonInstance::ImageButtonInstance(G3D::TextureRef newImage, G3D::TextureRef overImage = NULL, G3D::TextureRef downImage = NULL, G3D::TextureRef disableImage = NULL) : BaseButtonInstance()
{
BaseButtonInstance::BaseButtonInstance();
image = newImage;
openGLID = image->getOpenGLID();
image_ovr = overImage;

View File

@@ -1,9 +1,8 @@
#include "DataModelV3/Gui/TextButtonInstance.h"
#include "DataModelV3/Gui/BaseGuiInstance.h"
using namespace B3D;
TextButtonInstance::TextButtonInstance(void)
TextButtonInstance::TextButtonInstance(void) : BaseButtonInstance()
{
BaseButtonInstance::BaseButtonInstance();
boxBegin = Vector2(0,0);
boxEnd = Vector2(0,0);
fontLocationRelativeTo = Vector2(0,0);

View File

@@ -13,7 +13,12 @@ Instance::Instance(std::string className)
Instance::Instance(void)
{
Instance::Instance("");
//TODO split
this->parent = NULL;
this->parentDataModel = NULL;
this->dataTable = new Reflection::ReflectionDataTable(this, "");
this->name = Reflection::ReflectionProperty<std::string>("Name", "Level", Reflection::TYPE_STRING, dataTable);
canDelete = true;
}
Instance::~Instance(void)
@@ -27,6 +32,7 @@ Instance::~Instance(void)
Instance::Instance(const Instance &oinst)
{
printf("I *really* should not have been called yet!\n");
//CLONE WITH REFLECTION!!!
}
@@ -53,7 +59,7 @@ void Instance::update()
void Instance::setName(std::string newName)
{
*name.value = newName;
name.setValue(newName);
}
std::string Instance::getClassName()
@@ -134,7 +140,7 @@ Instance* Instance::findFirstChild(std::string searchName)
{
for(size_t i = 0; i < children.size(); i++)
{
if(children.at(i)->name.value->compare(searchName) == 0)
if(children.at(i)->name.value.compare(searchName) == 0)
{
return children.at(i);
}

View File

@@ -2,9 +2,8 @@
#include "DataModelV3/LevelInstance.h"
using namespace B3D;
LevelInstance::LevelInstance(void)
LevelInstance::LevelInstance(void) : Instance("LevelService")
{
Instance::Instance("LevelService");
name = "Level";
//Reflection values

View File

@@ -6,9 +6,8 @@
using namespace B3D;
LightingInstance::LightingInstance(void)
LightingInstance::LightingInstance(void) : Instance("Lighting")
{
Instance::Instance("Lighting");
name = "Lighting";
canDelete = false;
_hideSky = false;

View File

@@ -1,9 +1,9 @@
#include "DataModelV3/PVInstance.h"
using namespace B3D;
PVInstance::PVInstance(std::string className)
PVInstance::PVInstance(std::string className) : Instance(className)
{
Instance::Instance(className);
//TODO split
nameShown = Reflection::ReflectionProperty<bool>("NameShown", false, TYPE_BOOLEAN, this->dataTable);
controllerFlagShown = Reflection::ReflectionProperty<bool>("ControllerFlagShown", true, TYPE_BOOLEAN, this->dataTable);
@@ -13,9 +13,16 @@ PVInstance::PVInstance(std::string className)
}
PVInstance::PVInstance(void)
PVInstance::PVInstance(void) : Instance("PVInstance")
{
PVInstance::PVInstance("PVInstance");
//TODO split
nameShown = Reflection::ReflectionProperty<bool>("NameShown", false, TYPE_BOOLEAN, this->dataTable);
controllerFlagShown = Reflection::ReflectionProperty<bool>("ControllerFlagShown", true, TYPE_BOOLEAN, this->dataTable);
controller = Reflection::ReflectionProperty<Enum::Controller::Value>("Controller", Enum::Controller::None, TYPE_ENUM, this->dataTable,
(void*)new EnumMeta(Enum::Controller::LENGTH, Enum::Controller::STR_TABLE));
cFrame = Reflection::ReflectionProperty<CoordinateFrame>("CFrame", CoordinateFrame(), TYPE_CFRAME, this->dataTable);
}
PVInstance::~PVInstance(void)

View File

@@ -13,10 +13,8 @@
using namespace B3D;
using namespace Reflection;
PartInstance::PartInstance(void)
PartInstance::PartInstance(void) : PVInstance("Part")
{
PVInstance::PVInstance("Part");
name = "Unnamed PVItem";
canCollide = ReflectionProperty<bool>("CanCollide", true, TYPE_BOOLEAN, this->dataTable);
anchored = ReflectionProperty<bool>("Anchored", false, TYPE_BOOLEAN, this->dataTable);
@@ -72,9 +70,9 @@ void PartInstance::setDragging(bool value)
float PartInstance::getMass()
{
if(shape == Enum::Shape::Block)
return size.value->x*size.value->y*size.value->z*0.7F;
return size.value.x*size.value.y*size.value.z*0.7F;
else
return 1.3333333333333333333333333333333F*(size.value->x/2)*(size.value->y/2)*(size.value->z/2)*0.7F;
return 1.3333333333333333333333333333333F*(size.value.x/2)*(size.value.y/2)*(size.value.z/2)*0.7F;
}
Vector3 PartInstance::getVelocity()
@@ -286,7 +284,7 @@ void PartInstance::setShape(Enum::Shape::Value shape)
void PartInstance::setPosition(Vector3 pos)
{
position = pos;
setCFrame(CoordinateFrame(cFrame.value->rotation, pos));
setCFrame(CoordinateFrame(cFrame.value.rotation, pos));
if (anchored && getParentDataModel() != NULL)
getParentDataModel()->getEngine()->resetBody(this);
@@ -307,7 +305,7 @@ bool PartInstance::isAnchored()
CoordinateFrame PartInstance::getCFrame()
{
return cFrame.value->rotation;
return cFrame.value.rotation;
}
void PartInstance::setCFrame(CoordinateFrame coordinateFrame)
{
@@ -342,7 +340,7 @@ bool PartInstance::collides(PartInstance * part)
Box PartInstance::getBox()
{
Box box = Box(Vector3(size.value->x/2, size.value->y/2, size.value->z/2) ,Vector3(-size.value->x/2,-size.value->y/2,-size.value->z/2));
Box box = Box(Vector3(size.value.x/2, size.value.y/2, size.value.z/2) ,Vector3(-size.value.x/2,-size.value.y/2,-size.value.z/2));
CoordinateFrame c = getCFrame();
itemBox = c.toWorldSpace(box);
return itemBox;
@@ -350,7 +348,7 @@ Box PartInstance::getBox()
Sphere PartInstance::getSphere()
{
Sphere sphere = Sphere(Vector3(0,0,0), size.value->y/2);
Sphere sphere = Sphere(Vector3(0,0,0), size.value.y/2);
CoordinateFrame c = getCFrame();
return sphere;
}

View File

@@ -10,8 +10,7 @@
using namespace B3D;
SelectionService::SelectionService(void){
Instance::Instance();
SelectionService::SelectionService(void) : Instance(){
mode = CURSOR;
// TODO Port PropertyWindow
//propertyWindow = NULL;

View File

@@ -4,9 +4,8 @@
using namespace B3D;
using namespace Reflection;
SoundInstance::SoundInstance()
SoundInstance::SoundInstance(void) : Instance("Sound")
{
Instance::Instance("Sound");
name = "Sound";
soundVolume = Reflection::ReflectionProperty<float>("SoundVolume", 0.5F, TYPE_FLOAT, this->dataTable);
soundId = Reflection::ReflectionProperty<std::string>("SoundID", "", TYPE_STRING, this->dataTable);

View File

@@ -3,9 +3,8 @@
#include "AudioPlayer.h"
using namespace B3D;
SoundService::SoundService()
SoundService::SoundService() : Instance("SoundService")
{
Instance::Instance("SoundService");
name = "SoundService";
musicVolume = 0.3f;
canDelete = false;

View File

@@ -2,9 +2,8 @@
using namespace B3D;
WorkspaceInstance::WorkspaceInstance(void)
WorkspaceInstance::WorkspaceInstance(void) : GroupInstance("Workspace")
{
GroupInstance::GroupInstance("Workspace");
name = "Workspace";
canDelete = false;
}

View File

@@ -4,9 +4,8 @@
using namespace B3D;
XplicitNgine::XplicitNgine()
XplicitNgine::XplicitNgine() : Instance()
{
physWorld = dWorldCreate();
physSpace = dHashSpaceCreate(0);
@@ -146,7 +145,7 @@ void XplicitNgine::createBody(PartInstance* partInstance)
// Create geom
if(*(partInstance->shape.value) == Enum::Shape::Block)
if(partInstance->shape.value == Enum::Shape::Block)
{
partInstance->physGeom[0] = dCreateBox(physSpace,
partSize.x,

View File

@@ -5,14 +5,16 @@
#include "PropertyWindow.h"
#include "strsafe.h"
#include "Application.h"
#include "propertyGrid.h"
std::vector<PROPGRIDITEM> prop;
std::vector<Instance*> children;
Instance * selectedInstance;
Instance * parent = NULL;
//std::vector<PROPGRIDITEM> prop;
//std::vector<B3D::Instance*> children;
//Instance * selectedInstance;
//Instance * parent = NULL;
const int CX_BITMAP = 16;
const int CY_BITMAP = 16;
//TODO Re-Implement for DataModelV3
HBITMAP CreateBitmapMask(HBITMAP hbmColour, COLORREF crTransparent)
{
@@ -73,6 +75,7 @@ LRESULT CALLBACK PropProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
break;
case WM_DRAWITEM:
{
/*
COLORREF clrBackground;
COLORREF clrForeground;
TEXTMETRIC tm;
@@ -147,7 +150,7 @@ LRESULT CALLBACK PropProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
// If the item has the focus, draw the focus rectangle.
if (lpdis->itemState & ODS_FOCUS)
DrawFocusRect(lpdis->hDC, &lpdis->rcItem);
*/
}
break;
@@ -167,11 +170,11 @@ LRESULT CALLBACK PropProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
if(HIWORD(wParam) == CBN_SELCHANGE)
{
int ItemIndex = SendMessage((HWND) lParam, (UINT) CB_GETCURSEL, (WPARAM) 0, (LPARAM) 0);
/*int ItemIndex = SendMessage((HWND) lParam, (UINT) CB_GETCURSEL, (WPARAM) 0, (LPARAM) 0);
CHAR ListItem[256];
SendMessage((HWND) lParam, (UINT) CB_GETLBTEXT, (WPARAM) ItemIndex, (LPARAM) ListItem);
g_dataModel->getSelectionService()->clearSelection();
g_dataModel->getSelectionService()->addSelected(children.at(ItemIndex));
g_dataModel->getSelectionService()->addSelected(children.at(ItemIndex));*/
}
}
break;
@@ -183,10 +186,10 @@ LRESULT CALLBACK PropProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
case PGN_PROPERTYCHANGE:
{
if (IDC_PROPERTYGRID==wParam) {
LPNMHDR pnm = (LPNMHDR)lParam;
/*LPNMHDR pnm = (LPNMHDR)lParam;
LPNMPROPGRID lpnmp = (LPNMPROPGRID)pnm;
LPPROPGRIDITEM item = PropGrid_GetItemData(pnm->hwndFrom,lpnmp->iIndex);
selectedInstance->PropUpdate(item);
selectedInstance->PropUpdate(item);*/
//propWind->UpdateSelected(selectedInstance);
}
}
@@ -209,7 +212,7 @@ void PropertyWindow::clearExplorer()
void PropertyWindow::refreshExplorer(std::vector<Instance*> selectedInstances)
{
Instance * instance = selectedInstances[0];
/*Instance * instance = selectedInstances[0];
SendMessage(_explorerComboBox,CB_RESETCONTENT,0,0);
parent = NULL;
children.clear();
@@ -232,7 +235,7 @@ void PropertyWindow::refreshExplorer(std::vector<Instance*> selectedInstances)
SendMessage(_explorerComboBox,CB_ADDSTRING, 0,(LPARAM)selectedChildren.at(z)->name.c_str());
}
//g_usableApp->selectInstance(selectedInstance, this);
SendMessage(_explorerComboBox,CB_SETCURSEL,0,(LPARAM)0);
SendMessage(_explorerComboBox,CB_SETCURSEL,0,(LPARAM)0);*/
//}
}
@@ -273,42 +276,9 @@ bool PropertyWindow::onCreate(int x, int y, int sx, int sy, HMODULE hThisInstanc
_propGrid = New_PropertyGrid(_hwndProp,IDC_PROPERTYGRID);
/*PROPGRIDITEM pItem;
PropGrid_ItemInit(pItem);
pItem.lpszCatalog="Test";
pItem.lpszPropName="Offset";
pItem.lpszzCmbItems="What";
pItem.lpszPropDesc="Description";
pItem.lpCurValue=(LPARAM)"0, 0, 0";
pItem.iItemType=PIT_EDIT;
PROPGRIDITEM pItem2;
PropGrid_ItemInit(pItem2);
pItem2.lpszCatalog="Test";
pItem2.lpszPropName="s";
pItem2.lpszzCmbItems="itemlist\0itemlist2\0itemlist3";
pItem2.lpszPropDesc="";
pItem2.lpCurValue=0;
pItem2.iItemType=PIT_COMBO;
/*PROPGRIDITEM FauxExplorerItem;
PropGrid_ItemInit(FauxExplorerItem);
FauxExplorerItem.lpszCatalog="Test";
FauxExplorerItem.lpszPropName = "Editable Combo Field";
FauxExplorerItem.lpszzCmbItems = "Test1\0Test2\0Test3";
FauxExplorerItem.lpszPropDesc = "Press F4 to view drop down.";
FauxExplorerItem.iItemType = PIT_EDITCOMBO;
FauxExplorerItem.lpCurValue = 1;
PropGrid_AddItem(_propGrid, &FauxExplorerItem);*/
PropGrid_Enable(_propGrid,true);
ShowWindow(_propGrid,SW_SHOW);
// PropGrid_AddItem(_propGrid,&pItem);
// PropGrid_AddItem(_propGrid,&pItem2);
PropGrid_SetItemHeight(_propGrid,20);
PropGrid_ShowToolTips(_propGrid,TRUE);
PropGrid_ShowPropertyDescriptions(_propGrid,TRUE);
@@ -317,7 +287,6 @@ bool PropertyWindow::onCreate(int x, int y, int sx, int sy, HMODULE hThisInstanc
SetWindowLongPtr(_hwndProp,GWL_USERDATA,(LONG)this);
//refreshExplorer();
_resize();
return true;
@@ -342,7 +311,7 @@ void PropertyWindow::_resize()
void PropertyWindow::UpdateSelected(std::vector<Instance *> instances)
{
if(instances.size() <= 0)
/*if(instances.size() <= 0)
{
ClearProperties();
return;
@@ -366,7 +335,7 @@ void PropertyWindow::UpdateSelected(std::vector<Instance *> instances)
refreshExplorer(instances);
_resize();
}
}*/
}
void PropertyWindow::ClearProperties()

View File

@@ -1,6 +1,8 @@
#include "Tool/ArrowTool.h"
#include "Application.h"
#include "DataModelV2/SelectionService.h"
#include "DataModelV3/SelectionService.h"
using namespace B3D;
ArrowTool::ArrowTool(void)
{

View File

@@ -1,6 +1,8 @@
#include "Tool/DraggerTool.h"
#include "Application.h"
#include "DataModelV2/SelectionService.h"
#include "DataModelV3/SelectionService.h"
using namespace B3D;
DraggerTool::DraggerTool(void)
{

View File

@@ -1,5 +1,7 @@
#include "Tool/SurfaceTool.h"
#include "Application.h"
using namespace B3D;
SurfaceTool::SurfaceTool(int theSurface, int extraParam)
{
surface = theSurface;

View File

@@ -1,5 +1,5 @@
#include "Tool/Tool.h"
using namespace B3D;
Tool::Tool(void)
{
}