diff --git a/share/CMakeLists.txt b/share/CMakeLists.txt
index eb0be27..0ad654b 100644
--- a/share/CMakeLists.txt
+++ b/share/CMakeLists.txt
@@ -1,20 +1,20 @@
find_package(mkdocs 1.0)
# if(MKDOCS_FOUND)
-# configure_file(mkdocs.yml "${CMAKE_CURRENT_BINARY_DIR}/mkdocs.yml" COPYONLY)
-# set(MKDOCS_FLAGS
-# --site-dir "${CMAKE_CURRENT_BINARY_DIR}/docs/user/"
-# --config-file "${CMAKE_CURRENT_BINARY_DIR}/mkdocs.yml"
-# )
-# if(DEBUG_MODE)
-# list(APPEND MKDOCS_FLAGS --clean --verbose)
-# endif()
-# add_custom_target(docs-user
-# ${MKDOCS_EXECUTABLE} build ${MKDOCS_FLAGS}
-# WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
-# COMMENT "Generating user documentation"
-# )
-# add_dependencies(docs docs-user)
+# configure_file(mkdocs.yml "${CMAKE_CURRENT_BINARY_DIR}/mkdocs.yml" COPYONLY)
+# set(MKDOCS_FLAGS
+# --site-dir "${CMAKE_CURRENT_BINARY_DIR}/docs/user/"
+# --config-file "${CMAKE_CURRENT_BINARY_DIR}/mkdocs.yml"
+# )
+# if(DEBUG_MODE)
+# list(APPEND MKDOCS_FLAGS --clean --verbose)
+# endif()
+# add_custom_target(docs-user
+# ${MKDOCS_EXECUTABLE} build ${MKDOCS_FLAGS}
+# WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
+# COMMENT "Generating user documentation"
+# )
+# add_dependencies(docs docs-user)
# else()
-# message(STATUS "SKIPPING generation of user documentation (mkdocs not found)")
+# message(STATUS "SKIPPING generation of user documentation (mkdocs not found)")
# endif()
diff --git a/share/doc/pixwerx.xmind b/share/doc/pixwerx.xmind
index 6e061eb..5c96f0f 100644
Binary files a/share/doc/pixwerx.xmind and b/share/doc/pixwerx.xmind differ
diff --git a/src/scripting/src/script_system.cpp b/src/scripting/src/script_system.cpp
index d5629e2..7ef8d35 100644
--- a/src/scripting/src/script_system.cpp
+++ b/src/scripting/src/script_system.cpp
@@ -2,6 +2,7 @@
#include "pw/system/window.hpp"
#include "pw/system/input.hpp"
+#include "pw/system/display.hpp"
namespace pw {
@@ -11,8 +12,8 @@ void script_system::load(sol::table &ns)
"update",&window::update,
"title",sol::writeonly_property(&window::set_title),
"size",sol::property(&window::size,&window::set_size),
- "position",sol::property(&window::position,&window::set_position),
- "fullscreen",sol::property(&window::fullscreen,&window::set_fullscreen)
+ "position",sol::property(&window::position,&window::set_position),
+ "fullscreen",sol::property(&window::fullscreen,&window::set_fullscreen)
);
ns.new_usertype("input",
@@ -20,9 +21,14 @@ void script_system::load(sol::table &ns)
"get",&input::get,
"mouse_position",sol::readonly_property(&input::mouse_position),
"mouse_button",sol::readonly_property(&input::mouse_button),
- "mouse_pressed",sol::readonly_property(&input::mouse_pressed),
+ "mouse_pressed",sol::readonly_property(&input::mouse_pressed),
"input_string",sol::readonly_property(&input::input_string)
);
+
+ ns.new_usertype("display",
+ "all",&display::all,
+ "name",sol::readonly_property(&display::name)
+ );
}
}
diff --git a/src/scripts/demos/simple_000.lua b/src/scripts/demos/simple_000.lua
index 3f69c1e..9b83a59 100644
--- a/src/scripts/demos/simple_000.lua
+++ b/src/scripts/demos/simple_000.lua
@@ -73,6 +73,11 @@ w.title = "pixwerx 0.1"
-- set size
w.size = pw.size.new(1200,800)
+local ds = pw.display:all()
+for i = 1,#ds do
+ print("display ",i,ds[i].name)
+end
+
while w:update()
do
diff --git a/src/system/CMakeLists.txt b/src/system/CMakeLists.txt
index f475113..08b2781 100644
--- a/src/system/CMakeLists.txt
+++ b/src/system/CMakeLists.txt
@@ -2,9 +2,11 @@
set(hdrs
include/pw/system/window.hpp
include/pw/system/input.hpp
+ include/pw/system/display.hpp
)
set(srcs
+ src/display.cpp
src/window.cpp
src/input.cpp
)
diff --git a/src/system/include/pw/system/display.hpp b/src/system/include/pw/system/display.hpp
new file mode 100644
index 0000000..e85fafc
--- /dev/null
+++ b/src/system/include/pw/system/display.hpp
@@ -0,0 +1,29 @@
+#ifndef PW_SYSTEM_DISPLAY_HPP
+#define PW_SYSTEM_DISPLAY_HPP
+
+#include
+#include
+
+namespace pw {
+
+class display {
+public:
+
+ typedef std::vector list;
+
+ static const list& all() { return _displays; }
+
+ std::string name() const { return _name; }
+
+protected:
+ friend class window;
+
+ std::string _name;
+
+ static list _displays;
+
+};
+
+}
+
+#endif
diff --git a/src/system/src/display.cpp b/src/system/src/display.cpp
new file mode 100644
index 0000000..d722399
--- /dev/null
+++ b/src/system/src/display.cpp
@@ -0,0 +1,10 @@
+#include "pw/system/display.hpp"
+
+
+
+namespace pw {
+
+
+display::list display::_displays;
+
+}
diff --git a/src/system/src/window.cpp b/src/system/src/window.cpp
index 80e3aea..fd3b180 100644
--- a/src/system/src/window.cpp
+++ b/src/system/src/window.cpp
@@ -1,10 +1,12 @@
#include "pw/system/window.hpp"
+#include "glad/glad.h"
#include "GLFW/glfw3.h"
-//#include "glad/glad.h"
#include "pw/visual/context.hpp"
#include "pw/system/input.hpp"
+#include "pw/system/display.hpp"
+
#include "pw/core/debug.hpp"
#include
@@ -97,37 +99,65 @@ struct window::impl {
// glViewport(0, 0, width, height);
}
+ void update_display_list()
+ {
+ display::_displays.clear();
+
+ // fetch all monitors
+ int monitor_count = 0;
+ GLFWmonitor** monitors = glfwGetMonitors(&monitor_count);
+
+ for (int i = 0; i < monitor_count;i++) {
+ display d;
+ d._name = std::string(glfwGetMonitorName(monitors[i]));
+
+ display::_displays.push_back(d);
+
+// debug::d() <<
+ }
+
+// GLFWvidmode
+// glfwGetVideoModes() ... get all
+// glfwGetVideoMode( . get current
+// glfwGetMonitorPos(
+// glfwGetMonitorPhysicalSize(
+// glfwGetMonitorName();
+
+ }
+
impl()
{
// initialize
glfwInit();
+ update_display_list();
+
// request specific version 3.2
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2);
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
-
//
_window = glfwCreateWindow(640, 480, "pixwerxs", nullptr, nullptr);
+ // make window current
+ glfwMakeContextCurrent(_window);
+
+ // load opengl
+ if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))
+ {
+ debug::e() << "glad couldn't get OpenGL API";
+ }
+
// check Version
int major, minor, rev;
major = glfwGetWindowAttrib(_window, GLFW_CONTEXT_VERSION_MAJOR);
minor = glfwGetWindowAttrib(_window, GLFW_CONTEXT_VERSION_MINOR);
rev = glfwGetWindowAttrib(_window, GLFW_CONTEXT_REVISION);
-
// maybe something to pass to the outside
-// debug::d() << "OpenGL " << major << "." << minor << "." << rev;
-
-
-// if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))
-// {
-// debug::e() << "G";
-// return -1;
-// }
+ debug::d() << "OpenGL " << major << "." << minor << "." << rev;
glfwSetWindowUserPointer(_window,this);
@@ -142,14 +172,6 @@ struct window::impl {
glfwSetCursorPosCallback(_window, cursor_pos_callback);
glfwSetMouseButtonCallback(_window, mouse_button_callback);
glfwSetScrollCallback(_window, scroll_callback);
-
-
-#if 0
- glfwMakeContextCurrent(_window);
-
- gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);
-
-#endif
}
~impl()
diff --git a/src/visual/CMakeLists.txt b/src/visual/CMakeLists.txt
index 3e89d52..6d48f62 100644
--- a/src/visual/CMakeLists.txt
+++ b/src/visual/CMakeLists.txt
@@ -2,13 +2,14 @@
set(hdrs
include/pw/visual/mesh_renderer.hpp
include/pw/visual/shader.hpp
- include/pw/visual/context.hpp
+ include/pw/visual/pipeline.hpp
)
set(srcs
src/mesh_renderer.cpp
src/shader.cpp
src/context.cpp
+ src/pipeline.cpp
)
add_library(pwvisual
diff --git a/src/visual/include/pw/visual/mesh_renderer.hpp b/src/visual/include/pw/visual/mesh_renderer.hpp
index f923321..76ba99d 100644
--- a/src/visual/include/pw/visual/mesh_renderer.hpp
+++ b/src/visual/include/pw/visual/mesh_renderer.hpp
@@ -1,5 +1,5 @@
-#ifndef PW_VISUAL_RENDERER_HPP
-#define PW_VISUAL_RENDERER_HPP
+#ifndef PW_VISUAL_MESH_RENDERER_HPP
+#define PW_VISUAL_MESH_RENDERER_HPP
#include
#include
diff --git a/src/visual/include/pw/visual/pipeline.hpp b/src/visual/include/pw/visual/pipeline.hpp
new file mode 100644
index 0000000..a591b87
--- /dev/null
+++ b/src/visual/include/pw/visual/pipeline.hpp
@@ -0,0 +1,13 @@
+#ifndef PW_VISUAL_PIPELINE_HPP
+#define PW_VISUAL_PIPELINE_HPP
+
+#include
+#include
+
+#include