Skip to content

Instantly share code, notes, and snippets.

View ericoporto's full-sized avatar
🎮
making

Érico Porto ericoporto

🎮
making
View GitHub Profile
@ericoporto
ericoporto / 1.Instructions.md
Created October 19, 2020 02:10 — forked from WesThorburn/1.Instructions.md
Linux: Compile C++ to WebAssembly and JavaScript using Emscripten and CMake

Linux: Compile C++ to WebAssembly and JavaScript using Emscripten and CMake

Download and Install Emscripten

  • My preferred installation location is /home/user
  • Get the latest sdk: git clone https://github.com/emscripten-core/emsdk.git
  • Enter the cloned directory: cd emsdk
  • Install the lastest sdk tools: ./emsdk install latest
  • Activate the latest sdk tools: ./emsdk activate latest
  • Activate path variables: source ./emsdk_env.sh
  • Configure emsdk in your bash profile by running: echo 'source "/home/user/emsdk/emsdk_env.sh"' >> $HOME/.bash_profile
@ericoporto
ericoporto / sdlkey_to_agskey.cpp
Last active October 16, 2020 14:38
AGS Keycode equivalents in SDL Keycodes
SDL_Keysym SDLKeysymFromAgsKey (int key)
{
SDL_Keysym sk;
sk.scancode = SDL_SCANCODE_UNKNOWN;
sk.sym = SDLK_UNKNOWN;
switch (key) {
// ctrl-[A-Z] keys are numbered 1-26 for A-Z
case eAGSKeyCodeCtrlA: { sk.scancode = SDL_SCANCODE_A; sk.sym = SDLK_a; sk.mod = KMOD_CTRL; } break;
case eAGSKeyCodeCtrlB: { sk.scancode = SDL_SCANCODE_B; sk.sym = SDLK_b; sk.mod = KMOD_CTRL; } break;
// Rellax
// 0.1.5~
// A module to provide smooth scrolling and parallax!
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
// Before starting, you must create the following Custom Properties
// in AGS Editor, for usage with Objects.
// Just click on Properties [...] and on the Edit Custom Properties screen,
// click on Edit Schema ... button, and add the two properties below:
//
// PxPos:
@ericoporto
ericoporto / theoricalproblem.md
Last active July 18, 2020 03:33
Theoretical problem

When resolving script imports, the code doesn't deals with empty string imports, and relies on nullptr :

https://github.com/adventuregamestudio/ags/blob/c52217180969576717173777d8ac195dd4347047/Engine/script/cc_instance.cpp#L1591

This works because when reading script objects, empty strings (a single \0 character) are replaced by a nullptr :

https://github.com/adventuregamestudio/ags/blob/c52217180969576717173777d8ac195dd4347047/Common/script/cc_script.cpp#L39

But when writing a script object, we don't treat the nullptr case, so if you read a script object, and want to write it back to a file, this will break here :

@ericoporto
ericoporto / remember.txt
Created July 15, 2020 02:15
need to add a install target to ags executable cmakelists.txt
add_executable(ags)
if(NOT CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
install(TARGETS ags
DESTINATION "${CMAKE_INSTALL_PREFIX}/bin"
)
endif()
@ericoporto
ericoporto / extract-subtitles.sh
Last active July 27, 2020 00:26
bash script to extract all subtitles from mp4 files and remove html tags
#!/bin/bash
for file in *.mp4;
do
filename=$(basename -s .mp4 "$file")
ffmpeg -i "${filename}.mp4" "${filename}.srt"
done
sed -i 's/<[^>]*>//g' *.srt
@ericoporto
ericoporto / README.md
Last active July 3, 2020 20:04
Building an AGS game

Building an AGS game

Ideally, while the project files holds the game information in the form that is the most convenient by the Editor used by the game developer, the game data represents this information in the most convenient form for the Engine.

Building a game is to transform information that describes the game to the form convenient for the Engine. This document describes how a platform agnostic AGS game is built.

@ericoporto
ericoporto / 3.5.0.24.yaml
Last active July 1, 2020 14:47
Adventure Game Studio WinGet Template, more information here: https://docs.microsoft.com/en-us/windows/package-manager/
Id: ags.ags
Publisher: Adventure Game Studio
Name: Adventure Game Studio
Version: 3.5.0.24
AppMoniker: ags
MinOSVersion: 10.0.0.0
Description: The Adventure Game Studio IDE
Homepage: https://www.adventuregamestudio.co.uk
License: Copyright (c) Chris Jones et al. Artistic License 2.0.
LicenseUrl: https://raw.githubusercontent.com/adventuregamestudio/ags/master/License.txt
@ericoporto
ericoporto / making_language_grammar.md
Created June 26, 2020 10:39 — forked from Aerijo/making_language_grammar.md
Guide to writing an Atom language grammar

A guide to writing a language grammar (TextMate) in Atom

Tree sitter

  • Atom is transitioning to an entirely new way of defining grammars using tree-sitter. This will be enabled by default quite soon now. It is theoretically faster and more powerful than regex based grammars (the one described in this guide), but requires a steeper learning curve. My understanding is that regex based grammars will still be supported however (at least until version 2), so this guide can still be useful. To enable it yourself, go to Settings -> Core and check Use Tree Sitter Parsers

Links for tree-sitter help:

@ericoporto
ericoporto / README.BBCode
Last active February 6, 2022 20:10
☕eri0o's Adventure Game Studio Repositories (BBCode Edition)!
[size=16pt][b] eri0o's Adventure Game Studio Repositories! [/b][/size]
Using AGS for some time now, here's a list of things I made!
[size=12pt][b] Script Modules [/b][/size]
[list][li][b][url=https://github.com/ericoporto/ImGi]ImGi[/url][/b] | [u][url=https://github.com/ericoporto/ImGi/releases][tt]Downloads ⇩[/tt][/url][/u][/li][list]
[li]Immediate GuI script module using Overlays for AGS.[/li]
[/list][/list]
[list][li][b][url=https://github.com/ericoporto/math3d]math3d[/url][/b] | [u][url=https://github.com/ericoporto/math3d/releases][tt]Downloads ⇩[/tt][/url][/u][/li][list]