Skip to content

Instantly share code, notes, and snippets.

View germandiagogomez's full-sized avatar

Germán Diago germandiagogomez

  • Spain
View GitHub Profile
@germandiagogomez
germandiagogomez / meson.build
Created July 18, 2022 10:29
Adding lzma sdk wrap
[wrap-file]
directory = lzmasdk
[provide]
dependency_names = liblzmasdk
[wrap-file]
directory = xz-5.2.5
source_url = http://tukaani.org/xz/xz-5.2.5.tar.xz
source_filename = xz-5.2.5.tar.xz
source_hash = 3e1e518ffc912f86608a8cb35e4bd41ad1aec210df2a47aaa1f95e7f5576ef56
patch_filename = liblzma_5.2.5-1_patch.zip
patch_url = https://wrapdb.mesonbuild.com/v2/liblzma_5.2.5-1/get_patch
patch_hash = 2bc85394d8cdb7ec93ddf889cf553a9e08f430a1de3a980f186a5323cdeb7315
[provide]
@germandiagogomez
germandiagogomez / meson.build
Created July 18, 2022 10:07
Adding a library with a previously-embedded and harcoded dependencies
sources = ['lzma.cpp']
lzmaupp_plugin_dependencies = [
core_dep,
dependency('zlib'),
dependency('liblzma'),
dependency('liblzmasdk')
]
lzmaupp_plugin_lib = library('lzmaupp', sources: sources,
@germandiagogomez
germandiagogomez / meson.build
Created July 18, 2022 10:04
Adding a library for Ultimate++
sources = [
'Object.cpp',
'RichImage.cpp',
'ParaData.cpp',
'ParaType.cpp',
'ParaPaint.cpp',
'HeaderFooter.cpp',
'TxtData.cpp',
'TxtPaint.cpp',
'TxtOp.cpp',
@germandiagogomez
germandiagogomez / meson.build
Created May 26, 2021 14:12
Initial meson.build file
project('onionbase85',
'cpp',
default_options : ['cpp_std=c++2a'])
subdir('src')
catch2_dep = dependency('catch2', fallback : ['catch2', 'catch2_dep'])
test_decoding = executable('testDecoding', ['TestDecoding.cpp'],
dependencies :
[catch2_dep])
@germandiagogomez
germandiagogomez / ExposeCppStateInWren.cpp
Last active May 24, 2021 22:51
Workaround to expose C++ instances in Wren with Wrenbind17
// 1. Create a struct to be able to expose some fields
struct ScriptEnv {
std::shared_ptr<spdlog::logger> gameLog;
Guinyote::View::VideoManager * videoManager;
RuntimeConfig const * config;
std::string orsAddress;
};
// Create a C++ instance to pass the data to wren
ScriptEnv scriptEnv{
.gameLog = logger_,
@germandiagogomez
germandiagogomez / MenuScreen.wren
Last active May 25, 2021 10:13
Menu Screen from game scripted
import "environment" for Env
import "guinyoteview" for IBasicGameView, TrySelectEvent
import "inputsystem" for Input
import "guinyoteutils" for MouseClickedEvent, MouseReleasedEvent
class InputSystem {
construct new(inputSystem) {
_input = inputSystem
}
@germandiagogomez
germandiagogomez / ClassInWren.wren
Last active May 25, 2021 10:19
Classes in Wren
class Counter {
construct new(withValue) {
_currentValue = withValue
}
increment() {
_currentValue = _currentValue + 1
}
value { _currentValue }
}
@germandiagogomez
germandiagogomez / StdFunctionParameter.chai
Created May 24, 2021 22:41
Function Parameters can take callback from ChaiScript
// C++ side
// void f(std::function<void (MyRegisteredClass)> callback);
...
chai.add(fun(f), "f");
//chaiscript side
f([](myObject) {
})
@germandiagogomez
germandiagogomez / DynamicJson.chai
Last active May 25, 2021 10:17
Dynamic Json object
class JsonObject {
var contents
def JsonObject(string jsonStr) {
this.contents = from_json(jsonStr)
}
def JsonObject(Map contents) {
this.contents = contents
}