Compare commits
No commits in common. "da26fdae53a40e9134f5254e1a89f8cbf607b8e9" and "4f9ff698019b26a5600f0d0ea9f73f280ac2c2e7" have entirely different histories.
da26fdae53
...
4f9ff69801
13 changed files with 8 additions and 209 deletions
3
.clangd
3
.clangd
|
@ -1,3 +0,0 @@
|
||||||
CompileFlags: # Tweak the parse settings, example directory given to show format
|
|
||||||
Add:
|
|
||||||
- "--include-directory=../../src"
|
|
7
.gitignore
vendored
7
.gitignore
vendored
|
@ -1,12 +1,5 @@
|
||||||
bin/
|
bin/
|
||||||
lib/
|
|
||||||
CMakeFiles/
|
CMakeFiles/
|
||||||
cmake_install.cmake
|
cmake_install.cmake
|
||||||
CMakeCache.txt
|
CMakeCache.txt
|
||||||
Makefile
|
Makefile
|
||||||
|
|
||||||
# Qt
|
|
||||||
.lupdate/
|
|
||||||
*.pro.user*
|
|
||||||
CMakeLists.txt.user*
|
|
||||||
*_autogen/
|
|
|
@ -1,11 +1,10 @@
|
||||||
cmake_minimum_required(VERSION 3.5.0)
|
cmake_minimum_required(VERSION 3.5.0)
|
||||||
set(CMAKE_CXX_STANDARD 17)
|
set(CMAKE_CXX_STANDARD 17)
|
||||||
project(openblocks VERSION 0.1.0)
|
project(GLTest VERSION 0.1.0)
|
||||||
set(OpenGL_GL_PREFERENCE "GLVND")
|
set(OpenGL_GL_PREFERENCE "GLVND")
|
||||||
|
|
||||||
set( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin )
|
set( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin )
|
||||||
set( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib )
|
set( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib )
|
||||||
set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/lib )
|
|
||||||
|
|
||||||
find_package(OpenGL REQUIRED COMPONENTS OpenGL)
|
find_package(OpenGL REQUIRED COMPONENTS OpenGL)
|
||||||
|
|
||||||
|
@ -31,13 +30,6 @@ find_package(ReactPhysics3D REQUIRED)
|
||||||
file(MAKE_DIRECTORY bin)
|
file(MAKE_DIRECTORY bin)
|
||||||
|
|
||||||
file(GLOB_RECURSE SOURCES "src/*.cpp" "src/*.h")
|
file(GLOB_RECURSE SOURCES "src/*.cpp" "src/*.h")
|
||||||
add_library(openblocks ${SOURCES})
|
add_executable(${PROJECT_NAME} ${SOURCES})
|
||||||
set_target_properties(openblocks PROPERTIES OUTPUT_NAME "openblocks")
|
set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME "gltest")
|
||||||
target_link_libraries(openblocks ${SDL2_LIBRARIES} ${GLEW_LIBRARIES} ${GLUT_LIBRARIES} OpenGL::GL OpenGL::GLU glfw glm::glm assimp ReactPhysics3D::ReactPhysics3D)
|
target_link_libraries(${PROJECT_NAME} ${SDL2_LIBRARIES} ${GLEW_LIBRARIES} ${GLUT_LIBRARIES} OpenGL::GL OpenGL::GLU glfw glm::glm assimp ReactPhysics3D::ReactPhysics3D)
|
||||||
|
|
||||||
# add_executable(client "client/src/main.cpp" $<TARGET_OBJECTS:openblocks>)
|
|
||||||
# include_directories("src")
|
|
||||||
# target_link_libraries(client ${SDL2_LIBRARIES} ${GLEW_LIBRARIES} ${GLUT_LIBRARIES} OpenGL::GL OpenGL::GLU glfw glm::glm assimp ReactPhysics3D::ReactPhysics3D)
|
|
||||||
|
|
||||||
add_subdirectory("client")
|
|
||||||
add_subdirectory("editor")
|
|
|
@ -1,4 +0,0 @@
|
||||||
|
|
||||||
add_executable(client "src/main.cpp" $<TARGET_OBJECTS:openblocks>)
|
|
||||||
include_directories("../src")
|
|
||||||
target_link_libraries(client ${SDL2_LIBRARIES} ${GLEW_LIBRARIES} ${GLUT_LIBRARIES} OpenGL::GL OpenGL::GLU glfw glm::glm assimp ReactPhysics3D::ReactPhysics3D)
|
|
|
@ -1,77 +0,0 @@
|
||||||
cmake_minimum_required(VERSION 3.16)
|
|
||||||
|
|
||||||
project(editor VERSION 0.1 LANGUAGES CXX)
|
|
||||||
|
|
||||||
set(CMAKE_AUTOUIC ON)
|
|
||||||
set(CMAKE_AUTOMOC ON)
|
|
||||||
set(CMAKE_AUTORCC ON)
|
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 17)
|
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
||||||
|
|
||||||
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets LinguistTools)
|
|
||||||
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets LinguistTools)
|
|
||||||
|
|
||||||
set(TS_FILES editor_en_US.ts)
|
|
||||||
|
|
||||||
set(PROJECT_SOURCES
|
|
||||||
main.cpp
|
|
||||||
mainwindow.cpp
|
|
||||||
mainwindow.h
|
|
||||||
mainwindow.ui
|
|
||||||
${TS_FILES}
|
|
||||||
)
|
|
||||||
|
|
||||||
if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
|
|
||||||
qt_add_executable(editor
|
|
||||||
MANUAL_FINALIZATION
|
|
||||||
${PROJECT_SOURCES}
|
|
||||||
)
|
|
||||||
# Define target properties for Android with Qt 6 as:
|
|
||||||
# set_property(TARGET editor APPEND PROPERTY QT_ANDROID_PACKAGE_SOURCE_DIR
|
|
||||||
# ${CMAKE_CURRENT_SOURCE_DIR}/android)
|
|
||||||
# For more information, see https://doc.qt.io/qt-6/qt-add-executable.html#target-creation
|
|
||||||
|
|
||||||
qt_create_translation(QM_FILES ${CMAKE_SOURCE_DIR} ${TS_FILES})
|
|
||||||
else()
|
|
||||||
if(ANDROID)
|
|
||||||
add_library(editor SHARED
|
|
||||||
${PROJECT_SOURCES}
|
|
||||||
)
|
|
||||||
# Define properties for Android with Qt 5 after find_package() calls as:
|
|
||||||
# set(ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android")
|
|
||||||
else()
|
|
||||||
add_executable(editor
|
|
||||||
${PROJECT_SOURCES}
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
qt5_create_translation(QM_FILES ${CMAKE_SOURCE_DIR} ${TS_FILES})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
target_link_libraries(editor PRIVATE Qt${QT_VERSION_MAJOR}::Widgets)
|
|
||||||
|
|
||||||
# Qt for iOS sets MACOSX_BUNDLE_GUI_IDENTIFIER automatically since Qt 6.1.
|
|
||||||
# If you are developing for iOS or macOS you should consider setting an
|
|
||||||
# explicit, fixed bundle identifier manually though.
|
|
||||||
if(${QT_VERSION} VERSION_LESS 6.1.0)
|
|
||||||
set(BUNDLE_ID_OPTION MACOSX_BUNDLE_GUI_IDENTIFIER com.example.qtbasic)
|
|
||||||
endif()
|
|
||||||
set_target_properties(editor PROPERTIES
|
|
||||||
${BUNDLE_ID_OPTION}
|
|
||||||
MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
|
|
||||||
MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
|
|
||||||
MACOSX_BUNDLE TRUE
|
|
||||||
WIN32_EXECUTABLE TRUE
|
|
||||||
)
|
|
||||||
|
|
||||||
include(GNUInstallDirs)
|
|
||||||
install(TARGETS editor
|
|
||||||
BUNDLE DESTINATION .
|
|
||||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
||||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
|
||||||
)
|
|
||||||
|
|
||||||
if(QT_VERSION_MAJOR EQUAL 6)
|
|
||||||
qt_finalize_executable(editor)
|
|
||||||
endif()
|
|
|
@ -1,15 +0,0 @@
|
||||||
#include "mainwindow.h"
|
|
||||||
|
|
||||||
#include <QApplication>
|
|
||||||
#include <QLocale>
|
|
||||||
#include <QTranslator>
|
|
||||||
#include <QStyleFactory>
|
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
|
||||||
{
|
|
||||||
QApplication a(argc, argv);
|
|
||||||
|
|
||||||
MainWindow w;
|
|
||||||
w.show();
|
|
||||||
return a.exec();
|
|
||||||
}
|
|
|
@ -1,19 +0,0 @@
|
||||||
#include "mainwindow.h"
|
|
||||||
#include "./ui_mainwindow.h"
|
|
||||||
|
|
||||||
#include <QFileDialog>
|
|
||||||
#include <QMessageBox>
|
|
||||||
#include <QProcess>
|
|
||||||
#include <QThread>
|
|
||||||
|
|
||||||
MainWindow::MainWindow(QWidget *parent)
|
|
||||||
: QMainWindow(parent)
|
|
||||||
, ui(new Ui::MainWindow)
|
|
||||||
{
|
|
||||||
ui->setupUi(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
MainWindow::~MainWindow()
|
|
||||||
{
|
|
||||||
delete ui;
|
|
||||||
}
|
|
|
@ -1,24 +0,0 @@
|
||||||
#ifndef MAINWINDOW_H
|
|
||||||
#define MAINWINDOW_H
|
|
||||||
|
|
||||||
#include <QMainWindow>
|
|
||||||
#include <QLineEdit>
|
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
|
||||||
namespace Ui {
|
|
||||||
class MainWindow;
|
|
||||||
}
|
|
||||||
QT_END_NAMESPACE
|
|
||||||
|
|
||||||
class MainWindow : public QMainWindow
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
MainWindow(QWidget *parent = nullptr);
|
|
||||||
~MainWindow();
|
|
||||||
|
|
||||||
private:
|
|
||||||
Ui::MainWindow *ui;
|
|
||||||
};
|
|
||||||
#endif // MAINWINDOW_H
|
|
|
@ -1,31 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<ui version="4.0">
|
|
||||||
<class>MainWindow</class>
|
|
||||||
<widget class="QMainWindow" name="MainWindow">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>800</width>
|
|
||||||
<height>600</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="windowTitle">
|
|
||||||
<string>MainWindow</string>
|
|
||||||
</property>
|
|
||||||
<widget class="QWidget" name="centralwidget"/>
|
|
||||||
<widget class="QMenuBar" name="menubar">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>800</width>
|
|
||||||
<height>30</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
<widget class="QStatusBar" name="statusbar"/>
|
|
||||||
</widget>
|
|
||||||
<resources/>
|
|
||||||
<connections/>
|
|
||||||
</ui>
|
|
|
@ -1,6 +0,0 @@
|
||||||
// TEMPORARY COMMON DATA FOR DIFFERENT INTERNAL COMPONENTS
|
|
||||||
|
|
||||||
#include "common.h"
|
|
||||||
|
|
||||||
Camera camera(glm::vec3(0.0, 0.0, 3.0));
|
|
||||||
std::vector<Part> parts;
|
|
|
@ -1,8 +0,0 @@
|
||||||
#pragma once
|
|
||||||
#include "part.h"
|
|
||||||
#include "camera.h"
|
|
||||||
|
|
||||||
// TEMPORARY COMMON DATA FOR DIFFERENT INTERNAL COMPONENTS
|
|
||||||
|
|
||||||
extern Camera camera;
|
|
||||||
extern std::vector<Part> parts;
|
|
|
@ -13,10 +13,11 @@
|
||||||
#include "physics/simulation.h"
|
#include "physics/simulation.h"
|
||||||
#include "camera.h"
|
#include "camera.h"
|
||||||
|
|
||||||
#include "common.h"
|
|
||||||
|
|
||||||
void errorCatcher(int id, const char* str);
|
void errorCatcher(int id, const char* str);
|
||||||
|
|
||||||
|
Camera camera(glm::vec3(0.0, 0.0, 3.0));
|
||||||
|
std::vector<Part> parts;
|
||||||
|
|
||||||
int mode = 0;
|
int mode = 0;
|
||||||
|
|
||||||
void keyCallback(GLFWwindow* window, int key, int scancode, int action, int mods);
|
void keyCallback(GLFWwindow* window, int key, int scancode, int action, int mods);
|
||||||
|
@ -29,7 +30,7 @@ int main() {
|
||||||
glfwSetErrorCallback(errorCatcher);
|
glfwSetErrorCallback(errorCatcher);
|
||||||
|
|
||||||
glfwInit();
|
glfwInit();
|
||||||
GLFWwindow *window = glfwCreateWindow(1200, 900, "OpenBlocks Client ALPHA", NULL, NULL);
|
GLFWwindow *window = glfwCreateWindow(1200, 900, "GLTest", NULL, NULL);
|
||||||
glfwSetKeyCallback(window, keyCallback);
|
glfwSetKeyCallback(window, keyCallback);
|
||||||
glfwSetMouseButtonCallback(window, mouseButtonCallback);
|
glfwSetMouseButtonCallback(window, mouseButtonCallback);
|
||||||
glfwSetCursorPosCallback(window, mouseCallback);
|
glfwSetCursorPosCallback(window, mouseCallback);
|
Loading…
Add table
Reference in a new issue