Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
godotengine
GitHub Repository: godotengine/godot
Path: blob/master/platform/linuxbsd/os_linuxbsd.h
20920 views
1
/**************************************************************************/
2
/* os_linuxbsd.h */
3
/**************************************************************************/
4
/* This file is part of: */
5
/* GODOT ENGINE */
6
/* https://godotengine.org */
7
/**************************************************************************/
8
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
9
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
10
/* */
11
/* Permission is hereby granted, free of charge, to any person obtaining */
12
/* a copy of this software and associated documentation files (the */
13
/* "Software"), to deal in the Software without restriction, including */
14
/* without limitation the rights to use, copy, modify, merge, publish, */
15
/* distribute, sublicense, and/or sell copies of the Software, and to */
16
/* permit persons to whom the Software is furnished to do so, subject to */
17
/* the following conditions: */
18
/* */
19
/* The above copyright notice and this permission notice shall be */
20
/* included in all copies or substantial portions of the Software. */
21
/* */
22
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
23
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
24
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
25
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
26
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
27
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
28
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
29
/**************************************************************************/
30
31
#pragma once
32
33
#include "crash_handler_linuxbsd.h"
34
35
#include "core/input/input_event.h"
36
#include "core/templates/rb_map.h"
37
#include "drivers/alsa/audio_driver_alsa.h"
38
#include "drivers/alsamidi/midi_driver_alsamidi.h"
39
#include "drivers/pulseaudio/audio_driver_pulseaudio.h"
40
#include "drivers/unix/os_unix.h"
41
#include "servers/audio/audio_server.h"
42
43
#ifdef FONTCONFIG_ENABLED
44
#ifdef SOWRAP_ENABLED
45
#include "fontconfig-so_wrap.h"
46
#else
47
#include <fontconfig/fontconfig.h>
48
#endif
49
#endif
50
51
class JoypadSDL;
52
53
class OS_LinuxBSD : public OS_Unix {
54
virtual void delete_main_loop() override;
55
56
#ifdef FONTCONFIG_ENABLED
57
bool font_config_initialized = false;
58
FcConfig *config = nullptr;
59
FcObjectSet *object_set = nullptr;
60
61
int _weight_to_fc(int p_weight) const;
62
int _stretch_to_fc(int p_stretch) const;
63
#endif
64
65
#ifdef SDL_ENABLED
66
JoypadSDL *joypad_sdl = nullptr;
67
#endif
68
69
#ifdef ALSA_ENABLED
70
AudioDriverALSA driver_alsa;
71
#endif
72
73
#ifdef ALSAMIDI_ENABLED
74
MIDIDriverALSAMidi driver_alsamidi;
75
#endif
76
77
#ifdef PULSEAUDIO_ENABLED
78
AudioDriverPulseAudio driver_pulseaudio;
79
#endif
80
81
CrashHandler crash_handler;
82
83
MainLoop *main_loop = nullptr;
84
85
String get_systemd_os_release_info_value(const String &key) const;
86
87
Vector<String> lspci_device_filter(Vector<String> vendor_device_id_mapping, String class_suffix, String check_column, String whitelist) const;
88
Vector<String> lspci_get_device_value(Vector<String> vendor_device_id_mapping, String check_column, String blacklist) const;
89
90
String system_dir_desktop_cache;
91
92
protected:
93
virtual void initialize() override;
94
virtual void finalize() override;
95
96
virtual void initialize_joypads() override;
97
98
virtual void set_main_loop(MainLoop *p_main_loop) override;
99
100
public:
101
virtual String get_identifier() const override;
102
virtual String get_name() const override;
103
virtual String get_distribution_name() const override;
104
virtual String get_version() const override;
105
106
virtual Vector<String> get_video_adapter_driver_info() const override;
107
108
virtual MainLoop *get_main_loop() const override;
109
110
virtual uint64_t get_embedded_pck_offset() const override;
111
112
virtual Vector<String> get_system_fonts() const override;
113
virtual String get_system_font_path(const String &p_font_name, int p_weight = 400, int p_stretch = 100, bool p_italic = false) const override;
114
virtual Vector<String> get_system_font_path_for_text(const String &p_font_name, const String &p_text, const String &p_locale = String(), const String &p_script = String(), int p_weight = 400, int p_stretch = 100, bool p_italic = false) const override;
115
116
virtual String get_config_path() const override;
117
virtual String get_data_path() const override;
118
virtual String get_cache_path() const override;
119
120
virtual String get_system_dir(SystemDir p_dir, bool p_shared_storage = true) const override;
121
122
virtual Error shell_open(const String &p_uri) override;
123
124
virtual String get_unique_id() const override;
125
virtual String get_processor_name() const override;
126
127
virtual bool is_sandboxed() const override;
128
129
virtual void alert(const String &p_alert, const String &p_title = "ALERT!") override;
130
131
virtual bool _check_internal_feature_support(const String &p_feature) override;
132
133
void run();
134
135
virtual void disable_crash_handler() override;
136
virtual bool is_disable_crash_handler() const override;
137
138
virtual Error move_to_trash(const String &p_path) override;
139
140
virtual String get_system_ca_certificates() override;
141
142
#ifdef TOOLS_ENABLED
143
virtual bool _test_create_rendering_device_and_gl(const String &p_display_driver) const override;
144
virtual bool _test_create_rendering_device(const String &p_display_driver) const override;
145
#endif
146
147
OS_LinuxBSD();
148
~OS_LinuxBSD();
149
};
150
151