| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- #include "CmEditorWindow.h"
- #include "CmRenderWindow.h"
- #include "CmApplication.h"
- #include "CmSceneObject.h"
- #include "CmCursor.h"
- #include "BsGUIManager.h"
- #include "BsGUIWidget.h"
- #include "BsGUILabel.h"
- #include "BsGUISkin.h"
- #include "BsOverlayManager.h"
- #include "BsCamera.h"
- #include "BsUpdateCallback.h"
- #include "BsEngineGUI.h"
- using namespace CamelotFramework;
- using namespace BansheeEngine;
- namespace BansheeEditor
- {
- EditorWindow::EditorWindow(const String& name)
- {
- RENDER_WINDOW_DESC renderWindowDesc;
- renderWindowDesc.width = 200;
- renderWindowDesc.height = 200;
- renderWindowDesc.title = "EditorWindow";
- renderWindowDesc.fullscreen = false;
- renderWindowDesc.border = WindowBorder::None;
- renderWindowDesc.toolWindow = true;
- mRenderWindow = RenderWindow::create(renderWindowDesc, gApplication().getPrimaryWindow());
- HSceneObject so = SceneObject::create("EditorWindow-" + name);
- GameObjectHandle<UpdateCallback> updateCallback = so->addComponent<UpdateCallback>();
- updateCallback->onUpdate.connect(boost::bind(&EditorWindow::update, this));
- HCamera camera = so->addComponent<Camera>();
- camera->initialize(mRenderWindow, 0.0f, 0.0f, 1.0f, 1.0f, 0);
- camera->setNearClipDistance(5);
- camera->setAspectRatio(1.0f);
- camera->setIgnoreSceneRenderables(true);
- mGUI = so->addComponent<GUIWidget>();
- mGUI->initialize(camera->getViewport().get(), mRenderWindow.get());
- //// DEBUG
- mGUI->setSkin(&EngineGUI::instance().getSkin());
- mDbgLabel = GUILabel::create(mGUI.get(), "Testing test", renderWindowDesc.width);
- }
- EditorWindow::~EditorWindow()
- {
- mRenderWindow->destroy();
- }
- void EditorWindow::update()
- {
- Int2 cursorPos = Cursor::getWindowPosition(*mRenderWindow);
-
- mDbgLabel->setText(toString(mDbgLabel->getBounds().x) + ", " + toString(mDbgLabel->getBounds().y) + ", " +
- toString(mDbgLabel->getBounds().width) + " - " + toString(mDbgLabel->getBounds().height));
- }
- }
|