本文整理汇总了C++中Project::AddNode方法的典型用法代码示例。如果您正苦于以下问题:C++ Project::AddNode方法的具体用法?C++ Project::AddNode怎么用?C++ Project::AddNode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Project
的用法示例。
在下文中一共展示了Project::AddNode方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: run
bool Editor::run(IrrlichtDevice* irr_device, Configuration* conf,
bool editor_is_installed)
{
// Do Irrlicht Stuff
device = irr_device;
IVideoDriver *driver = device->getVideoDriver();
ISceneManager *smgr = device->getSceneManager();
IGUIEnvironment *guienv = device->getGUIEnvironment();
device->setEventReceiver(this);
device->setWindowCaption(L"Node Box Editor");
if (!conf->getBool("fullscreen")) {
device->setResizable(true);
}
// Project and state
Project *proj = new Project();
state = new EditorState(device, proj, conf);
state->isInstalled = editor_is_installed;
// Menu State
state->menu = new MenuState(state);
// Add editor modes
state->AddMode(new NBEditor(state));
state->AddMode(new NodeEditor(state));
state->AddMode(new TextureEditor(state));
// Set up project
proj->AddNode(state, true, false);
proj->media.debug();
// Load user interface
LoadScene();
state->SelectMode(0);
int LastX = driver->getScreenSize().Width;
if (!state->settings->getBool("hide_sidebar")) {
LastX -= 256;
}
int LastY = driver->getScreenSize().Height;
#ifdef _DEBUG
int lastFPS = -1;
#endif
bool dosleep = state->settings->getBool("use_sleep");
u32 last = std::clock();
double dtime = 0;
while (device->run()) {
if (state->NeedsClose()) {
device->closeDevice();
return true;
}
driver->beginScene(true, true, irr::video::SColor(255, 150, 150, 150));
int ResX = driver->getScreenSize().Width;
if (!state->settings->getBool("hide_sidebar"))
ResX -= 256;
int ResY = driver->getScreenSize().Height;
if (currentWindow == -1) {
bool newmoused = (state->mousedown && !click_handled);
viewportTick(VIEW_TL, rect<s32>(0, 0, ResX/2, ResY/2),
newmoused, !middle_click_handled);
viewportTick(VIEW_TR, rect<s32>(ResX/2, 0, ResX, ResY/2),
newmoused, !middle_click_handled);
viewportTick(VIEW_BL, rect<s32>(0, ResY/2, ResX/2, ResY ),
newmoused, !middle_click_handled);
viewportTick(VIEW_BR, rect<s32>(ResX/2, ResY/2, ResX, ResY ),
newmoused, !middle_click_handled);
// Draw separating lines
driver->setViewPort(rect<s32>(0, 0, driver->getScreenSize().Width,
driver->getScreenSize().Height));
driver->draw2DLine(vector2d<irr::s32>(0, ResY/2),
vector2d<irr::s32>(ResX, ResY/2), SColor(175,255,255,255));
driver->draw2DLine(vector2d<irr::s32>(0, ResY/2-1),
vector2d<irr::s32>(ResX, ResY/2-1), SColor(175,255,255,255));
driver->draw2DLine(vector2d<irr::s32>(ResX/2, 0),
vector2d<irr::s32>(ResX/2, ResY), SColor(175,255,255,255));
driver->draw2DLine(vector2d<irr::s32>(ResX/2+1, 0),
vector2d<irr::s32>(ResX/2+1, ResY), SColor(175,255,255,255));
} else if (camera[currentWindow]) {
viewportTick((Viewport)currentWindow, rect<s32>(0, 0, ResX, ResY),
(state->mousedown && !click_handled), !middle_click_handled);
}
if (state->menu) {
state->menu->draw(driver);
}
if (state->Mode()) {
state->Mode()->draw(driver);
}
if (state->project && state->project->GetCurrentNode()) {
vector3df pos = vector3df(
(f32)state->project->GetCurrentNode()->position.X,
//.........这里部分代码省略.........
示例2: run
bool Editor::run(IrrlichtDevice* irr_device,Configuration* conf){
// Do Irrlicht Stuff
_device = irr_device;
IVideoDriver* driver = GetDevice()->getVideoDriver();
ISceneManager* smgr = GetDevice()->getSceneManager();
IGUIEnvironment* guienv = GetDevice()->getGUIEnvironment();
GetDevice()->setEventReceiver(this);
if (!conf->getSettingAsBool("fullscreen"))
GetDevice()->setResizable(true);
// Project and state
Project* proj = new Project();
_state = new EditorState(GetDevice(),proj,conf);
// Menu State
MenuState* ms = new MenuState(GetState());
GetState()->SetMenu(ms);
// Add editor modes
GetState()->AddMode(new NBEditor(GetState()));
// Set up project
proj->AddNode(new Node(GetDevice(),GetState()));
proj->SelectNode(0);
// Load user interface
LoadScene();
GetState()->Menu()->init();
GetState()->Mode()->load();
printf("Complete!\n");
int LastX = driver->getScreenSize().Width;
if (!GetState()->Settings()->getSettingAsBool("hide_sidebar"))
LastX -= 256;
int LastY = driver->getScreenSize().Height;
int lastFPS = -1;
while (GetDevice()->run()){
if (GetState()->NeedsClose()){
GetDevice()->closeDevice();
return true;
}
driver->beginScene(true, true, irr::video::SColor(255,150,150,150));
int ResX = driver->getScreenSize().Width;
if (!GetState()->Settings()->getSettingAsBool("hide_sidebar"))
ResX -= 256;
int ResY = driver->getScreenSize().Height;
if (currentWindow == -1)
{
// Draw Camera 0
if (camera[0]){
smgr->setActiveCamera(camera[0]);
rect<s32> offset = rect<s32>(0,0,ResX/2,ResY/2);
driver->setViewPort(offset);
smgr->drawAll();
if (GetState()->Mode())
GetState()->Mode()->viewportTick(EVIEW_PERS, driver, offset);
}
// Draw Camera 1
if (camera[1]){
smgr->setActiveCamera(camera[1]);
rect<s32> offset = rect<s32>(ResX/2,0,ResX,ResY/2);
driver->setViewPort(offset);
smgr->drawAll();
if (GetState()->Mode())
GetState()->Mode()->viewportTick(EVIEW_XZ, driver, offset);
}
// Draw Camera 2
if (camera[2]){
smgr->setActiveCamera(camera[2]);
rect<s32> offset = rect<s32>(0,ResY/2,ResX/2,ResY);
driver->setViewPort(offset);
smgr->drawAll();
if (GetState()->Mode())
GetState()->Mode()->viewportTick(EVIEW_XY, driver, offset);
}
// Draw Camera 3
if (camera[3]){
smgr->setActiveCamera(camera[3]);
rect<s32> offset = rect<s32>(ResX/2,ResY/2,ResX,ResY);
driver->setViewPort(offset);
smgr->drawAll();
if (GetState()->Mode())
GetState()->Mode()->viewportTick(EVIEW_ZY, driver, offset);
}
// Draw GUI
driver->setViewPort(rect<s32>(0,0,driver->getScreenSize().Width,driver->getScreenSize().Height));
//.........这里部分代码省略.........
示例3: run
bool Editor::run(IrrlichtDevice* irr_device,Configuration* conf)
{
// Do Irrlicht Stuff
device = irr_device;
IVideoDriver *driver = device->getVideoDriver();
ISceneManager *smgr = device->getSceneManager();
IGUIEnvironment *guienv = device->getGUIEnvironment();
device->setEventReceiver(this);
device->setWindowCaption(L"Node Box Editor");
if (!conf->getBool("fullscreen")) {
device->setResizable(true);
}
// Project and state
Project *proj = new Project();
state = new EditorState(device, proj, conf);
// Menu State
state->menu = new MenuState(state);
// Add editor modes
state->AddMode(new NBEditor(state));
state->AddMode(new NodeEditor(state));
// Set up project
proj->AddNode(state, true, false);
// Load user interface
LoadScene();
state->SelectMode(0);
int LastX = driver->getScreenSize().Width;
if (!state->settings->getBool("hide_sidebar")) {
LastX -= 256;
}
int LastY = driver->getScreenSize().Height;
#ifdef _DEBUG
int lastFPS = -1;
#endif
bool dosleep = state->settings->getBool("use_sleep");
u32 last = std::clock();
double dtime = 0;
while (device->run()) {
if (state->NeedsClose()) {
device->closeDevice();
return true;
}
driver->beginScene(true, true, irr::video::SColor(255, 150, 150, 150));
int ResX = driver->getScreenSize().Width;
if (!state->settings->getBool("hide_sidebar"))
ResX -= 256;
int ResY = driver->getScreenSize().Height;
if (currentWindow == -1) {
// Draw Camera 0
if (camera[0]) {
smgr->setActiveCamera(camera[0]);
rect<s32> offset = rect<s32>(0, 0, ResX/2, ResY/2);
driver->setViewPort(offset);
smgr->drawAll();
if (state->Mode())
state->Mode()->viewportTick(VIEW_PERS, driver, offset);
}
// Draw Camera 1
if (camera[1]) {
smgr->setActiveCamera(camera[1]);
rect<s32> offset = rect<s32>(ResX/2, 0, ResX, ResY/2);
driver->setViewPort(offset);
smgr->drawAll();
if (state->Mode())
state->Mode()->viewportTick(VIEW_XZ, driver, offset);
}
// Draw Camera 2
if (camera[2]) {
smgr->setActiveCamera(camera[2]);
rect<s32> offset = rect<s32>(0, ResY/2, ResX/2, ResY);
driver->setViewPort(offset);
smgr->drawAll();
if (state->Mode())
state->Mode()->viewportTick(VIEW_XY, driver, offset);
}
// Draw Camera 3
if (camera[3]) {
smgr->setActiveCamera(camera[3]);
rect<s32> offset = rect<s32>(ResX/2, ResY/2, ResX, ResY);
driver->setViewPort(offset);
smgr->drawAll();
//.........这里部分代码省略.........