Skip to content

Commit 162bc8b

Browse files
committed
improved menu
1 parent af8f7e2 commit 162bc8b

12 files changed

+364
-87
lines changed

AssaultCube-Multihack.vcxproj

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@
9191
<Optimization>Disabled</Optimization>
9292
<SDLCheck>true</SDLCheck>
9393
<ConformanceMode>true</ConformanceMode>
94-
<AdditionalIncludeDirectories>$(ProjectDir)include;$(ProjectDir)include\assaultcube\include;$(ProjectDir)src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
94+
<AdditionalIncludeDirectories>$(ProjectDir)include;$(ProjectDir)include\assaultcube\include;$(ProjectDir)src;$(ProjectDir)assets;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
9595
<PrecompiledHeader>Use</PrecompiledHeader>
9696
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
9797
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@@ -108,7 +108,7 @@
108108
<Optimization>Disabled</Optimization>
109109
<SDLCheck>true</SDLCheck>
110110
<ConformanceMode>true</ConformanceMode>
111-
<AdditionalIncludeDirectories>$(ProjectDir)include;$(ProjectDir)include\assaultcube\include;$(ProjectDir)src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
111+
<AdditionalIncludeDirectories>$(ProjectDir)include;$(ProjectDir)include\assaultcube\include;$(ProjectDir)src;$(ProjectDir)assets;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
112112
<PrecompiledHeader>Use</PrecompiledHeader>
113113
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
114114
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@@ -127,7 +127,7 @@
127127
<IntrinsicFunctions>true</IntrinsicFunctions>
128128
<SDLCheck>true</SDLCheck>
129129
<ConformanceMode>true</ConformanceMode>
130-
<AdditionalIncludeDirectories>$(ProjectDir)include;$(ProjectDir)include\assaultcube\include;$(ProjectDir)src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
130+
<AdditionalIncludeDirectories>$(ProjectDir)include;$(ProjectDir)include\assaultcube\include;$(ProjectDir)src;$(ProjectDir)assets;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
131131
<PrecompiledHeader>Use</PrecompiledHeader>
132132
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
133133
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@@ -148,7 +148,7 @@
148148
<IntrinsicFunctions>true</IntrinsicFunctions>
149149
<SDLCheck>true</SDLCheck>
150150
<ConformanceMode>true</ConformanceMode>
151-
<AdditionalIncludeDirectories>$(ProjectDir)include;$(ProjectDir)include\assaultcube\include;$(ProjectDir)src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
151+
<AdditionalIncludeDirectories>$(ProjectDir)include;$(ProjectDir)include\assaultcube\include;$(ProjectDir)src;$(ProjectDir)assets;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
152152
<PrecompiledHeader>Use</PrecompiledHeader>
153153
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
154154
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@@ -242,6 +242,8 @@
242242
</ClCompile>
243243
</ItemGroup>
244244
<ItemGroup>
245+
<ClInclude Include="assets\font\UbuntuMono_Regular.h" />
246+
<ClInclude Include="assets\font\Ubuntu_Regular.h" />
245247
<ClInclude Include="include\assaultcube\include\AL\al.h" />
246248
<ClInclude Include="include\assaultcube\include\AL\alc.h" />
247249
<ClInclude Include="include\assaultcube\include\AL\efx-creative.h" />
@@ -369,6 +371,7 @@
369371
<ClInclude Include="src\pch.h" />
370372
</ItemGroup>
371373
<ItemGroup>
374+
<Text Include="assets\font\UFL.txt" />
372375
<Text Include="assets\readme.txt" />
373376
<Text Include="build\readme.txt" />
374377
</ItemGroup>
@@ -390,6 +393,13 @@
390393
<Library Include="include\assaultcube\lib\ws2_32.lib" />
391394
<Library Include="include\assaultcube\lib\zdll.lib" />
392395
</ItemGroup>
396+
<ItemGroup>
397+
<Font Include="assets\font\Ubuntu-Regular.ttf" />
398+
<Font Include="assets\font\UbuntuMono-Regular.ttf" />
399+
</ItemGroup>
400+
<ItemGroup>
401+
<None Include="assets\font\create_font_headers.py" />
402+
</ItemGroup>
393403
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
394404
<ImportGroup Label="ExtensionTargets">
395405
</ImportGroup>

AssaultCube-Multihack.vcxproj.filters

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -491,10 +491,17 @@
491491
<ClInclude Include="include\assaultcube\src\i18n.h">
492492
<Filter>Header Files</Filter>
493493
</ClInclude>
494+
<ClInclude Include="assets\font\Ubuntu_Regular.h">
495+
<Filter>Header Files</Filter>
496+
</ClInclude>
497+
<ClInclude Include="assets\font\UbuntuMono_Regular.h">
498+
<Filter>Header Files</Filter>
499+
</ClInclude>
494500
</ItemGroup>
495501
<ItemGroup>
496502
<Text Include="build\readme.txt" />
497503
<Text Include="assets\readme.txt" />
504+
<Text Include="assets\font\UFL.txt" />
498505
</ItemGroup>
499506
<ItemGroup>
500507
<Library Include="include\assaultcube\lib\EFX-Util.lib" />
@@ -514,4 +521,11 @@
514521
<Library Include="include\assaultcube\lib\SDL_ttf.lib" />
515522
<Library Include="include\assaultcube\lib\wldap32.lib" />
516523
</ItemGroup>
524+
<ItemGroup>
525+
<Font Include="assets\font\UbuntuMono-Regular.ttf" />
526+
<Font Include="assets\font\Ubuntu-Regular.ttf" />
527+
</ItemGroup>
528+
<ItemGroup>
529+
<None Include="assets\font\create_font_headers.py" />
530+
</ItemGroup>
517531
</Project>

assets/font/UFL.txt

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
-------------------------------
2+
UBUNTU FONT LICENCE Version 1.0
3+
-------------------------------
4+
5+
PREAMBLE
6+
This licence allows the licensed fonts to be used, studied, modified and
7+
redistributed freely. The fonts, including any derivative works, can be
8+
bundled, embedded, and redistributed provided the terms of this licence
9+
are met. The fonts and derivatives, however, cannot be released under
10+
any other licence. The requirement for fonts to remain under this
11+
licence does not require any document created using the fonts or their
12+
derivatives to be published under this licence, as long as the primary
13+
purpose of the document is not to be a vehicle for the distribution of
14+
the fonts.
15+
16+
DEFINITIONS
17+
"Font Software" refers to the set of files released by the Copyright
18+
Holder(s) under this licence and clearly marked as such. This may
19+
include source files, build scripts and documentation.
20+
21+
"Original Version" refers to the collection of Font Software components
22+
as received under this licence.
23+
24+
"Modified Version" refers to any derivative made by adding to, deleting,
25+
or substituting -- in part or in whole -- any of the components of the
26+
Original Version, by changing formats or by porting the Font Software to
27+
a new environment.
28+
29+
"Copyright Holder(s)" refers to all individuals and companies who have a
30+
copyright ownership of the Font Software.
31+
32+
"Substantially Changed" refers to Modified Versions which can be easily
33+
identified as dissimilar to the Font Software by users of the Font
34+
Software comparing the Original Version with the Modified Version.
35+
36+
To "Propagate" a work means to do anything with it that, without
37+
permission, would make you directly or secondarily liable for
38+
infringement under applicable copyright law, except executing it on a
39+
computer or modifying a private copy. Propagation includes copying,
40+
distribution (with or without modification and with or without charging
41+
a redistribution fee), making available to the public, and in some
42+
countries other activities as well.
43+
44+
PERMISSION & CONDITIONS
45+
This licence does not grant any rights under trademark law and all such
46+
rights are reserved.
47+
48+
Permission is hereby granted, free of charge, to any person obtaining a
49+
copy of the Font Software, to propagate the Font Software, subject to
50+
the below conditions:
51+
52+
1) Each copy of the Font Software must contain the above copyright
53+
notice and this licence. These can be included either as stand-alone
54+
text files, human-readable headers or in the appropriate machine-
55+
readable metadata fields within text or binary files as long as those
56+
fields can be easily viewed by the user.
57+
58+
2) The font name complies with the following:
59+
(a) The Original Version must retain its name, unmodified.
60+
(b) Modified Versions which are Substantially Changed must be renamed to
61+
avoid use of the name of the Original Version or similar names entirely.
62+
(c) Modified Versions which are not Substantially Changed must be
63+
renamed to both (i) retain the name of the Original Version and (ii) add
64+
additional naming elements to distinguish the Modified Version from the
65+
Original Version. The name of such Modified Versions must be the name of
66+
the Original Version, with "derivative X" where X represents the name of
67+
the new work, appended to that name.
68+
69+
3) The name(s) of the Copyright Holder(s) and any contributor to the
70+
Font Software shall not be used to promote, endorse or advertise any
71+
Modified Version, except (i) as required by this licence, (ii) to
72+
acknowledge the contribution(s) of the Copyright Holder(s) or (iii) with
73+
their explicit written permission.
74+
75+
4) The Font Software, modified or unmodified, in part or in whole, must
76+
be distributed entirely under this licence, and must not be distributed
77+
under any other licence. The requirement for fonts to remain under this
78+
licence does not affect any document created using the Font Software,
79+
except any version of the Font Software extracted from a document
80+
created using the Font Software may only be distributed under this
81+
licence.
82+
83+
TERMINATION
84+
This licence becomes null and void if any of the above conditions are
85+
not met.
86+
87+
DISCLAIMER
88+
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
89+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
90+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
91+
COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
92+
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
93+
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
94+
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
95+
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER
96+
DEALINGS IN THE FONT SOFTWARE.

