Reorganisation. Remove installed from configuration to state->isInstalled
parent
5729100f56
commit
f1f6f54fda
|
@ -8,10 +8,12 @@ Makefile
|
|||
|
||||
# Configuration/generated
|
||||
editor.conf
|
||||
debug.txt
|
||||
conf_cmake.hpp
|
||||
install_manifest.txt
|
||||
*.nbe
|
||||
*.lua
|
||||
*.obj
|
||||
|
||||
#################
|
||||
## Eclipse
|
||||
|
@ -21,22 +23,6 @@ install_manifest.txt
|
|||
build
|
||||
Build
|
||||
|
||||
*.pydevproject
|
||||
.project
|
||||
.metadata
|
||||
tmp/
|
||||
*.tmp
|
||||
*.bak
|
||||
*.swp
|
||||
*~.nib
|
||||
local.properties
|
||||
.classpath
|
||||
.settings/
|
||||
.loadpath
|
||||
|
||||
# External tool builders
|
||||
.externalToolBuilders/
|
||||
|
||||
# Locally stored "Eclipse launch configurations"
|
||||
*.launch
|
||||
|
||||
|
@ -144,25 +130,6 @@ Thumbs.db
|
|||
# Folder config file
|
||||
Desktop.ini
|
||||
|
||||
|
||||
#############
|
||||
## Python
|
||||
#############
|
||||
|
||||
*.py[co]
|
||||
|
||||
# Packages
|
||||
*.egg
|
||||
*.egg-info
|
||||
dist
|
||||
build
|
||||
eggs
|
||||
parts
|
||||
var
|
||||
sdist
|
||||
develop-eggs
|
||||
.installed.cfg
|
||||
|
||||
# Installer logs
|
||||
pip-log.txt
|
||||
|
||||
|
|
|
@ -1,30 +1,26 @@
|
|||
#
|
||||
# Set up project
|
||||
#
|
||||
cmake_minimum_required(VERSION 2.6)
|
||||
project(NodeBoxEditor)
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/")
|
||||
|
||||
#
|
||||
# Configuration
|
||||
#
|
||||
set(NBE_MAJOR_VERSION 0)
|
||||
set(NBE_MINOR_VERSION 7)
|
||||
set(NBE_PATCH_VERSION 0)
|
||||
set(NBE_DESCR_VERSION "\"0.7 - Iron\"")
|
||||
configure_file (
|
||||
configure_file(
|
||||
src/conf_cmake.hpp.in
|
||||
src/conf_cmake.hpp
|
||||
)
|
||||
|
||||
# Dependancies
|
||||
find_package(Irrlicht REQUIRED)
|
||||
find_package(ZLIB REQUIRED)
|
||||
find_package(X11 REQUIRED)
|
||||
find_package(OpenGL REQUIRED)
|
||||
find_package(JPEG REQUIRED)
|
||||
find_package(BZip2 REQUIRED)
|
||||
find_package(PNG REQUIRED)
|
||||
find_library(XXF86VM_LIBRARY Xxf86vm)
|
||||
|
||||
#
|
||||
# Source files
|
||||
set(NBGEN_SRC
|
||||
#
|
||||
set(NBE_SRC
|
||||
src/main.cpp
|
||||
src/Configuration.cpp
|
||||
src/GUIHelpers.cpp
|
||||
|
@ -53,8 +49,18 @@ set(NBGEN_SRC
|
|||
src/util/SimpleFileCombiner.cpp
|
||||
src/util/tinyfiledialogs.c
|
||||
)
|
||||
add_executable(${PROJECT_NAME} ${NBE_SRC})
|
||||
|
||||
# Include Directories
|
||||
#
|
||||
# Dependencies
|
||||
#
|
||||
find_package(Irrlicht REQUIRED)
|
||||
find_package(ZLIB REQUIRED)
|
||||
find_package(X11 REQUIRED)
|
||||
find_package(OpenGL REQUIRED)
|
||||
find_package(JPEG REQUIRED)
|
||||
find_package(BZip2 REQUIRED)
|
||||
find_package(PNG REQUIRED)
|
||||
include_directories(
|
||||
${PROJECT_BINARY_DIR}
|
||||
${IRRLICHT_INCLUDE_DIR}
|
||||
|
@ -64,11 +70,7 @@ include_directories(
|
|||
${OPENGL_INCLUDE_DIR}
|
||||
${PNG_INCLUDE_DIR}
|
||||
)
|
||||
|
||||
add_executable(${PROJECT_NAME} ${NBGEN_SRC})
|
||||
|
||||
target_link_libraries(
|
||||
${PROJECT_NAME}
|
||||
set(TLL
|
||||
${IRRLICHT_LIBRARY}
|
||||
${ZLIB_LIBRARIES}
|
||||
${X11_LIBRARIES}
|
||||
|
@ -76,38 +78,54 @@ target_link_libraries(
|
|||
${JPEG_LIBRARIES}
|
||||
${BZIP2_LIBRARIES}
|
||||
${PNG_LIBRARIES}
|
||||
${XXF86VM_LIBRARY}
|
||||
)
|
||||
if(UNIX)
|
||||
find_library(XXF86VM_LIBRARY Xxf86vm)
|
||||
target_link_libraries(
|
||||
${PROJECT_NAME}
|
||||
${TLL}
|
||||
${XXF86VM_LIBRARY}
|
||||
)
|
||||
else()
|
||||
target_link_libraries(
|
||||
${PROJECT_NAME}
|
||||
${TLL}
|
||||
)
|
||||
endif(UNIX)
|
||||
|
||||
#
|
||||
# Executable
|
||||
#
|
||||
file(MAKE_DIRECTORY "bin")
|
||||
|
||||
SET(CMAKE_CXX_FLAGS
|
||||
"${CMAKE_CXX_FLAGS} -pthread")
|
||||
|
||||
set_target_properties(${PROJECT_NAME}
|
||||
PROPERTIES
|
||||
OUTPUT_NAME bin/nodeboxeditor
|
||||
)
|
||||
|
||||
# Install DLLs
|
||||
install (FILES media/fontlucida.png DESTINATION share/nodeboxeditor/media)
|
||||
install (FILES media/gui_scale.png DESTINATION share/nodeboxeditor/media)
|
||||
install (FILES media/coordinates.png DESTINATION share/nodeboxeditor/media)
|
||||
install (FILES media/icon_mode_node.png DESTINATION share/nodeboxeditor/media)
|
||||
install (FILES media/icon_mode_nodebox.png DESTINATION share/nodeboxeditor/media)
|
||||
install (FILES media/icon_mode_texture.png DESTINATION share/nodeboxeditor/media)
|
||||
install (FILES media/sky.jpg DESTINATION share/nodeboxeditor/media)
|
||||
install (FILES media/texture_box.png DESTINATION share/nodeboxeditor/media)
|
||||
install (FILES media/texture_terrain.png DESTINATION share/nodeboxeditor/media)
|
||||
install (FILES media/icon.png DESTINATION share/nodeboxeditor/media)
|
||||
install (FILES media/rotate_x.png DESTINATION share/nodeboxeditor/media)
|
||||
install (FILES media/rotate_y.png DESTINATION share/nodeboxeditor/media)
|
||||
install (FILES media/rotate_z.png DESTINATION share/nodeboxeditor/media)
|
||||
install (FILES editor.conf.example DESTINATION share/nodeboxeditor)
|
||||
install (FILES nodeboxeditor.desktop DESTINATION ~/.local/share/applications)
|
||||
install (FILES README.md DESTINATION share/nodeboxeditor)
|
||||
install (TARGETS ${PROJECT_NAME} DESTINATION bin)
|
||||
|
||||
#
|
||||
# Installation
|
||||
#
|
||||
install(FILES media/fontlucida.png DESTINATION share/nodeboxeditor/media)
|
||||
install(FILES media/gui_scale.png DESTINATION share/nodeboxeditor/media)
|
||||
install(FILES media/coordinates.png DESTINATION share/nodeboxeditor/media)
|
||||
install(FILES media/icon_mode_node.png DESTINATION share/nodeboxeditor/media)
|
||||
install(FILES media/icon_mode_nodebox.png DESTINATION share/nodeboxeditor/media)
|
||||
install(FILES media/icon_mode_texture.png DESTINATION share/nodeboxeditor/media)
|
||||
install(FILES media/sky.jpg DESTINATION share/nodeboxeditor/media)
|
||||
install(FILES media/texture_box.png DESTINATION share/nodeboxeditor/media)
|
||||
install(FILES media/texture_terrain.png DESTINATION share/nodeboxeditor/media)
|
||||
install(FILES media/icon.png DESTINATION share/nodeboxeditor/media)
|
||||
install(FILES media/rotate_x.png DESTINATION share/nodeboxeditor/media)
|
||||
install(FILES media/rotate_y.png DESTINATION share/nodeboxeditor/media)
|
||||
install(FILES media/rotate_z.png DESTINATION share/nodeboxeditor/media)
|
||||
install(FILES editor.conf.example DESTINATION share/nodeboxeditor)
|
||||
if(UNIX)
|
||||
install (FILES nodeboxeditor.desktop DESTINATION ~/.local/share/applications)
|
||||
endif()
|
||||
install(FILES README.md DESTINATION share/nodeboxeditor)
|
||||
install(TARGETS ${PROJECT_NAME} DESTINATION bin)
|
||||
if(WIN32)
|
||||
if(DEFINED IRRLICHT_DLL)
|
||||
install(FILES ${IRRLICHT_DLL} DESTINATION bin)
|
||||
|
|
|
@ -41,7 +41,7 @@ void drawCoord(IGUIFont* font, IVideoDriver *driver, unsigned int x, unsigned in
|
|||
);
|
||||
}
|
||||
|
||||
bool Editor::run(IrrlichtDevice* irr_device,Configuration* conf)
|
||||
bool Editor::run(IrrlichtDevice* irr_device, Configuration* conf, bool editor_is_installed)
|
||||
{
|
||||
// Do Irrlicht Stuff
|
||||
device = irr_device;
|
||||
|
@ -58,6 +58,7 @@ bool Editor::run(IrrlichtDevice* irr_device,Configuration* conf)
|
|||
// 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);
|
||||
|
|
|
@ -9,7 +9,7 @@ class Editor : public IEventReceiver
|
|||
{
|
||||
public:
|
||||
Editor();
|
||||
bool run(IrrlichtDevice *irr_device, Configuration *conf);
|
||||
bool run(IrrlichtDevice *irr_device, Configuration *conf, bool editor_is_installed);
|
||||
virtual bool OnEvent(const SEvent &event);
|
||||
|
||||
EditorState *state;
|
||||
|
|
|
@ -56,6 +56,8 @@ public:
|
|||
MenuState *menu;
|
||||
|
||||
ViewportType getViewportType(Viewport id);
|
||||
|
||||
bool isInstalled;
|
||||
private:
|
||||
int currentmode;
|
||||
EditorMode *modes[5];
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
Project *NBEFileFormat::read(const std::string &filename, Project *project)
|
||||
{
|
||||
std::string tmpdir = getTmpDirectory(state->settings->getBool("installed"));
|
||||
std::string tmpdir = getTmpDirectory(state->isInstalled);
|
||||
if (!CreateDir(tmpdir)) {
|
||||
error_code = EFFE_IO_ERROR;
|
||||
return NULL;
|
||||
|
@ -52,7 +52,7 @@ Project *NBEFileFormat::read(const std::string &filename, Project *project)
|
|||
|
||||
bool NBEFileFormat::write(Project *project, const std::string &filename)
|
||||
{
|
||||
std::string tmpdir = getTmpDirectory(state->settings->getBool("installed"));
|
||||
std::string tmpdir = getTmpDirectory(state->isInstalled);
|
||||
if (!CreateDir(tmpdir)) {
|
||||
error_code = EFFE_IO_ERROR;
|
||||
return false;
|
||||
|
|
|
@ -148,7 +148,7 @@ bool MenuState::OnEvent(const SEvent& event){
|
|||
return true;
|
||||
case GUI_FILE_RUN_IN_MINETEST: {
|
||||
Minetest mt(state->settings);
|
||||
if (!mt.findMinetest()) {
|
||||
if (!mt.findMinetest(state->isInstalled)) {
|
||||
state->device->getGUIEnvironment()->addMessageBox(L"Unable to find Minetest",
|
||||
L"Minetest could not be found by NBE.\n\t(try setting 'minetest_root' in editor.conf)");
|
||||
return true;
|
||||
|
@ -225,7 +225,7 @@ bool MenuState::OnEvent(const SEvent& event){
|
|||
NBEFileFormat writer(state);
|
||||
|
||||
// Get directory to save to
|
||||
std::string dir = getSaveLoadDirectory(state->settings->get("save_directory"), state->settings->getBool("installed"));
|
||||
std::string dir = getSaveLoadDirectory(state->settings->get("save_directory"), state->isInstalled);
|
||||
|
||||
std::cerr << "Saving to " << dir + "exit." << std::endl;
|
||||
if (!writer.write(state->project, dir + "exit.nbe"))
|
||||
|
|
|
@ -7,7 +7,8 @@
|
|||
|
||||
void FileDialog_open_project(EditorState *state)
|
||||
{
|
||||
std::string path = getSaveLoadDirectory(state->settings->get("save_directory"), state->settings->getBool("installed"));
|
||||
std::string path = getSaveLoadDirectory(state->settings->get("save_directory"),
|
||||
state->isInstalled);
|
||||
|
||||
const char* filters[] = {"*.nbe"};
|
||||
const char *cfile = tinyfd_openFileDialog("Open Project",
|
||||
|
@ -79,7 +80,7 @@ void FileDialog_open_project(EditorState *state)
|
|||
void FileDialog_import(EditorState *state)
|
||||
{
|
||||
std::string path = getSaveLoadDirectory(state->settings->get("save_directory"),
|
||||
state->settings->getBool("installed"));
|
||||
state->isInstalled);
|
||||
|
||||
const char* filters[] = {"*.nbe"};
|
||||
const char *cfile = tinyfd_openFileDialog("Import Nodes",
|
||||
|
@ -144,7 +145,8 @@ void FileDialog_import(EditorState *state)
|
|||
void FileDialog_save_project(EditorState *state)
|
||||
{
|
||||
// Get path
|
||||
std::string path = getSaveLoadDirectory(state->settings->get("save_directory"), state->settings->getBool("installed"));
|
||||
std::string path = getSaveLoadDirectory(state->settings->get("save_directory"),
|
||||
state->isInstalled);
|
||||
|
||||
const char* filters[] = {"*.nbe"};
|
||||
std::string file = tinyfd_saveFileDialog("Save Project", path.c_str(),
|
||||
|
@ -161,7 +163,8 @@ void FileDialog_save_project(EditorState *state)
|
|||
void FileDialog_export(EditorState *state, int parser)
|
||||
{
|
||||
// Get path
|
||||
std::string path = getSaveLoadDirectory(state->settings->get("save_directory"), state->settings->getBool("installed"));
|
||||
std::string path = getSaveLoadDirectory(state->settings->get("save_directory"),
|
||||
state->isInstalled);
|
||||
|
||||
const char* filters[] = {""};
|
||||
|
||||
|
@ -187,7 +190,8 @@ void FileDialog_export(EditorState *state, int parser)
|
|||
void FileDialog_export_obj(EditorState *state, Node *node)
|
||||
{
|
||||
// Get path
|
||||
std::string path = getSaveLoadDirectory(state->settings->get("save_directory"), state->settings->getBool("installed"));
|
||||
std::string path = getSaveLoadDirectory(state->settings->get("save_directory"),
|
||||
state->isInstalled);
|
||||
|
||||
const char* filters[] = {"*.obj"};
|
||||
|
||||
|
@ -207,7 +211,7 @@ void FileDialog_export_obj(EditorState *state, Node *node)
|
|||
void FileDialog_export_mod(EditorState *state)
|
||||
{
|
||||
std::string path = getSaveLoadDirectory(state->settings->get("save_directory"),
|
||||
state->settings->getBool("installed"));
|
||||
state->isInstalled);
|
||||
|
||||
const char *cdir = tinyfd_selectFolderDialog ("Select Folder", path.c_str());
|
||||
|
||||
|
@ -229,7 +233,7 @@ void FileDialog_export_mod(EditorState *state)
|
|||
void FileDialog_export_textures(EditorState *state)
|
||||
{
|
||||
std::string path = getSaveLoadDirectory(state->settings->get("save_directory"),
|
||||
state->settings->getBool("installed"));
|
||||
state->isInstalled);
|
||||
|
||||
const char *cdir = tinyfd_selectFolderDialog ("Select Folder", path.c_str());
|
||||
|
||||
|
|
|
@ -83,7 +83,7 @@ bool ImageDialog::OnEvent(const SEvent &event)
|
|||
if (event.GUIEvent.EventType == EGET_BUTTON_CLICKED) {
|
||||
if (event.GUIEvent.Caller->getID() == EID_GUI_ID_BROWSE) {
|
||||
std::string path = getSaveLoadDirectory(state->settings->get("save_directory"),
|
||||
state->settings->getBool("installed"));
|
||||
state->isInstalled);
|
||||
const char* filters[] = {"*.png", "*.jpg", "*.gif", "*.jpeg"};
|
||||
const char *cfile = tinyfd_openFileDialog("Select Image",
|
||||
path.c_str(), 1, filters, 0);
|
||||
|
|
|
@ -202,7 +202,7 @@ bool TextureDialog::OnEvent(const SEvent &event)
|
|||
return true;
|
||||
|
||||
std::string path = getSaveLoadDirectory(state->settings->get("save_directory"),
|
||||
state->settings->getBool("installed"));
|
||||
state->isInstalled);
|
||||
path += image->name;
|
||||
|
||||
const char *filters[] = {"*.png"};
|
||||
|
|
|
@ -85,7 +85,6 @@ int main(int argc, char *argv[]) {
|
|||
else
|
||||
if (!conf->load(std::string(getSaveLoadDirectory("", true)) + ".config/nodeboxeditor.conf"))
|
||||
conf->load("editor.conf");
|
||||
conf->set("installed", editor_is_installed?"true":"false");
|
||||
|
||||
// Set up irrlicht device
|
||||
E_DRIVER_TYPE driv = irr::video::EDT_OPENGL;
|
||||
|
@ -126,7 +125,7 @@ int main(int argc, char *argv[]) {
|
|||
|
||||
// Editor
|
||||
Editor* editor = new Editor();
|
||||
editor->run(device, conf);
|
||||
editor->run(device, conf, editor_is_installed);
|
||||
|
||||
if (!editor_is_installed)
|
||||
conf->save("editor.conf");
|
||||
|
|
|
@ -31,7 +31,7 @@ bool Minetest::findMinetestDir(std::string path)
|
|||
return false;
|
||||
}
|
||||
|
||||
bool Minetest::findMinetest()
|
||||
bool Minetest::findMinetest(bool editor_is_installed)
|
||||
{
|
||||
std::cerr << "Searching for Minetest using minetest_root setting.." << std::endl;
|
||||
std::string path = _conf->get("minetest_root");
|
||||
|
@ -63,7 +63,7 @@ bool Minetest::findMinetest()
|
|||
#endif
|
||||
|
||||
std::cerr << "Searching for Minetest relative to NBE save directory..." << std::endl;
|
||||
path = getSaveLoadDirectory(_conf->get("save_directory"), _conf->getBool("installed"));
|
||||
path = getSaveLoadDirectory(_conf->get("save_directory"), editor_is_installed);
|
||||
path = cleanDirectoryPath(path);
|
||||
|
||||
if (findMinetestDir(path + "../minetest/") && minetest_exe != "")
|
||||
|
|
|
@ -9,7 +9,7 @@ class Minetest
|
|||
{
|
||||
public:
|
||||
Minetest(Configuration *conf);
|
||||
bool findMinetest();
|
||||
bool findMinetest(bool editor_is_installed);
|
||||
bool runMod(EditorState *state, const std::string &world = "nbe_test");
|
||||
private:
|
||||
bool findMinetestDir(std::string path);
|
||||
|
|
Loading…
Reference in New Issue