Add Debug features
parent
fe385fbb6d
commit
43237d85e9
|
@ -2,7 +2,8 @@
|
|||
bin
|
||||
|
||||
# Build system
|
||||
CMake*
|
||||
CMakeCache.txt
|
||||
CMakeFiles
|
||||
cmake*
|
||||
Makefile
|
||||
|
||||
|
|
|
@ -12,11 +12,17 @@ set(NBE_MAJOR_VERSION 0)
|
|||
set(NBE_MINOR_VERSION 8)
|
||||
set(NBE_PATCH_VERSION 1)
|
||||
set(NBE_DESCR_VERSION "0.8.1 - Glass")
|
||||
set(DEBUG "" CACHE BOOL "Is debug mode (optional)")
|
||||
if(DEBUG)
|
||||
message("-- Is debug")
|
||||
set(CMAKE_BUILD_TYPE debug)
|
||||
endif(DEBUG)
|
||||
configure_file(
|
||||
"${PROJECT_SOURCE_DIR}/src/conf_cmake.hpp.in"
|
||||
"${PROJECT_BINARY_DIR}/conf_cmake.hpp"
|
||||
)
|
||||
|
||||
|
||||
#
|
||||
# Source files
|
||||
#
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include "modes/NBEditor.hpp"
|
||||
#include "modes/TextureEditor.hpp"
|
||||
#include "modes/NodeEditor.hpp"
|
||||
#include "util/string.hpp"
|
||||
#include <ctime>
|
||||
#include <time.h>
|
||||
|
||||
|
@ -22,6 +23,22 @@ Editor::Editor() :
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
#include <sstream>
|
||||
void debugRenderINT(int id, IrrlichtDevice *device, std::string name, int content)
|
||||
{
|
||||
int ResX = device->getVideoDriver()->getScreenSize().Width;
|
||||
int ResY = device->getVideoDriver()->getScreenSize().Height;
|
||||
std::ostringstream os;
|
||||
os << name;
|
||||
os << ": ";
|
||||
os << content;
|
||||
device->getGUIEnvironment()->getSkin()->getFont()->
|
||||
draw(narrow_to_wide(os.str()).c_str(),
|
||||
rect<s32>(80, ResY - id*20 - 10, ResX - 200, ResY - id*20), SColor(255, 255, 255, 255));
|
||||
}
|
||||
#endif
|
||||
|
||||
bool Editor::run(IrrlichtDevice* irr_device, Configuration* conf,
|
||||
bool editor_is_installed)
|
||||
{
|
||||
|
@ -133,6 +150,12 @@ bool Editor::run(IrrlichtDevice* irr_device, Configuration* conf,
|
|||
if (state->menu->dialog)
|
||||
state->menu->dialog->draw(driver);
|
||||
|
||||
#ifdef _DEBUG
|
||||
debugRenderINT(1, device, "MaterialRenders", driver->getMaterialRendererCount());
|
||||
debugRenderINT(2, device, "Triangles", driver->getPrimitiveCountDrawn());
|
||||
debugRenderINT(3, device, "Textures", driver->getTextureCount());
|
||||
#endif
|
||||
|
||||
driver->endScene();
|
||||
|
||||
#ifdef _DEBUG
|
||||
|
|
|
@ -3,4 +3,8 @@
|
|||
|
||||
#define EDITOR_TEXT_VERSION "@NBE_DESCR_VERSION@"
|
||||
|
||||
#if @DEBUG@
|
||||
#define _DEBUG
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -27,6 +27,10 @@ int main(int argc, char *argv[]) {
|
|||
"|_| \\_|\\___/ \\__,_|\\___| |____/ \\___/_/\\_\\ |_____\\__,_|_|\\__\\___/|_| \n\n"
|
||||
<< std::endl;
|
||||
|
||||
#ifdef _DEBUG
|
||||
std::cerr << "Debug mode enabled!" << std::endl;
|
||||
#endif
|
||||
|
||||
|
||||
// Find the working directory
|
||||
bool editor_is_installed = false;
|
||||
|
|
Loading…
Reference in New Issue