V
Hab mir auch mal ein GUI Framework gebastelt:
#include "VertexwahnLib.h"
using namespace Vertexwahn::GUI;
#define ORTHOGONAL_CAMERA_DISTANCE 900.0
#define ORTHOGONAL_CAMERA_NEAR_CLIP 300.0
#define ORTHOGONAL_CAMERA_FAR_CLIP 5000.0
class MyApplication : public Vertexwahn::Application::EventDriven
{
public:
MyApplication() : MyWindow(L"World Editor"),
m_Ogre3DWidget1(10,10,200,200), m_Ogre3DWidget2(340,10,200,200),
m_Ogre3DWidget3(10,220,200,200), m_Ogre3DWidget4(340,220,200,200),
tableLayout(0,0,400,400,2,2)
{
MyWindow.setDefaultCloseOperation(Vertexwahn::GUI::Window::EXIT_ON_CLOSE);
tableLayout.add(&m_Ogre3DWidget1,0,0);
tableLayout.add(&m_Ogre3DWidget2,0,1);
tableLayout.add(&m_Ogre3DWidget3,1,0);
tableLayout.add(&m_Ogre3DWidget4,1,1);
tableLayout.m_ColumnWidthInPercentage.push_back(50);
tableLayout.m_ColumnWidthInPercentage.push_back(50);
tableLayout.m_RowHeightInPercentage.push_back(50);
tableLayout.m_RowHeightInPercentage.push_back(50);
tableLayout.setAnchor(RIGHT | LEFT | TOP |BOTTOM);
MyWindow.setSize(600, 600);
MyWindow.add(&tableLayout);
// Position and orient the cameras
m_Ogre3DWidget1.getCamera()->setProjectionType(Ogre::PT_ORTHOGRAPHIC);
m_Ogre3DWidget1.getCamera()->setFixedYawAxis(false);
m_Ogre3DWidget1.getCamera()->setPosition(ORTHOGONAL_CAMERA_DISTANCE * Ogre::Vector3::UNIT_Y);
m_Ogre3DWidget1.getCamera()->setDirection(Ogre::Vector3::NEGATIVE_UNIT_Y);
m_Ogre3DWidget1.getCamera()->setNearClipDistance(ORTHOGONAL_CAMERA_NEAR_CLIP);
m_Ogre3DWidget1.getCamera()->setFarClipDistance(ORTHOGONAL_CAMERA_FAR_CLIP);
m_Ogre3DWidget1.getCamera()->setPolygonMode(Ogre::PM_WIREFRAME);
m_Ogre3DWidget1.getCamera()->setAutoAspectRatio(true);
m_Ogre3DWidget2.getCamera()->setProjectionType(Ogre::PT_ORTHOGRAPHIC);
m_Ogre3DWidget2.getCamera()->setFixedYawAxis(false);
m_Ogre3DWidget2.getCamera()->setPosition(ORTHOGONAL_CAMERA_DISTANCE * Ogre::Vector3::NEGATIVE_UNIT_X);
m_Ogre3DWidget2.getCamera()->setDirection(Ogre::Vector3::UNIT_X);
m_Ogre3DWidget2.getCamera()->setNearClipDistance(ORTHOGONAL_CAMERA_NEAR_CLIP);
m_Ogre3DWidget2.getCamera()->setFarClipDistance(ORTHOGONAL_CAMERA_FAR_CLIP);
m_Ogre3DWidget2.getCamera()->setPolygonMode(Ogre::PM_WIREFRAME);
m_Ogre3DWidget3.getCamera()->setProjectionType(Ogre::PT_ORTHOGRAPHIC);
m_Ogre3DWidget3.getCamera()->setFixedYawAxis(false);
m_Ogre3DWidget3.getCamera()->setPosition(ORTHOGONAL_CAMERA_DISTANCE * Ogre::Vector3::UNIT_Z);
m_Ogre3DWidget3.getCamera()->setDirection(Ogre::Vector3::NEGATIVE_UNIT_Z);
m_Ogre3DWidget3.getCamera()->setNearClipDistance(ORTHOGONAL_CAMERA_NEAR_CLIP);
m_Ogre3DWidget3.getCamera()->setFarClipDistance(ORTHOGONAL_CAMERA_FAR_CLIP);
m_Ogre3DWidget3.getCamera()->setPolygonMode(Ogre::PM_WIREFRAME);
m_Ogre3DWidget4.getCamera()->setPosition(-55.0, 40.0, 140.0);
m_Ogre3DWidget4.getCamera()->lookAt(-10.0, 20.0, 5.0);
m_Ogre3DWidget4.getCamera()->setNearClipDistance(5.0);
m_Ogre3DWidget4.getCamera()->setFarClipDistance(5000.0);
m_Ogre3DWidget4.getCamera()->setAutoAspectRatio(true);
MyWindow.show();
}
private:
Window MyWindow;
Vertexwahn::GUI::TableLayout tableLayout;
Ogre3DWidget m_Ogre3DWidget1;
Ogre3DWidget m_Ogre3DWidget2;
Ogre3DWidget m_Ogre3DWidget3;
Ogre3DWidget m_Ogre3DWidget4;
};
Hier ein Screenshot
http://loop.servehttp.com/~vertexwahn/uploads/editor3.PNG
Problem hierbei ist halt das ich ein eigenes Framework entwickelt habe, das nur ich kenne - hätte ich jetzt z. B. Qt verwendet oder GTK++ oder ein bekanntes anderes GUI Framework, dann hätten es andere Entwickler nicht so schwer sich in meinem Code zurecht zu finden. Außerdem stecken bestimmt noch einige Bugs im Framework, die Größtenteils nur durch mich gefixt werden können, da ich das Detailwissen habe - das lenkt mich von meinem eigentlichen Vorhaben noch weiter ab und es kostet mich Stunden ein Steuerelement wie eine TreeView Control zu integrieren. Naja - die WinAPI zu wrappern ist nicht immer die beste Lösung...