parent
801a05d1ab
commit
a68cce5cbb
@ -0,0 +1,5 @@ |
|||||||
|
{ |
||||||
|
"git_path": ".\\", |
||||||
|
"build_cmd": "C:/Users/lcthw/AppData/Local/Microsoft/WinGet/Packages/ezwinports.make_Microsoft.Winget.Source_8wekyb3d8bbwe/bin/make.exe build", |
||||||
|
"test_cmd": "./builddir/runtests.exe" |
||||||
|
} |
@ -0,0 +1 @@ |
|||||||
|
set makeprg=meson\ compile\ -C\ . |
@ -0,0 +1,49 @@ |
|||||||
|
all: build |
||||||
|
|
||||||
|
reset: |
||||||
|
ifeq '$(OS)' 'Windows_NT' |
||||||
|
powershell -executionpolicy bypass .\scripts\reset_build.ps1
|
||||||
|
else |
||||||
|
sh -x ./scripts/reset_build.sh
|
||||||
|
endif |
||||||
|
|
||||||
|
build: |
||||||
|
meson compile -j 10 -C builddir
|
||||||
|
|
||||||
|
release_build: |
||||||
|
meson --wipe builddir -Db_ndebug=true --buildtype release
|
||||||
|
meson compile -j 10 -C builddir
|
||||||
|
|
||||||
|
debug_build: |
||||||
|
meson setup --wipe builddir -Db_ndebug=true --buildtype debugoptimized
|
||||||
|
meson compile -j 10 -C builddir
|
||||||
|
|
||||||
|
tracy_build: |
||||||
|
meson setup --wipe builddir --buildtype debugoptimized -Dtracy_enable=true -Dtracy:on_demand=true
|
||||||
|
meson compile -j 10 -C builddir
|
||||||
|
|
||||||
|
run: build |
||||||
|
ifeq '$(OS)' 'Windows_NT' |
||||||
|
powershell "cp ./builddir/clicker.exe ."
|
||||||
|
./clicker
|
||||||
|
else |
||||||
|
./builddir/clicker
|
||||||
|
endif |
||||||
|
|
||||||
|
debug: build |
||||||
|
gdb --nx -x .gdbinit --ex run --args builddir/clicker
|
||||||
|
|
||||||
|
debug_run: build |
||||||
|
gdb --nx -x .gdbinit --batch --ex run --ex bt --ex q --args builddir/clicker
|
||||||
|
|
||||||
|
clean: |
||||||
|
meson compile --clean -C builddir
|
||||||
|
|
||||||
|
debug_test: build |
||||||
|
gdb --nx -x .gdbinit --ex run --args builddir/runtests -e
|
||||||
|
|
||||||
|
win_installer: |
||||||
|
powershell 'start "C:\Program Files (x86)\solicus\InstallForge\bin\ifbuilderenvx86.exe" scripts\win_installer.ifp'
|
||||||
|
|
||||||
|
coverage_report: |
||||||
|
powershell 'scripts/coverage_report.ps1'
|
After Width: | Height: | Size: 808 KiB |
After Width: | Height: | Size: 34 KiB |
@ -0,0 +1,28 @@ |
|||||||
|
{ |
||||||
|
"sounds": { |
||||||
|
"ui_click": "assets/sounds/ui_click.ogg", |
||||||
|
"ui_hover": "assets/sounds/ui_hover.ogg", |
||||||
|
"clicker_bark": "assets/sounds/clicker_bark.ogg", |
||||||
|
"blank": "assets/sounds/blank.ogg" |
||||||
|
}, |
||||||
|
"sprites": { |
||||||
|
"textures_test": |
||||||
|
{"path": "assets/textures_test.png", |
||||||
|
"frame_width": 53, |
||||||
|
"frame_height": 34 |
||||||
|
}, |
||||||
|
"clicker_the_dog": |
||||||
|
{"path": "assets/clicker_the_dog-1024.png", |
||||||
|
"frame_width": 1024, |
||||||
|
"frame_height": 1024 |
||||||
|
}, |
||||||
|
"clicker_treat_bone": |
||||||
|
{"path": "assets/clicker_treat_bone.png", |
||||||
|
"frame_width": 256, |
||||||
|
"frame_height": 144 |
||||||
|
} |
||||||
|
}, |
||||||
|
"graphics": { |
||||||
|
"smooth_textures": false |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,10 @@ |
|||||||
|
{ |
||||||
|
"ui_shader": { |
||||||
|
"file_name": "assets/shaders/ui_shader.frag", |
||||||
|
"type": "fragment" |
||||||
|
}, |
||||||
|
"ERROR": { |
||||||
|
"file_name": "assets/shaders/ui_error.frag", |
||||||
|
"type": "fragment" |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,18 @@ |
|||||||
|
uniform vec2 u_resolution; |
||||||
|
uniform vec2 u_mouse; |
||||||
|
uniform float u_duration; |
||||||
|
uniform float u_time; |
||||||
|
uniform float u_time_end; |
||||||
|
uniform sampler2D texture; |
||||||
|
uniform bool is_shape; |
||||||
|
|
||||||
|
void main() { |
||||||
|
if(is_shape) { |
||||||
|
vec4 color = vec4(1.0, 0.0, 0.0, 1.0); |
||||||
|
gl_FragColor = gl_Color * color; |
||||||
|
} else { |
||||||
|
vec4 pixel = texture2D(texture, gl_TexCoord[0].xy); |
||||||
|
vec4 color = vec4(1.0, 0.0, 0.0, 1.0); |
||||||
|
gl_FragColor = gl_Color * color * pixel; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,29 @@ |
|||||||
|
uniform vec2 u_resolution; |
||||||
|
uniform vec2 u_mouse; |
||||||
|
uniform float u_duration; |
||||||
|
uniform float u_time; |
||||||
|
uniform float u_time_end; |
||||||
|
uniform sampler2D texture; |
||||||
|
uniform bool is_shape; |
||||||
|
uniform bool hover; |
||||||
|
|
||||||
|
vec4 blink() { |
||||||
|
if(hover) { |
||||||
|
return vec4(0.95, 0.95, 1.0, 1.0); |
||||||
|
} else { |
||||||
|
float tick = (u_time_end - u_time) / u_duration; |
||||||
|
float blink = mix(0.5, 1.0, tick); |
||||||
|
return vec4(blink, blink, blink, 1.0); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
void main() { |
||||||
|
vec4 color = blink(); |
||||||
|
|
||||||
|
if(!is_shape) { |
||||||
|
vec4 pixel = texture2D(texture, gl_TexCoord[0].xy); |
||||||
|
color *= pixel; |
||||||
|
} |
||||||
|
|
||||||
|
gl_FragColor = gl_Color * color; |
||||||
|
} |
@ -0,0 +1,12 @@ |
|||||||
|
uniform vec2 u_resolution; |
||||||
|
uniform vec2 u_mouse; |
||||||
|
uniform float u_duration; |
||||||
|
uniform float u_time; |
||||||
|
uniform float u_time_end; |
||||||
|
|
||||||
|
void main() { |
||||||
|
float tick = (u_time_end - u_time) / u_duration; |
||||||
|
float blink = smoothstep(1.0, 0.5, tick); |
||||||
|
vec4 color = vec4(blink, blink, blink, 1.0); |
||||||
|
gl_FragColor = gl_Color * color; |
||||||
|
} |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
After Width: | Height: | Size: 579 B |
@ -0,0 +1,69 @@ |
|||||||
|
#include "backend.hpp" |
||||||
|
#include <guecs/sfml/shaders.hpp> |
||||||
|
#include <guecs/sfml/sound.hpp> |
||||||
|
#include <guecs/sfml/textures.hpp> |
||||||
|
#include <guecs/sfml/config.hpp> |
||||||
|
|
||||||
|
namespace sfml { |
||||||
|
guecs::SpriteTexture Backend::texture_get(const string& name) { |
||||||
|
auto sp = textures::get(name); |
||||||
|
return {sp.sprite, sp.texture}; |
||||||
|
} |
||||||
|
|
||||||
|
Backend::Backend() { |
||||||
|
sound::init(); |
||||||
|
shaders::init(); |
||||||
|
textures::init(); |
||||||
|
} |
||||||
|
|
||||||
|
void Backend::sound_play(const string& name) { |
||||||
|
sound::play(name); |
||||||
|
} |
||||||
|
|
||||||
|
void Backend::sound_stop(const string& name) { |
||||||
|
sound::stop(name); |
||||||
|
} |
||||||
|
|
||||||
|
std::shared_ptr<sf::Shader> Backend::shader_get(const std::string& name) { |
||||||
|
return shaders::get(name); |
||||||
|
} |
||||||
|
|
||||||
|
bool Backend::shader_updated() { |
||||||
|
if(shaders::updated($shaders_version)) { |
||||||
|
$shaders_version = shaders::version(); |
||||||
|
return true; |
||||||
|
} else { |
||||||
|
return false; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
guecs::Theme Backend::theme() { |
||||||
|
guecs::Theme theme; |
||||||
|
|
||||||
|
// {
|
||||||
|
// .BLACK={1, 4, 2},
|
||||||
|
// .DARK_DARK={9, 29, 16},
|
||||||
|
// .DARK_MID={14, 50, 26},
|
||||||
|
// .DARK_LIGHT={0, 109, 44},
|
||||||
|
// .MID={63, 171, 92},
|
||||||
|
// .LIGHT_DARK={161, 217, 155},
|
||||||
|
// .LIGHT_MID={199, 233, 192},
|
||||||
|
// .LIGHT_LIGHT={229, 245, 224},
|
||||||
|
// .WHITE={255, 255, 255},
|
||||||
|
// .TRANSPARENT = sf::Color::Transparent
|
||||||
|
// };
|
||||||
|
|
||||||
|
theme.PADDING = 3; |
||||||
|
theme.BORDER_PX = 1; |
||||||
|
theme.TEXT_SIZE = 40; |
||||||
|
theme.LABEL_SIZE = 40; |
||||||
|
theme.FILL_COLOR = theme.DARK_DARK; |
||||||
|
theme.TEXT_COLOR = theme.LIGHT_LIGHT; |
||||||
|
theme.BG_COLOR = theme.MID; |
||||||
|
theme.BORDER_COLOR = theme.LIGHT_DARK; |
||||||
|
theme.BG_COLOR_DARK = theme.BLACK; |
||||||
|
theme.FONT_FILE_NAME = Config::path_to("assets/text.otf").string(); |
||||||
|
|
||||||
|
return theme; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,19 @@ |
|||||||
|
#include "guecs/ui.hpp" |
||||||
|
|
||||||
|
namespace sfml { |
||||||
|
using std::string; |
||||||
|
|
||||||
|
class Backend : public guecs::Backend { |
||||||
|
int $shaders_version = 0; |
||||||
|
|
||||||
|
public: |
||||||
|
|
||||||
|
Backend(); |
||||||
|
guecs::SpriteTexture texture_get(const string& name); |
||||||
|
void sound_play(const string& name); |
||||||
|
void sound_stop(const string& name); |
||||||
|
std::shared_ptr<sf::Shader> shader_get(const std::string& name); |
||||||
|
bool shader_updated(); |
||||||
|
guecs::Theme theme(); |
||||||
|
}; |
||||||
|
} |
@ -0,0 +1,47 @@ |
|||||||
|
#include "dbc.hpp" |
||||||
|
#include <iostream> |
||||||
|
|
||||||
|
void dbc::log(const string &message, const std::source_location location) { |
||||||
|
std::cout << '[' << location.file_name() << ':' |
||||||
|
<< location.line() << "|" |
||||||
|
<< location.function_name() << "] " |
||||||
|
<< message << std::endl; |
||||||
|
} |
||||||
|
|
||||||
|
void dbc::sentinel(const string &message, const std::source_location location) { |
||||||
|
string err = fmt::format("[SENTINEL!] {}", message); |
||||||
|
dbc::log(err, location); |
||||||
|
throw dbc::SentinelError{err}; |
||||||
|
} |
||||||
|
|
||||||
|
void dbc::pre(const string &message, bool test, const std::source_location location) { |
||||||
|
if(!test) { |
||||||
|
string err = fmt::format("[PRE!] {}", message); |
||||||
|
dbc::log(err, location); |
||||||
|
throw dbc::PreCondError{err}; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
void dbc::pre(const string &message, std::function<bool()> tester, const std::source_location location) { |
||||||
|
dbc::pre(message, tester(), location); |
||||||
|
} |
||||||
|
|
||||||
|
void dbc::post(const string &message, bool test, const std::source_location location) { |
||||||
|
if(!test) { |
||||||
|
string err = fmt::format("[POST!] {}", message); |
||||||
|
dbc::log(err, location); |
||||||
|
throw dbc::PostCondError{err}; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
void dbc::post(const string &message, std::function<bool()> tester, const std::source_location location) { |
||||||
|
dbc::post(message, tester(), location); |
||||||
|
} |
||||||
|
|
||||||
|
void dbc::check(bool test, const string &message, const std::source_location location) { |
||||||
|
if(!test) { |
||||||
|
string err = fmt::format("[CHECK!] {}\n", message); |
||||||
|
dbc::log(err, location); |
||||||
|
throw dbc::CheckError{err}; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,51 @@ |
|||||||
|
#pragma once |
||||||
|
|
||||||
|
#include <string> |
||||||
|
#include <fmt/core.h> |
||||||
|
#include <functional> |
||||||
|
#include <source_location> |
||||||
|
|
||||||
|
|
||||||
|
namespace dbc { |
||||||
|
using std::string; |
||||||
|
|
||||||
|
class Error { |
||||||
|
public: |
||||||
|
const string message; |
||||||
|
Error(string m) : message{m} {} |
||||||
|
Error(const char *m) : message{m} {} |
||||||
|
}; |
||||||
|
|
||||||
|
class CheckError : public Error {}; |
||||||
|
class SentinelError : public Error {}; |
||||||
|
class PreCondError : public Error {}; |
||||||
|
class PostCondError : public Error {}; |
||||||
|
|
||||||
|
void log(const string &message, |
||||||
|
const std::source_location location = |
||||||
|
std::source_location::current()); |
||||||
|
|
||||||
|
[[noreturn]] void sentinel(const string &message, |
||||||
|
const std::source_location location = |
||||||
|
std::source_location::current()); |
||||||
|
|
||||||
|
void pre(const string &message, bool test, |
||||||
|
const std::source_location location = |
||||||
|
std::source_location::current()); |
||||||
|
|
||||||
|
void pre(const string &message, std::function<bool()> tester, |
||||||
|
const std::source_location location = |
||||||
|
std::source_location::current()); |
||||||
|
|
||||||
|
void post(const string &message, bool test, |
||||||
|
const std::source_location location = |
||||||
|
std::source_location::current()); |
||||||
|
|
||||||
|
void post(const string &message, std::function<bool()> tester, |
||||||
|
const std::source_location location = |
||||||
|
std::source_location::current()); |
||||||
|
|
||||||
|
void check(bool test, const string &message, |
||||||
|
const std::source_location location = |
||||||
|
std::source_location::current()); |
||||||
|
} |
@ -0,0 +1,177 @@ |
|||||||
|
#include "guecs/sfml/backend.hpp" |
||||||
|
#include "guecs/sfml/components.hpp" |
||||||
|
#include "guecs/ui.hpp" |
||||||
|
#include <fmt/xchar.h> |
||||||
|
#include <deque> |
||||||
|
#include <iostream> |
||||||
|
|
||||||
|
constexpr const int WINDOW_WIDTH=1280; |
||||||
|
constexpr const int WINDOW_HEIGHT=720; |
||||||
|
constexpr const int FRAME_LIMIT=60; |
||||||
|
constexpr const bool VSYNC=true; |
||||||
|
|
||||||
|
using std::string, std::wstring; |
||||||
|
|
||||||
|
enum class Event { |
||||||
|
CLICKER, A_BUTTON |
||||||
|
}; |
||||||
|
|
||||||
|
struct Shake { |
||||||
|
float scale_factor = 0.05f; |
||||||
|
int frames = 10; |
||||||
|
float ease_rate = 0.1f; |
||||||
|
bool playing = false; |
||||||
|
int current = 0; |
||||||
|
float x=0.0; |
||||||
|
float y=0.0; |
||||||
|
float w=0.0; |
||||||
|
float h=0.0; |
||||||
|
sf::Vector2f initial_scale; |
||||||
|
|
||||||
|
float ease() { |
||||||
|
float tick = float(frames) / float(current) * ease_rate; |
||||||
|
return (std::sin(tick) + 1.0) / 2.0; |
||||||
|
} |
||||||
|
|
||||||
|
void init(lel::Cell& cell) { |
||||||
|
x = cell.x; |
||||||
|
y = cell.y; |
||||||
|
w = cell.w; |
||||||
|
h = cell.h; |
||||||
|
} |
||||||
|
|
||||||
|
void play(guecs::Sprite& sprite) { |
||||||
|
if(!playing) { |
||||||
|
playing = true; |
||||||
|
current = 0; |
||||||
|
initial_scale = sprite.sprite->getScale(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
void render(guecs::Sprite& sprite) { |
||||||
|
current++; |
||||||
|
|
||||||
|
if(playing && current < frames) { |
||||||
|
float tick = ease(); |
||||||
|
sf::Vector2f scale{ |
||||||
|
std::lerp(initial_scale.x, initial_scale.x + scale_factor, tick), |
||||||
|
std::lerp(initial_scale.y, initial_scale.y + scale_factor, tick)}; |
||||||
|
|
||||||
|
sprite.sprite->setScale(scale); |
||||||
|
} else { |
||||||
|
playing = false; |
||||||
|
current = 0; |
||||||
|
sprite.sprite->setScale(initial_scale); |
||||||
|
} |
||||||
|
} |
||||||
|
}; |
||||||
|
|
||||||
|
struct ClickerUI { |
||||||
|
guecs::UI $gui; |
||||||
|
guecs::Entity $clicker; |
||||||
|
|
||||||
|
ClickerUI() { |
||||||
|
$gui.position(0, 0, WINDOW_WIDTH, WINDOW_HEIGHT); |
||||||
|
$gui.layout( |
||||||
|
"[_|*%(300,400)clicker|_|_|_]" |
||||||
|
"[_|_ |_|_|_]" |
||||||
|
"[_|_ |_|_|_]" |
||||||
|
"[_|_ |_|_|_]" |
||||||
|
"[a1|a2|a3|a4|a5]"); |
||||||
|
} |
||||||
|
|
||||||
|
void init() { |
||||||
|
$gui.set<guecs::Background>($gui.MAIN, {$gui.$parser, {0, 0, 0, 255}}); |
||||||
|
|
||||||
|
for(auto& [name, cell] : $gui.cells()) { |
||||||
|
auto id = $gui.entity(name); |
||||||
|
if(name != "clicker") { |
||||||
|
$gui.set<guecs::Rectangle>(id, {}); |
||||||
|
$gui.set<guecs::Effect>(id, {}); |
||||||
|
$gui.set<guecs::Sprite>(id, { "clicker_treat_bone" }); |
||||||
|
fmt::println("button dim: {},{}", cell.w, cell.h); |
||||||
|
$gui.set<guecs::Clickable>(id, { |
||||||
|
[&](auto, auto) { handle_button(Event::A_BUTTON); } |
||||||
|
}); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
$clicker = $gui.entity("clicker"); |
||||||
|
$gui.set<guecs::Sprite>($clicker, {"clicker_the_dog"}); |
||||||
|
$gui.set<guecs::Sound>($clicker, {"clicker_bark"}); |
||||||
|
$gui.set<guecs::Clickable>($clicker, { |
||||||
|
[&](auto, auto) { handle_button(Event::CLICKER); } |
||||||
|
}); |
||||||
|
|
||||||
|
// custom components need to be initialized manually
|
||||||
|
$gui.set_init<Shake>($clicker, {}); |
||||||
|
|
||||||
|
$gui.init(); |
||||||
|
} |
||||||
|
|
||||||
|
void render(sf::RenderWindow& window) { |
||||||
|
auto& shaker = $gui.get<Shake>($clicker); |
||||||
|
|
||||||
|
if(shaker.playing) { |
||||||
|
auto& sprite = $gui.get<guecs::Sprite>($clicker); |
||||||
|
shaker.render(sprite); |
||||||
|
window.clear(); |
||||||
|
} |
||||||
|
|
||||||
|
$gui.render(window); |
||||||
|
|
||||||
|
// $gui.debug_layout(window);
|
||||||
|
} |
||||||
|
|
||||||
|
void mouse(float x, float y, bool hover) { |
||||||
|
$gui.mouse(x, y, hover); |
||||||
|
} |
||||||
|
|
||||||
|
void handle_button(Event ev) { |
||||||
|
using enum Event; |
||||||
|
switch(ev) { |
||||||
|
case CLICKER: { |
||||||
|
auto& shaker = $gui.get<Shake>($clicker); |
||||||
|
auto& sprite = $gui.get<guecs::Sprite>($clicker); |
||||||
|
shaker.play(sprite); |
||||||
|
fmt::println("CLICKER LOVES YOU!"); |
||||||
|
} break; |
||||||
|
case A_BUTTON: |
||||||
|
fmt::println("a button clicked"); |
||||||
|
break; |
||||||
|
|
||||||
|
default: |
||||||
|
assert(false && "invalid event"); |
||||||
|
} |
||||||
|
} |
||||||
|
}; |
||||||
|
|
||||||
|
int main() { |
||||||
|
sfml::Backend backend; |
||||||
|
guecs::init(&backend); |
||||||
|
|
||||||
|
sf::RenderWindow window(sf::VideoMode({WINDOW_WIDTH, WINDOW_HEIGHT}), "Clicker the Dog"); |
||||||
|
window.setFramerateLimit(FRAME_LIMIT); |
||||||
|
window.setVerticalSyncEnabled(VSYNC); |
||||||
|
|
||||||
|
ClickerUI clicker; |
||||||
|
clicker.init(); |
||||||
|
|
||||||
|
while(window.isOpen()) { |
||||||
|
while (const auto event = window.pollEvent()) { |
||||||
|
if(event->is<sf::Event::Closed>()) { |
||||||
|
window.close(); |
||||||
|
} |
||||||
|
|
||||||
|
if(const auto* mouse = event->getIf<sf::Event::MouseButtonPressed>()) { |
||||||
|
if(mouse->button == sf::Mouse::Button::Left) { |
||||||
|
sf::Vector2f pos = window.mapPixelToCoords(mouse->position); |
||||||
|
clicker.mouse(pos.x, pos.y, false); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
clicker.render(window); |
||||||
|
window.display(); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,93 @@ |
|||||||
|
# clang might need _LIBCPP_ENABLE_CXX26_REMOVED_CODECVT |
||||||
|
|
||||||
|
project('clicker-loves-you', 'cpp', |
||||||
|
version: '0.1.0', |
||||||
|
default_options: [ |
||||||
|
'cpp_std=c++20', |
||||||
|
'cpp_args=-D_GLIBCXX_DEBUG=1 -D_GLIBCXX_DEBUG_PEDANTIC=1', |
||||||
|
]) |
||||||
|
|
||||||
|
# use this for common options only for our executables |
||||||
|
cpp_args=[] |
||||||
|
link_args=[] |
||||||
|
# these are passed as override_defaults |
||||||
|
exe_defaults = [ 'warning_level=2' ] |
||||||
|
|
||||||
|
cc = meson.get_compiler('cpp') |
||||||
|
dependencies = [] |
||||||
|
|
||||||
|
if build_machine.system() == 'windows' |
||||||
|
add_global_link_arguments( |
||||||
|
'-static-libgcc', |
||||||
|
'-static-libstdc++', |
||||||
|
'-static', |
||||||
|
language: 'cpp', |
||||||
|
) |
||||||
|
|
||||||
|
sfml_main = dependency('sfml_main') |
||||||
|
opengl32 = cc.find_library('opengl32', required: true) |
||||||
|
winmm = cc.find_library('winmm', required: true) |
||||||
|
gdi32 = cc.find_library('gdi32', required: true) |
||||||
|
|
||||||
|
dependencies += [ |
||||||
|
opengl32, winmm, gdi32, sfml_main |
||||||
|
] |
||||||
|
exe_defaults += ['werror=true'] |
||||||
|
|
||||||
|
elif build_machine.system() == 'darwin' |
||||||
|
add_global_link_arguments( |
||||||
|
language: 'cpp', |
||||||
|
) |
||||||
|
|
||||||
|
opengl = dependency('OpenGL') |
||||||
|
corefoundation = dependency('CoreFoundation') |
||||||
|
carbon = dependency('Carbon') |
||||||
|
cocoa = dependency('Cocoa') |
||||||
|
iokit = dependency('IOKit') |
||||||
|
corevideo = dependency('CoreVideo') |
||||||
|
|
||||||
|
link_args += ['-ObjC'] |
||||||
|
exe_defaults += ['werror=false'] |
||||||
|
dependencies += [ |
||||||
|
opengl, corefoundation, carbon, cocoa, iokit, corevideo |
||||||
|
] |
||||||
|
endif |
||||||
|
|
||||||
|
catch2 = dependency('catch2-with-main') |
||||||
|
fmt = subproject('fmt').get_variable('fmt_dep') |
||||||
|
json = dependency('nlohmann_json') |
||||||
|
freetype2 = dependency('freetype2') |
||||||
|
|
||||||
|
flac = dependency('flac') |
||||||
|
ogg = dependency('ogg') |
||||||
|
vorbis = dependency('vorbis') |
||||||
|
vorbisfile = dependency('vorbisfile') |
||||||
|
vorbisenc = dependency('vorbisenc') |
||||||
|
sfml_audio = dependency('sfml_audio') |
||||||
|
sfml_graphics = dependency('sfml_graphics') |
||||||
|
sfml_network = dependency('sfml_network') |
||||||
|
sfml_system = dependency('sfml_system') |
||||||
|
sfml_window = dependency('sfml_window', |
||||||
|
default_options: ['default_library=shared']) |
||||||
|
lel_guecs = dependency('lel_guecs') |
||||||
|
lel_guecs_sfml = dependency('lel_guecs_sfml') |
||||||
|
|
||||||
|
dependencies += [ |
||||||
|
fmt, json, freetype2, |
||||||
|
flac, ogg, vorbis, vorbisfile, vorbisenc, |
||||||
|
sfml_audio, sfml_graphics, |
||||||
|
sfml_network, sfml_system, |
||||||
|
sfml_window, lel_guecs, lel_guecs_sfml |
||||||
|
] |
||||||
|
|
||||||
|
sources = [ |
||||||
|
'dbc.cpp', |
||||||
|
'backend.cpp', |
||||||
|
'main.cpp', |
||||||
|
] |
||||||
|
|
||||||
|
executable('clicker', sources, |
||||||
|
cpp_args: cpp_args, |
||||||
|
link_args: link_args, |
||||||
|
override_options: exe_defaults, |
||||||
|
dependencies: dependencies) |
@ -0,0 +1,13 @@ |
|||||||
|
rm -recurse -force coverage/* |
||||||
|
cp *.cpp,*.hpp,*.rl builddir |
||||||
|
|
||||||
|
. .venv/Scripts/activate |
||||||
|
|
||||||
|
rm -recurse -force coverage |
||||||
|
cp scripts\gcovr_patched_coverage.py .venv\Lib\site-packages\gcovr\coverage.py |
||||||
|
|
||||||
|
gcovr -o coverage/ --html --html-details --html-theme github.dark-blue --gcov-ignore-errors all --gcov-ignore-parse-errors negative_hits.warn_once_per_file -e builddir/subprojects -e builddir -e subprojects -j 10 . |
||||||
|
|
||||||
|
rm *.gcov.json.gz |
||||||
|
|
||||||
|
start .\coverage\coverage_details.html |
@ -0,0 +1,7 @@ |
|||||||
|
mv .\subprojects\packagecache . |
||||||
|
rm -recurse -force .\subprojects\,.\builddir\ |
||||||
|
mkdir subprojects |
||||||
|
mv .\packagecache .\subprojects\ |
||||||
|
mkdir builddir |
||||||
|
cp wraps\*.wrap subprojects\ |
||||||
|
meson setup --default-library=static --prefer-static -Db_coverage=true builddir |
@ -0,0 +1,11 @@ |
|||||||
|
#!/usr/bin/env bash |
||||||
|
set -e |
||||||
|
|
||||||
|
mv -f ./subprojects/packagecache . |
||||||
|
rm -rf subprojects builddir |
||||||
|
mkdir subprojects |
||||||
|
mv packagecache ./subprojects/ |
||||||
|
mkdir builddir |
||||||
|
cp wraps/*.wrap subprojects/ |
||||||
|
# on OSX you can't do this with static |
||||||
|
meson setup -Db_coverage=true builddir |
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,7 @@ |
|||||||
|
mv .\subprojects\packagecache . |
||||||
|
rm -recurse -force .\subprojects\,.\builddir\ |
||||||
|
mkdir subprojects |
||||||
|
mv .\packagecache .\subprojects\ |
||||||
|
mkdir builddir |
||||||
|
cp wraps\*.wrap subprojects\ |
||||||
|
meson setup --default-library=static --prefer-static builddir |
@ -0,0 +1,10 @@ |
|||||||
|
#!/usr/bin/env bash |
||||||
|
|
||||||
|
mv -f ./subprojects/packagecache . |
||||||
|
rm -rf subprojects builddir |
||||||
|
mkdir subprojects |
||||||
|
mv -f packagecache ./subprojects/ && true |
||||||
|
mkdir builddir |
||||||
|
cp wraps/*.wrap subprojects/ |
||||||
|
# on OSX you can't do this with static |
||||||
|
meson setup --default-library=static --prefer-static builddir |
Binary file not shown.
@ -0,0 +1,11 @@ |
|||||||
|
[wrap-file] |
||||||
|
directory = Catch2-3.7.1 |
||||||
|
source_url = https://github.com/catchorg/Catch2/archive/v3.7.1.tar.gz |
||||||
|
source_filename = Catch2-3.7.1.tar.gz |
||||||
|
source_hash = c991b247a1a0d7bb9c39aa35faf0fe9e19764213f28ffba3109388e62ee0269c |
||||||
|
source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/catch2_3.7.1-1/Catch2-3.7.1.tar.gz |
||||||
|
wrapdb_version = 3.7.1-1 |
||||||
|
|
||||||
|
[provide] |
||||||
|
catch2 = catch2_dep |
||||||
|
catch2-with-main = catch2_with_main_dep |
@ -0,0 +1,13 @@ |
|||||||
|
[wrap-file] |
||||||
|
directory = flac-1.4.3 |
||||||
|
source_url = https://github.com/xiph/flac/releases/download/1.4.3/flac-1.4.3.tar.xz |
||||||
|
source_filename = flac-1.4.3.tar.xz |
||||||
|
source_hash = 6c58e69cd22348f441b861092b825e591d0b822e106de6eb0ee4d05d27205b70 |
||||||
|
patch_filename = flac_1.4.3-2_patch.zip |
||||||
|
patch_url = https://wrapdb.mesonbuild.com/v2/flac_1.4.3-2/get_patch |
||||||
|
patch_hash = 3eace1bd0769d3e0d4ff099960160766a5185d391c8f583293b087a1f96c2a9c |
||||||
|
source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/flac_1.4.3-2/flac-1.4.3.tar.xz |
||||||
|
wrapdb_version = 1.4.3-2 |
||||||
|
|
||||||
|
[provide] |
||||||
|
flac = flac_dep |
@ -0,0 +1,13 @@ |
|||||||
|
[wrap-file] |
||||||
|
directory = fmt-11.0.2 |
||||||
|
source_url = https://github.com/fmtlib/fmt/archive/11.0.2.tar.gz |
||||||
|
source_filename = fmt-11.0.2.tar.gz |
||||||
|
source_hash = 6cb1e6d37bdcb756dbbe59be438790db409cdb4868c66e888d5df9f13f7c027f |
||||||
|
patch_filename = fmt_11.0.2-1_patch.zip |
||||||
|
patch_url = https://wrapdb.mesonbuild.com/v2/fmt_11.0.2-1/get_patch |
||||||
|
patch_hash = 90c9e3b8e8f29713d40ca949f6f93ad115d78d7fb921064112bc6179e6427c5e |
||||||
|
source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/fmt_11.0.2-1/fmt-11.0.2.tar.gz |
||||||
|
wrapdb_version = 11.0.2-1 |
||||||
|
|
||||||
|
[provide] |
||||||
|
fmt = fmt_dep |
@ -0,0 +1,11 @@ |
|||||||
|
[wrap-file] |
||||||
|
directory = freetype-2.13.3 |
||||||
|
source_url = https://download.savannah.gnu.org/releases/freetype/freetype-2.13.3.tar.xz |
||||||
|
source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/freetype2_2.13.3-1/freetype-2.13.3.tar.xz |
||||||
|
source_filename = freetype-2.13.3.tar.xz |
||||||
|
source_hash = 0550350666d427c74daeb85d5ac7bb353acba5f76956395995311a9c6f063289 |
||||||
|
wrapdb_version = 2.13.3-1 |
||||||
|
|
||||||
|
[provide] |
||||||
|
freetype2 = freetype_dep |
||||||
|
freetype = freetype_dep |
@ -0,0 +1,10 @@ |
|||||||
|
[wrap-git] |
||||||
|
directory=lel-guecs-0.2.0 |
||||||
|
url=https://git.learnjsthehardway.com/learn-code-the-hard-way/lel-guecs.git |
||||||
|
revision=HEAD |
||||||
|
depth=1 |
||||||
|
method=meson |
||||||
|
|
||||||
|
[provide] |
||||||
|
lel_guecs = lel_guecs_dep |
||||||
|
lel_guecs_sfml = lel_guecs_sfml_dep |
@ -0,0 +1,13 @@ |
|||||||
|
[wrap-file] |
||||||
|
directory = libpng-1.6.44 |
||||||
|
source_url = https://github.com/glennrp/libpng/archive/v1.6.44.tar.gz |
||||||
|
source_filename = libpng-1.6.44.tar.gz |
||||||
|
source_hash = 0ef5b633d0c65f780c4fced27ff832998e71478c13b45dfb6e94f23a82f64f7c |
||||||
|
patch_filename = libpng_1.6.44-1_patch.zip |
||||||
|
patch_url = https://wrapdb.mesonbuild.com/v2/libpng_1.6.44-1/get_patch |
||||||
|
patch_hash = 394b07614c45fbd1beac8b660386216a490fe12f841a1a445799b676c9c892fb |
||||||
|
source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/libpng_1.6.44-1/libpng-1.6.44.tar.gz |
||||||
|
wrapdb_version = 1.6.44-1 |
||||||
|
|
||||||
|
[provide] |
||||||
|
libpng = libpng_dep |
@ -0,0 +1,11 @@ |
|||||||
|
[wrap-file] |
||||||
|
directory = nlohmann_json-3.11.3 |
||||||
|
lead_directory_missing = true |
||||||
|
source_url = https://github.com/nlohmann/json/releases/download/v3.11.3/include.zip |
||||||
|
source_filename = nlohmann_json-3.11.3.zip |
||||||
|
source_hash = a22461d13119ac5c78f205d3df1db13403e58ce1bb1794edc9313677313f4a9d |
||||||
|
source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/nlohmann_json_3.11.3-1/nlohmann_json-3.11.3.zip |
||||||
|
wrapdb_version = 3.11.3-1 |
||||||
|
|
||||||
|
[provide] |
||||||
|
nlohmann_json = nlohmann_json_dep |
@ -0,0 +1,13 @@ |
|||||||
|
[wrap-file] |
||||||
|
directory = libogg-1.3.5 |
||||||
|
source_url = https://downloads.xiph.org/releases/ogg/libogg-1.3.5.tar.xz |
||||||
|
source_filename = libogg-1.3.5.tar.xz |
||||||
|
source_hash = c4d91be36fc8e54deae7575241e03f4211eb102afb3fc0775fbbc1b740016705 |
||||||
|
patch_filename = ogg_1.3.5-6_patch.zip |
||||||
|
patch_url = https://wrapdb.mesonbuild.com/v2/ogg_1.3.5-6/get_patch |
||||||
|
patch_hash = 8be6dcd5f93bbf9c0b9c8ec1fa29810226a60f846383074ca05b313a248e78b2 |
||||||
|
source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/ogg_1.3.5-6/libogg-1.3.5.tar.xz |
||||||
|
wrapdb_version = 1.3.5-6 |
||||||
|
|
||||||
|
[provide] |
||||||
|
ogg = libogg_dep |
@ -0,0 +1,14 @@ |
|||||||
|
[wrap-git] |
||||||
|
directory=SFML-3.0.0 |
||||||
|
url=https://github.com/SFML/SFML.git |
||||||
|
revision=3.0.0 |
||||||
|
depth=1 |
||||||
|
method=cmake |
||||||
|
|
||||||
|
[provide] |
||||||
|
sfml_audio = sfml_audio_dep |
||||||
|
sfml_graphics = sfml_graphics_dep |
||||||
|
sfml_main = sfml_main_dep |
||||||
|
sfml_network = sfml_network_dep |
||||||
|
sfml_system = sfml_system_dep |
||||||
|
sfml_window = sfml_window_dep |
@ -0,0 +1,7 @@ |
|||||||
|
[wrap-git] |
||||||
|
url=https://github.com/wolfpld/tracy.git |
||||||
|
revision=v0.11.1 |
||||||
|
depth=1 |
||||||
|
|
||||||
|
[provide] |
||||||
|
tracy = tracy_dep |
@ -0,0 +1,14 @@ |
|||||||
|
[wrap-file] |
||||||
|
directory = libvorbis-1.3.7 |
||||||
|
source_url = https://downloads.xiph.org/releases/vorbis/libvorbis-1.3.7.tar.xz |
||||||
|
source_filename = libvorbis-1.3.7.tar.xz |
||||||
|
source_hash = b33cc4934322bcbf6efcbacf49e3ca01aadbea4114ec9589d1b1e9d20f72954b |
||||||
|
patch_filename = vorbis_1.3.7-4_patch.zip |
||||||
|
patch_url = https://wrapdb.mesonbuild.com/v2/vorbis_1.3.7-4/get_patch |
||||||
|
patch_hash = 979e22b24b16c927040700dfd8319cd6ba29bf52a14dbc66b1cb4ea60504f14a |
||||||
|
wrapdb_version = 1.3.7-4 |
||||||
|
|
||||||
|
[provide] |
||||||
|
vorbis = vorbis_dep |
||||||
|
vorbisfile = vorbisfile_dep |
||||||
|
vorbisenc = vorbisenc_dep |
Loading…
Reference in new issue