Move Haiku platform port to external repository
The Haiku port now resides at:
https://github.com/godotengine/godot-haiku-platform
While we're happy to support as many Free and Open Source platforms as we can,
we need to put the main focus on the platforms that we can reasonably maintain,
and for Haiku we have been lacking maintainers ever since the port was first
merged in 2015.
The Haiku code has not been compiling and much less working at least since the
release of Godot 3.0, and while some attempts have been made at fixing things,
it's still not functional today in the `3.2` branch (and much less in `master`,
understandably).
Having it in an external repository should hopefully enable Haiku contributors
to fix issues in their own time, and possibly tag versions compatible with
past Godot releases once they are ready.
(cherry picked from commit efcc508ee5
)
This commit is contained in:
parent
7e3d7417e3
commit
8ac13e50cf
21 changed files with 1 additions and 2107 deletions
|
@ -277,7 +277,7 @@
|
|||
<return type="String">
|
||||
</return>
|
||||
<description>
|
||||
Returns the name of the host OS. Possible values are: [code]"Android"[/code], [code]"Haiku"[/code], [code]"iOS"[/code], [code]"HTML5"[/code], [code]"OSX"[/code], [code]"Server"[/code], [code]"Windows"[/code], [code]"UWP"[/code], [code]"X11"[/code].
|
||||
Returns the name of the host OS. Possible values are: [code]"Android"[/code], [code]"iOS"[/code], [code]"HTML5"[/code], [code]"OSX"[/code], [code]"Server"[/code], [code]"Windows"[/code], [code]"UWP"[/code], [code]"X11"[/code].
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_power_percent_left">
|
||||
|
|
|
@ -1,25 +0,0 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
Import("env")
|
||||
|
||||
common_haiku = [
|
||||
"os_haiku.cpp",
|
||||
"context_gl_haiku.cpp",
|
||||
"haiku_application.cpp",
|
||||
"haiku_direct_window.cpp",
|
||||
"haiku_gl_view.cpp",
|
||||
"key_mapping_haiku.cpp",
|
||||
"audio_driver_media_kit.cpp",
|
||||
]
|
||||
|
||||
target = env.add_program("#bin/godot", ["godot_haiku.cpp"] + common_haiku)
|
||||
|
||||
command = env.Command("#bin/godot.rsrc", "#platform/haiku/godot.rdef", ["rc -o $TARGET $SOURCE"])
|
||||
|
||||
|
||||
def addResourcesAction(target=None, source=None, env=None):
|
||||
return env.Execute("xres -o " + File(target)[0].path + " bin/godot.rsrc")
|
||||
|
||||
|
||||
env.AddPostAction(target, addResourcesAction)
|
||||
env.Depends(target, command)
|
|
@ -1,142 +0,0 @@
|
|||
/*************************************************************************/
|
||||
/* audio_driver_media_kit.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
|
||||
/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
|
||||
#include "audio_driver_media_kit.h"
|
||||
|
||||
#ifdef MEDIA_KIT_ENABLED
|
||||
|
||||
#include "core/project_settings.h"
|
||||
|
||||
int32_t *AudioDriverMediaKit::samples_in = NULL;
|
||||
|
||||
Error AudioDriverMediaKit::init() {
|
||||
active = false;
|
||||
|
||||
mix_rate = GLOBAL_GET("audio/mix_rate");
|
||||
speaker_mode = SPEAKER_MODE_STEREO;
|
||||
channels = 2;
|
||||
|
||||
int latency = GLOBAL_GET("audio/output_latency");
|
||||
buffer_size = next_power_of_2(latency * mix_rate / 1000);
|
||||
samples_in = memnew_arr(int32_t, buffer_size * channels);
|
||||
|
||||
media_raw_audio_format format;
|
||||
format = media_raw_audio_format::wildcard;
|
||||
format.frame_rate = mix_rate;
|
||||
format.channel_count = channels;
|
||||
format.format = media_raw_audio_format::B_AUDIO_INT;
|
||||
format.byte_order = B_MEDIA_LITTLE_ENDIAN;
|
||||
format.buffer_size = buffer_size * sizeof(int32_t) * channels;
|
||||
|
||||
player = new BSoundPlayer(
|
||||
&format,
|
||||
"godot_sound_server",
|
||||
AudioDriverMediaKit::PlayBuffer,
|
||||
NULL,
|
||||
this);
|
||||
|
||||
if (player->InitCheck() != B_OK) {
|
||||
fprintf(stderr, "MediaKit ERR: can not create a BSoundPlayer instance\n");
|
||||
ERR_FAIL_COND_V(player == NULL, ERR_CANT_OPEN);
|
||||
}
|
||||
|
||||
mutex = Mutex::create();
|
||||
player->Start();
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
void AudioDriverMediaKit::PlayBuffer(void *cookie, void *buffer, size_t size, const media_raw_audio_format &format) {
|
||||
AudioDriverMediaKit *ad = (AudioDriverMediaKit *)cookie;
|
||||
int32_t *buf = (int32_t *)buffer;
|
||||
|
||||
if (!ad->active) {
|
||||
for (unsigned int i = 0; i < ad->buffer_size * ad->channels; i++) {
|
||||
AudioDriverMediaKit::samples_in[i] = 0;
|
||||
}
|
||||
} else {
|
||||
ad->lock();
|
||||
ad->audio_server_process(ad->buffer_size, AudioDriverMediaKit::samples_in);
|
||||
ad->unlock();
|
||||
}
|
||||
|
||||
for (unsigned int i = 0; i < ad->buffer_size * ad->channels; i++) {
|
||||
buf[i] = AudioDriverMediaKit::samples_in[i];
|
||||
}
|
||||
}
|
||||
|
||||
void AudioDriverMediaKit::start() {
|
||||
active = true;
|
||||
}
|
||||
|
||||
int AudioDriverMediaKit::get_mix_rate() const {
|
||||
return mix_rate;
|
||||
}
|
||||
|
||||
AudioDriverMediaKit::SpeakerMode AudioDriverMediaKit::get_speaker_mode() const {
|
||||
return speaker_mode;
|
||||
}
|
||||
|
||||
void AudioDriverMediaKit::lock() {
|
||||
if (!mutex)
|
||||
return;
|
||||
|
||||
mutex->lock();
|
||||
}
|
||||
|
||||
void AudioDriverMediaKit::unlock() {
|
||||
if (!mutex)
|
||||
return;
|
||||
|
||||
mutex->unlock();
|
||||
}
|
||||
|
||||
void AudioDriverMediaKit::finish() {
|
||||
delete player;
|
||||
|
||||
if (samples_in) {
|
||||
memdelete_arr(samples_in);
|
||||
};
|
||||
|
||||
if (mutex) {
|
||||
memdelete(mutex);
|
||||
mutex = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
AudioDriverMediaKit::AudioDriverMediaKit() {
|
||||
mutex = NULL;
|
||||
player = NULL;
|
||||
}
|
||||
|
||||
AudioDriverMediaKit::~AudioDriverMediaKit() {
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,74 +0,0 @@
|
|||
/*************************************************************************/
|
||||
/* audio_driver_media_kit.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
|
||||
/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
|
||||
#include "servers/audio_server.h"
|
||||
|
||||
#ifdef MEDIA_KIT_ENABLED
|
||||
|
||||
#include "core/os/mutex.h"
|
||||
#include "core/os/thread.h"
|
||||
|
||||
#include <kernel/image.h> // needed for image_id
|
||||
|
||||
#include <SoundPlayer.h>
|
||||
|
||||
class AudioDriverMediaKit : public AudioDriver {
|
||||
Mutex *mutex;
|
||||
|
||||
BSoundPlayer *player;
|
||||
static int32_t *samples_in;
|
||||
|
||||
static void PlayBuffer(void *cookie, void *buffer, size_t size, const media_raw_audio_format &format);
|
||||
|
||||
unsigned int mix_rate;
|
||||
SpeakerMode speaker_mode;
|
||||
unsigned int buffer_size;
|
||||
int channels;
|
||||
|
||||
bool active;
|
||||
|
||||
public:
|
||||
const char *get_name() const {
|
||||
return "MediaKit";
|
||||
};
|
||||
|
||||
virtual Error init();
|
||||
virtual void start();
|
||||
virtual int get_mix_rate() const;
|
||||
virtual SpeakerMode get_speaker_mode() const;
|
||||
virtual void lock();
|
||||
virtual void unlock();
|
||||
virtual void finish();
|
||||
|
||||
AudioDriverMediaKit();
|
||||
~AudioDriverMediaKit();
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,83 +0,0 @@
|
|||
/*************************************************************************/
|
||||
/* context_gl_haiku.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
|
||||
/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
|
||||
#include "context_gl_haiku.h"
|
||||
|
||||
#if defined(OPENGL_ENABLED)
|
||||
|
||||
ContextGL_Haiku::ContextGL_Haiku(HaikuDirectWindow *p_window) {
|
||||
window = p_window;
|
||||
|
||||
uint32 type = BGL_RGB | BGL_DOUBLE | BGL_DEPTH;
|
||||
view = new HaikuGLView(window->Bounds(), type);
|
||||
|
||||
use_vsync = false;
|
||||
}
|
||||
|
||||
ContextGL_Haiku::~ContextGL_Haiku() {
|
||||
delete view;
|
||||
}
|
||||
|
||||
Error ContextGL_Haiku::initialize() {
|
||||
window->AddChild(view);
|
||||
window->SetHaikuGLView(view);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
void ContextGL_Haiku::release_current() {
|
||||
view->UnlockGL();
|
||||
}
|
||||
|
||||
void ContextGL_Haiku::make_current() {
|
||||
view->LockGL();
|
||||
}
|
||||
|
||||
void ContextGL_Haiku::swap_buffers() {
|
||||
view->SwapBuffers(use_vsync);
|
||||
}
|
||||
|
||||
int ContextGL_Haiku::get_window_width() {
|
||||
return window->Bounds().IntegerWidth();
|
||||
}
|
||||
|
||||
int ContextGL_Haiku::get_window_height() {
|
||||
return window->Bounds().IntegerHeight();
|
||||
}
|
||||
|
||||
void ContextGL_Haiku::set_use_vsync(bool p_use) {
|
||||
use_vsync = p_use;
|
||||
}
|
||||
|
||||
bool ContextGL_Haiku::is_using_vsync() const {
|
||||
return use_vsync;
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,62 +0,0 @@
|
|||
/*************************************************************************/
|
||||
/* context_gl_haiku.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
|
||||
/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
|
||||
#ifndef CONTEXT_GL_HAIKU_H
|
||||
#define CONTEXT_GL_HAIKU_H
|
||||
|
||||
#if defined(OPENGL_ENABLED)
|
||||
|
||||
#include "haiku_direct_window.h"
|
||||
#include "haiku_gl_view.h"
|
||||
|
||||
class ContextGL_Haiku {
|
||||
private:
|
||||
HaikuGLView *view;
|
||||
HaikuDirectWindow *window;
|
||||
|
||||
bool use_vsync;
|
||||
|
||||
public:
|
||||
Error initialize();
|
||||
void release_current();
|
||||
void make_current();
|
||||
void swap_buffers();
|
||||
int get_window_width();
|
||||
int get_window_height();
|
||||
|
||||
void set_use_vsync(bool p_use);
|
||||
bool is_using_vsync() const;
|
||||
|
||||
ContextGL_Haiku(HaikuDirectWindow *p_window);
|
||||
~ContextGL_Haiku();
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif
|
|
@ -1,158 +0,0 @@
|
|||
import os
|
||||
import sys
|
||||
|
||||
|
||||
def is_active():
|
||||
return True
|
||||
|
||||
|
||||
def get_name():
|
||||
return "Haiku"
|
||||
|
||||
|
||||
def can_build():
|
||||
|
||||
if os.name != "posix" or sys.platform == "darwin":
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
|
||||
def get_opts():
|
||||
from SCons.Variables import EnumVariable
|
||||
|
||||
return [
|
||||
EnumVariable("debug_symbols", "Add debugging symbols to release builds", "yes", ("yes", "no", "full")),
|
||||
]
|
||||
|
||||
|
||||
def get_flags():
|
||||
|
||||
return []
|
||||
|
||||
|
||||
def configure(env):
|
||||
|
||||
## Build type
|
||||
|
||||
if env["target"] == "release":
|
||||
env.Prepend(CCFLAGS=["-O3"])
|
||||
if env["debug_symbols"] == "yes":
|
||||
env.Prepend(CCFLAGS=["-g1"])
|
||||
if env["debug_symbols"] == "full":
|
||||
env.Prepend(CCFLAGS=["-g2"])
|
||||
|
||||
elif env["target"] == "release_debug":
|
||||
env.Prepend(CCFLAGS=["-O2", "-DDEBUG_ENABLED"])
|
||||
if env["debug_symbols"] == "yes":
|
||||
env.Prepend(CCFLAGS=["-g1"])
|
||||
if env["debug_symbols"] == "full":
|
||||
env.Prepend(CCFLAGS=["-g2"])
|
||||
|
||||
elif env["target"] == "debug":
|
||||
env.Prepend(CCFLAGS=["-g3", "-DDEBUG_ENABLED", "-DDEBUG_MEMORY_ENABLED"])
|
||||
|
||||
## Architecture
|
||||
|
||||
is64 = sys.maxsize > 2 ** 32
|
||||
if env["bits"] == "default":
|
||||
env["bits"] = "64" if is64 else "32"
|
||||
|
||||
## Compiler configuration
|
||||
|
||||
env["CC"] = "gcc-x86"
|
||||
env["CXX"] = "g++-x86"
|
||||
|
||||
## Dependencies
|
||||
|
||||
if not env["builtin_libwebp"]:
|
||||
env.ParseConfig("pkg-config libwebp --cflags --libs")
|
||||
|
||||
# freetype depends on libpng and zlib, so bundling one of them while keeping others
|
||||
# as shared libraries leads to weird issues
|
||||
if env["builtin_freetype"] or env["builtin_libpng"] or env["builtin_zlib"]:
|
||||
env["builtin_freetype"] = True
|
||||
env["builtin_libpng"] = True
|
||||
env["builtin_zlib"] = True
|
||||
|
||||
if not env["builtin_freetype"]:
|
||||
env.ParseConfig("pkg-config freetype2 --cflags --libs")
|
||||
|
||||
if not env["builtin_libpng"]:
|
||||
env.ParseConfig("pkg-config libpng16 --cflags --libs")
|
||||
|
||||
if not env["builtin_bullet"]:
|
||||
# We need at least version 2.88
|
||||
import subprocess
|
||||
|
||||
bullet_version = subprocess.check_output(["pkg-config", "bullet", "--modversion"]).strip()
|
||||
if bullet_version < "2.88":
|
||||
# Abort as system bullet was requested but too old
|
||||
print(
|
||||
"Bullet: System version {0} does not match minimal requirements ({1}). Aborting.".format(
|
||||
bullet_version, "2.88"
|
||||
)
|
||||
)
|
||||
sys.exit(255)
|
||||
env.ParseConfig("pkg-config bullet --cflags --libs")
|
||||
|
||||
if not env["builtin_enet"]:
|
||||
env.ParseConfig("pkg-config libenet --cflags --libs")
|
||||
|
||||
if not env["builtin_squish"]:
|
||||
env.ParseConfig("pkg-config libsquish --cflags --libs")
|
||||
|
||||
if not env["builtin_zstd"]:
|
||||
env.ParseConfig("pkg-config libzstd --cflags --libs")
|
||||
|
||||
# Sound and video libraries
|
||||
# Keep the order as it triggers chained dependencies (ogg needed by others, etc.)
|
||||
|
||||
if not env["builtin_libtheora"]:
|
||||
env["builtin_libogg"] = False # Needed to link against system libtheora
|
||||
env["builtin_libvorbis"] = False # Needed to link against system libtheora
|
||||
env.ParseConfig("pkg-config theora theoradec --cflags --libs")
|
||||
|
||||
if not env["builtin_libvpx"]:
|
||||
env.ParseConfig("pkg-config vpx --cflags --libs")
|
||||
|
||||
if not env["builtin_libvorbis"]:
|
||||
env["builtin_libogg"] = False # Needed to link against system libvorbis
|
||||
env.ParseConfig("pkg-config vorbis vorbisfile --cflags --libs")
|
||||
|
||||
if not env["builtin_opus"]:
|
||||
env["builtin_libogg"] = False # Needed to link against system opus
|
||||
env.ParseConfig("pkg-config opus opusfile --cflags --libs")
|
||||
|
||||
if not env["builtin_libogg"]:
|
||||
env.ParseConfig("pkg-config ogg --cflags --libs")
|
||||
|
||||
if env["builtin_libtheora"]:
|
||||
list_of_x86 = ["x86_64", "x86", "i386", "i586"]
|
||||
if any(platform.machine() in s for s in list_of_x86):
|
||||
env["x86_libtheora_opt_gcc"] = True
|
||||
|
||||
if not env["builtin_wslay"]:
|
||||
env.ParseConfig("pkg-config libwslay --cflags --libs")
|
||||
|
||||
if not env["builtin_mbedtls"]:
|
||||
# mbedTLS does not provide a pkgconfig config yet. See https://github.com/ARMmbed/mbedtls/issues/228
|
||||
env.Append(LIBS=["mbedtls", "mbedcrypto", "mbedx509"])
|
||||
|
||||
if not env["builtin_miniupnpc"]:
|
||||
# No pkgconfig file so far, hardcode default paths.
|
||||
env.Prepend(CPPPATH=["/system/develop/headers/x86/miniupnpc"])
|
||||
env.Append(LIBS=["miniupnpc"])
|
||||
|
||||
# On Linux wchar_t should be 32-bits
|
||||
# 16-bit library shouldn't be required due to compiler optimisations
|
||||
if not env["builtin_pcre2"]:
|
||||
env.ParseConfig("pkg-config libpcre2-32 --cflags --libs")
|
||||
|
||||
## Flags
|
||||
|
||||
env.Prepend(CPPPATH=["#platform/haiku"])
|
||||
env.Append(CPPDEFINES=["UNIX_ENABLED", "OPENGL_ENABLED", "GLES_ENABLED"])
|
||||
env.Append(CPPDEFINES=["MEDIA_KIT_ENABLED"])
|
||||
env.Append(CPPDEFINES=["PTHREAD_NO_RENAME"]) # TODO: enable when we have pthread_setname_np
|
||||
env.Append(LIBS=["be", "game", "media", "network", "bnetapi", "z", "GL"])
|
|
@ -1,60 +0,0 @@
|
|||
resource app_version {
|
||||
major = 2,
|
||||
middle = 0,
|
||||
minor = 0,
|
||||
|
||||
variety = B_APPV_FINAL,
|
||||
internal = 0,
|
||||
|
||||
short_info = "Godot Game Engine",
|
||||
long_info = "An advanced, feature packed, multi-platform 2D and 3D game engine."
|
||||
};
|
||||
|
||||
resource app_signature "application/x-vnd.godot";
|
||||
|
||||
resource vector_icon {
|
||||
$"6E6369660403A39F9F05FF03478CBF03414042090A04B37FB379CC26B379CC26"
|
||||
$"CC20B37FCC200A09B5E9C41B2AC240B8E1BDFBBFA1BDA4C6A7BDFFCA1AC45CC9"
|
||||
$"7AC607C01CC75BB6F4C65A062AFE9FFF9F69FE7FFEDFCF0FC95FC3D7C95FC51E"
|
||||
$"C95FC51EC95FC53EC92BC565C94AC55BC92BC565C728C60BC728C60BC712C612"
|
||||
$"C6E6C600C6F9C60EC6D3C5F2C6C7C5C4C6C7C5DCC6C7C5C4C460C4E5C4BCC4E5"
|
||||
$"C626C4E5C626C4E5C64BC4A5C670C4CAC66BC4A5C670C1EDC6CFC1EDC6CFC1E9"
|
||||
$"C6CFC1E2C6D0C1E6C6D0C1D1C6D0C1B2C6BEC1BFC6C9C1A2C6AFC19851C198C6"
|
||||
$"9BC19851C505C031C507C507C016C507BFFCC507C507BE94C505BE9451BE9451"
|
||||
$"BE94C69BBE7BC6BEBE8BC6AFBE6DC6C9BE4AC6D0BE5CC6D0BE47C6D0BE40C6CF"
|
||||
$"BE44C6CFBE40C6CFBB87C670BB87C670BB63C66BBB47C626BB47C64BBB47C626"
|
||||
$"C4BCB965C460B965C5C4B965C5C4B965C5DCB947C600B95AC5F2B934C60EB904"
|
||||
$"C60BB91BC612B904C60BB701C565B701C565B6E3C55BB6CEC51EB6CEC53EB6CE"
|
||||
$"C51EC3D7B590C36CB590C36CB581C3B0B578C43AB578C3F5B578C78FBFF8CA27"
|
||||
$"BA2ACA22BFF8CA27BFFABFFCCA27BFFCCA27C5CACA22CA7CC43ACA7CC78FCA7C"
|
||||
$"C3FBCA67C37ECA754ACA67C37E0639F6F97FFEF8E7FFF9F6FFFFFFFFFF03B67D"
|
||||
$"BDEEC31FB730C35CB730C35CB74EC3662BC3A22BC3822BC3A2C4E8B8D1C55EB8"
|
||||
$"D1C406B8D1C406B8D1C3F0B8ECC3CDB8DBC3DBB8FDC3BFB929C3BDB913C3B9B9"
|
||||
$"29C3BDBB9FC436BB9FC436BBC2C43CBBDCC47EBBDCC45BBBDCC47EC5E6BE00C6"
|
||||
$"31BE00C4BBBE00C4BBBE00C4A7BE16C486BE08C494BE24C479BE4AC471BE37C4"
|
||||
$"71BE4AC471BE4BC016C473C1E2C471C1E2C471C1F6C471C217C486C209C479C2"
|
||||
$"25C494C22DC4BBC22DC4A7C22DC4BBC631C451C5E6C451C47EC451C47EC451C4"
|
||||
$"5BC48DC436C46AC43CC48DC436C704C3BDC704C3BDC719C3B9C741C3CDC730C3"
|
||||
$"BF53C3DBC75CC406C75CC3F0C75CC406C55EC8CAC4E8C8CAC3A2C8CAC3A2C8CA"
|
||||
$"C382C8FDC35CC8DFC366C8FDC35CC977C333BDEEC97ABDEEC97ABDEEC9F1BD56"
|
||||
$"CAC9BC0BCA60BCB6CA3DBB1CC8D9B981C991BA47C82FB9D7C6EDBAA0C789BA38"
|
||||
$"C69FBA52C5F0B9D0C647BA12C59BB98BC4E0B91FC53BB959C4FBB855C50EB6C0"
|
||||
$"C509B78FC424B64AC22DB5C4C32AB5FCC1C8B66DC11BB7D9C16BB725C0BCB7C9"
|
||||
$"BFFCB7C2C05CB7C3BFFCB7C2BFFCB7C2BFFCB7C2BFFBB7C2BFFAB7C2BFFAB7C2"
|
||||
$"BFF9B7C2BFF8B7C2BFF9B7C2BFF8B7C2BFF8B7C2BFF8B7C2BF98B7C3BED9B7D9"
|
||||
$"BF38B7C9BE88B725BDC7B5C4BE2CB66DBCCAB5FCBAE6B6C0BBD0B64ABAEBB78F"
|
||||
$"BB13B91F34B855BAB8B959BA04B9D0BA59B98BB9ADBA12B907BAA0B955BA52B8"
|
||||
$"6ABA38B71AB981B7C5B9D7B663BA47B52BBC0BB5B7BB1CB594BCB6B679BDEEB6"
|
||||
$"02BD56B679BDEE0005BD3EC06CBD3EC06CBD3EC197BB2147BC4C47B9F647B904"
|
||||
$"C06CB904C197B904BF41BB21BE4FB9F6BE4FBC4CBE4FBD3EC06CBD3EBF41BD3E"
|
||||
$"C06C0005BCBC42BCBC42BCBCC153BB55C1F3BC1BC1F3BA8EC1F3B9ED42B9EDC1"
|
||||
$"53B9EDBFC6BB55BF25BA8EBF25BC1BBF25BCBC42BCBCBFC6BCBC420007C01BC2"
|
||||
$"BBC01BC2BBBFBAC2BBBF6CC21CBF6CC274BF6CC21CBF6CC02ABF6CC02ABF6CBF"
|
||||
$"D3C01BBF8CBFBABF8CC07BBF8CC0C9C02AC0C9BFD3C0C9C02AC0C9C21CC0C9C2"
|
||||
$"1CC0C9C274C01BC2BBC07BC2BBC01BC2BB0005C2F7C06CC2F7C06CC2F7C197C5"
|
||||
$"1547C3E947C64047C732C06CC732C197C732BF41C515BE4FC640BE4FC3E9BE4F"
|
||||
$"C2F7C06CC2F7BF41C2F7C06C0005C37942C37942C379C153C4E1C1F3C41AC1F3"
|
||||
$"C5A7C1F3C64842C648C153C648BFC6C4E1BF25C5A7BF25C41ABF25C37942C379"
|
||||
$"BFC6C37942090A0000000A010101000A020102000A020103000A010104000A03"
|
||||
$"0105000A010106000A010107000A03010800"
|
||||
};
|
|
@ -1,49 +0,0 @@
|
|||
/*************************************************************************/
|
||||
/* godot_haiku.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
|
||||
/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
|
||||
#include "main/main.h"
|
||||
#include "os_haiku.h"
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
OS_Haiku os;
|
||||
|
||||
Error error = Main::setup(argv[0], argc - 1, &argv[1]);
|
||||
if (error != OK) {
|
||||
return 255;
|
||||
}
|
||||
|
||||
if (Main::start()) {
|
||||
os.run();
|
||||
}
|
||||
|
||||
Main::cleanup();
|
||||
|
||||
return os.get_exit_code();
|
||||
}
|
|
@ -1,35 +0,0 @@
|
|||
/*************************************************************************/
|
||||
/* haiku_application.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
|
||||
/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
|
||||
#include "haiku_application.h"
|
||||
|
||||
HaikuApplication::HaikuApplication() :
|
||||
BApplication("application/x-vnd.godot") {
|
||||
}
|
|
@ -1,43 +0,0 @@
|
|||
/*************************************************************************/
|
||||
/* haiku_application.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
|
||||
/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
|
||||
#ifndef HAIKU_APPLICATION_H
|
||||
#define HAIKU_APPLICATION_H
|
||||
|
||||
#include <kernel/image.h> // needed for image_id
|
||||
|
||||
#include <Application.h>
|
||||
|
||||
class HaikuApplication : public BApplication {
|
||||
public:
|
||||
HaikuApplication();
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,361 +0,0 @@
|
|||
/*************************************************************************/
|
||||
/* haiku_direct_window.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
|
||||
/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
|
||||
#include <UnicodeChar.h>
|
||||
|
||||
#include "core/os/keyboard.h"
|
||||
#include "haiku_direct_window.h"
|
||||
#include "key_mapping_haiku.h"
|
||||
#include "main/main.h"
|
||||
|
||||
HaikuDirectWindow::HaikuDirectWindow(BRect p_frame) :
|
||||
BDirectWindow(p_frame, "Godot", B_TITLED_WINDOW, B_QUIT_ON_WINDOW_CLOSE) {
|
||||
last_mouse_pos_valid = false;
|
||||
last_buttons_state = 0;
|
||||
last_button_mask = 0;
|
||||
last_key_modifier_state = 0;
|
||||
|
||||
view = NULL;
|
||||
update_runner = NULL;
|
||||
input = NULL;
|
||||
main_loop = NULL;
|
||||
}
|
||||
|
||||
HaikuDirectWindow::~HaikuDirectWindow() {
|
||||
}
|
||||
|
||||
void HaikuDirectWindow::SetHaikuGLView(HaikuGLView *p_view) {
|
||||
view = p_view;
|
||||
}
|
||||
|
||||
void HaikuDirectWindow::StartMessageRunner() {
|
||||
update_runner = new BMessageRunner(BMessenger(this),
|
||||
new BMessage(REDRAW_MSG), 1000000 / 60 /* 60 fps */);
|
||||
}
|
||||
|
||||
void HaikuDirectWindow::StopMessageRunner() {
|
||||
delete update_runner;
|
||||
}
|
||||
|
||||
void HaikuDirectWindow::SetInput(InputDefault *p_input) {
|
||||
input = p_input;
|
||||
}
|
||||
|
||||
void HaikuDirectWindow::SetMainLoop(MainLoop *p_main_loop) {
|
||||
main_loop = p_main_loop;
|
||||
}
|
||||
|
||||
bool HaikuDirectWindow::QuitRequested() {
|
||||
StopMessageRunner();
|
||||
main_loop->notification(MainLoop::NOTIFICATION_WM_QUIT_REQUEST);
|
||||
return false;
|
||||
}
|
||||
|
||||
void HaikuDirectWindow::DirectConnected(direct_buffer_info *info) {
|
||||
view->DirectConnected(info);
|
||||
view->EnableDirectMode(true);
|
||||
}
|
||||
|
||||
void HaikuDirectWindow::MessageReceived(BMessage *message) {
|
||||
switch (message->what) {
|
||||
case REDRAW_MSG:
|
||||
if (Main::iteration()) {
|
||||
view->EnableDirectMode(false);
|
||||
Quit();
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
BDirectWindow::MessageReceived(message);
|
||||
}
|
||||
}
|
||||
|
||||
void HaikuDirectWindow::DispatchMessage(BMessage *message, BHandler *handler) {
|
||||
switch (message->what) {
|
||||
case B_MOUSE_DOWN:
|
||||
case B_MOUSE_UP:
|
||||
HandleMouseButton(message);
|
||||
break;
|
||||
|
||||
case B_MOUSE_MOVED:
|
||||
HandleMouseMoved(message);
|
||||
break;
|
||||
|
||||
case B_MOUSE_WHEEL_CHANGED:
|
||||
HandleMouseWheelChanged(message);
|
||||
break;
|
||||
|
||||
case B_KEY_DOWN:
|
||||
case B_KEY_UP:
|
||||
HandleKeyboardEvent(message);
|
||||
break;
|
||||
|
||||
case B_MODIFIERS_CHANGED:
|
||||
HandleKeyboardModifierEvent(message);
|
||||
break;
|
||||
|
||||
case B_WINDOW_RESIZED:
|
||||
HandleWindowResized(message);
|
||||
break;
|
||||
|
||||
case LOCKGL_MSG:
|
||||
view->LockGL();
|
||||
break;
|
||||
|
||||
case UNLOCKGL_MSG:
|
||||
view->UnlockGL();
|
||||
break;
|
||||
|
||||
default:
|
||||
BDirectWindow::DispatchMessage(message, handler);
|
||||
}
|
||||
}
|
||||
|
||||
void HaikuDirectWindow::HandleMouseButton(BMessage *message) {
|
||||
BPoint where;
|
||||
if (message->FindPoint("where", &where) != B_OK) {
|
||||
return;
|
||||
}
|
||||
|
||||
uint32 modifiers = message->FindInt32("modifiers");
|
||||
uint32 buttons = message->FindInt32("buttons");
|
||||
uint32 button = buttons ^ last_buttons_state;
|
||||
last_buttons_state = buttons;
|
||||
|
||||
// TODO: implement the mouse_mode checks
|
||||
/*
|
||||
if (mouse_mode == MOUSE_MODE_CAPTURED) {
|
||||
event.xbutton.x=last_mouse_pos.x;
|
||||
event.xbutton.y=last_mouse_pos.y;
|
||||
}
|
||||
*/
|
||||
|
||||
Ref<InputEventMouseButton> mouse_event;
|
||||
mouse_event.instance();
|
||||
|
||||
mouse_event->set_button_mask(GetMouseButtonState(buttons));
|
||||
mouse_event->set_position({ where.x, where.y });
|
||||
mouse_event->set_global_position({ where.x, where.y });
|
||||
GetKeyModifierState(mouse_event, modifiers);
|
||||
|
||||
switch (button) {
|
||||
default:
|
||||
case B_PRIMARY_MOUSE_BUTTON:
|
||||
mouse_event->set_button_index(1);
|
||||
break;
|
||||
|
||||
case B_SECONDARY_MOUSE_BUTTON:
|
||||
mouse_event->set_button_index(2);
|
||||
break;
|
||||
|
||||
case B_TERTIARY_MOUSE_BUTTON:
|
||||
mouse_event->set_button_index(3);
|
||||
break;
|
||||
}
|
||||
|
||||
mouse_event->set_pressed(message->what == B_MOUSE_DOWN);
|
||||
|
||||
if (message->what == B_MOUSE_DOWN && mouse_event->get_button_index() == 1) {
|
||||
int32 clicks = message->FindInt32("clicks");
|
||||
|
||||
if (clicks > 1) {
|
||||
mouse_event->set_doubleclick(true);
|
||||
}
|
||||
}
|
||||
|
||||
input->parse_input_event(mouse_event);
|
||||
}
|
||||
|
||||
void HaikuDirectWindow::HandleMouseMoved(BMessage *message) {
|
||||
BPoint where;
|
||||
if (message->FindPoint("where", &where) != B_OK) {
|
||||
return;
|
||||
}
|
||||
|
||||
Point2i pos(where.x, where.y);
|
||||
uint32 modifiers = message->FindInt32("modifiers");
|
||||
uint32 buttons = message->FindInt32("buttons");
|
||||
|
||||
if (!last_mouse_pos_valid) {
|
||||
last_mouse_position = pos;
|
||||
last_mouse_pos_valid = true;
|
||||
}
|
||||
|
||||
Point2i rel = pos - last_mouse_position;
|
||||
|
||||
Ref<InputEventMouseMotion> motion_event;
|
||||
motion_event.instance();
|
||||
GetKeyModifierState(motion_event, modifiers);
|
||||
|
||||
motion_event->set_button_mask(GetMouseButtonState(buttons));
|
||||
motion_event->set_position({ pos.x, pos.y });
|
||||
input->set_mouse_position(pos);
|
||||
motion_event->set_global_position({ pos.x, pos.y });
|
||||
motion_event->set_speed({ input->get_last_mouse_speed().x,
|
||||
input->get_last_mouse_speed().y });
|
||||
|
||||
motion_event->set_relative({ rel.x, rel.y });
|
||||
|
||||
last_mouse_position = pos;
|
||||
|
||||
input->parse_input_event(motion_event);
|
||||
}
|
||||
|
||||
void HaikuDirectWindow::HandleMouseWheelChanged(BMessage *message) {
|
||||
float wheel_delta_y = 0;
|
||||
if (message->FindFloat("be:wheel_delta_y", &wheel_delta_y) != B_OK) {
|
||||
return;
|
||||
}
|
||||
|
||||
Ref<InputEventMouseButton> mouse_event;
|
||||
mouse_event.instance();
|
||||
//GetKeyModifierState(mouse_event, modifiers);
|
||||
|
||||
mouse_event->set_button_index(wheel_delta_y < 0 ? 4 : 5);
|
||||
mouse_event->set_button_mask(last_button_mask);
|
||||
mouse_event->set_position({ last_mouse_position.x,
|
||||
last_mouse_position.y });
|
||||
mouse_event->set_global_position({ last_mouse_position.x,
|
||||
last_mouse_position.y });
|
||||
|
||||
mouse_event->set_pressed(true);
|
||||
input->parse_input_event(mouse_event);
|
||||
|
||||
mouse_event->set_pressed(false);
|
||||
input->parse_input_event(mouse_event);
|
||||
}
|
||||
|
||||
void HaikuDirectWindow::HandleKeyboardEvent(BMessage *message) {
|
||||
int32 raw_char = 0;
|
||||
int32 key = 0;
|
||||
int32 modifiers = 0;
|
||||
|
||||
if (message->FindInt32("raw_char", &raw_char) != B_OK) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (message->FindInt32("key", &key) != B_OK) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (message->FindInt32("modifiers", &modifiers) != B_OK) {
|
||||
return;
|
||||
}
|
||||
|
||||
Ref<InputEventKey> event;
|
||||
event.instance();
|
||||
GetKeyModifierState(event, modifiers);
|
||||
event->set_pressed(message->what == B_KEY_DOWN);
|
||||
event->set_scancode(KeyMappingHaiku::get_keysym(raw_char, key));
|
||||
event->set_echo(message->HasInt32("be:key_repeat"));
|
||||
event->set_unicode(0);
|
||||
|
||||
const char *bytes = NULL;
|
||||
if (message->FindString("bytes", &bytes) == B_OK) {
|
||||
event->set_unicode(BUnicodeChar::FromUTF8(&bytes));
|
||||
}
|
||||
|
||||
//make it consistent across platforms.
|
||||
if (event->get_scancode() == KEY_BACKTAB) {
|
||||
event->set_scancode(KEY_TAB);
|
||||
event->set_shift(true);
|
||||
}
|
||||
|
||||
input->parse_input_event(event);
|
||||
}
|
||||
|
||||
void HaikuDirectWindow::HandleKeyboardModifierEvent(BMessage *message) {
|
||||
int32 old_modifiers = 0;
|
||||
int32 modifiers = 0;
|
||||
|
||||
if (message->FindInt32("be:old_modifiers", &old_modifiers) != B_OK) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (message->FindInt32("modifiers", &modifiers) != B_OK) {
|
||||
return;
|
||||
}
|
||||
|
||||
int32 key = old_modifiers ^ modifiers;
|
||||
|
||||
Ref<InputEventWithModifiers> event;
|
||||
event.instance();
|
||||
GetKeyModifierState(event, modifiers);
|
||||
|
||||
event->set_shift(key & B_SHIFT_KEY);
|
||||
event->set_alt(key & B_OPTION_KEY);
|
||||
event->set_control(key & B_CONTROL_KEY);
|
||||
event->set_command(key & B_COMMAND_KEY);
|
||||
|
||||
input->parse_input_event(event);
|
||||
}
|
||||
|
||||
void HaikuDirectWindow::HandleWindowResized(BMessage *message) {
|
||||
int32 width = 0;
|
||||
int32 height = 0;
|
||||
|
||||
if ((message->FindInt32("width", &width) != B_OK) || (message->FindInt32("height", &height) != B_OK)) {
|
||||
return;
|
||||
}
|
||||
|
||||
current_video_mode->width = width;
|
||||
current_video_mode->height = height;
|
||||
}
|
||||
|
||||
inline void HaikuDirectWindow::GetKeyModifierState(Ref<InputEventWithModifiers> event, uint32 p_state) {
|
||||
last_key_modifier_state = p_state;
|
||||
|
||||
event->set_shift(p_state & B_SHIFT_KEY);
|
||||
event->set_control(p_state & B_CONTROL_KEY);
|
||||
event->set_alt(p_state & B_OPTION_KEY);
|
||||
event->set_metakey(p_state & B_COMMAND_KEY);
|
||||
|
||||
return state;
|
||||
}
|
||||
|
||||
inline int HaikuDirectWindow::GetMouseButtonState(uint32 p_state) {
|
||||
int state = 0;
|
||||
|
||||
if (p_state & B_PRIMARY_MOUSE_BUTTON) {
|
||||
state |= 1 << 0;
|
||||
}
|
||||
|
||||
if (p_state & B_SECONDARY_MOUSE_BUTTON) {
|
||||
state |= 1 << 1;
|
||||
}
|
||||
|
||||
if (p_state & B_TERTIARY_MOUSE_BUTTON) {
|
||||
state |= 1 << 2;
|
||||
}
|
||||
|
||||
last_button_mask = state;
|
||||
|
||||
return state;
|
||||
}
|
|
@ -1,89 +0,0 @@
|
|||
/*************************************************************************/
|
||||
/* haiku_direct_window.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
|
||||
/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
|
||||
#ifndef HAIKU_DIRECT_WINDOW_H
|
||||
#define HAIKU_DIRECT_WINDOW_H
|
||||
|
||||
#include <kernel/image.h> // needed for image_id
|
||||
|
||||
#include <DirectWindow.h>
|
||||
|
||||
#include "core/os/os.h"
|
||||
#include "main/input_default.h"
|
||||
|
||||
#include "haiku_gl_view.h"
|
||||
|
||||
#define REDRAW_MSG 'rdrw'
|
||||
#define LOCKGL_MSG 'glck'
|
||||
#define UNLOCKGL_MSG 'ulck'
|
||||
|
||||
class HaikuDirectWindow : public BDirectWindow {
|
||||
private:
|
||||
Point2i last_mouse_position;
|
||||
bool last_mouse_pos_valid;
|
||||
uint32 last_buttons_state;
|
||||
uint32 last_key_modifier_state;
|
||||
int last_button_mask;
|
||||
OS::VideoMode *current_video_mode;
|
||||
|
||||
MainLoop *main_loop;
|
||||
InputDefault *input;
|
||||
HaikuGLView *view;
|
||||
BMessageRunner *update_runner;
|
||||
|
||||
void HandleMouseButton(BMessage *message);
|
||||
void HandleMouseMoved(BMessage *message);
|
||||
void HandleMouseWheelChanged(BMessage *message);
|
||||
void HandleWindowResized(BMessage *message);
|
||||
void HandleKeyboardEvent(BMessage *message);
|
||||
void HandleKeyboardModifierEvent(BMessage *message);
|
||||
inline void GetKeyModifierState(Ref<InputEventWithModifiers> event, uint32 p_state);
|
||||
inline int GetMouseButtonState(uint32 p_state);
|
||||
|
||||
public:
|
||||
HaikuDirectWindow(BRect p_frame);
|
||||
~HaikuDirectWindow();
|
||||
|
||||
void SetHaikuGLView(HaikuGLView *p_view);
|
||||
void StartMessageRunner();
|
||||
void StopMessageRunner();
|
||||
void SetInput(InputDefault *p_input);
|
||||
void SetMainLoop(MainLoop *p_main_loop);
|
||||
inline void SetVideoMode(OS::VideoMode *video_mode) { current_video_mode = video_mode; };
|
||||
virtual bool QuitRequested();
|
||||
virtual void DirectConnected(direct_buffer_info *info);
|
||||
virtual void MessageReceived(BMessage *message);
|
||||
virtual void DispatchMessage(BMessage *message, BHandler *handler);
|
||||
|
||||
inline Point2i GetLastMousePosition() { return last_mouse_position; };
|
||||
inline int GetLastButtonMask() { return last_button_mask; };
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,47 +0,0 @@
|
|||
/*************************************************************************/
|
||||
/* haiku_gl_view.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
|
||||
/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
|
||||
#include "haiku_gl_view.h"
|
||||
#include "main/main.h"
|
||||
|
||||
HaikuGLView::HaikuGLView(BRect frame, uint32 type) :
|
||||
BGLView(frame, "GodotGLView", B_FOLLOW_ALL_SIDES, 0, type) {
|
||||
}
|
||||
|
||||
void HaikuGLView::AttachedToWindow(void) {
|
||||
LockGL();
|
||||
BGLView::AttachedToWindow();
|
||||
UnlockGL();
|
||||
MakeFocus();
|
||||
}
|
||||
|
||||
void HaikuGLView::Draw(BRect updateRect) {
|
||||
Main::force_redraw();
|
||||
}
|
|
@ -1,45 +0,0 @@
|
|||
/*************************************************************************/
|
||||
/* haiku_gl_view.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
|
||||
/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
|
||||
#ifndef HAIKU_GL_VIEW_H
|
||||
#define HAIKU_GL_VIEW_H
|
||||
|
||||
#include <kernel/image.h> // needed for image_id
|
||||
|
||||
#include <GLView.h>
|
||||
|
||||
class HaikuGLView : public BGLView {
|
||||
public:
|
||||
HaikuGLView(BRect frame, uint32 type);
|
||||
virtual void AttachedToWindow(void);
|
||||
virtual void Draw(BRect updateRect);
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,249 +0,0 @@
|
|||
/*************************************************************************/
|
||||
/* key_mapping_haiku.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
|
||||
/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
|
||||
#include <InterfaceDefs.h>
|
||||
|
||||
#include "core/os/keyboard.h"
|
||||
#include "key_mapping_haiku.h"
|
||||
|
||||
struct _HaikuTranslatePair {
|
||||
unsigned int keysym;
|
||||
int32 keycode;
|
||||
};
|
||||
|
||||
static _HaikuTranslatePair _mod_to_keycode[] = {
|
||||
{ KEY_SHIFT, B_SHIFT_KEY },
|
||||
{ KEY_ALT, B_COMMAND_KEY },
|
||||
{ KEY_CONTROL, B_CONTROL_KEY },
|
||||
{ KEY_CAPSLOCK, B_CAPS_LOCK },
|
||||
{ KEY_SCROLLLOCK, B_SCROLL_LOCK },
|
||||
{ KEY_NUMLOCK, B_NUM_LOCK },
|
||||
{ KEY_SUPER_L, B_OPTION_KEY },
|
||||
{ KEY_MENU, B_MENU_KEY },
|
||||
{ KEY_SHIFT, B_LEFT_SHIFT_KEY },
|
||||
{ KEY_SHIFT, B_RIGHT_SHIFT_KEY },
|
||||
{ KEY_ALT, B_LEFT_COMMAND_KEY },
|
||||
{ KEY_ALT, B_RIGHT_COMMAND_KEY },
|
||||
{ KEY_CONTROL, B_LEFT_CONTROL_KEY },
|
||||
{ KEY_CONTROL, B_RIGHT_CONTROL_KEY },
|
||||
{ KEY_SUPER_L, B_LEFT_OPTION_KEY },
|
||||
{ KEY_SUPER_R, B_RIGHT_OPTION_KEY },
|
||||
{ KEY_UNKNOWN, 0 }
|
||||
};
|
||||
|
||||
static _HaikuTranslatePair _fn_to_keycode[] = {
|
||||
{ KEY_F1, B_F1_KEY },
|
||||
{ KEY_F2, B_F2_KEY },
|
||||
{ KEY_F3, B_F3_KEY },
|
||||
{ KEY_F4, B_F4_KEY },
|
||||
{ KEY_F5, B_F5_KEY },
|
||||
{ KEY_F6, B_F6_KEY },
|
||||
{ KEY_F7, B_F7_KEY },
|
||||
{ KEY_F8, B_F8_KEY },
|
||||
{ KEY_F9, B_F9_KEY },
|
||||
{ KEY_F10, B_F10_KEY },
|
||||
{ KEY_F11, B_F11_KEY },
|
||||
{ KEY_F12, B_F12_KEY },
|
||||
//{ KEY_F13, ? },
|
||||
//{ KEY_F14, ? },
|
||||
//{ KEY_F15, ? },
|
||||
//{ KEY_F16, ? },
|
||||
{ KEY_PRINT, B_PRINT_KEY },
|
||||
{ KEY_SCROLLLOCK, B_SCROLL_KEY },
|
||||
{ KEY_PAUSE, B_PAUSE_KEY },
|
||||
{ KEY_UNKNOWN, 0 }
|
||||
};
|
||||
|
||||
static _HaikuTranslatePair _hb_to_keycode[] = {
|
||||
{ KEY_BACKSPACE, B_BACKSPACE },
|
||||
{ KEY_TAB, B_TAB },
|
||||
{ KEY_ENTER, B_RETURN },
|
||||
{ KEY_CAPSLOCK, B_CAPS_LOCK },
|
||||
{ KEY_ESCAPE, B_ESCAPE },
|
||||
{ KEY_SPACE, B_SPACE },
|
||||
{ KEY_PAGEUP, B_PAGE_UP },
|
||||
{ KEY_PAGEDOWN, B_PAGE_DOWN },
|
||||
{ KEY_END, B_END },
|
||||
{ KEY_HOME, B_HOME },
|
||||
{ KEY_LEFT, B_LEFT_ARROW },
|
||||
{ KEY_UP, B_UP_ARROW },
|
||||
{ KEY_RIGHT, B_RIGHT_ARROW },
|
||||
{ KEY_DOWN, B_DOWN_ARROW },
|
||||
{ KEY_PRINT, B_PRINT_KEY },
|
||||
{ KEY_INSERT, B_INSERT },
|
||||
{ KEY_DELETE, B_DELETE },
|
||||
// { KEY_HELP, ??? },
|
||||
|
||||
{ KEY_0, (0x30) },
|
||||
{ KEY_1, (0x31) },
|
||||
{ KEY_2, (0x32) },
|
||||
{ KEY_3, (0x33) },
|
||||
{ KEY_4, (0x34) },
|
||||
{ KEY_5, (0x35) },
|
||||
{ KEY_6, (0x36) },
|
||||
{ KEY_7, (0x37) },
|
||||
{ KEY_8, (0x38) },
|
||||
{ KEY_9, (0x39) },
|
||||
{ KEY_A, (0x61) },
|
||||
{ KEY_B, (0x62) },
|
||||
{ KEY_C, (0x63) },
|
||||
{ KEY_D, (0x64) },
|
||||
{ KEY_E, (0x65) },
|
||||
{ KEY_F, (0x66) },
|
||||
{ KEY_G, (0x67) },
|
||||
{ KEY_H, (0x68) },
|
||||
{ KEY_I, (0x69) },
|
||||
{ KEY_J, (0x6A) },
|
||||
{ KEY_K, (0x6B) },
|
||||
{ KEY_L, (0x6C) },
|
||||
{ KEY_M, (0x6D) },
|
||||
{ KEY_N, (0x6E) },
|
||||
{ KEY_O, (0x6F) },
|
||||
{ KEY_P, (0x70) },
|
||||
{ KEY_Q, (0x71) },
|
||||
{ KEY_R, (0x72) },
|
||||
{ KEY_S, (0x73) },
|
||||
{ KEY_T, (0x74) },
|
||||
{ KEY_U, (0x75) },
|
||||
{ KEY_V, (0x76) },
|
||||
{ KEY_W, (0x77) },
|
||||
{ KEY_X, (0x78) },
|
||||
{ KEY_Y, (0x79) },
|
||||
{ KEY_Z, (0x7A) },
|
||||
|
||||
/*
|
||||
{ KEY_PLAY, VK_PLAY},// (0xFA)
|
||||
{ KEY_STANDBY,VK_SLEEP },//(0x5F)
|
||||
{ KEY_BACK,VK_BROWSER_BACK},// (0xA6)
|
||||
{ KEY_FORWARD,VK_BROWSER_FORWARD},// (0xA7)
|
||||
{ KEY_REFRESH,VK_BROWSER_REFRESH},// (0xA8)
|
||||
{ KEY_STOP,VK_BROWSER_STOP},// (0xA9)
|
||||
{ KEY_SEARCH,VK_BROWSER_SEARCH},// (0xAA)
|
||||
{ KEY_FAVORITES, VK_BROWSER_FAVORITES},// (0xAB)
|
||||
{ KEY_HOMEPAGE,VK_BROWSER_HOME},// (0xAC)
|
||||
{ KEY_VOLUMEMUTE,VK_VOLUME_MUTE},// (0xAD)
|
||||
{ KEY_VOLUMEDOWN,VK_VOLUME_DOWN},// (0xAE)
|
||||
{ KEY_VOLUMEUP,VK_VOLUME_UP},// (0xAF)
|
||||
{ KEY_MEDIANEXT,VK_MEDIA_NEXT_TRACK},// (0xB0)
|
||||
{ KEY_MEDIAPREVIOUS,VK_MEDIA_PREV_TRACK},// (0xB1)
|
||||
{ KEY_MEDIASTOP,VK_MEDIA_STOP},// (0xB2)
|
||||
{ KEY_LAUNCHMAIL, VK_LAUNCH_MAIL},// (0xB4)
|
||||
{ KEY_LAUNCHMEDIA,VK_LAUNCH_MEDIA_SELECT},// (0xB5)
|
||||
{ KEY_LAUNCH0,VK_LAUNCH_APP1},// (0xB6)
|
||||
{ KEY_LAUNCH1,VK_LAUNCH_APP2},// (0xB7)
|
||||
*/
|
||||
|
||||
{ KEY_SEMICOLON, 0x3B },
|
||||
{ KEY_EQUAL, 0x3D },
|
||||
{ KEY_COLON, 0x2C },
|
||||
{ KEY_MINUS, 0x2D },
|
||||
{ KEY_PERIOD, 0x2E },
|
||||
{ KEY_SLASH, 0x2F },
|
||||
{ KEY_KP_MULTIPLY, 0x2A },
|
||||
{ KEY_KP_ADD, 0x2B },
|
||||
|
||||
{ KEY_QUOTELEFT, 0x60 },
|
||||
{ KEY_BRACKETLEFT, 0x5B },
|
||||
{ KEY_BACKSLASH, 0x5C },
|
||||
{ KEY_BRACKETRIGHT, 0x5D },
|
||||
{ KEY_APOSTROPHE, 0x27 },
|
||||
|
||||
{ KEY_UNKNOWN, 0 }
|
||||
};
|
||||
|
||||
unsigned int KeyMappingHaiku::get_keysym(int32 raw_char, int32 key) {
|
||||
if (raw_char == B_INSERT && key == 0x64) {
|
||||
return KEY_KP_0;
|
||||
}
|
||||
if (raw_char == B_END && key == 0x58) {
|
||||
return KEY_KP_1;
|
||||
}
|
||||
if (raw_char == B_DOWN_ARROW && key == 0x59) {
|
||||
return KEY_KP_2;
|
||||
}
|
||||
if (raw_char == B_PAGE_DOWN && key == 0x5A) {
|
||||
return KEY_KP_3;
|
||||
}
|
||||
if (raw_char == B_LEFT_ARROW && key == 0x48) {
|
||||
return KEY_KP_4;
|
||||
}
|
||||
if (raw_char == 0x35 && key == 0x49) {
|
||||
return KEY_KP_5;
|
||||
}
|
||||
if (raw_char == B_RIGHT_ARROW && key == 0x4A) {
|
||||
return KEY_KP_6;
|
||||
}
|
||||
if (raw_char == B_HOME && key == 0x37) {
|
||||
return KEY_KP_7;
|
||||
}
|
||||
if (raw_char == B_UP_ARROW && key == 0x38) {
|
||||
return KEY_KP_8;
|
||||
}
|
||||
if (raw_char == B_PAGE_UP && key == 0x39) {
|
||||
return KEY_KP_9;
|
||||
}
|
||||
if (raw_char == 0x2F && key == 0x23) {
|
||||
return KEY_KP_DIVIDE;
|
||||
}
|
||||
if (raw_char == 0x2D && key == 0x25) {
|
||||
return KEY_KP_SUBTRACT;
|
||||
}
|
||||
if (raw_char == B_DELETE && key == 0x65) {
|
||||
return KEY_KP_PERIOD;
|
||||
}
|
||||
|
||||
if (raw_char == 0x10) {
|
||||
for (int i = 0; _fn_to_keycode[i].keysym != KEY_UNKNOWN; i++) {
|
||||
if (_fn_to_keycode[i].keycode == key) {
|
||||
return _fn_to_keycode[i].keysym;
|
||||
}
|
||||
}
|
||||
|
||||
return KEY_UNKNOWN;
|
||||
}
|
||||
|
||||
for (int i = 0; _hb_to_keycode[i].keysym != KEY_UNKNOWN; i++) {
|
||||
if (_hb_to_keycode[i].keycode == raw_char) {
|
||||
return _hb_to_keycode[i].keysym;
|
||||
}
|
||||
}
|
||||
|
||||
return KEY_UNKNOWN;
|
||||
}
|
||||
|
||||
unsigned int KeyMappingHaiku::get_modifier_keysym(int32 key) {
|
||||
for (int i = 0; _mod_to_keycode[i].keysym != KEY_UNKNOWN; i++) {
|
||||
if ((_mod_to_keycode[i].keycode & key) != 0) {
|
||||
return _mod_to_keycode[i].keysym;
|
||||
}
|
||||
}
|
||||
|
||||
return KEY_UNKNOWN;
|
||||
}
|
|
@ -1,42 +0,0 @@
|
|||
/*************************************************************************/
|
||||
/* key_mapping_haiku.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
|
||||
/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
|
||||
#ifndef KEY_MAPPING_HAIKU_H
|
||||
#define KEY_MAPPING_HAIKU_H
|
||||
|
||||
class KeyMappingHaiku {
|
||||
KeyMappingHaiku(){};
|
||||
|
||||
public:
|
||||
static unsigned int get_keysym(int32 raw_char, int32 key);
|
||||
static unsigned int get_modifier_keysym(int32 key);
|
||||
};
|
||||
|
||||
#endif
|
Binary file not shown.
Before Width: | Height: | Size: 1.2 KiB |
|
@ -1,378 +0,0 @@
|
|||
/*************************************************************************/
|
||||
/* os_haiku.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
|
||||
/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
|
||||
#include "drivers/gles3/rasterizer_gles3.h"
|
||||
|
||||
#include "os_haiku.h"
|
||||
|
||||
#include "main/main.h"
|
||||
#include "servers/physics/physics_server_sw.h"
|
||||
#include "servers/visual/visual_server_raster.h"
|
||||
#include "servers/visual/visual_server_wrap_mt.h"
|
||||
|
||||
#include <Screen.h>
|
||||
|
||||
OS_Haiku::OS_Haiku() {
|
||||
#ifdef MEDIA_KIT_ENABLED
|
||||
AudioDriverManager::add_driver(&driver_media_kit);
|
||||
#endif
|
||||
};
|
||||
|
||||
void OS_Haiku::run() {
|
||||
if (!main_loop) {
|
||||
return;
|
||||
}
|
||||
|
||||
main_loop->init();
|
||||
context_gl->release_current();
|
||||
|
||||
// TODO: clean up
|
||||
BMessenger *bms = new BMessenger(window);
|
||||
BMessage *msg = new BMessage();
|
||||
bms->SendMessage(LOCKGL_MSG, msg);
|
||||
|
||||
window->StartMessageRunner();
|
||||
app->Run();
|
||||
window->StopMessageRunner();
|
||||
|
||||
delete app;
|
||||
|
||||
delete bms;
|
||||
delete msg;
|
||||
main_loop->finish();
|
||||
}
|
||||
|
||||
String OS_Haiku::get_name() const {
|
||||
return "Haiku";
|
||||
}
|
||||
|
||||
int OS_Haiku::get_video_driver_count() const {
|
||||
return 1;
|
||||
}
|
||||
|
||||
const char *OS_Haiku::get_video_driver_name(int p_driver) const {
|
||||
return "GLES3";
|
||||
}
|
||||
|
||||
int OS_Haiku::get_current_video_driver() const {
|
||||
return video_driver_index;
|
||||
}
|
||||
|
||||
Error OS_Haiku::initialize(const VideoMode &p_desired, int p_video_driver, int p_audio_driver) {
|
||||
main_loop = NULL;
|
||||
current_video_mode = p_desired;
|
||||
|
||||
app = new HaikuApplication();
|
||||
|
||||
BRect frame;
|
||||
frame.Set(50, 50, 50 + current_video_mode.width - 1, 50 + current_video_mode.height - 1);
|
||||
|
||||
window = new HaikuDirectWindow(frame);
|
||||
window->SetVideoMode(¤t_video_mode);
|
||||
|
||||
if (current_video_mode.fullscreen) {
|
||||
window->SetFullScreen(true);
|
||||
}
|
||||
|
||||
if (!current_video_mode.resizable) {
|
||||
uint32 flags = window->Flags();
|
||||
flags |= B_NOT_RESIZABLE;
|
||||
window->SetFlags(flags);
|
||||
}
|
||||
|
||||
#if defined(OPENGL_ENABLED)
|
||||
context_gl = memnew(ContextGL_Haiku(window));
|
||||
context_gl->initialize();
|
||||
context_gl->make_current();
|
||||
context_gl->set_use_vsync(current_video_mode.use_vsync);
|
||||
RasterizerGLES3::register_config();
|
||||
RasterizerGLES3::make_current();
|
||||
|
||||
#endif
|
||||
|
||||
visual_server = memnew(VisualServerRaster);
|
||||
// FIXME: Reimplement threaded rendering
|
||||
if (get_render_thread_mode() != RENDER_THREAD_UNSAFE) {
|
||||
visual_server = memnew(VisualServerWrapMT(visual_server, false));
|
||||
}
|
||||
|
||||
ERR_FAIL_COND_V(!visual_server, ERR_UNAVAILABLE);
|
||||
|
||||
video_driver_index = p_video_driver;
|
||||
|
||||
input = memnew(InputDefault);
|
||||
window->SetInput(input);
|
||||
|
||||
window->Show();
|
||||
visual_server->init();
|
||||
|
||||
AudioDriverManager::initialize(p_audio_driver);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
void OS_Haiku::finalize() {
|
||||
if (main_loop) {
|
||||
memdelete(main_loop);
|
||||
}
|
||||
|
||||
main_loop = NULL;
|
||||
|
||||
visual_server->finish();
|
||||
memdelete(visual_server);
|
||||
|
||||
memdelete(input);
|
||||
|
||||
#if defined(OPENGL_ENABLED)
|
||||
memdelete(context_gl);
|
||||
#endif
|
||||
}
|
||||
|
||||
void OS_Haiku::set_main_loop(MainLoop *p_main_loop) {
|
||||
main_loop = p_main_loop;
|
||||
input->set_main_loop(p_main_loop);
|
||||
window->SetMainLoop(p_main_loop);
|
||||
}
|
||||
|
||||
MainLoop *OS_Haiku::get_main_loop() const {
|
||||
return main_loop;
|
||||
}
|
||||
|
||||
void OS_Haiku::delete_main_loop() {
|
||||
if (main_loop) {
|
||||
memdelete(main_loop);
|
||||
}
|
||||
|
||||
main_loop = NULL;
|
||||
window->SetMainLoop(NULL);
|
||||
}
|
||||
|
||||
void OS_Haiku::release_rendering_thread() {
|
||||
context_gl->release_current();
|
||||
}
|
||||
|
||||
void OS_Haiku::make_rendering_thread() {
|
||||
context_gl->make_current();
|
||||
}
|
||||
|
||||
bool OS_Haiku::can_draw() const {
|
||||
// TODO: implement
|
||||
return true;
|
||||
}
|
||||
|
||||
void OS_Haiku::swap_buffers() {
|
||||
context_gl->swap_buffers();
|
||||
}
|
||||
|
||||
Point2 OS_Haiku::get_mouse_position() const {
|
||||
return window->GetLastMousePosition();
|
||||
}
|
||||
|
||||
int OS_Haiku::get_mouse_button_state() const {
|
||||
return window->GetLastButtonMask();
|
||||
}
|
||||
|
||||
void OS_Haiku::set_cursor_shape(CursorShape p_shape) {
|
||||
//ERR_PRINT("set_cursor_shape() NOT IMPLEMENTED");
|
||||
}
|
||||
|
||||
OS::CursorShape OS_Haiku::get_cursor_shape() const {
|
||||
// TODO: implement get_cursor_shape
|
||||
}
|
||||
|
||||
void OS_Haiku::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shape, const Vector2 &p_hotspot) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
int OS_Haiku::get_screen_count() const {
|
||||
// TODO: implement get_screen_count()
|
||||
return 1;
|
||||
}
|
||||
|
||||
int OS_Haiku::get_current_screen() const {
|
||||
// TODO: implement get_current_screen()
|
||||
return 0;
|
||||
}
|
||||
|
||||
void OS_Haiku::set_current_screen(int p_screen) {
|
||||
// TODO: implement set_current_screen()
|
||||
}
|
||||
|
||||
Point2 OS_Haiku::get_screen_position(int p_screen) const {
|
||||
// TODO: make this work with the p_screen parameter
|
||||
BScreen *screen = new BScreen(window);
|
||||
BRect frame = screen->Frame();
|
||||
delete screen;
|
||||
return Point2i(frame.left, frame.top);
|
||||
}
|
||||
|
||||
Size2 OS_Haiku::get_screen_size(int p_screen) const {
|
||||
// TODO: make this work with the p_screen parameter
|
||||
BScreen *screen = new BScreen(window);
|
||||
BRect frame = screen->Frame();
|
||||
delete screen;
|
||||
return Size2i(frame.IntegerWidth() + 1, frame.IntegerHeight() + 1);
|
||||
}
|
||||
|
||||
void OS_Haiku::set_window_title(const String &p_title) {
|
||||
window->SetTitle(p_title.utf8().get_data());
|
||||
}
|
||||
|
||||
Size2 OS_Haiku::get_window_size() const {
|
||||
BSize size = window->Size();
|
||||
return Size2i(size.IntegerWidth() + 1, size.IntegerHeight() + 1);
|
||||
}
|
||||
|
||||
void OS_Haiku::set_window_size(const Size2 p_size) {
|
||||
// TODO: why does it stop redrawing after this is called?
|
||||
window->ResizeTo(p_size.x, p_size.y);
|
||||
}
|
||||
|
||||
Point2 OS_Haiku::get_window_position() const {
|
||||
BPoint point(0, 0);
|
||||
window->ConvertToScreen(&point);
|
||||
return Point2i(point.x, point.y);
|
||||
}
|
||||
|
||||
void OS_Haiku::set_window_position(const Point2 &p_position) {
|
||||
window->MoveTo(p_position.x, p_position.y);
|
||||
}
|
||||
|
||||
void OS_Haiku::set_window_fullscreen(bool p_enabled) {
|
||||
window->SetFullScreen(p_enabled);
|
||||
current_video_mode.fullscreen = p_enabled;
|
||||
visual_server->init();
|
||||
}
|
||||
|
||||
bool OS_Haiku::is_window_fullscreen() const {
|
||||
return current_video_mode.fullscreen;
|
||||
}
|
||||
|
||||
void OS_Haiku::set_window_resizable(bool p_enabled) {
|
||||
uint32 flags = window->Flags();
|
||||
|
||||
if (p_enabled) {
|
||||
flags &= ~(B_NOT_RESIZABLE);
|
||||
} else {
|
||||
flags |= B_NOT_RESIZABLE;
|
||||
}
|
||||
|
||||
window->SetFlags(flags);
|
||||
current_video_mode.resizable = p_enabled;
|
||||
}
|
||||
|
||||
bool OS_Haiku::is_window_resizable() const {
|
||||
return current_video_mode.resizable;
|
||||
}
|
||||
|
||||
void OS_Haiku::set_window_minimized(bool p_enabled) {
|
||||
window->Minimize(p_enabled);
|
||||
}
|
||||
|
||||
bool OS_Haiku::is_window_minimized() const {
|
||||
return window->IsMinimized();
|
||||
}
|
||||
|
||||
void OS_Haiku::set_window_maximized(bool p_enabled) {
|
||||
window->Minimize(!p_enabled);
|
||||
}
|
||||
|
||||
bool OS_Haiku::is_window_maximized() const {
|
||||
return !window->IsMinimized();
|
||||
}
|
||||
|
||||
void OS_Haiku::set_video_mode(const VideoMode &p_video_mode, int p_screen) {
|
||||
ERR_PRINT("set_video_mode() NOT IMPLEMENTED");
|
||||
}
|
||||
|
||||
OS::VideoMode OS_Haiku::get_video_mode(int p_screen) const {
|
||||
return current_video_mode;
|
||||
}
|
||||
|
||||
void OS_Haiku::get_fullscreen_mode_list(List<VideoMode> *p_list, int p_screen) const {
|
||||
ERR_PRINT("get_fullscreen_mode_list() NOT IMPLEMENTED");
|
||||
}
|
||||
|
||||
String OS_Haiku::get_executable_path() const {
|
||||
return OS::get_executable_path();
|
||||
}
|
||||
|
||||
bool OS_Haiku::_check_internal_feature_support(const String &p_feature) {
|
||||
|
||||
return p_feature == "pc";
|
||||
}
|
||||
|
||||
String OS_Haiku::get_config_path() const {
|
||||
|
||||
if (has_environment("XDG_CONFIG_HOME")) {
|
||||
return get_environment("XDG_CONFIG_HOME");
|
||||
} else if (has_environment("HOME")) {
|
||||
return get_environment("HOME").plus_file("config/settings");
|
||||
} else {
|
||||
return ".";
|
||||
}
|
||||
}
|
||||
|
||||
String OS_Haiku::get_data_path() const {
|
||||
|
||||
if (has_environment("XDG_DATA_HOME")) {
|
||||
return get_environment("XDG_DATA_HOME");
|
||||
} else if (has_environment("HOME")) {
|
||||
return get_environment("HOME").plus_file("config/data");
|
||||
} else {
|
||||
return get_config_path();
|
||||
}
|
||||
}
|
||||
|
||||
String OS_Haiku::get_cache_path() const {
|
||||
|
||||
if (has_environment("XDG_CACHE_HOME")) {
|
||||
return get_environment("XDG_CACHE_HOME");
|
||||
} else if (has_environment("HOME")) {
|
||||
return get_environment("HOME").plus_file("config/cache");
|
||||
} else {
|
||||
return get_config_path();
|
||||
}
|
||||
}
|
||||
|
||||
OS::PowerState OS_Haiku::get_power_state() {
|
||||
WARN_PRINT("Power management is not implemented on this platform, defaulting to POWERSTATE_UNKNOWN");
|
||||
return OS::POWERSTATE_UNKNOWN;
|
||||
}
|
||||
|
||||
int OS_Haiku::get_power_seconds_left() {
|
||||
WARN_PRINT("Power management is not implemented on this platform, defaulting to -1");
|
||||
return -1;
|
||||
}
|
||||
|
||||
int OS_Haiku::get_power_percent_left() {
|
||||
WARN_PRINT("Power management is not implemented on this platform, defaulting to -1");
|
||||
return -1;
|
||||
}
|
|
@ -1,127 +0,0 @@
|
|||
/*************************************************************************/
|
||||
/* os_haiku.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
|
||||
/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
|
||||
#ifndef OS_HAIKU_H
|
||||
#define OS_HAIKU_H
|
||||
|
||||
#include "audio_driver_media_kit.h"
|
||||
#include "context_gl_haiku.h"
|
||||
#include "drivers/unix/os_unix.h"
|
||||
#include "haiku_application.h"
|
||||
#include "haiku_direct_window.h"
|
||||
#include "main/input_default.h"
|
||||
#include "servers/audio_server.h"
|
||||
#include "servers/visual_server.h"
|
||||
|
||||
class OS_Haiku : public OS_Unix {
|
||||
private:
|
||||
HaikuApplication *app;
|
||||
HaikuDirectWindow *window;
|
||||
MainLoop *main_loop;
|
||||
InputDefault *input;
|
||||
VisualServer *visual_server;
|
||||
VideoMode current_video_mode;
|
||||
int video_driver_index;
|
||||
|
||||
#ifdef MEDIA_KIT_ENABLED
|
||||
AudioDriverMediaKit driver_media_kit;
|
||||
#endif
|
||||
|
||||
#if defined(OPENGL_ENABLED)
|
||||
ContextGL_Haiku *context_gl;
|
||||
#endif
|
||||
|
||||
virtual void delete_main_loop();
|
||||
|
||||
protected:
|
||||
virtual int get_video_driver_count() const;
|
||||
virtual const char *get_video_driver_name(int p_driver) const;
|
||||
virtual int get_current_video_driver() const;
|
||||
|
||||
virtual Error initialize(const VideoMode &p_desired, int p_video_driver, int p_audio_driver);
|
||||
virtual void finalize();
|
||||
|
||||
virtual void set_main_loop(MainLoop *p_main_loop);
|
||||
|
||||
public:
|
||||
OS_Haiku();
|
||||
void run();
|
||||
|
||||
virtual String get_name() const;
|
||||
|
||||
virtual MainLoop *get_main_loop() const;
|
||||
|
||||
virtual bool can_draw() const;
|
||||
virtual void release_rendering_thread();
|
||||
virtual void make_rendering_thread();
|
||||
virtual void swap_buffers();
|
||||
|
||||
virtual Point2 get_mouse_position() const;
|
||||
virtual int get_mouse_button_state() const;
|
||||
virtual void set_cursor_shape(CursorShape p_shape);
|
||||
virtual CursorShape get_cursor_shape() const;
|
||||
virtual void set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shape, const Vector2 &p_hotspot);
|
||||
|
||||
virtual int get_screen_count() const;
|
||||
virtual int get_current_screen() const;
|
||||
virtual void set_current_screen(int p_screen);
|
||||
virtual Point2 get_screen_position(int p_screen = -1) const;
|
||||
virtual Size2 get_screen_size(int p_screen = -1) const;
|
||||
virtual void set_window_title(const String &p_title);
|
||||
virtual Size2 get_window_size() const;
|
||||
virtual void set_window_size(const Size2 p_size);
|
||||
virtual Point2 get_window_position() const;
|
||||
virtual void set_window_position(const Point2 &p_position);
|
||||
virtual void set_window_fullscreen(bool p_enabled);
|
||||
virtual bool is_window_fullscreen() const;
|
||||
virtual void set_window_resizable(bool p_enabled);
|
||||
virtual bool is_window_resizable() const;
|
||||
virtual void set_window_minimized(bool p_enabled);
|
||||
virtual bool is_window_minimized() const;
|
||||
virtual void set_window_maximized(bool p_enabled);
|
||||
virtual bool is_window_maximized() const;
|
||||
|
||||
virtual void set_video_mode(const VideoMode &p_video_mode, int p_screen = 0);
|
||||
virtual VideoMode get_video_mode(int p_screen = 0) const;
|
||||
virtual void get_fullscreen_mode_list(List<VideoMode> *p_list, int p_screen = 0) const;
|
||||
virtual String get_executable_path() const;
|
||||
|
||||
virtual OS::PowerState get_power_state();
|
||||
virtual int get_power_seconds_left();
|
||||
virtual int get_power_percent_left();
|
||||
|
||||
virtual bool _check_internal_feature_support(const String &p_feature);
|
||||
|
||||
virtual String get_config_path() const;
|
||||
virtual String get_data_path() const;
|
||||
virtual String get_cache_path() const;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,37 +0,0 @@
|
|||
/*************************************************************************/
|
||||
/* platform_config.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
|
||||
/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
|
||||
#include <alloca.h>
|
||||
|
||||
// for ifaddrs.h needed in drivers/unix/ip_unix.cpp
|
||||
#define _BSD_SOURCE 1
|
||||
|
||||
#define GLES3_INCLUDE_H "thirdparty/glad/glad/glad.h"
|
||||
#define GLES2_INCLUDE_H "thirdparty/glad/glad/glad.h"
|
Loading…
Reference in a new issue