Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
charmap.qc
Go to the documentation of this file.
1#include "charmap.qh"
2
3#include "inputbox.qh"
4
5string CHARMAP =
6 "★◆■▮▰▬◣◤◥◢◀▲▶▼"
7 "🌍🌎🌏🚀🌌👽🔫⌖❇❈←↑→↓"
8 "☠☣☢⚛⚡⚙🔥❌⚠⛔❰❱❲❳"
9 "😃😊😁😄😆😎😈😇😉😛😝😘❤ "
10 "😐😒😕😮😲😞😟😠😣😭😵😴 "
11 "\xEE\x83\xA1\xEE\x83\xA2\xEE\x83\xA3\xEE\x83\xA4\xEE\x83\xA5\xEE\x83\xA6\xEE\x83\xA7"
12 "\xEE\x83\xA8\xEE\x83\xA9\xEE\x83\xAA\xEE\x83\xAB\xEE\x83\xAC\xEE\x83\xAD\xEE\x83\xAE"
13 "\xEE\x83\xAF\xEE\x83\xB0\xEE\x83\xB1\xEE\x83\xB2\xEE\x83\xB3\xEE\x83\xB4\xEE\x83\xB5"
14 "\xEE\x83\xB6\xEE\x83\xB7\xEE\x83\xB8\xEE\x83\xB9\xEE\x83\xBA\xEE\x80\x90\xEE\x80\x91"
15 "\xEE\x82\xB0\xEE\x82\xB1\xEE\x82\xB2\xEE\x82\xB3\xEE\x82\xB4\xEE\x82\xB5\xEE\x82\xB6"
16 "\xEE\x82\xB7\xEE\x82\xB8\xEE\x82\xB9\xEE\x82\xA1\xEE\x82\xBF\xEE\x82\xA6\xEE\x82\xA5"
17 "\xEE\x83\x81\xEE\x83\x82\xEE\x83\x83\xEE\x83\x84\xEE\x83\x85\xEE\x83\x86\xEE\x83\x87"
18 "\xEE\x83\x88\xEE\x83\x89\xEE\x83\x8A\xEE\x83\x8B\xEE\x83\x8C\xEE\x83\x8D\xEE\x83\x8E"
19 "\xEE\x83\x8F\xEE\x83\x90\xEE\x83\x91\xEE\x83\x92\xEE\x83\x93\xEE\x83\x94\xEE\x83\x95"
20 "\xEE\x83\x96\xEE\x83\x97\xEE\x83\x98\xEE\x83\x99\xEE\x83\x9A\xEE\x81\x9B\xEE\x81\x9D";
21
23{
24 string character = substring(CHARMAP, cell.y * me.columns + cell.x, 1);
25 return (character != " ") ? character : "";
26}
27
28entity makeXonoticCharmap(entity controlledInputBox)
29{
31 me.configureXonoticCharmap(me, controlledInputBox);
32 return me;
33}
34
36{
37 me.inputBox = controlledInputBox;
38 me.configureXonoticPicker(me);
39}
40
41void XonoticCharmap_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
42{
43 SUPER(XonoticCharmap).resizeNotify(me, relOrigin, relSize, absOrigin, absSize);
44
45 float maxFontWidth = SKINFONTSIZE_NORMAL / absSize.x;
46 float maxFontHeight = SKINFONTSIZE_NORMAL / absSize.y;
47
48 if (me.realCellSize.x * absSize.x > me.realCellSize.y * absSize.y)
49 {
50 me.realFontSize.x = me.realCellSize.y * absSize.y / absSize.x;
51 me.realFontSize.y = me.realCellSize.y;
52 }
53 else
54 {
55 me.realFontSize.x = me.realCellSize.x;
56 me.realFontSize.y = me.realCellSize.x * absSize.x / absSize.y;
57 }
58
59 if (me.realFontSize.x > maxFontWidth || me.realFontSize.y > maxFontHeight)
60 me.realFontSize = eX * maxFontWidth + eY * maxFontHeight;
61
62 me.charOffset = eX * me.realCellSize.x / 2 + eY * ((me.realCellSize.y - me.realFontSize.y) / 2);
63}
64
65float XonoticCharmap_keyDown(entity me, float key, float ascii, float shift)
66{
67 if (SUPER(XonoticCharmap).keyDown(me, key, ascii, shift))
68 return 1;
69 return me.inputBox.keyDown(me.inputBox, key, ascii, shift);
70}
71
73{
74 string character = charmap_cellToChar(me, cell);
75 if (character != "")
76 {
77 me.inputBox.enterText(me.inputBox, character);
78 if (me.inputBox.applyButton)
79 me.inputBox.applyButton.disabled = false;
80 }
81}
82
84{
85 return (charmap_cellToChar(me, cell) != "");
86}
87
89{
90 draw_CenterText(cellPos + me.charOffset, charmap_cellToChar(me, cell), me.realFontSize, SKINCOLOR_CHARMAP_CHAR, SKINALPHA_CHARMAP_CHAR, 0);
91}
92
94{
95 me.inputBox.saveCvars(me.inputBox);
96}
string CHARMAP
Definition charmap.qc:5
void XonoticCharmap_focusLeave(entity me)
Definition charmap.qc:93
entity makeXonoticCharmap(entity controlledInputBox)
Definition charmap.qc:28
string charmap_cellToChar(entity me, vector cell)
Definition charmap.qc:22
void XonoticCharmap_cellDraw(entity me, vector cell, vector cellPos)
Definition charmap.qc:88
void XonoticCharmap_cellSelect(entity me, vector cell)
Definition charmap.qc:72
void XonoticCharmap_configureXonoticCharmap(entity me, entity controlledInputBox)
Definition charmap.qc:35
float XonoticCharmap_keyDown(entity me, float key, float ascii, float shift)
Definition charmap.qc:65
void XonoticCharmap_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
Definition charmap.qc:41
bool XonoticCharmap_cellIsValid(entity me, vector cell)
Definition charmap.qc:83
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
void draw_CenterText(vector theOrigin, string theText, vector theSize, vector theColor, float theAlpha, bool allowColorCodes)
Definition draw.qc:296
string substring(string s, float start, float length)
#define NEW(cname,...)
Definition oo.qh:120
#define SUPER(cname)
Definition oo.qh:236
vector
Definition self.qh:96
const vector eY
Definition vector.qh:44
const vector eX
Definition vector.qh:43