Files
milsko/pl/utils.pl
IoIxD 9a4c74ad93 Unfinished Wayland PR (#1)
moved from the github repo.

current progress:

<img width="389" alt="image.png" src="attachments/6a2cb365-7348-44b4-8fa7-9980df965a67">

Other notes:

- took the opportunity to remove MwLLSetBackground which I was told was deprecated
- Updated .gitignore to more accurately cover/remove example binaries
- Uses OpenGL as the backend.
- New LL function for swapping buffers, MwLLEndDraw
- [TODO] Uses weak linking for all libraries so that systems that don't support Wayland or even have it installed can launch without it.

Reviewed-on: https://gitea.nishi.boats/pyrite-dev/milsko/pulls/1
Co-authored-by: IoIxD <alphaproject217@gmail.com>
Co-committed-by: IoIxD <alphaproject217@gmail.com>
2025-12-09 20:11:01 -06:00

109 lines
2.0 KiB
Perl

sub add_incdir {
my $input = $_[0];
$input =~ s/\r?\n/ /g;
$incdir = "${incdir} ${input}";
}
sub add_cflags {
my $input = $_[0];
$input =~ s/\r?\n/ /g;
$cflags = "${cflags} ${input}";
}
sub add_libdir {
my $input = $_[0];
$input =~ s/\r?\n/ /g;
$libdir = "${libdir} ${input}";
}
sub add_ldflags {
my $input = $_[0];
$input =~ s/\r?\n/ /g;
$ldflags = "${ldflags} ${input}";
}
sub add_libs {
my $input = $_[0];
$input =~ s/\r?\n/ /g;
$libs = "${libs} ${input}";
}
sub new_example {
if (@_ == 2) {
$examples_libs{"$_[0]${executable_suffix}"} = $_[1];
}
push(@examples_targets, "${_[0]}${executable_suffix}");
}
sub new_object {
my @l = glob($_[0]);
foreach my $e (@l) {
$e =~ s/\.c$/$object_suffix/;
push(@library_targets, $e);
}
}
sub use_backend {
foreach my $l (@_) {
push(@backends, $l);
}
}
sub scan_wayland_protocol {
my $tier = $_[0];
my $proto = $_[1];
my $ver = $_[2];
my $proto_c = "src/backend/wayland-${proto}-protocol.c";
if (
system(
"wayland-scanner private-code /usr/share/wayland-protocols/${tier}/${proto}/${proto}${ver}.xml ${proto_c}"
) != 0
)
{
print(
"^ Error on getting private code for /usr/share/wayland-protocols/${tier}/${proto}/${proto}${ver}.xml\n"
);
}
else {
new_object($proto_c);
}
if (
system(
"wayland-scanner client-header /usr/share/wayland-protocols/${tier}/${proto}/${proto}${ver}.xml include/Mw/LowLevel/Wayland/${proto}-client-protocol.h"
)
)
{
print(
"^ Error on getting client header for /usr/share/wayland-protocols/${tier}/${proto}/${proto}${ver}.xml\n"
);
}
}
our %params = ();
sub param_set {
$params{ $_[0] } = $_[1];
}
sub param_get {
if (not(defined($params{ $_[0] }))) {
return 0;
}
else {
return $params{ $_[0] };
}
}
sub param_list {
return sort(keys(%params));
}
1;