assets/font/Ubuntu-Regular.ttf

292 KB
Binary file not shown.

assets/font/UbuntuMono-Regular.ttf

185 KB
Binary file not shown.

assets/font/UbuntuMono_Regular.h

Lines changed: 2 additions & 0 deletions
Large diffs are not rendered by default.

assets/font/Ubuntu_Regular.h

Lines changed: 2 additions & 0 deletions
Large diffs are not rendered by default.

assets/font/create_font_headers.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import os
2+
3+
for root, dirnames, files in os.walk("."):
4+
for file in files:
5+
if file.endswith(".ttf"):
6+
file_handle = open(file, "rb")
7+
file_data = file_handle.read()
8+
file_handle.close()
9+
10+
file_data_str = ""
11+
12+
for byte in file_data:
13+
file_data_str += f"{hex(byte)}, "
14+
15+
file_data_str = "".join(file_data_str.rsplit(", ", 1)) #Remove last ', '
16+
17+
font_name = "".join(file.rsplit(".ttf", 1))
18+
font_name = font_name.replace("-", "_")
19+
cpp_header = "#pragma once\nconst unsigned char %s[] = { %s };\n" %(font_name, file_data_str)
20+
21+
header_file = f"{font_name}.h"
22+
header_handle = open(header_file, "w")
23+
header_handle.write(cpp_header)
24+
header_handle.close()

src/base.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ bool Base::Data::ShowMenu = true;
4242
HGLRC Base::Data::glContext = NULL;
4343
HGLRC Base::Data::oContext = NULL;
4444
AC_Client Base::Data::game;
45+
ImFont* Base::Data::FontTitle = nullptr;
46+
ImFont* Base::Data::FontMenu = nullptr;
47+
ImFont* Base::Data::FontHack = nullptr;
4548

4649
bool Base::Data::Settings::EnableCrosshair = false;
4750
int Base::Data::Settings::CrosshairType = 0;

src/base.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ namespace Base
6060
extern HGLRC glContext;
6161
extern HGLRC oContext;
6262
extern AC_Client game;
63+
extern ImFont* FontTitle;
64+
extern ImFont* FontMenu;
65+
extern ImFont* FontHack;
6366

6467
namespace Settings
6568
{

0 commit comments

Comments
 (0)