Add KEY_MAP constant

This commit is contained in:
Leroy Hopson 2024-02-14 19:46:29 +13:00
parent 10eb791fea
commit 0a1ba5abcd
No known key found for this signature in database
GPG key ID: D2747312A6DB51AA
2 changed files with 7 additions and 29 deletions

View file

@ -1,37 +1,12 @@
// SPDX-FileCopyrightText: 2021, 2024 Leroy Hopson <godot-xterm@leroy.nix.nz>
// SPDX-License-Identifier: MIT
#include "terminal.h" #include "terminal.h"
#include <xkbcommon/xkbcommon-keysyms.h> #include <xkbcommon/xkbcommon-keysyms.h>
using namespace godot; using namespace godot;
const std::map<const char *, const char *> Terminal::FONTS = {
{"normal_font", "res://addons/godot_xterm/fonts/normal.ttf"},
{"bold_font", "res://addons/godot_xterm/fonts/bold.ttf"},
{"italics_font", "res://addons/godot_xterm/fonts/italics.ttf"},
{"bold_italics_font", "res://addons/godot_xterm/fonts/bold_italics.ttf"},
};
// TODO: Ensure it is default Xterm dark theme.
const Terminal::ColorMap Terminal::COLORS = {
{"ansi_0_color", {"#000000", TSM_COLOR_BLACK}},
{"ansi_1_color", {"#CD0000", TSM_COLOR_RED}},
{"ansi_2_color", {"#00CD00", TSM_COLOR_GREEN}},
{"ansi_3_color", {"#CDCD00", TSM_COLOR_YELLOW}},
{"ansi_4_color", {"#0000EE", TSM_COLOR_BLUE}},
{"ansi_5_color", {"#CD00CD", TSM_COLOR_MAGENTA}},
{"ansi_6_color", {"#00CDCD", TSM_COLOR_CYAN}},
{"ansi_7_color", {"#E5E5E5", TSM_COLOR_LIGHT_GREY}},
{"ansi_8_color", {"#7F7F7F", TSM_COLOR_DARK_GREY}},
{"ansi_9_color", {"#FF0000", TSM_COLOR_LIGHT_RED}},
{"ansi_10_color", {"#00FF00", TSM_COLOR_LIGHT_GREEN}},
{"ansi_11_color", {"#FFFF00", TSM_COLOR_LIGHT_YELLOW}},
{"ansi_12_color", {"#0000FC", TSM_COLOR_LIGHT_BLUE}},
{"ansi_13_color", {"#FF00FF", TSM_COLOR_LIGHT_MAGENTA}},
{"ansi_14_color", {"#00FFFF", TSM_COLOR_LIGHT_CYAN}},
{"ansi_15_color", {"#FFFFFF", TSM_COLOR_WHITE}},
{"foreground_color", {"#FFFFFF", TSM_COLOR_FOREGROUND}},
{"background_color", {"#000000", TSM_COLOR_BACKGROUND}},
};
const Terminal::KeyMap Terminal::KEY_MAP = { const Terminal::KeyMap Terminal::KEY_MAP = {
// Godot does not have seperate scancodes for keypad keys when NumLock is // Godot does not have seperate scancodes for keypad keys when NumLock is
// off. We can check the unicode value to determine whether it is off and // off. We can check the unicode value to determine whether it is off and

View file

@ -37,6 +37,9 @@ namespace godot
BOLD_ITALICS, BOLD_ITALICS,
}; };
typedef std::map<std::pair<Key, char32_t>, uint32_t> KeyMap;
static const KeyMap KEY_MAP;
public: public:
enum AttrFlag enum AttrFlag
{ {