From 8df3e30abd06ce8d51e6b1ad696aabf97ea9f178 Mon Sep 17 00:00:00 2001 From: Kostadin Damyanov Date: Thu, 11 Jun 2015 22:57:41 +0300 Subject: Haiku: create a GL context and initialize the audio and physics servers --- platform/haiku/haiku_gl_view.cpp | 54 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 platform/haiku/haiku_gl_view.cpp (limited to 'platform/haiku/haiku_gl_view.cpp') diff --git a/platform/haiku/haiku_gl_view.cpp b/platform/haiku/haiku_gl_view.cpp new file mode 100644 index 0000000000..61a0120656 --- /dev/null +++ b/platform/haiku/haiku_gl_view.cpp @@ -0,0 +1,54 @@ +#include "haiku_gl_view.h" + +HaikuGLView::HaikuGLView(BRect frame, uint32 type) + : BGLView(frame, "SampleGLView", B_FOLLOW_ALL_SIDES, 0, type), rotate(0) +{ + width = frame.right-frame.left; + height = frame.bottom-frame.top; +} + +void HaikuGLView::AttachedToWindow(void) +{ + LockGL(); + BGLView::AttachedToWindow(); + UnlockGL(); + MakeFocus(); +} + +void HaikuGLView::FrameResized(float newWidth, float newHeight) +{ +} + +void HaikuGLView::gDraw(float rotation) +{ +} + +void HaikuGLView::gReshape(int width, int height) +{ +} + +void HaikuGLView::Render(void) +{ + LockGL(); + SwapBuffers(); + UnlockGL(); +} + +void HaikuGLView::MessageReceived(BMessage * msg) +{ + switch (msg->what) { + case 'rdrw': + Render(); + /* Rotate a bit more */ + rotate++; + break; + + default: + BGLView::MessageReceived(msg); + } +} + +void HaikuGLView::KeyDown(const char *bytes, int32 numBytes) +{ + +} -- cgit v1.2.3 From 1505d65ac9ec9f44195e961f0089343aabe3de79 Mon Sep 17 00:00:00 2001 From: Kostadin Damyanov Date: Tue, 16 Jun 2015 21:52:24 +0300 Subject: Haiku: handle mouse movement and click events --- platform/haiku/haiku_gl_view.cpp | 45 ++++++++++------------------------------ 1 file changed, 11 insertions(+), 34 deletions(-) (limited to 'platform/haiku/haiku_gl_view.cpp') diff --git a/platform/haiku/haiku_gl_view.cpp b/platform/haiku/haiku_gl_view.cpp index 61a0120656..8adab96a87 100644 --- a/platform/haiku/haiku_gl_view.cpp +++ b/platform/haiku/haiku_gl_view.cpp @@ -1,54 +1,31 @@ +#include "main/main.h" #include "haiku_gl_view.h" HaikuGLView::HaikuGLView(BRect frame, uint32 type) - : BGLView(frame, "SampleGLView", B_FOLLOW_ALL_SIDES, 0, type), rotate(0) + : BGLView(frame, "SampleGLView", B_FOLLOW_ALL_SIDES, 0, type) { - width = frame.right-frame.left; - height = frame.bottom-frame.top; } -void HaikuGLView::AttachedToWindow(void) -{ +void HaikuGLView::AttachedToWindow(void) { LockGL(); BGLView::AttachedToWindow(); UnlockGL(); MakeFocus(); } -void HaikuGLView::FrameResized(float newWidth, float newHeight) -{ -} - -void HaikuGLView::gDraw(float rotation) -{ -} - -void HaikuGLView::gReshape(int width, int height) -{ -} - -void HaikuGLView::Render(void) -{ - LockGL(); - SwapBuffers(); - UnlockGL(); +void HaikuGLView::Draw(BRect updateRect) { + Main::force_redraw(); } -void HaikuGLView::MessageReceived(BMessage * msg) +void HaikuGLView::MessageReceived(BMessage* msg) { + // TODO: remove if not needed switch (msg->what) { - case 'rdrw': - Render(); - /* Rotate a bit more */ - rotate++; - break; - - default: - BGLView::MessageReceived(msg); + default: + BGLView::MessageReceived(msg); } } -void HaikuGLView::KeyDown(const char *bytes, int32 numBytes) -{ - +void HaikuGLView::MouseMoved (BPoint where, uint32 code, const BMessage *dragMessage) { + ERR_PRINT("MouseMoved()"); } -- cgit v1.2.3 From ced44b45d3590e6c2149fd83792dbf702321aff5 Mon Sep 17 00:00:00 2001 From: Kostadin Damyanov Date: Wed, 12 Aug 2015 22:14:40 +0300 Subject: Haiku: remove unneeded code --- platform/haiku/haiku_gl_view.cpp | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) (limited to 'platform/haiku/haiku_gl_view.cpp') diff --git a/platform/haiku/haiku_gl_view.cpp b/platform/haiku/haiku_gl_view.cpp index 8adab96a87..481d6098a7 100644 --- a/platform/haiku/haiku_gl_view.cpp +++ b/platform/haiku/haiku_gl_view.cpp @@ -2,7 +2,7 @@ #include "haiku_gl_view.h" HaikuGLView::HaikuGLView(BRect frame, uint32 type) - : BGLView(frame, "SampleGLView", B_FOLLOW_ALL_SIDES, 0, type) + : BGLView(frame, "GodotGLView", B_FOLLOW_ALL_SIDES, 0, type) { } @@ -16,16 +16,3 @@ void HaikuGLView::AttachedToWindow(void) { void HaikuGLView::Draw(BRect updateRect) { Main::force_redraw(); } - -void HaikuGLView::MessageReceived(BMessage* msg) -{ - // TODO: remove if not needed - switch (msg->what) { - default: - BGLView::MessageReceived(msg); - } -} - -void HaikuGLView::MouseMoved (BPoint where, uint32 code, const BMessage *dragMessage) { - ERR_PRINT("MouseMoved()"); -} -- cgit v1.2.3