mirror of
https://github.com/godotengine/godot-platform-haiku.git
synced 2026-01-05 10:10:03 +03:00
Compare commits
13 Commits
3.2
...
2.1.4-stab
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a78dd556f9 | ||
|
|
80801978a5 | ||
|
|
9b4ed82558 | ||
|
|
99d0aa0b8e | ||
|
|
1b389a8e4c | ||
|
|
f07bb36f97 | ||
|
|
289fc15e57 | ||
|
|
92806c4c08 | ||
|
|
8824d6f4f3 | ||
|
|
a8658241a1 | ||
|
|
2325ef4fa4 | ||
|
|
012500bf43 | ||
|
|
64d247674c |
20
LICENSE.txt
20
LICENSE.txt
@@ -1,20 +0,0 @@
|
|||||||
Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur.
|
|
||||||
Copyright (c) 2014-2020 Godot Engine contributors.
|
|
||||||
|
|
||||||
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.
|
|
||||||
53
README.md
53
README.md
@@ -1,53 +0,0 @@
|
|||||||
## Godot Engine platform port for Haiku
|
|
||||||
|
|
||||||
This is the platform port of [Godot Engine](https://godotengine.org) for the
|
|
||||||
[Haiku](https://www.haiku-os.org) operating system.
|
|
||||||
|
|
||||||
Haiku is not an officially supported platform in the main tree of Godot, so
|
|
||||||
this port is kept separate so that it can be contributed to independently of
|
|
||||||
Godot's main release cycle.
|
|
||||||
|
|
||||||
It may imply that this port might not be functional for the latest versions of
|
|
||||||
Godot. For the time being, neither the `3.2` branch nor the `master` branch are
|
|
||||||
functional out-of-the-box on Haiku.
|
|
||||||
|
|
||||||
We welcome all contributions from Haiku developers to ensure that each branch
|
|
||||||
and Git tag of this repository work as expected with the matching branches and
|
|
||||||
tags of the [Godot repository](https://github.com/godotengine/godot/).
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
This code is meant to be copied as `platform/haiku` in the Godot Engine
|
|
||||||
[source repository](https://github.com/godotengine/godot/) to make builds of
|
|
||||||
Godot for Haiku.
|
|
||||||
|
|
||||||
It can also be cloned as a Git submodule:
|
|
||||||
|
|
||||||
```
|
|
||||||
git clone https://github.com/godotengine/godot
|
|
||||||
cd godot
|
|
||||||
git submodule add https://github.com/godotengine/godot-haiku-platform platform/haiku
|
|
||||||
```
|
|
||||||
|
|
||||||
Be sure to use compatible branches for the Godot repository and the Haiku port.
|
|
||||||
|
|
||||||
You can then compile Godot for Haiku with:
|
|
||||||
|
|
||||||
```
|
|
||||||
# Editor build, optimized.
|
|
||||||
scons p=haiku tools=yes target=release_debug
|
|
||||||
|
|
||||||
# Export template, debug.
|
|
||||||
scons p=haiku tools=no target=release_debug
|
|
||||||
# Export template, release.
|
|
||||||
scons p=haiku tools=no target=release
|
|
||||||
```
|
|
||||||
|
|
||||||
## License
|
|
||||||
|
|
||||||
This port is distributed under the MIT license, with the same copyright as the
|
|
||||||
main Godot source repository.
|
|
||||||
|
|
||||||
See [LICENSE.txt](/LICENSE.txt) for details, and
|
|
||||||
[AUTHORS.md](https://github.com/godotengine/godot/blob/master/AUTHORS.md) in
|
|
||||||
the Godot repository for a list of contributors.
|
|
||||||
2
SCsub
2
SCsub
@@ -12,7 +12,7 @@ common_haiku = [
|
|||||||
'audio_driver_media_kit.cpp'
|
'audio_driver_media_kit.cpp'
|
||||||
]
|
]
|
||||||
|
|
||||||
target = env.add_program(
|
target = env.Program(
|
||||||
'#bin/godot',
|
'#bin/godot',
|
||||||
['godot_haiku.cpp'] + common_haiku
|
['godot_haiku.cpp'] + common_haiku
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -5,8 +5,8 @@
|
|||||||
/* GODOT ENGINE */
|
/* GODOT ENGINE */
|
||||||
/* https://godotengine.org */
|
/* https://godotengine.org */
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
|
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
|
||||||
/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
|
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
|
||||||
/* */
|
/* */
|
||||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||||
/* a copy of this software and associated documentation files (the */
|
/* a copy of this software and associated documentation files (the */
|
||||||
@@ -27,24 +27,23 @@
|
|||||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
|
|
||||||
#include "audio_driver_media_kit.h"
|
#include "audio_driver_media_kit.h"
|
||||||
|
|
||||||
#ifdef MEDIA_KIT_ENABLED
|
#ifdef MEDIA_KIT_ENABLED
|
||||||
|
|
||||||
#include "core/project_settings.h"
|
#include "globals.h"
|
||||||
|
|
||||||
int32_t *AudioDriverMediaKit::samples_in = NULL;
|
int32_t *AudioDriverMediaKit::samples_in = NULL;
|
||||||
|
|
||||||
Error AudioDriverMediaKit::init() {
|
Error AudioDriverMediaKit::init() {
|
||||||
active = false;
|
active = false;
|
||||||
|
|
||||||
mix_rate = GLOBAL_DEF_RST("audio/mix_rate", DEFAULT_MIX_RATE);
|
mix_rate = 44100;
|
||||||
speaker_mode = SPEAKER_MODE_STEREO;
|
output_format = OUTPUT_STEREO;
|
||||||
channels = 2;
|
channels = 2;
|
||||||
|
|
||||||
int latency = GLOBAL_DEF_RST("audio/output_latency", DEFAULT_OUTPUT_LATENCY);
|
int latency = GLOBAL_DEF("audio/output_latency", 25);
|
||||||
buffer_size = next_power_of_2(latency * mix_rate / 1000);
|
buffer_size = closest_power_of_2(latency * mix_rate / 1000);
|
||||||
samples_in = memnew_arr(int32_t, buffer_size * channels);
|
samples_in = memnew_arr(int32_t, buffer_size * channels);
|
||||||
|
|
||||||
media_raw_audio_format format;
|
media_raw_audio_format format;
|
||||||
@@ -100,8 +99,8 @@ int AudioDriverMediaKit::get_mix_rate() const {
|
|||||||
return mix_rate;
|
return mix_rate;
|
||||||
}
|
}
|
||||||
|
|
||||||
AudioDriverMediaKit::SpeakerMode AudioDriverMediaKit::get_speaker_mode() const {
|
AudioDriverSW::OutputFormat AudioDriverMediaKit::get_output_format() const {
|
||||||
return speaker_mode;
|
return output_format;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioDriverMediaKit::lock() {
|
void AudioDriverMediaKit::lock() {
|
||||||
|
|||||||
@@ -5,8 +5,8 @@
|
|||||||
/* GODOT ENGINE */
|
/* GODOT ENGINE */
|
||||||
/* https://godotengine.org */
|
/* https://godotengine.org */
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
|
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
|
||||||
/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
|
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
|
||||||
/* */
|
/* */
|
||||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||||
/* a copy of this software and associated documentation files (the */
|
/* a copy of this software and associated documentation files (the */
|
||||||
@@ -27,19 +27,17 @@
|
|||||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
|
#include "servers/audio/audio_server_sw.h"
|
||||||
#include "servers/audio_server.h"
|
|
||||||
|
|
||||||
#ifdef MEDIA_KIT_ENABLED
|
#ifdef MEDIA_KIT_ENABLED
|
||||||
|
|
||||||
#include "core/os/mutex.h"
|
#include "core/os/mutex.h"
|
||||||
#include "core/os/thread.h"
|
#include "core/os/thread.h"
|
||||||
|
|
||||||
|
#include <SoundPlayer.h>
|
||||||
#include <kernel/image.h> // needed for image_id
|
#include <kernel/image.h> // needed for image_id
|
||||||
|
|
||||||
#include <SoundPlayer.h>
|
class AudioDriverMediaKit : public AudioDriverSW {
|
||||||
|
|
||||||
class AudioDriverMediaKit : public AudioDriver {
|
|
||||||
Mutex *mutex;
|
Mutex *mutex;
|
||||||
|
|
||||||
BSoundPlayer *player;
|
BSoundPlayer *player;
|
||||||
@@ -48,7 +46,7 @@ class AudioDriverMediaKit : public AudioDriver {
|
|||||||
static void PlayBuffer(void *cookie, void *buffer, size_t size, const media_raw_audio_format &format);
|
static void PlayBuffer(void *cookie, void *buffer, size_t size, const media_raw_audio_format &format);
|
||||||
|
|
||||||
unsigned int mix_rate;
|
unsigned int mix_rate;
|
||||||
SpeakerMode speaker_mode;
|
OutputFormat output_format;
|
||||||
unsigned int buffer_size;
|
unsigned int buffer_size;
|
||||||
int channels;
|
int channels;
|
||||||
|
|
||||||
@@ -62,7 +60,7 @@ public:
|
|||||||
virtual Error init();
|
virtual Error init();
|
||||||
virtual void start();
|
virtual void start();
|
||||||
virtual int get_mix_rate() const;
|
virtual int get_mix_rate() const;
|
||||||
virtual SpeakerMode get_speaker_mode() const;
|
virtual OutputFormat get_output_format() const;
|
||||||
virtual void lock();
|
virtual void lock();
|
||||||
virtual void unlock();
|
virtual void unlock();
|
||||||
virtual void finish();
|
virtual void finish();
|
||||||
|
|||||||
@@ -5,8 +5,8 @@
|
|||||||
/* GODOT ENGINE */
|
/* GODOT ENGINE */
|
||||||
/* https://godotengine.org */
|
/* https://godotengine.org */
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
|
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
|
||||||
/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
|
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
|
||||||
/* */
|
/* */
|
||||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||||
/* a copy of this software and associated documentation files (the */
|
/* a copy of this software and associated documentation files (the */
|
||||||
@@ -27,10 +27,9 @@
|
|||||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
|
|
||||||
#include "context_gl_haiku.h"
|
#include "context_gl_haiku.h"
|
||||||
|
|
||||||
#if defined(OPENGL_ENABLED)
|
#if defined(OPENGL_ENABLED) || defined(LEGACYGL_ENABLED)
|
||||||
|
|
||||||
ContextGL_Haiku::ContextGL_Haiku(HaikuDirectWindow *p_window) {
|
ContextGL_Haiku::ContextGL_Haiku(HaikuDirectWindow *p_window) {
|
||||||
window = p_window;
|
window = p_window;
|
||||||
|
|||||||
@@ -5,8 +5,8 @@
|
|||||||
/* GODOT ENGINE */
|
/* GODOT ENGINE */
|
||||||
/* https://godotengine.org */
|
/* https://godotengine.org */
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
|
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
|
||||||
/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
|
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
|
||||||
/* */
|
/* */
|
||||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||||
/* a copy of this software and associated documentation files (the */
|
/* a copy of this software and associated documentation files (the */
|
||||||
@@ -27,16 +27,17 @@
|
|||||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
|
|
||||||
#ifndef CONTEXT_GL_HAIKU_H
|
#ifndef CONTEXT_GL_HAIKU_H
|
||||||
#define CONTEXT_GL_HAIKU_H
|
#define CONTEXT_GL_HAIKU_H
|
||||||
|
|
||||||
#if defined(OPENGL_ENABLED)
|
#if defined(OPENGL_ENABLED) || defined(LEGACYGL_ENABLED)
|
||||||
|
|
||||||
|
#include "drivers/gl_context/context_gl.h"
|
||||||
|
|
||||||
#include "haiku_direct_window.h"
|
#include "haiku_direct_window.h"
|
||||||
#include "haiku_gl_view.h"
|
#include "haiku_gl_view.h"
|
||||||
|
|
||||||
class ContextGL_Haiku {
|
class ContextGL_Haiku : public ContextGL {
|
||||||
private:
|
private:
|
||||||
HaikuGLView *view;
|
HaikuGLView *view;
|
||||||
HaikuDirectWindow *window;
|
HaikuDirectWindow *window;
|
||||||
@@ -44,18 +45,18 @@ private:
|
|||||||
bool use_vsync;
|
bool use_vsync;
|
||||||
|
|
||||||
public:
|
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(HaikuDirectWindow *p_window);
|
||||||
~ContextGL_Haiku();
|
~ContextGL_Haiku();
|
||||||
|
|
||||||
|
virtual Error initialize();
|
||||||
|
virtual void release_current();
|
||||||
|
virtual void make_current();
|
||||||
|
virtual void swap_buffers();
|
||||||
|
virtual int get_window_width();
|
||||||
|
virtual int get_window_height();
|
||||||
|
|
||||||
|
virtual void set_use_vsync(bool p_use);
|
||||||
|
virtual bool is_using_vsync() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
145
detect.py
145
detect.py
@@ -11,144 +11,57 @@ def get_name():
|
|||||||
|
|
||||||
|
|
||||||
def can_build():
|
def can_build():
|
||||||
|
if (os.name != "posix"):
|
||||||
|
return False
|
||||||
|
|
||||||
if (os.name != "posix" or sys.platform == "darwin"):
|
if (sys.platform == "darwin"):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
def get_opts():
|
def get_opts():
|
||||||
from SCons.Variables import EnumVariable
|
|
||||||
|
|
||||||
return [
|
return [
|
||||||
EnumVariable('debug_symbols', 'Add debugging symbols to release builds', 'yes', ('yes', 'no', 'full')),
|
('debug_release', 'Add debug symbols to release version', 'no')
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
def get_flags():
|
def get_flags():
|
||||||
|
|
||||||
return [
|
return [
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
def configure(env):
|
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
|
is64 = sys.maxsize > 2**32
|
||||||
if (env["bits"] == "default"):
|
|
||||||
env["bits"] = "64" if is64 else "32"
|
|
||||||
|
|
||||||
## Compiler configuration
|
if (env["bits"] == "default"):
|
||||||
|
if (is64):
|
||||||
|
env["bits"] = "64"
|
||||||
|
else:
|
||||||
|
env["bits"] = "32"
|
||||||
|
|
||||||
|
env.Append(CPPPATH=['#platform/haiku'])
|
||||||
|
|
||||||
env["CC"] = "gcc-x86"
|
env["CC"] = "gcc-x86"
|
||||||
env["CXX"] = "g++-x86"
|
env["CXX"] = "g++-x86"
|
||||||
|
|
||||||
## Dependencies
|
if (env["target"] == "release"):
|
||||||
|
if (env["debug_release"] == "yes"):
|
||||||
|
env.Append(CCFLAGS=['-g2'])
|
||||||
|
else:
|
||||||
|
env.Append(CCFLAGS=['-O3', '-ffast-math'])
|
||||||
|
elif (env["target"] == "release_debug"):
|
||||||
|
env.Append(CCFLAGS=['-O2', '-ffast-math', '-DDEBUG_ENABLED'])
|
||||||
|
elif (env["target"] == "debug"):
|
||||||
|
env.Append(CCFLAGS=['-g2', '-DDEBUG_ENABLED', '-DDEBUG_MEMORY_ENABLED'])
|
||||||
|
|
||||||
if not env['builtin_libwebp']:
|
# env.Append(CCFLAGS=['-DFREETYPE_ENABLED'])
|
||||||
env.ParseConfig('pkg-config libwebp --cflags --libs')
|
env.Append(CPPFLAGS=['-DPTHREAD_NO_RENAME']) # TODO: enable when we have pthread_setname_np
|
||||||
|
env.Append(CPPFLAGS=['-DOPENGL_ENABLED', '-DMEDIA_KIT_ENABLED'])
|
||||||
# freetype depends on libpng and zlib, so bundling one of them while keeping others
|
env.Append(CPPFLAGS=['-DUNIX_ENABLED', '-DGLES2_ENABLED', '-DGLES_OVER_GL'])
|
||||||
# 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'])
|
env.Append(LIBS=['be', 'game', 'media', 'network', 'bnetapi', 'z', 'GL'])
|
||||||
|
|
||||||
|
import methods
|
||||||
|
env.Append(BUILDERS={'GLSL120': env.Builder(action=methods.build_legacygl_headers, suffix='glsl.gen.h', src_suffix='.glsl')})
|
||||||
|
env.Append(BUILDERS={'GLSL': env.Builder(action=methods.build_glsl_headers, suffix='glsl.gen.h', src_suffix='.glsl')})
|
||||||
|
env.Append(BUILDERS={'GLSL120GLES': env.Builder(action=methods.build_gles2_headers, suffix='glsl.gen.h', src_suffix='.glsl')})
|
||||||
|
|||||||
@@ -5,8 +5,8 @@
|
|||||||
/* GODOT ENGINE */
|
/* GODOT ENGINE */
|
||||||
/* https://godotengine.org */
|
/* https://godotengine.org */
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
|
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
|
||||||
/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
|
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
|
||||||
/* */
|
/* */
|
||||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||||
/* a copy of this software and associated documentation files (the */
|
/* a copy of this software and associated documentation files (the */
|
||||||
@@ -27,7 +27,6 @@
|
|||||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
|
|
||||||
#include "main/main.h"
|
#include "main/main.h"
|
||||||
#include "os_haiku.h"
|
#include "os_haiku.h"
|
||||||
|
|
||||||
|
|||||||
@@ -5,8 +5,8 @@
|
|||||||
/* GODOT ENGINE */
|
/* GODOT ENGINE */
|
||||||
/* https://godotengine.org */
|
/* https://godotengine.org */
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
|
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
|
||||||
/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
|
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
|
||||||
/* */
|
/* */
|
||||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||||
/* a copy of this software and associated documentation files (the */
|
/* a copy of this software and associated documentation files (the */
|
||||||
@@ -27,9 +27,8 @@
|
|||||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
|
|
||||||
#include "haiku_application.h"
|
#include "haiku_application.h"
|
||||||
|
|
||||||
HaikuApplication::HaikuApplication() :
|
HaikuApplication::HaikuApplication()
|
||||||
BApplication("application/x-vnd.godot") {
|
: BApplication("application/x-vnd.godot") {
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,8 +5,8 @@
|
|||||||
/* GODOT ENGINE */
|
/* GODOT ENGINE */
|
||||||
/* https://godotengine.org */
|
/* https://godotengine.org */
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
|
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
|
||||||
/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
|
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
|
||||||
/* */
|
/* */
|
||||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||||
/* a copy of this software and associated documentation files (the */
|
/* a copy of this software and associated documentation files (the */
|
||||||
@@ -27,13 +27,11 @@
|
|||||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
|
|
||||||
#ifndef HAIKU_APPLICATION_H
|
#ifndef HAIKU_APPLICATION_H
|
||||||
#define HAIKU_APPLICATION_H
|
#define HAIKU_APPLICATION_H
|
||||||
|
|
||||||
#include <kernel/image.h> // needed for image_id
|
|
||||||
|
|
||||||
#include <Application.h>
|
#include <Application.h>
|
||||||
|
#include <kernel/image.h> // needed for image_id
|
||||||
|
|
||||||
class HaikuApplication : public BApplication {
|
class HaikuApplication : public BApplication {
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -5,8 +5,8 @@
|
|||||||
/* GODOT ENGINE */
|
/* GODOT ENGINE */
|
||||||
/* https://godotengine.org */
|
/* https://godotengine.org */
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
|
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
|
||||||
/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
|
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
|
||||||
/* */
|
/* */
|
||||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||||
/* a copy of this software and associated documentation files (the */
|
/* a copy of this software and associated documentation files (the */
|
||||||
@@ -27,28 +27,23 @@
|
|||||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
|
|
||||||
#include <UnicodeChar.h>
|
#include <UnicodeChar.h>
|
||||||
|
|
||||||
#include "core/os/keyboard.h"
|
|
||||||
#include "haiku_direct_window.h"
|
#include "haiku_direct_window.h"
|
||||||
#include "key_mapping_haiku.h"
|
#include "key_mapping_haiku.h"
|
||||||
#include "main/main.h"
|
#include "main/main.h"
|
||||||
|
#include "os/keyboard.h"
|
||||||
|
|
||||||
HaikuDirectWindow::HaikuDirectWindow(BRect p_frame) :
|
HaikuDirectWindow::HaikuDirectWindow(BRect p_frame)
|
||||||
BDirectWindow(p_frame, "Godot", B_TITLED_WINDOW, B_QUIT_ON_WINDOW_CLOSE) {
|
: BDirectWindow(p_frame, "Godot", B_TITLED_WINDOW, B_QUIT_ON_WINDOW_CLOSE) {
|
||||||
last_mouse_pos_valid = false;
|
last_mouse_pos_valid = false;
|
||||||
last_buttons_state = 0;
|
last_buttons_state = 0;
|
||||||
last_button_mask = 0;
|
last_button_mask = 0;
|
||||||
last_key_modifier_state = 0;
|
last_key_modifier_state = 0;
|
||||||
|
|
||||||
view = NULL;
|
|
||||||
update_runner = NULL;
|
|
||||||
input = NULL;
|
|
||||||
main_loop = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
HaikuDirectWindow::~HaikuDirectWindow() {
|
HaikuDirectWindow::~HaikuDirectWindow() {
|
||||||
|
delete update_runner;
|
||||||
}
|
}
|
||||||
|
|
||||||
void HaikuDirectWindow::SetHaikuGLView(HaikuGLView *p_view) {
|
void HaikuDirectWindow::SetHaikuGLView(HaikuGLView *p_view) {
|
||||||
@@ -57,7 +52,7 @@ void HaikuDirectWindow::SetHaikuGLView(HaikuGLView *p_view) {
|
|||||||
|
|
||||||
void HaikuDirectWindow::StartMessageRunner() {
|
void HaikuDirectWindow::StartMessageRunner() {
|
||||||
update_runner = new BMessageRunner(BMessenger(this),
|
update_runner = new BMessageRunner(BMessenger(this),
|
||||||
new BMessage(REDRAW_MSG), 1000000 / 60 /* 60 fps */);
|
new BMessage(REDRAW_MSG), 1000000 / 30 /* 30 fps */);
|
||||||
}
|
}
|
||||||
|
|
||||||
void HaikuDirectWindow::StopMessageRunner() {
|
void HaikuDirectWindow::StopMessageRunner() {
|
||||||
@@ -73,7 +68,6 @@ void HaikuDirectWindow::SetMainLoop(MainLoop *p_main_loop) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool HaikuDirectWindow::QuitRequested() {
|
bool HaikuDirectWindow::QuitRequested() {
|
||||||
StopMessageRunner();
|
|
||||||
main_loop->notification(MainLoop::NOTIFICATION_WM_QUIT_REQUEST);
|
main_loop->notification(MainLoop::NOTIFICATION_WM_QUIT_REQUEST);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -86,7 +80,7 @@ void HaikuDirectWindow::DirectConnected(direct_buffer_info *info) {
|
|||||||
void HaikuDirectWindow::MessageReceived(BMessage *message) {
|
void HaikuDirectWindow::MessageReceived(BMessage *message) {
|
||||||
switch (message->what) {
|
switch (message->what) {
|
||||||
case REDRAW_MSG:
|
case REDRAW_MSG:
|
||||||
if (Main::iteration()) {
|
if (Main::iteration() == true) {
|
||||||
view->EnableDirectMode(false);
|
view->EnableDirectMode(false);
|
||||||
Quit();
|
Quit();
|
||||||
}
|
}
|
||||||
@@ -150,43 +144,45 @@ void HaikuDirectWindow::HandleMouseButton(BMessage *message) {
|
|||||||
last_buttons_state = buttons;
|
last_buttons_state = buttons;
|
||||||
|
|
||||||
// TODO: implement the mouse_mode checks
|
// TODO: implement the mouse_mode checks
|
||||||
/*
|
//if (mouse_mode == MOUSE_MODE_CAPTURED) {
|
||||||
if (mouse_mode == MOUSE_MODE_CAPTURED) {
|
// event.xbutton.x=last_mouse_pos.x;
|
||||||
event.xbutton.x=last_mouse_pos.x;
|
// event.xbutton.y=last_mouse_pos.y;
|
||||||
event.xbutton.y=last_mouse_pos.y;
|
//}
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
Ref<InputEventMouseButton> mouse_event;
|
InputEvent mouse_event;
|
||||||
mouse_event.instance();
|
mouse_event.ID = ++event_id;
|
||||||
|
mouse_event.type = InputEvent::MOUSE_BUTTON;
|
||||||
|
mouse_event.device = 0;
|
||||||
|
|
||||||
mouse_event->set_button_mask(GetMouseButtonState(buttons));
|
mouse_event.mouse_button.mod = GetKeyModifierState(modifiers);
|
||||||
mouse_event->set_position({ where.x, where.y });
|
mouse_event.mouse_button.button_mask = GetMouseButtonState(buttons);
|
||||||
mouse_event->set_global_position({ where.x, where.y });
|
mouse_event.mouse_button.x = where.x;
|
||||||
GetKeyModifierState(mouse_event, modifiers);
|
mouse_event.mouse_button.y = where.y;
|
||||||
|
mouse_event.mouse_button.global_x = where.x;
|
||||||
|
mouse_event.mouse_button.global_y = where.y;
|
||||||
|
|
||||||
switch (button) {
|
switch (button) {
|
||||||
default:
|
default:
|
||||||
case B_PRIMARY_MOUSE_BUTTON:
|
case B_PRIMARY_MOUSE_BUTTON:
|
||||||
mouse_event->set_button_index(1);
|
mouse_event.mouse_button.button_index = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case B_SECONDARY_MOUSE_BUTTON:
|
case B_SECONDARY_MOUSE_BUTTON:
|
||||||
mouse_event->set_button_index(2);
|
mouse_event.mouse_button.button_index = 2;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case B_TERTIARY_MOUSE_BUTTON:
|
case B_TERTIARY_MOUSE_BUTTON:
|
||||||
mouse_event->set_button_index(3);
|
mouse_event.mouse_button.button_index = 3;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
mouse_event->set_pressed(message->what == B_MOUSE_DOWN);
|
mouse_event.mouse_button.pressed = (message->what == B_MOUSE_DOWN);
|
||||||
|
|
||||||
if (message->what == B_MOUSE_DOWN && mouse_event->get_button_index() == 1) {
|
if (message->what == B_MOUSE_DOWN && mouse_event.mouse_button.button_index == 1) {
|
||||||
int32 clicks = message->FindInt32("clicks");
|
int32 clicks = message->FindInt32("clicks");
|
||||||
|
|
||||||
if (clicks > 1) {
|
if (clicks > 1) {
|
||||||
mouse_event->set_doubleclick(true);
|
mouse_event.mouse_button.doubleclick = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -210,18 +206,23 @@ void HaikuDirectWindow::HandleMouseMoved(BMessage *message) {
|
|||||||
|
|
||||||
Point2i rel = pos - last_mouse_position;
|
Point2i rel = pos - last_mouse_position;
|
||||||
|
|
||||||
Ref<InputEventMouseMotion> motion_event;
|
InputEvent motion_event;
|
||||||
motion_event.instance();
|
motion_event.ID = ++event_id;
|
||||||
GetKeyModifierState(motion_event, modifiers);
|
motion_event.type = InputEvent::MOUSE_MOTION;
|
||||||
|
motion_event.device = 0;
|
||||||
|
|
||||||
motion_event->set_button_mask(GetMouseButtonState(buttons));
|
motion_event.mouse_motion.mod = GetKeyModifierState(modifiers);
|
||||||
motion_event->set_position({ pos.x, pos.y });
|
motion_event.mouse_motion.button_mask = GetMouseButtonState(buttons);
|
||||||
input->set_mouse_position(pos);
|
motion_event.mouse_motion.x = pos.x;
|
||||||
motion_event->set_global_position({ pos.x, pos.y });
|
motion_event.mouse_motion.y = pos.y;
|
||||||
motion_event->set_speed({ input->get_last_mouse_speed().x,
|
input->set_mouse_pos(pos);
|
||||||
input->get_last_mouse_speed().y });
|
motion_event.mouse_motion.global_x = pos.x;
|
||||||
|
motion_event.mouse_motion.global_y = pos.y;
|
||||||
|
motion_event.mouse_motion.speed_x = input->get_mouse_speed().x;
|
||||||
|
motion_event.mouse_motion.speed_y = input->get_mouse_speed().y;
|
||||||
|
|
||||||
motion_event->set_relative({ rel.x, rel.y });
|
motion_event.mouse_motion.relative_x = rel.x;
|
||||||
|
motion_event.mouse_motion.relative_y = rel.y;
|
||||||
|
|
||||||
last_mouse_position = pos;
|
last_mouse_position = pos;
|
||||||
|
|
||||||
@@ -234,21 +235,24 @@ void HaikuDirectWindow::HandleMouseWheelChanged(BMessage *message) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ref<InputEventMouseButton> mouse_event;
|
InputEvent mouse_event;
|
||||||
mouse_event.instance();
|
mouse_event.ID = ++event_id;
|
||||||
//GetKeyModifierState(mouse_event, modifiers);
|
mouse_event.type = InputEvent::MOUSE_BUTTON;
|
||||||
|
mouse_event.device = 0;
|
||||||
|
|
||||||
mouse_event->set_button_index(wheel_delta_y < 0 ? 4 : 5);
|
mouse_event.mouse_button.button_index = wheel_delta_y < 0 ? 4 : 5;
|
||||||
mouse_event->set_button_mask(last_button_mask);
|
mouse_event.mouse_button.mod = GetKeyModifierState(last_key_modifier_state);
|
||||||
mouse_event->set_position({ last_mouse_position.x,
|
mouse_event.mouse_button.button_mask = last_button_mask;
|
||||||
last_mouse_position.y });
|
mouse_event.mouse_button.x = last_mouse_position.x;
|
||||||
mouse_event->set_global_position({ last_mouse_position.x,
|
mouse_event.mouse_button.y = last_mouse_position.y;
|
||||||
last_mouse_position.y });
|
mouse_event.mouse_button.global_x = last_mouse_position.x;
|
||||||
|
mouse_event.mouse_button.global_y = last_mouse_position.y;
|
||||||
|
|
||||||
mouse_event->set_pressed(true);
|
mouse_event.mouse_button.pressed = true;
|
||||||
input->parse_input_event(mouse_event);
|
input->parse_input_event(mouse_event);
|
||||||
|
|
||||||
mouse_event->set_pressed(false);
|
mouse_event.ID = ++event_id;
|
||||||
|
mouse_event.mouse_button.pressed = false;
|
||||||
input->parse_input_event(mouse_event);
|
input->parse_input_event(mouse_event);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -269,23 +273,25 @@ void HaikuDirectWindow::HandleKeyboardEvent(BMessage *message) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ref<InputEventKey> event;
|
InputEvent event;
|
||||||
event.instance();
|
event.ID = ++event_id;
|
||||||
GetKeyModifierState(event, modifiers);
|
event.type = InputEvent::KEY;
|
||||||
event->set_pressed(message->what == B_KEY_DOWN);
|
event.device = 0;
|
||||||
event->set_scancode(KeyMappingHaiku::get_keysym(raw_char, key));
|
event.key.mod = GetKeyModifierState(modifiers);
|
||||||
event->set_echo(message->HasInt32("be:key_repeat"));
|
event.key.pressed = (message->what == B_KEY_DOWN);
|
||||||
event->set_unicode(0);
|
event.key.scancode = KeyMappingHaiku::get_keysym(raw_char, key);
|
||||||
|
event.key.echo = message->HasInt32("be:key_repeat");
|
||||||
|
event.key.unicode = 0;
|
||||||
|
|
||||||
const char *bytes = NULL;
|
const char *bytes = NULL;
|
||||||
if (message->FindString("bytes", &bytes) == B_OK) {
|
if (message->FindString("bytes", &bytes) == B_OK) {
|
||||||
event->set_unicode(BUnicodeChar::FromUTF8(&bytes));
|
event.key.unicode = BUnicodeChar::FromUTF8(&bytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
//make it consistent across platforms.
|
//make it consistent accross platforms.
|
||||||
if (event->get_scancode() == KEY_BACKTAB) {
|
if (event.key.scancode == KEY_BACKTAB) {
|
||||||
event->set_scancode(KEY_TAB);
|
event.key.scancode = KEY_TAB;
|
||||||
event->set_shift(true);
|
event.key.mod.shift = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
input->parse_input_event(event);
|
input->parse_input_event(event);
|
||||||
@@ -305,14 +311,15 @@ void HaikuDirectWindow::HandleKeyboardModifierEvent(BMessage *message) {
|
|||||||
|
|
||||||
int32 key = old_modifiers ^ modifiers;
|
int32 key = old_modifiers ^ modifiers;
|
||||||
|
|
||||||
Ref<InputEventWithModifiers> event;
|
InputEvent event;
|
||||||
event.instance();
|
event.ID = ++event_id;
|
||||||
GetKeyModifierState(event, modifiers);
|
event.type = InputEvent::KEY;
|
||||||
|
event.device = 0;
|
||||||
event->set_shift(key & B_SHIFT_KEY);
|
event.key.mod = GetKeyModifierState(modifiers);
|
||||||
event->set_alt(key & B_OPTION_KEY);
|
event.key.pressed = ((modifiers & key) != 0);
|
||||||
event->set_control(key & B_CONTROL_KEY);
|
event.key.scancode = KeyMappingHaiku::get_modifier_keysym(key);
|
||||||
event->set_command(key & B_COMMAND_KEY);
|
event.key.echo = false;
|
||||||
|
event.key.unicode = 0;
|
||||||
|
|
||||||
input->parse_input_event(event);
|
input->parse_input_event(event);
|
||||||
}
|
}
|
||||||
@@ -329,13 +336,14 @@ void HaikuDirectWindow::HandleWindowResized(BMessage *message) {
|
|||||||
current_video_mode->height = height;
|
current_video_mode->height = height;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void HaikuDirectWindow::GetKeyModifierState(Ref<InputEventWithModifiers> event, uint32 p_state) {
|
inline InputModifierState HaikuDirectWindow::GetKeyModifierState(uint32 p_state) {
|
||||||
last_key_modifier_state = p_state;
|
last_key_modifier_state = p_state;
|
||||||
|
InputModifierState state;
|
||||||
|
|
||||||
event->set_shift(p_state & B_SHIFT_KEY);
|
state.shift = (p_state & B_SHIFT_KEY) != 0;
|
||||||
event->set_control(p_state & B_CONTROL_KEY);
|
state.control = (p_state & B_CONTROL_KEY) != 0;
|
||||||
event->set_alt(p_state & B_OPTION_KEY);
|
state.alt = (p_state & B_OPTION_KEY) != 0;
|
||||||
event->set_metakey(p_state & B_COMMAND_KEY);
|
state.meta = (p_state & B_COMMAND_KEY) != 0;
|
||||||
|
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,8 +5,8 @@
|
|||||||
/* GODOT ENGINE */
|
/* GODOT ENGINE */
|
||||||
/* https://godotengine.org */
|
/* https://godotengine.org */
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
|
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
|
||||||
/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
|
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
|
||||||
/* */
|
/* */
|
||||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||||
/* a copy of this software and associated documentation files (the */
|
/* a copy of this software and associated documentation files (the */
|
||||||
@@ -27,13 +27,11 @@
|
|||||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
|
|
||||||
#ifndef HAIKU_DIRECT_WINDOW_H
|
#ifndef HAIKU_DIRECT_WINDOW_H
|
||||||
#define HAIKU_DIRECT_WINDOW_H
|
#define HAIKU_DIRECT_WINDOW_H
|
||||||
|
|
||||||
#include <kernel/image.h> // needed for image_id
|
|
||||||
|
|
||||||
#include <DirectWindow.h>
|
#include <DirectWindow.h>
|
||||||
|
#include <kernel/image.h> // needed for image_id
|
||||||
|
|
||||||
#include "core/os/os.h"
|
#include "core/os/os.h"
|
||||||
#include "main/input_default.h"
|
#include "main/input_default.h"
|
||||||
@@ -46,6 +44,7 @@
|
|||||||
|
|
||||||
class HaikuDirectWindow : public BDirectWindow {
|
class HaikuDirectWindow : public BDirectWindow {
|
||||||
private:
|
private:
|
||||||
|
unsigned int event_id;
|
||||||
Point2i last_mouse_position;
|
Point2i last_mouse_position;
|
||||||
bool last_mouse_pos_valid;
|
bool last_mouse_pos_valid;
|
||||||
uint32 last_buttons_state;
|
uint32 last_buttons_state;
|
||||||
@@ -64,7 +63,7 @@ private:
|
|||||||
void HandleWindowResized(BMessage *message);
|
void HandleWindowResized(BMessage *message);
|
||||||
void HandleKeyboardEvent(BMessage *message);
|
void HandleKeyboardEvent(BMessage *message);
|
||||||
void HandleKeyboardModifierEvent(BMessage *message);
|
void HandleKeyboardModifierEvent(BMessage *message);
|
||||||
inline void GetKeyModifierState(Ref<InputEventWithModifiers> event, uint32 p_state);
|
inline InputModifierState GetKeyModifierState(uint32 p_state);
|
||||||
inline int GetMouseButtonState(uint32 p_state);
|
inline int GetMouseButtonState(uint32 p_state);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -5,8 +5,8 @@
|
|||||||
/* GODOT ENGINE */
|
/* GODOT ENGINE */
|
||||||
/* https://godotengine.org */
|
/* https://godotengine.org */
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
|
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
|
||||||
/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
|
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
|
||||||
/* */
|
/* */
|
||||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||||
/* a copy of this software and associated documentation files (the */
|
/* a copy of this software and associated documentation files (the */
|
||||||
@@ -27,12 +27,11 @@
|
|||||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
|
|
||||||
#include "haiku_gl_view.h"
|
#include "haiku_gl_view.h"
|
||||||
#include "main/main.h"
|
#include "main/main.h"
|
||||||
|
|
||||||
HaikuGLView::HaikuGLView(BRect frame, uint32 type) :
|
HaikuGLView::HaikuGLView(BRect frame, uint32 type)
|
||||||
BGLView(frame, "GodotGLView", B_FOLLOW_ALL_SIDES, 0, type) {
|
: BGLView(frame, "GodotGLView", B_FOLLOW_ALL_SIDES, 0, type) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void HaikuGLView::AttachedToWindow(void) {
|
void HaikuGLView::AttachedToWindow(void) {
|
||||||
|
|||||||
@@ -5,8 +5,8 @@
|
|||||||
/* GODOT ENGINE */
|
/* GODOT ENGINE */
|
||||||
/* https://godotengine.org */
|
/* https://godotengine.org */
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
|
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
|
||||||
/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
|
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
|
||||||
/* */
|
/* */
|
||||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||||
/* a copy of this software and associated documentation files (the */
|
/* a copy of this software and associated documentation files (the */
|
||||||
@@ -27,13 +27,11 @@
|
|||||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
|
|
||||||
#ifndef HAIKU_GL_VIEW_H
|
#ifndef HAIKU_GL_VIEW_H
|
||||||
#define HAIKU_GL_VIEW_H
|
#define HAIKU_GL_VIEW_H
|
||||||
|
|
||||||
#include <kernel/image.h> // needed for image_id
|
|
||||||
|
|
||||||
#include <GLView.h>
|
#include <GLView.h>
|
||||||
|
#include <kernel/image.h> // needed for image_id
|
||||||
|
|
||||||
class HaikuGLView : public BGLView {
|
class HaikuGLView : public BGLView {
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -5,8 +5,8 @@
|
|||||||
/* GODOT ENGINE */
|
/* GODOT ENGINE */
|
||||||
/* https://godotengine.org */
|
/* https://godotengine.org */
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
|
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
|
||||||
/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
|
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
|
||||||
/* */
|
/* */
|
||||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||||
/* a copy of this software and associated documentation files (the */
|
/* a copy of this software and associated documentation files (the */
|
||||||
@@ -27,11 +27,10 @@
|
|||||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
|
|
||||||
#include <InterfaceDefs.h>
|
#include <InterfaceDefs.h>
|
||||||
|
|
||||||
#include "core/os/keyboard.h"
|
|
||||||
#include "key_mapping_haiku.h"
|
#include "key_mapping_haiku.h"
|
||||||
|
#include "os/keyboard.h"
|
||||||
|
|
||||||
struct _HaikuTranslatePair {
|
struct _HaikuTranslatePair {
|
||||||
unsigned int keysym;
|
unsigned int keysym;
|
||||||
@@ -84,7 +83,7 @@ static _HaikuTranslatePair _fn_to_keycode[] = {
|
|||||||
static _HaikuTranslatePair _hb_to_keycode[] = {
|
static _HaikuTranslatePair _hb_to_keycode[] = {
|
||||||
{ KEY_BACKSPACE, B_BACKSPACE },
|
{ KEY_BACKSPACE, B_BACKSPACE },
|
||||||
{ KEY_TAB, B_TAB },
|
{ KEY_TAB, B_TAB },
|
||||||
{ KEY_ENTER, B_RETURN },
|
{ KEY_RETURN, B_RETURN },
|
||||||
{ KEY_CAPSLOCK, B_CAPS_LOCK },
|
{ KEY_CAPSLOCK, B_CAPS_LOCK },
|
||||||
{ KEY_ESCAPE, B_ESCAPE },
|
{ KEY_ESCAPE, B_ESCAPE },
|
||||||
{ KEY_SPACE, B_SPACE },
|
{ KEY_SPACE, B_SPACE },
|
||||||
|
|||||||
@@ -5,8 +5,8 @@
|
|||||||
/* GODOT ENGINE */
|
/* GODOT ENGINE */
|
||||||
/* https://godotengine.org */
|
/* https://godotengine.org */
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
|
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
|
||||||
/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
|
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
|
||||||
/* */
|
/* */
|
||||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||||
/* a copy of this software and associated documentation files (the */
|
/* a copy of this software and associated documentation files (the */
|
||||||
@@ -27,7 +27,6 @@
|
|||||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
|
|
||||||
#ifndef KEY_MAPPING_HAIKU_H
|
#ifndef KEY_MAPPING_HAIKU_H
|
||||||
#define KEY_MAPPING_HAIKU_H
|
#define KEY_MAPPING_HAIKU_H
|
||||||
|
|
||||||
|
|||||||
BIN
logo.png
BIN
logo.png
Binary file not shown.
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.5 KiB |
151
os_haiku.cpp
151
os_haiku.cpp
@@ -5,8 +5,8 @@
|
|||||||
/* GODOT ENGINE */
|
/* GODOT ENGINE */
|
||||||
/* https://godotengine.org */
|
/* https://godotengine.org */
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
|
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
|
||||||
/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
|
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
|
||||||
/* */
|
/* */
|
||||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||||
/* a copy of this software and associated documentation files (the */
|
/* a copy of this software and associated documentation files (the */
|
||||||
@@ -27,21 +27,20 @@
|
|||||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
|
#include <Screen.h>
|
||||||
|
|
||||||
#include "drivers/gles3/rasterizer_gles3.h"
|
#include "drivers/gles2/rasterizer_gles2.h"
|
||||||
|
|
||||||
#include "os_haiku.h"
|
|
||||||
|
|
||||||
#include "main/main.h"
|
|
||||||
#include "servers/physics/physics_server_sw.h"
|
#include "servers/physics/physics_server_sw.h"
|
||||||
#include "servers/visual/visual_server_raster.h"
|
#include "servers/visual/visual_server_raster.h"
|
||||||
#include "servers/visual/visual_server_wrap_mt.h"
|
#include "servers/visual/visual_server_wrap_mt.h"
|
||||||
|
//#include "servers/physics_2d/physics_2d_server_wrap_mt.h"
|
||||||
|
#include "main/main.h"
|
||||||
|
|
||||||
#include <Screen.h>
|
#include "os_haiku.h"
|
||||||
|
|
||||||
OS_Haiku::OS_Haiku() {
|
OS_Haiku::OS_Haiku() {
|
||||||
#ifdef MEDIA_KIT_ENABLED
|
#ifdef MEDIA_KIT_ENABLED
|
||||||
AudioDriverManager::add_driver(&driver_media_kit);
|
AudioDriverManagerSW::add_driver(&driver_media_kit);
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -69,7 +68,7 @@ void OS_Haiku::run() {
|
|||||||
main_loop->finish();
|
main_loop->finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
String OS_Haiku::get_name() const {
|
String OS_Haiku::get_name() {
|
||||||
return "Haiku";
|
return "Haiku";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -78,14 +77,14 @@ int OS_Haiku::get_video_driver_count() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const char *OS_Haiku::get_video_driver_name(int p_driver) const {
|
const char *OS_Haiku::get_video_driver_name(int p_driver) const {
|
||||||
return "GLES3";
|
return "GLES2";
|
||||||
}
|
}
|
||||||
|
|
||||||
int OS_Haiku::get_current_video_driver() const {
|
OS::VideoMode OS_Haiku::get_default_video_mode() const {
|
||||||
return video_driver_index;
|
return OS::VideoMode(800, 600, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
Error OS_Haiku::initialize(const VideoMode &p_desired, int p_video_driver, int p_audio_driver) {
|
void OS_Haiku::initialize(const VideoMode &p_desired, int p_video_driver, int p_audio_driver) {
|
||||||
main_loop = NULL;
|
main_loop = NULL;
|
||||||
current_video_mode = p_desired;
|
current_video_mode = p_desired;
|
||||||
|
|
||||||
@@ -107,25 +106,22 @@ Error OS_Haiku::initialize(const VideoMode &p_desired, int p_video_driver, int p
|
|||||||
window->SetFlags(flags);
|
window->SetFlags(flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(OPENGL_ENABLED)
|
#if defined(OPENGL_ENABLED) || defined(LEGACYGL_ENABLED)
|
||||||
context_gl = memnew(ContextGL_Haiku(window));
|
context_gl = memnew(ContextGL_Haiku(window));
|
||||||
context_gl->initialize();
|
context_gl->initialize();
|
||||||
context_gl->make_current();
|
context_gl->make_current();
|
||||||
context_gl->set_use_vsync(current_video_mode.use_vsync);
|
|
||||||
RasterizerGLES3::register_config();
|
|
||||||
RasterizerGLES3::make_current();
|
|
||||||
|
|
||||||
|
rasterizer = memnew(RasterizerGLES2);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
visual_server = memnew(VisualServerRaster);
|
visual_server = memnew(VisualServerRaster(rasterizer));
|
||||||
// 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);
|
ERR_FAIL_COND(!visual_server);
|
||||||
|
|
||||||
video_driver_index = p_video_driver;
|
// TODO: enable multithreaded VS
|
||||||
|
//if (get_render_thread_mode() != RENDER_THREAD_UNSAFE) {
|
||||||
|
// visual_server = memnew(VisualServerWrapMT(visual_server, get_render_thread_mode() == RENDER_SEPARATE_THREAD));
|
||||||
|
//}
|
||||||
|
|
||||||
input = memnew(InputDefault);
|
input = memnew(InputDefault);
|
||||||
window->SetInput(input);
|
window->SetInput(input);
|
||||||
@@ -133,9 +129,27 @@ Error OS_Haiku::initialize(const VideoMode &p_desired, int p_video_driver, int p
|
|||||||
window->Show();
|
window->Show();
|
||||||
visual_server->init();
|
visual_server->init();
|
||||||
|
|
||||||
AudioDriverManager::initialize(p_audio_driver);
|
physics_server = memnew(PhysicsServerSW);
|
||||||
|
physics_server->init();
|
||||||
|
physics_2d_server = memnew(Physics2DServerSW);
|
||||||
|
// TODO: enable multithreaded PS
|
||||||
|
//physics_2d_server = Physics2DServerWrapMT::init_server<Physics2DServerSW>();
|
||||||
|
physics_2d_server->init();
|
||||||
|
|
||||||
return OK;
|
AudioDriverManagerSW::get_driver(p_audio_driver)->set_singleton();
|
||||||
|
|
||||||
|
if (AudioDriverManagerSW::get_driver(p_audio_driver)->init() != OK) {
|
||||||
|
ERR_PRINT("Initializing audio failed.");
|
||||||
|
}
|
||||||
|
|
||||||
|
sample_manager = memnew(SampleManagerMallocSW);
|
||||||
|
audio_server = memnew(AudioServerSW(sample_manager));
|
||||||
|
audio_server->init();
|
||||||
|
|
||||||
|
spatial_sound_server = memnew(SpatialSoundServerSW);
|
||||||
|
spatial_sound_server->init();
|
||||||
|
spatial_sound_2d_server = memnew(SpatialSound2DServerSW);
|
||||||
|
spatial_sound_2d_server->init();
|
||||||
}
|
}
|
||||||
|
|
||||||
void OS_Haiku::finalize() {
|
void OS_Haiku::finalize() {
|
||||||
@@ -145,12 +159,30 @@ void OS_Haiku::finalize() {
|
|||||||
|
|
||||||
main_loop = NULL;
|
main_loop = NULL;
|
||||||
|
|
||||||
|
spatial_sound_server->finish();
|
||||||
|
memdelete(spatial_sound_server);
|
||||||
|
|
||||||
|
spatial_sound_2d_server->finish();
|
||||||
|
memdelete(spatial_sound_2d_server);
|
||||||
|
|
||||||
|
memdelete(sample_manager);
|
||||||
|
|
||||||
|
audio_server->finish();
|
||||||
|
memdelete(audio_server);
|
||||||
|
|
||||||
visual_server->finish();
|
visual_server->finish();
|
||||||
memdelete(visual_server);
|
memdelete(visual_server);
|
||||||
|
memdelete(rasterizer);
|
||||||
|
|
||||||
|
physics_server->finish();
|
||||||
|
memdelete(physics_server);
|
||||||
|
|
||||||
|
physics_2d_server->finish();
|
||||||
|
memdelete(physics_2d_server);
|
||||||
|
|
||||||
memdelete(input);
|
memdelete(input);
|
||||||
|
|
||||||
#if defined(OPENGL_ENABLED)
|
#if defined(OPENGL_ENABLED) || defined(LEGACYGL_ENABLED)
|
||||||
memdelete(context_gl);
|
memdelete(context_gl);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -191,7 +223,7 @@ void OS_Haiku::swap_buffers() {
|
|||||||
context_gl->swap_buffers();
|
context_gl->swap_buffers();
|
||||||
}
|
}
|
||||||
|
|
||||||
Point2 OS_Haiku::get_mouse_position() const {
|
Point2 OS_Haiku::get_mouse_pos() const {
|
||||||
return window->GetLastMousePosition();
|
return window->GetLastMousePosition();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -203,14 +235,6 @@ void OS_Haiku::set_cursor_shape(CursorShape p_shape) {
|
|||||||
//ERR_PRINT("set_cursor_shape() NOT IMPLEMENTED");
|
//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 {
|
int OS_Haiku::get_screen_count() const {
|
||||||
// TODO: implement get_screen_count()
|
// TODO: implement get_screen_count()
|
||||||
return 1;
|
return 1;
|
||||||
@@ -323,56 +347,3 @@ void OS_Haiku::get_fullscreen_mode_list(List<VideoMode> *p_list, int p_screen) c
|
|||||||
String OS_Haiku::get_executable_path() const {
|
String OS_Haiku::get_executable_path() const {
|
||||||
return OS::get_executable_path();
|
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;
|
|
||||||
}
|
|
||||||
|
|||||||
54
os_haiku.h
54
os_haiku.h
@@ -5,8 +5,8 @@
|
|||||||
/* GODOT ENGINE */
|
/* GODOT ENGINE */
|
||||||
/* https://godotengine.org */
|
/* https://godotengine.org */
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
|
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
|
||||||
/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
|
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
|
||||||
/* */
|
/* */
|
||||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||||
/* a copy of this software and associated documentation files (the */
|
/* a copy of this software and associated documentation files (the */
|
||||||
@@ -27,18 +27,24 @@
|
|||||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
|
|
||||||
#ifndef OS_HAIKU_H
|
#ifndef OS_HAIKU_H
|
||||||
#define OS_HAIKU_H
|
#define OS_HAIKU_H
|
||||||
|
|
||||||
|
#include "drivers/unix/os_unix.h"
|
||||||
|
#include "main/input_default.h"
|
||||||
|
#include "servers/audio/audio_server_sw.h"
|
||||||
|
#include "servers/audio/sample_manager_sw.h"
|
||||||
|
#include "servers/physics_2d/physics_2d_server_sw.h"
|
||||||
|
#include "servers/physics_server.h"
|
||||||
|
#include "servers/spatial_sound/spatial_sound_server_sw.h"
|
||||||
|
#include "servers/spatial_sound_2d/spatial_sound_2d_server_sw.h"
|
||||||
|
#include "servers/visual/rasterizer.h"
|
||||||
|
#include "servers/visual_server.h"
|
||||||
|
|
||||||
#include "audio_driver_media_kit.h"
|
#include "audio_driver_media_kit.h"
|
||||||
#include "context_gl_haiku.h"
|
#include "context_gl_haiku.h"
|
||||||
#include "drivers/unix/os_unix.h"
|
|
||||||
#include "haiku_application.h"
|
#include "haiku_application.h"
|
||||||
#include "haiku_direct_window.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 {
|
class OS_Haiku : public OS_Unix {
|
||||||
private:
|
private:
|
||||||
@@ -46,15 +52,21 @@ private:
|
|||||||
HaikuDirectWindow *window;
|
HaikuDirectWindow *window;
|
||||||
MainLoop *main_loop;
|
MainLoop *main_loop;
|
||||||
InputDefault *input;
|
InputDefault *input;
|
||||||
|
Rasterizer *rasterizer;
|
||||||
VisualServer *visual_server;
|
VisualServer *visual_server;
|
||||||
VideoMode current_video_mode;
|
VideoMode current_video_mode;
|
||||||
int video_driver_index;
|
PhysicsServer *physics_server;
|
||||||
|
Physics2DServer *physics_2d_server;
|
||||||
|
AudioServerSW *audio_server;
|
||||||
|
SampleManagerMallocSW *sample_manager;
|
||||||
|
SpatialSoundServerSW *spatial_sound_server;
|
||||||
|
SpatialSound2DServerSW *spatial_sound_2d_server;
|
||||||
|
|
||||||
#ifdef MEDIA_KIT_ENABLED
|
#ifdef MEDIA_KIT_ENABLED
|
||||||
AudioDriverMediaKit driver_media_kit;
|
AudioDriverMediaKit driver_media_kit;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(OPENGL_ENABLED)
|
#if defined(OPENGL_ENABLED) || defined(LEGACYGL_ENABLED)
|
||||||
ContextGL_Haiku *context_gl;
|
ContextGL_Haiku *context_gl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -63,9 +75,9 @@ private:
|
|||||||
protected:
|
protected:
|
||||||
virtual int get_video_driver_count() const;
|
virtual int get_video_driver_count() const;
|
||||||
virtual const char *get_video_driver_name(int p_driver) const;
|
virtual const char *get_video_driver_name(int p_driver) const;
|
||||||
virtual int get_current_video_driver() const;
|
virtual VideoMode get_default_video_mode() const;
|
||||||
|
|
||||||
virtual Error initialize(const VideoMode &p_desired, int p_video_driver, int p_audio_driver);
|
virtual void initialize(const VideoMode &p_desired, int p_video_driver, int p_audio_driver);
|
||||||
virtual void finalize();
|
virtual void finalize();
|
||||||
|
|
||||||
virtual void set_main_loop(MainLoop *p_main_loop);
|
virtual void set_main_loop(MainLoop *p_main_loop);
|
||||||
@@ -74,7 +86,7 @@ public:
|
|||||||
OS_Haiku();
|
OS_Haiku();
|
||||||
void run();
|
void run();
|
||||||
|
|
||||||
virtual String get_name() const;
|
virtual String get_name();
|
||||||
|
|
||||||
virtual MainLoop *get_main_loop() const;
|
virtual MainLoop *get_main_loop() const;
|
||||||
|
|
||||||
@@ -83,17 +95,15 @@ public:
|
|||||||
virtual void make_rendering_thread();
|
virtual void make_rendering_thread();
|
||||||
virtual void swap_buffers();
|
virtual void swap_buffers();
|
||||||
|
|
||||||
virtual Point2 get_mouse_position() const;
|
virtual Point2 get_mouse_pos() const;
|
||||||
virtual int get_mouse_button_state() const;
|
virtual int get_mouse_button_state() const;
|
||||||
virtual void set_cursor_shape(CursorShape p_shape);
|
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_screen_count() const;
|
||||||
virtual int get_current_screen() const;
|
virtual int get_current_screen() const;
|
||||||
virtual void set_current_screen(int p_screen);
|
virtual void set_current_screen(int p_screen);
|
||||||
virtual Point2 get_screen_position(int p_screen = -1) const;
|
virtual Point2 get_screen_position(int p_screen = 0) const;
|
||||||
virtual Size2 get_screen_size(int p_screen = -1) const;
|
virtual Size2 get_screen_size(int p_screen = 0) const;
|
||||||
virtual void set_window_title(const String &p_title);
|
virtual void set_window_title(const String &p_title);
|
||||||
virtual Size2 get_window_size() const;
|
virtual Size2 get_window_size() const;
|
||||||
virtual void set_window_size(const Size2 p_size);
|
virtual void set_window_size(const Size2 p_size);
|
||||||
@@ -112,16 +122,6 @@ public:
|
|||||||
virtual VideoMode get_video_mode(int p_screen = 0) const;
|
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 void get_fullscreen_mode_list(List<VideoMode> *p_list, int p_screen = 0) const;
|
||||||
virtual String get_executable_path() 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
|
#endif
|
||||||
|
|||||||
@@ -5,8 +5,8 @@
|
|||||||
/* GODOT ENGINE */
|
/* GODOT ENGINE */
|
||||||
/* https://godotengine.org */
|
/* https://godotengine.org */
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
|
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
|
||||||
/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
|
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
|
||||||
/* */
|
/* */
|
||||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||||
/* a copy of this software and associated documentation files (the */
|
/* a copy of this software and associated documentation files (the */
|
||||||
@@ -27,11 +27,9 @@
|
|||||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
|
|
||||||
#include <alloca.h>
|
#include <alloca.h>
|
||||||
|
|
||||||
// for ifaddrs.h needed in drivers/unix/ip_unix.cpp
|
// for ifaddrs.h needed in drivers/unix/ip_unix.cpp
|
||||||
#define _BSD_SOURCE 1
|
#define _BSD_SOURCE 1
|
||||||
|
|
||||||
#define GLES3_INCLUDE_H "thirdparty/glad/glad/glad.h"
|
#define GLES2_INCLUDE_H <GL/glew.h>
|
||||||
#define GLES2_INCLUDE_H "thirdparty/glad/glad/glad.h"
|
|
||||||
|
|||||||
Reference in New Issue
Block a user