Make the sfml parts a separate dependency so you can use them if you want.
This commit is contained in:
parent
de0d957c66
commit
b7c49711b6
4 changed files with 47 additions and 31 deletions
33
meson.build
33
meson.build
|
@ -1,5 +1,7 @@
|
|||
# clang might need _LIBCPP_ENABLE_CXX26_REMOVED_CODECVT
|
||||
|
||||
# HEY BUG: when you have a . spec in a LEL it doesn't work on text
|
||||
|
||||
project('lel-guecs', 'cpp',
|
||||
version: '0.2.0',
|
||||
default_options: [
|
||||
|
@ -63,11 +65,12 @@ sfml_window = subproject('sfml').get_variable('sfml_window_dep')
|
|||
|
||||
lib_depends = [ fmt, sfml_graphics, sfml_system, sfml_window ]
|
||||
|
||||
dependencies += [
|
||||
json, freetype2, flac, ogg,
|
||||
lib_sfml_depends = [
|
||||
fmt, json, freetype2, flac, ogg,
|
||||
vorbis, vorbisfile, vorbisenc, sfml_audio,
|
||||
] + lib_depends
|
||||
]
|
||||
|
||||
dependencies += lib_depends + lib_sfml_depends
|
||||
|
||||
sources = [
|
||||
'src/guecs/ui.cpp',
|
||||
|
@ -98,7 +101,19 @@ lel_guecs_dep = declare_dependency(
|
|||
link_with: lel_guecs_lib,
|
||||
include_directories: lel_guecs_inc)
|
||||
|
||||
executable('runtests', sfml_impl + [
|
||||
lel_guecs_sfml_lib = static_library('lel-guecs-sfml',
|
||||
sfml_impl,
|
||||
pic: true,
|
||||
cpp_args: cpp_args,
|
||||
include_directories: lel_guecs_inc,
|
||||
override_options: exe_defaults,
|
||||
dependencies: lib_sfml_depends)
|
||||
|
||||
lel_guecs_sfml_dep = declare_dependency(
|
||||
link_with: lel_guecs_sfml_lib,
|
||||
include_directories: lel_guecs_inc)
|
||||
|
||||
executable('runtests', [
|
||||
'tests/lel.cpp',
|
||||
'tests/shaders.cpp',
|
||||
'tests/sound.cpp',
|
||||
|
@ -109,25 +124,25 @@ executable('runtests', sfml_impl + [
|
|||
link_args: link_args,
|
||||
override_options: exe_defaults,
|
||||
include_directories: lel_guecs_inc,
|
||||
link_with: [lel_guecs_lib],
|
||||
link_with: [lel_guecs_lib, lel_guecs_sfml_lib],
|
||||
dependencies: dependencies + [catch2])
|
||||
|
||||
executable('clicker_game', sfml_impl + [
|
||||
executable('clicker_game', [
|
||||
'demos/clicker_game.cpp',
|
||||
],
|
||||
cpp_args: cpp_args,
|
||||
link_args: link_args,
|
||||
override_options: exe_defaults,
|
||||
include_directories: lel_guecs_inc,
|
||||
link_with: [lel_guecs_lib],
|
||||
link_with: [lel_guecs_lib, lel_guecs_sfml_lib],
|
||||
dependencies: dependencies)
|
||||
|
||||
executable('calc', sfml_impl + [
|
||||
executable('calc', [
|
||||
'demos/calc.cpp',
|
||||
],
|
||||
cpp_args: cpp_args,
|
||||
link_args: link_args,
|
||||
override_options: exe_defaults,
|
||||
include_directories: lel_guecs_inc,
|
||||
link_with: [lel_guecs_lib],
|
||||
link_with: [lel_guecs_lib, lel_guecs_sfml_lib],
|
||||
dependencies: dependencies)
|
||||
|
|
|
@ -21,8 +21,8 @@ static const char _Parser_actions[] = {
|
|||
};
|
||||
|
||||
static const char _Parser_key_offsets[] = {
|
||||
0, 0, 4, 20, 33, 35, 39, 41,
|
||||
44, 56, 61
|
||||
0, 0, 4, 20, 33, 35, 39, 44,
|
||||
47, 59, 64
|
||||
};
|
||||
|
||||
static const char _Parser_trans_keys[] = {
|
||||
|
@ -30,26 +30,26 @@ static const char _Parser_trans_keys[] = {
|
|||
46, 61, 94, 95, 9, 13, 60, 62,
|
||||
65, 90, 97, 122, 37, 40, 42, 46,
|
||||
61, 94, 95, 60, 62, 65, 90, 97,
|
||||
122, 48, 57, 41, 44, 48, 57, 48,
|
||||
57, 41, 48, 57, 32, 93, 95, 124,
|
||||
9, 13, 48, 57, 65, 90, 97, 122,
|
||||
32, 93, 124, 9, 13, 32, 91, 9,
|
||||
13, 0
|
||||
122, 48, 57, 41, 44, 48, 57, 32,
|
||||
9, 13, 48, 57, 41, 48, 57, 32,
|
||||
93, 95, 124, 9, 13, 48, 57, 65,
|
||||
90, 97, 122, 32, 93, 124, 9, 13,
|
||||
32, 91, 9, 13, 0
|
||||
};
|
||||
|
||||
static const char _Parser_single_lengths[] = {
|
||||
0, 2, 8, 7, 0, 2, 0, 1,
|
||||
0, 2, 8, 7, 0, 2, 1, 1,
|
||||
4, 3, 2
|
||||
};
|
||||
|
||||
static const char _Parser_range_lengths[] = {
|
||||
0, 1, 4, 3, 1, 1, 1, 1,
|
||||
0, 1, 4, 3, 1, 1, 2, 1,
|
||||
4, 1, 1
|
||||
};
|
||||
|
||||
static const char _Parser_index_offsets[] = {
|
||||
0, 0, 4, 17, 28, 30, 34, 36,
|
||||
39, 48, 53
|
||||
0, 0, 4, 17, 28, 30, 34, 38,
|
||||
41, 50, 55
|
||||
};
|
||||
|
||||
static const char _Parser_indicies[] = {
|
||||
|
@ -57,24 +57,24 @@ static const char _Parser_indicies[] = {
|
|||
7, 9, 7, 10, 3, 8, 10, 10,
|
||||
1, 4, 5, 6, 7, 9, 7, 10,
|
||||
8, 10, 10, 1, 11, 1, 12, 13,
|
||||
14, 1, 15, 1, 16, 17, 1, 18,
|
||||
20, 19, 21, 18, 19, 19, 19, 1,
|
||||
22, 23, 24, 22, 1, 25, 2, 25,
|
||||
1, 0
|
||||
14, 1, 15, 15, 16, 1, 17, 18,
|
||||
1, 19, 21, 20, 22, 19, 20, 20,
|
||||
20, 1, 23, 24, 25, 23, 1, 26,
|
||||
2, 26, 1, 0
|
||||
};
|
||||
|
||||
static const char _Parser_trans_targs[] = {
|
||||
1, 0, 2, 2, 3, 4, 3, 3,
|
||||
3, 3, 8, 5, 3, 6, 5, 7,
|
||||
3, 7, 9, 8, 10, 2, 9, 10,
|
||||
2, 10
|
||||
3, 3, 8, 5, 3, 6, 5, 6,
|
||||
7, 3, 7, 9, 8, 10, 2, 9,
|
||||
10, 2, 10
|
||||
};
|
||||
|
||||
static const char _Parser_trans_actions[] = {
|
||||
0, 0, 3, 0, 17, 0, 13, 5,
|
||||
11, 15, 21, 19, 23, 23, 0, 19,
|
||||
26, 0, 7, 0, 32, 29, 0, 9,
|
||||
1, 0
|
||||
11, 15, 21, 19, 23, 23, 0, 0,
|
||||
19, 26, 0, 7, 0, 32, 29, 0,
|
||||
9, 1, 0
|
||||
};
|
||||
|
||||
static const int Parser_start = 1;
|
||||
|
|
|
@ -31,7 +31,7 @@ namespace lel {
|
|||
percent = "%" $percent;
|
||||
halign = ("<" | ">") $align;
|
||||
number = digit+ >{ start = fpc; } %token;
|
||||
setw = ("(" number %setwidth ("," number %setheight)? ")") ;
|
||||
setw = ("(" number %setwidth ("," space* number %setheight)? ")") ;
|
||||
modifiers = (percent | center | expand | valign | halign | setw);
|
||||
id = ((alpha | '_')+ :>> (alnum | '_')*) >{start = fpc;} %id;
|
||||
cell = modifiers* id;
|
||||
|
|
|
@ -143,6 +143,7 @@ namespace guecs {
|
|||
|
||||
bool UI::mouse(float x, float y, bool hover) {
|
||||
int action_count = 0;
|
||||
// BUG: use lel::Parser.hit instead of this
|
||||
|
||||
query<lel::Cell>([&](auto ent, auto& cell) {
|
||||
if((x >= cell.x && x <= cell.x + cell.w) &&
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue