studio window
This commit is contained in:
parent
15e6ae1c32
commit
d41e78045b
|
|
@ -5,7 +5,7 @@ project(player)
|
||||||
project(server)
|
project(server)
|
||||||
project(studio)
|
project(studio)
|
||||||
|
|
||||||
find_package(Qt6 REQUIRED COMPONENTS Core)
|
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets OpenGLWidgets)
|
||||||
find_package(Boost REQUIRED)
|
find_package(Boost REQUIRED)
|
||||||
qt_standard_project_setup()
|
qt_standard_project_setup()
|
||||||
|
|
||||||
|
|
@ -29,12 +29,15 @@ add_executable(server
|
||||||
)
|
)
|
||||||
|
|
||||||
qt_add_executable(studio
|
qt_add_executable(studio
|
||||||
|
src/client/studio/studiowindow.cpp
|
||||||
|
src/client/studio/studiowindow.hpp
|
||||||
src/client/studio/main.cpp
|
src/client/studio/main.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
target_include_directories(engine PUBLIC src/include)
|
target_include_directories(engine PUBLIC src/include)
|
||||||
target_link_libraries(engine PUBLIC ${BOOST_LIBRARIES})
|
target_link_libraries(engine PUBLIC ${BOOST_LIBRARIES})
|
||||||
|
|
||||||
target_link_libraries(player PRIVATE Qt6::Core engine)
|
set(QT6_LIBRARIES_INCL Qt6::Core Qt6::Gui Qt6::Widgets Qt6::OpenGLWidgets)
|
||||||
target_link_libraries(studio PRIVATE Qt6::Core engine)
|
target_link_libraries(player PRIVATE ${QT6_LIBRARIES_INCL} engine)
|
||||||
|
target_link_libraries(studio PRIVATE ${QT6_LIBRARIES_INCL} engine)
|
||||||
target_link_libraries(server PRIVATE engine)
|
target_link_libraries(server PRIVATE engine)
|
||||||
|
|
@ -1,6 +1,14 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
int main()
|
#include <QApplication>
|
||||||
|
#include "studiowindow.hpp"
|
||||||
|
|
||||||
|
int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
printf("Hello world!");
|
QApplication a(argc, argv);
|
||||||
|
StudioWindow window = StudioWindow();
|
||||||
|
|
||||||
|
window.show();
|
||||||
|
|
||||||
|
return a.exec();
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
#include "studiowindow.hpp"
|
||||||
|
|
||||||
|
StudioWindow::StudioWindow()
|
||||||
|
{
|
||||||
|
setWindowTitle(QString("RBXNu Studio"));
|
||||||
|
setWindowIcon(QIcon(":/content/images/icon.png"));
|
||||||
|
|
||||||
|
studio_graphic_timer.start();
|
||||||
|
}
|
||||||
|
|
||||||
|
void StudioWindow::closeEvent(QCloseEvent* event)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
#ifndef __CLIENT_STUDIO_STUDIOWINDOW_HPP__
|
||||||
|
#define __CLIENT_STUDIO_STUDIOWINDOW_HPP__
|
||||||
|
|
||||||
|
#include <QMainWindow>
|
||||||
|
#include <QOpenGLWidget>
|
||||||
|
|
||||||
|
class StudioWindow : public QMainWindow
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
StudioWindow();
|
||||||
|
protected:
|
||||||
|
void closeEvent(QCloseEvent* event);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
#include <engine/app/v8/tree/Instance.hpp>
|
#include <engine/app/v8/tree/Instance.hpp>
|
||||||
|
#include <stdexcept>
|
||||||
|
|
||||||
RBX::Instance::Instance()
|
RBX::Instance::Instance()
|
||||||
{
|
{
|
||||||
|
|
@ -37,9 +38,9 @@ bool RBX::Instance::askAddChild(RBX::Instance* instance)
|
||||||
|
|
||||||
bool RBX::Instance::canAddChild(RBX::Instance* instance)
|
bool RBX::Instance::canAddChild(RBX::Instance* instance)
|
||||||
{
|
{
|
||||||
if(instance->contains(this) || instance->parent == this)
|
if(instance->contains(this) || instance->m_parent == this)
|
||||||
return false;
|
return false;
|
||||||
if(askAddC hild(instance))
|
if(askAddChild(instance))
|
||||||
return true;
|
return true;
|
||||||
return instance->askSetParent(this);
|
return instance->askSetParent(this);
|
||||||
}
|
}
|
||||||
|
|
@ -57,19 +58,22 @@ void RBX::Instance::setParent(RBX::Instance* newParent)
|
||||||
{
|
{
|
||||||
if(newParent != m_parent)
|
if(newParent != m_parent)
|
||||||
{
|
{
|
||||||
|
char error_text[255];
|
||||||
if(this == newParent)
|
if(this == newParent)
|
||||||
{
|
{
|
||||||
throw std::runtime_error("Attempt to set %s as its own parent", m_name);
|
snprintf(error_text, 255, "Attempt to set %s as its own parent", m_name);
|
||||||
|
throw std::runtime_error(error_text);
|
||||||
}
|
}
|
||||||
if(isAncestorOf(newParent))
|
if(isAncestorOf(newParent))
|
||||||
{
|
{
|
||||||
throw std::runtime_error("Attempt to set parent of %s to %s results in circular reference", newParent->getName(), m_name);
|
snprintf(error_text, 255, "Attempt to set parent of %s to %s results in circular reference", newParent->getName(), m_name);
|
||||||
|
throw std::runtime_error(error_text);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(m_parent)
|
if(m_parent)
|
||||||
{
|
{
|
||||||
std::vector<boost::shared_ptr<RBX::Instance>>* children = m_parent->getChildren();
|
std::vector<boost::shared_ptr<RBX::Instance>>* children = m_parent->getChildren();
|
||||||
auto child_it = std::find(children->begin(), children->end(), this);
|
auto child_it = std::find(children->begin(), children->end(), (boost::shared_ptr<RBX::Instance>)this);
|
||||||
if(child_it != children->end())
|
if(child_it != children->end())
|
||||||
children->erase(child_it);
|
children->erase(child_it);
|
||||||
if(m_parent->numChildren() == 0)
|
if(m_parent->numChildren() == 0)
|
||||||
|
|
@ -79,7 +83,7 @@ void RBX::Instance::setParent(RBX::Instance* newParent)
|
||||||
}
|
}
|
||||||
|
|
||||||
m_parent = newParent;
|
m_parent = newParent;
|
||||||
m_parent->children.push_back(this);
|
m_parent->m_children.push_back((boost::shared_ptr<RBX::Instance>)this);
|
||||||
newParent->onChildAdded(this);
|
newParent->onChildAdded(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ namespace RBX
|
||||||
bool m_archivable;
|
bool m_archivable;
|
||||||
public:
|
public:
|
||||||
Instance();
|
Instance();
|
||||||
Instance(char* name);
|
Instance(std::string name);
|
||||||
|
|
||||||
bool contains(RBX::Instance* child);
|
bool contains(RBX::Instance* child);
|
||||||
bool isAncestorOf(RBX::Instance* instance);
|
bool isAncestorOf(RBX::Instance* instance);
|
||||||
|
|
@ -29,12 +29,12 @@ namespace RBX
|
||||||
void createChild(boost::shared_ptr<RBX::Instance>* result, const RBX::Name *className);
|
void createChild(boost::shared_ptr<RBX::Instance>* result, const RBX::Name *className);
|
||||||
|
|
||||||
RBX::Instance* getParent() { return this->m_parent; };
|
RBX::Instance* getParent() { return this->m_parent; };
|
||||||
std::string getName() { return this->m_name };
|
std::string getName() { return this->m_name; };
|
||||||
|
|
||||||
void setParent(RBX::Instance* newParent);
|
void setParent(RBX::Instance* newParent);
|
||||||
void setName(std::string name);
|
void setName(std::string name);
|
||||||
std::vector<boost::shared_ptr<RBX::Instance>>* getChildren() { return &this->m_children; };
|
std::vector<boost::shared_ptr<RBX::Instance>>* getChildren() { return &this->m_children; };
|
||||||
int numChildren() { return this->m_children.size() };
|
int numChildren() { return this->m_children.size(); };
|
||||||
|
|
||||||
void onChildAdded(RBX::Instance* childAdded);
|
void onChildAdded(RBX::Instance* childAdded);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue