Big cleanup... Expect bugs
This commit is contained in:
1353
Application.cpp
Normal file
1353
Application.cpp
Normal file
File diff suppressed because it is too large
Load Diff
81
Application.h
Normal file
81
Application.h
Normal file
@@ -0,0 +1,81 @@
|
|||||||
|
#pragma once
|
||||||
|
#include <G3DAll.h>
|
||||||
|
#include "PropertyWindow.h"
|
||||||
|
#include "TextButtonInstance.h"
|
||||||
|
#include "ImageButtonInstance.h"
|
||||||
|
#include "CameraController.h"
|
||||||
|
|
||||||
|
class TextButtonInstance;
|
||||||
|
class ImageButtonInstance;
|
||||||
|
class PartInstance;
|
||||||
|
class CameraController;
|
||||||
|
|
||||||
|
class Application { // : public GApp {
|
||||||
|
public:
|
||||||
|
Application(HWND parentWindow);
|
||||||
|
void Boop();
|
||||||
|
virtual ~Application() {}
|
||||||
|
virtual void exitApplication();
|
||||||
|
virtual void onInit();
|
||||||
|
virtual void onLogic();
|
||||||
|
virtual void onNetwork();
|
||||||
|
virtual void onSimulation(RealTime rdt, SimTime sdt, SimTime idt);
|
||||||
|
virtual void onGraphics(RenderDevice* rd);
|
||||||
|
virtual void onUserInput(UserInput* ui);
|
||||||
|
virtual void onCleanup();
|
||||||
|
void clearInstances();
|
||||||
|
PartInstance* makePart();
|
||||||
|
void drawButtons(RenderDevice* rd);
|
||||||
|
void drawOutline(Vector3 from, Vector3 to, RenderDevice* rd, LightingParameters lighting, Vector3 size, Vector3 pos, CoordinateFrame c);
|
||||||
|
void makeFlag(Vector3 &vec, RenderDevice* &rd);
|
||||||
|
TextButtonInstance* makeTextButton();
|
||||||
|
ImageButtonInstance* makeImageButton(G3D::TextureRef newImage, G3D::TextureRef overImage, G3D::TextureRef downImage, G3D::TextureRef disableImage);
|
||||||
|
std::vector<Instance*> getSelection();
|
||||||
|
void deleteInstance();
|
||||||
|
void run();
|
||||||
|
void QuitApp();
|
||||||
|
void resizeWithParent(HWND parentWindow);
|
||||||
|
void onCreate(HWND parentWindow);
|
||||||
|
void onKeyPressed(int key);
|
||||||
|
void onKeyUp(int key);
|
||||||
|
void onMouseLeftPressed(HWND hwnd,int x, int y);
|
||||||
|
void onMouseLeftUp(int x, int y);
|
||||||
|
void onMouseRightPressed(int x, int y);
|
||||||
|
void onMouseRightUp(int x, int y);
|
||||||
|
void onMouseMoved(int x, int y);
|
||||||
|
void onMouseWheel(int x, int y, short delta);
|
||||||
|
int getMode();
|
||||||
|
CameraController cameraController;
|
||||||
|
RenderDevice* renderDevice;
|
||||||
|
UserInput* userInput;
|
||||||
|
PropertyWindow* _propWindow;
|
||||||
|
void generateShadowMap(const CoordinateFrame& lightViewMatrix) const;
|
||||||
|
private:
|
||||||
|
void initGUI();
|
||||||
|
HWND _hWndMain;
|
||||||
|
SkyRef sky;
|
||||||
|
bool quit;
|
||||||
|
bool mouseOnScreen;
|
||||||
|
bool rightButtonHolding;
|
||||||
|
void main();
|
||||||
|
GWindow* _window;
|
||||||
|
HWND _hwndToolbox;
|
||||||
|
HWND _buttonTest;
|
||||||
|
HWND _hwndRenderer;
|
||||||
|
DataModelInstance* _dataModel;
|
||||||
|
std::string _message;
|
||||||
|
G3D::RealTime _messageTime;
|
||||||
|
G3D::TextureRef shadowMap;
|
||||||
|
std::string _title;
|
||||||
|
bool _dragging;
|
||||||
|
int _mode;
|
||||||
|
GAppSettings _settings;
|
||||||
|
double lightProjX, lightProjY, lightProjNear, lightProjFar;
|
||||||
|
protected:
|
||||||
|
Stopwatch m_graphicsWatch;
|
||||||
|
Stopwatch m_logicWatch;
|
||||||
|
Stopwatch m_networkWatch;
|
||||||
|
Stopwatch m_userInputWatch;
|
||||||
|
Stopwatch m_simulationWatch;
|
||||||
|
Stopwatch m_waitWatch;
|
||||||
|
};
|
||||||
@@ -12,7 +12,7 @@ BaseButtonInstance::BaseButtonInstance(void)
|
|||||||
|
|
||||||
void BaseButtonInstance::render(RenderDevice* rd)
|
void BaseButtonInstance::render(RenderDevice* rd)
|
||||||
{
|
{
|
||||||
DataModelInstance* dataModel = Globals::dataModel;
|
DataModelInstance* dataModel = g_dataModel;
|
||||||
Vector2 pos = Vector2(dataModel->mousex,dataModel->mousey);
|
Vector2 pos = Vector2(dataModel->mousex,dataModel->mousey);
|
||||||
drawObj(rd, pos, dataModel->mouseButton1Down);
|
drawObj(rd, pos, dataModel->mouseButton1Down);
|
||||||
Instance::render(rd);
|
Instance::render(rd);
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "instance.h"
|
#include "instance.h"
|
||||||
#pragma once
|
|
||||||
#include "ButtonListener.h"
|
#include "ButtonListener.h"
|
||||||
|
|
||||||
class ButtonListener;
|
class ButtonListener;
|
||||||
|
class Instance;
|
||||||
|
|
||||||
class BaseButtonInstance : public Instance
|
class BaseButtonInstance : public Instance
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "Demo.h"
|
//#include "Application.h"
|
||||||
#include "BaseButtonInstance.h"
|
#include "BaseButtonInstance.h"
|
||||||
class BaseButtonInstance;
|
class BaseButtonInstance;
|
||||||
|
|
||||||
|
|||||||
24
CameraButtonListener.cpp
Normal file
24
CameraButtonListener.cpp
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
#include "CameraButtonListener.h"
|
||||||
|
#include "Globals.h"
|
||||||
|
#include "AudioPlayer.h"
|
||||||
|
#include "Application.h"
|
||||||
|
|
||||||
|
void CameraButtonListener::onButton1MouseClick(BaseButtonInstance* button)
|
||||||
|
{
|
||||||
|
AudioPlayer::playSound(cameraSound);
|
||||||
|
CoordinateFrame frame = g_usableApp->cameraController.getCamera()->getCoordinateFrame();
|
||||||
|
if(button->name == "CenterCam" && g_selectedInstances.size() > 0)
|
||||||
|
g_usableApp->cameraController.centerCamera(g_selectedInstances.at(0));
|
||||||
|
else if(button->name == "ZoomIn")
|
||||||
|
g_usableApp->cameraController.Zoom(1);
|
||||||
|
else if(button->name == "ZoomOut")
|
||||||
|
g_usableApp->cameraController.Zoom(-1);
|
||||||
|
else if(button->name == "PanRight")
|
||||||
|
g_usableApp->cameraController.panRight();
|
||||||
|
else if(button->name == "PanLeft")
|
||||||
|
g_usableApp->cameraController.panLeft();
|
||||||
|
else if(button->name == "TiltUp")
|
||||||
|
g_usableApp->cameraController.tiltUp();
|
||||||
|
else if(button->name == "TiltDown")
|
||||||
|
g_usableApp->cameraController.tiltDown();
|
||||||
|
}
|
||||||
6
CameraButtonListener.h
Normal file
6
CameraButtonListener.h
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
#include "ButtonListener.h"
|
||||||
|
|
||||||
|
class CameraButtonListener : public ButtonListener {
|
||||||
|
public:
|
||||||
|
void onButton1MouseClick(BaseButtonInstance*);
|
||||||
|
};
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
#include "win32Defines.h"
|
#include "win32Defines.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include "PartInstance.h"
|
#include "PartInstance.h"
|
||||||
#include "Demo.h"
|
#include "Application.h"
|
||||||
#include "AudioPlayer.h"
|
#include "AudioPlayer.h"
|
||||||
|
|
||||||
|
|
||||||
@@ -152,7 +152,7 @@ void CameraController::centerCamera(Instance* selection)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CameraController::update(Demo* demo)
|
void CameraController::update(Application* app)
|
||||||
{
|
{
|
||||||
float offsetSize = 0.05F;
|
float offsetSize = 0.05F;
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
#define CAM_ZOOM_MIN 0.1f
|
#define CAM_ZOOM_MIN 0.1f
|
||||||
#define CAM_ZOOM_MAX 100.f
|
#define CAM_ZOOM_MAX 100.f
|
||||||
|
|
||||||
class Demo;
|
class Application;
|
||||||
|
|
||||||
class CameraController {
|
class CameraController {
|
||||||
public:
|
public:
|
||||||
@@ -19,7 +19,7 @@ class CameraController {
|
|||||||
void lookAt(const Vector3& position);
|
void lookAt(const Vector3& position);
|
||||||
void refreshZoom(const CoordinateFrame& frame);
|
void refreshZoom(const CoordinateFrame& frame);
|
||||||
void pan(CoordinateFrame* frame,float spdX,float spdY);
|
void pan(CoordinateFrame* frame,float spdX,float spdY);
|
||||||
void update(Demo* demo);
|
void update(Application* app);
|
||||||
void centerCamera(Instance* selection);
|
void centerCamera(Instance* selection);
|
||||||
void panLeft();
|
void panLeft();
|
||||||
void panRight();
|
void panRight();
|
||||||
|
|||||||
8
DeleteListener.cpp
Normal file
8
DeleteListener.cpp
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
#include "DeleteListener.h"
|
||||||
|
#include "Globals.h"
|
||||||
|
#include "Application.h"
|
||||||
|
|
||||||
|
void DeleteListener::onButton1MouseClick(BaseButtonInstance* button)
|
||||||
|
{
|
||||||
|
g_usableApp->deleteInstance();
|
||||||
|
}
|
||||||
6
DeleteListener.h
Normal file
6
DeleteListener.h
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
#include "ButtonListener.h"
|
||||||
|
|
||||||
|
class DeleteListener : public ButtonListener {
|
||||||
|
public:
|
||||||
|
void onButton1MouseClick(BaseButtonInstance*);
|
||||||
|
};
|
||||||
18
Demo.h
18
Demo.h
@@ -7,15 +7,15 @@ class Demo { // : public GApp {
|
|||||||
public:
|
public:
|
||||||
Demo(const GAppSettings& settings,HWND parentWindow);
|
Demo(const GAppSettings& settings,HWND parentWindow);
|
||||||
void Boop();
|
void Boop();
|
||||||
virtual ~Demo() {}
|
virtual ~Demo() {}
|
||||||
virtual void exitApplication();
|
virtual void exitApplication();
|
||||||
virtual void onInit();
|
virtual void onInit();
|
||||||
virtual void onLogic();
|
virtual void onLogic();
|
||||||
virtual void onNetwork();
|
virtual void onNetwork();
|
||||||
virtual void onSimulation(RealTime rdt, SimTime sdt, SimTime idt);
|
virtual void onSimulation(RealTime rdt, SimTime sdt, SimTime idt);
|
||||||
virtual void onGraphics(RenderDevice* rd);
|
virtual void onGraphics(RenderDevice* rd);
|
||||||
virtual void onUserInput(UserInput* ui);
|
virtual void onUserInput(UserInput* ui);
|
||||||
virtual void onCleanup();
|
virtual void onCleanup();
|
||||||
|
|
||||||
std::vector<Instance*> getSelection();
|
std::vector<Instance*> getSelection();
|
||||||
void run();
|
void run();
|
||||||
|
|||||||
13
ErrorFunctions.cpp
Normal file
13
ErrorFunctions.cpp
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
#include "ErrorFunctions.h"
|
||||||
|
#include "Globals.h"
|
||||||
|
|
||||||
|
void OnError(int err, std::string msg)
|
||||||
|
{
|
||||||
|
//g_usableApp->window()->setInputCaptureCount(0);
|
||||||
|
//g_usableApp->window()->setMouseVisible(true);
|
||||||
|
std::string emsg = "An unexpected error has occured and "+g_PlaceholderName+" has to quit. We're sorry!" + msg;
|
||||||
|
std::string title = g_PlaceholderName+"Crash";
|
||||||
|
//clearInstances();
|
||||||
|
MessageBox(NULL, emsg.c_str(), title.c_str(), MB_OK);
|
||||||
|
exit(err);
|
||||||
|
}
|
||||||
3
ErrorFunctions.h
Normal file
3
ErrorFunctions.h
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
#include <string>
|
||||||
|
|
||||||
|
void OnError(int err, std::string msg = "");
|
||||||
40
GUDButtonListener.cpp
Normal file
40
GUDButtonListener.cpp
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
#include <G3DAll.h>
|
||||||
|
#include "Application.h"
|
||||||
|
#include "Globals.h"
|
||||||
|
#include "AudioPlayer.h"
|
||||||
|
#include "GUDButtonListener.h"
|
||||||
|
|
||||||
|
void GUDButtonListener::onButton1MouseClick(BaseButtonInstance* button)
|
||||||
|
{
|
||||||
|
bool cont = false;
|
||||||
|
for(size_t i = 0; i < g_selectedInstances.size(); i++)
|
||||||
|
if(g_selectedInstances.at(i)->canDelete)
|
||||||
|
{
|
||||||
|
cont = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if(cont)
|
||||||
|
{
|
||||||
|
AudioPlayer::playSound(dingSound);
|
||||||
|
if(button->name == "Duplicate")
|
||||||
|
{
|
||||||
|
std::vector<Instance*> newinst;
|
||||||
|
for(size_t i = 0; i < g_selectedInstances.size(); i++)
|
||||||
|
{
|
||||||
|
if(g_selectedInstances.at(i)->canDelete)
|
||||||
|
{
|
||||||
|
Instance* tempinst = g_selectedInstances.at(i);
|
||||||
|
|
||||||
|
Instance* clonedInstance = g_selectedInstances.at(i)->clone();
|
||||||
|
|
||||||
|
newinst.push_back(tempinst);
|
||||||
|
}
|
||||||
|
/*tempinst->setPosition(Vector3(tempPos.x, tempPos.y + tempSize.y, tempPos.z));
|
||||||
|
g_usableApp->cameraController.centerCamera(g_selectedInstances.at(0));*/
|
||||||
|
}
|
||||||
|
g_selectedInstances = newinst;
|
||||||
|
if(g_selectedInstances.size() > 0)
|
||||||
|
g_usableApp->_propWindow->UpdateSelected(newinst.at(0));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
6
GUDButtonListener.h
Normal file
6
GUDButtonListener.h
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
#include "ButtonListener.h"
|
||||||
|
|
||||||
|
class GUDButtonListener : public ButtonListener {
|
||||||
|
public:
|
||||||
|
void onButton1MouseClick(BaseButtonInstance*);
|
||||||
|
};
|
||||||
16
Globals.cpp
16
Globals.cpp
@@ -1,6 +1,6 @@
|
|||||||
#include "Globals.h"
|
#include "Globals.h"
|
||||||
|
#include "Application.h"
|
||||||
|
|
||||||
DataModelInstance* Globals::dataModel = NULL;
|
|
||||||
int const Globals::gen = 0;
|
int const Globals::gen = 0;
|
||||||
int const Globals::major = 0;
|
int const Globals::major = 0;
|
||||||
int const Globals::minor = 4;
|
int const Globals::minor = 4;
|
||||||
@@ -9,11 +9,23 @@ int Globals::surfaceId = 2;
|
|||||||
bool Globals::showMouse = true;
|
bool Globals::showMouse = true;
|
||||||
bool Globals::useMousePoint = false;
|
bool Globals::useMousePoint = false;
|
||||||
std::vector<Instance*> postRenderStack = std::vector<Instance*>();
|
std::vector<Instance*> postRenderStack = std::vector<Instance*>();
|
||||||
const std::string Globals::PlaceholderName = "Dynamica";
|
|
||||||
std::vector<Instance*> g_selectedInstances = std::vector<Instance*>();
|
std::vector<Instance*> g_selectedInstances = std::vector<Instance*>();
|
||||||
|
DataModelInstance* g_dataModel = NULL;
|
||||||
|
|
||||||
bool running = false;
|
bool running = false;
|
||||||
G3D::TextureRef Globals::surface;
|
G3D::TextureRef Globals::surface;
|
||||||
POINT Globals::mousepoint;
|
POINT Globals::mousepoint;
|
||||||
|
|
||||||
|
GFontRef fntdominant = NULL;
|
||||||
|
GFontRef fntlighttrek = NULL;
|
||||||
|
|
||||||
Globals::Globals(void){}
|
Globals::Globals(void){}
|
||||||
|
|
||||||
Globals::~Globals(void){}
|
Globals::~Globals(void){}
|
||||||
|
|
||||||
|
std::string cameraSound="";
|
||||||
|
std::string clickSound="";
|
||||||
|
std::string dingSound="";
|
||||||
|
|
||||||
|
Application *g_usableApp = NULL;
|
||||||
16
Globals.h
16
Globals.h
@@ -2,6 +2,8 @@
|
|||||||
#include "DataModelInstance.h"
|
#include "DataModelInstance.h"
|
||||||
#include <G3DAll.h>
|
#include <G3DAll.h>
|
||||||
|
|
||||||
|
class Application;
|
||||||
|
|
||||||
class Globals
|
class Globals
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -17,9 +19,19 @@ public:
|
|||||||
static const int patch;
|
static const int patch;
|
||||||
static G3D::TextureRef surface;
|
static G3D::TextureRef surface;
|
||||||
static int surfaceId;
|
static int surfaceId;
|
||||||
static const std::string PlaceholderName;
|
static const std::string g_PlaceholderName;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern std::vector<Instance*> postRenderStack;
|
extern std::vector<Instance*> postRenderStack;
|
||||||
extern std::vector<Instance*> g_selectedInstances;
|
extern std::vector<Instance*> g_selectedInstances;
|
||||||
extern bool running;
|
extern bool running;
|
||||||
|
extern DataModelInstance* g_dataModel;
|
||||||
|
extern Application* g_usableApp;
|
||||||
|
|
||||||
|
extern GFontRef fntdominant;
|
||||||
|
extern GFontRef fntlighttrek;
|
||||||
|
|
||||||
|
extern std::string cameraSound;
|
||||||
|
extern std::string clickSound;
|
||||||
|
extern std::string dingSound;
|
||||||
|
const std::string g_PlaceholderName = "HyperCube";
|
||||||
@@ -99,7 +99,7 @@ bool IEBrowser::navigateSyncURL(wchar_t* url)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MessageBox(NULL,"Cannot read IWebBrowser2...",(Globals::PlaceholderName+" Crash").c_str(),MB_OK);
|
MessageBox(NULL,"Cannot read IWebBrowser2...",(g_PlaceholderName+" Crash").c_str(),MB_OK);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "BaseButtonInstance.h"
|
#include "BaseButtonInstance.h"
|
||||||
|
|
||||||
|
class BaseButtonInstance;
|
||||||
|
|
||||||
class ImageButtonInstance : public BaseButtonInstance
|
class ImageButtonInstance : public BaseButtonInstance
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <G3DAll.h>
|
#include <G3DAll.h>
|
||||||
#include "propertyGrid.h"
|
#include "propertyGrid.h"
|
||||||
|
|
||||||
class Instance
|
class Instance
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|||||||
28
ModeSelectionListener.cpp
Normal file
28
ModeSelectionListener.cpp
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
#include "Globals.h"
|
||||||
|
#include "Instance.h"
|
||||||
|
#include "ModeSelectionListener.h"
|
||||||
|
#include "Application.h"
|
||||||
|
|
||||||
|
void ModeSelectionListener::onButton1MouseClick(BaseButtonInstance* button)
|
||||||
|
{
|
||||||
|
//CoordinateFrame frame = g_usableApp->g3dCamera.getCoordinateFrame();
|
||||||
|
int mode = g_usableApp->getMode();
|
||||||
|
|
||||||
|
std::vector<Instance*> instances_2D = g_dataModel->getGuiRoot()->getAllChildren();
|
||||||
|
for(size_t i = 0; i < instances_2D.size(); i++)
|
||||||
|
{
|
||||||
|
if(instances_2D.at(i)->name == "Cursor" || instances_2D.at(i)->name == "Resize" || instances_2D.at(i)->name == "Arrows")
|
||||||
|
{
|
||||||
|
BaseButtonInstance* button = (BaseButtonInstance*)instances_2D.at(i);
|
||||||
|
button->selected = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
button->selected = true;
|
||||||
|
if(button->name == "Cursor")
|
||||||
|
mode = CURSOR;
|
||||||
|
else if(button->name == "Resize")
|
||||||
|
mode = RESIZE;
|
||||||
|
else if(button->name == "Arrows")
|
||||||
|
mode = ARROWS;
|
||||||
|
}
|
||||||
10
ModeSelectionListener.h
Normal file
10
ModeSelectionListener.h
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
#include "ButtonListener.h"
|
||||||
|
|
||||||
|
#define CURSOR 0
|
||||||
|
#define ARROWS 1
|
||||||
|
#define RESIZE 2
|
||||||
|
|
||||||
|
class ModeSelectionListener : public ButtonListener {
|
||||||
|
public:
|
||||||
|
void onButton1MouseClick(BaseButtonInstance*);
|
||||||
|
};
|
||||||
20
RotateButtonListener.cpp
Normal file
20
RotateButtonListener.cpp
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
#include "RotateButtonListener.h"
|
||||||
|
#include "Globals.h"
|
||||||
|
#include "AudioPlayer.h"
|
||||||
|
|
||||||
|
void RotateButtonListener::onButton1MouseClick(BaseButtonInstance* button)
|
||||||
|
{
|
||||||
|
if(g_selectedInstances.size() > 0)
|
||||||
|
{
|
||||||
|
Instance* selectedInstance = g_selectedInstances.at(0);
|
||||||
|
AudioPlayer::playSound(clickSound);
|
||||||
|
if(PartInstance* part = dynamic_cast<PartInstance*>(selectedInstance))
|
||||||
|
{
|
||||||
|
if(button->name == "Tilt")
|
||||||
|
part->setCFrame(part->getCFrame()*Matrix3::fromEulerAnglesXYZ(0,0,toRadians(90)));
|
||||||
|
else if(button->name == "Rotate")
|
||||||
|
part->setCFrame(part->getCFrame()*Matrix3::fromEulerAnglesXYZ(0,toRadians(90),0));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
6
RotateButtonListener.h
Normal file
6
RotateButtonListener.h
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
#include "ButtonListener.h"
|
||||||
|
|
||||||
|
class RotateButtonListener : public ButtonListener {
|
||||||
|
public:
|
||||||
|
void onButton1MouseClick(BaseButtonInstance*);
|
||||||
|
};
|
||||||
31
StringFunctions.h
Normal file
31
StringFunctions.h
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
#include <string>
|
||||||
|
#include <sstream>
|
||||||
|
#include "ErrorFunctions.h"
|
||||||
|
|
||||||
|
std::string Convert (float number){
|
||||||
|
std::ostringstream buff;
|
||||||
|
buff<<number;
|
||||||
|
return buff.str();
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string ExePath() {
|
||||||
|
char buffer[MAX_PATH];
|
||||||
|
GetModuleFileName( NULL, buffer, MAX_PATH );
|
||||||
|
std::string::size_type pos = std::string( buffer ).find_last_of( "\\/" );
|
||||||
|
return std::string( buffer ).substr( 0, pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string GetFileInPath(std::string file)
|
||||||
|
{
|
||||||
|
std::string name = ExePath() + file;
|
||||||
|
struct stat buf;
|
||||||
|
if (stat(name.c_str(), &buf) != -1)
|
||||||
|
{
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
OnError(202, " \r\nFile not found: " + name);
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -2,3 +2,4 @@
|
|||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#define GetHoldKeyState(nVirtKey) (GetKeyState(nVirtKey)>>1)
|
#define GetHoldKeyState(nVirtKey) (GetKeyState(nVirtKey)>>1)
|
||||||
|
#define GetKPBool(nVirtKey) (GetKeyState(nVirtKey) & 0x8000)
|
||||||
|
|||||||
Reference in New Issue
Block a user