summaryrefslogtreecommitdiff
path: root/platform/haiku/haiku_direct_window.cpp
diff options
context:
space:
mode:
authorKostadin Damyanov <maxmight@gmail.com>2015-06-11 22:57:41 +0300
committerKostadin Damyanov <maxmight@gmail.com>2015-06-11 22:57:41 +0300
commit8df3e30abd06ce8d51e6b1ad696aabf97ea9f178 (patch)
tree9ebc12296d6d0f3bf68a4debe050066bb9b8936b /platform/haiku/haiku_direct_window.cpp
parentf99b72c04f484c39ae728bc175114544a26d7bca (diff)
Haiku: create a GL context and initialize the audio and physics servers
Diffstat (limited to 'platform/haiku/haiku_direct_window.cpp')
-rw-r--r--platform/haiku/haiku_direct_window.cpp45
1 files changed, 45 insertions, 0 deletions
diff --git a/platform/haiku/haiku_direct_window.cpp b/platform/haiku/haiku_direct_window.cpp
new file mode 100644
index 0000000000..e7f2718278
--- /dev/null
+++ b/platform/haiku/haiku_direct_window.cpp
@@ -0,0 +1,45 @@
+#include "haiku_direct_window.h"
+
+HaikuDirectWindow::HaikuDirectWindow(BRect p_frame)
+ : BDirectWindow(p_frame, "Godot", B_TITLED_WINDOW, 0)
+{
+ // TODO: formatting
+ float minWidth = 0.0f;
+ float maxWidth = 0.0f;
+ float minHeight = 0.0f;
+ float maxHeight = 0.0f;
+
+ GetSizeLimits(&minWidth, &maxWidth, &minHeight, &maxHeight);
+ SetSizeLimits(50.0f, maxWidth, 50.0f, maxHeight);
+}
+
+
+HaikuDirectWindow::~HaikuDirectWindow()
+{
+ delete update_runner;
+}
+
+void HaikuDirectWindow::SetHaikuGLView(HaikuGLView* p_view) {
+ view = p_view;
+}
+
+void HaikuDirectWindow::InitMessageRunner() {
+ update_runner = new BMessageRunner(BMessenger(view),
+ new BMessage(REDRAW_MSG), 1000000/60 /* 60 fps */);
+}
+
+
+bool HaikuDirectWindow::QuitRequested()
+{
+ view->EnableDirectMode(false);
+ be_app->PostMessage(B_QUIT_REQUESTED);
+ return true;
+}
+
+
+void HaikuDirectWindow::DirectConnected(direct_buffer_info *info)
+{
+ view->DirectConnected(info);
+ view->EnableDirectMode(true);
+}
+