Skip to content

Instantly share code, notes, and snippets.

View dacap's full-sized avatar
🎨
Programming

David Capello dacap

🎨
Programming
View GitHub Profile
@dacap
dacap / cache.cpp
Created February 24, 2017 13:48
Simple generic function to cache other functions
#include <cassert>
#include <functional>
#include <iostream>
#include <vector>
template<typename Container>
std::function<void(Container&)>
cache_function(void (*func)(Container&)) {
return [func](Container& result) {
static Container cache;
@dacap
dacap / theme.xml
Created April 24, 2017 18:34
Sunken mini check boxes
...
<style id="mini_check_box" extends="check_box" font="mini">
<newlayer />
<text color="face" align="left middle" x="14" y="1" />
<text color="face" align="left middle" x="14" y="1" state="disabled" />
<newlayer />
<text color="text" align="left middle" x="14" />
<text color="disabled" align="left middle" x="14" state="disabled" />
</style>
...
@dacap
dacap / new_sprite.xml
Created May 15, 2017 19:54
Aseprite UI example
<gui>
<window id="new_sprite" text="@.title">
<box vertical="true">
<separator text="@.size" left="true" horizontal="true" />
<grid columns="2">
<label text="@.width" />
<entry id="width" maxsize="8" magnet="true" cell_align="horizontal" suffix="px" />
<label text="@.height" />
<entry id="height" maxsize="8" cell_align="horizontal" suffix="px" />
JS Console output for mousedown left, right, middle, x1, x2 mouse buttons:
VM35:1 mousedown MouseEvent {isTrusted: true, screenX: 139, screenY: 248, clientX: 139, clientY: 128…}altKey: falsebubbles: truebutton: 0buttons: 1cancelBubble: falsecancelable: trueclientX: 139clientY: 128composed: truectrlKey: falsecurrentTarget: nulldefaultPrevented: falsedetail: 1eventPhase: 0fromElement: nullisTrusted: truelayerX: 139layerY: 128metaKey: falsemovementX: 0movementY: 0offsetX: 7offsetY: 54pageX: 139pageY: 128path: Array(9)relatedTarget: nullreturnValue: truescreenX: 139screenY: 248shiftKey: falsesourceCapabilities: InputDeviceCapabilitiessrcElement: div.news.column.two-thirdstarget: div.news.column.two-thirdstimeStamp: 227380.14500000002toElement: div.news.column.two-thirdstype: "mousedown"view: Windowwhich: 1x: 139y: 128__proto__: MouseEvent
VM35:1 mousedown MouseEvent {isTrusted: true, screenX: 139, screenY: 248, clientX: 139, clientY: 128…}altKey: falsebubbles: truebutton: 2buttons: 2cancelBubble: falsecancelable
@dacap
dacap / new_sprite.xml.h
Created August 26, 2017 13:23
Generated new_sprite.xml.h file
// Don't modify, generated file from /Users/david/Dropbox/ASEPRITE/aseprite/data/widgets/new_sprite.xml
#ifndef GENERATED_NEW_SPRITE_H_INCLUDED
#define GENERATED_NEW_SPRITE_H_INCLUDED
#pragma once
#include "app/find_widget.h"
#include "app/load_widget.h"
#include "ui/ui.h"
@dacap
dacap / test19.cpp
Created September 19, 2017 13:31
Testing -Wall on VS2017
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <limits>
#include <string>
#include <vector>
int main() {
}
<?xml version="1.0" encoding="utf-8" ?>
<keyboard version="1">
<commands>
<key command="SaveFile" shortcut="Ctrl+S" />
<key command="SaveFile" shortcut="5" />
<key command="AdvancedMode" shortcut="F" removed="true" />
<key command="Undo" shortcut="Ctrl+Z" removed="true" />
<key command="Undo" shortcut="D" />
<key command="Redo" shortcut="Ctrl+Y" removed="true" />
<key command="Redo" shortcut="Ctrl+Shift+Z" removed="true" />
<?xml version="1.0" encoding="utf-8" ?>
<keyboard version="1">
<commands>
<key command="SpriteSize" shortcut="I" />
</commands>
<tools>
<key tool="eyedropper" shortcut="I" removed="true" />
</tools>
<quicktools />
<actions />
@echo off
@set ASEPRITE="C:\Program Files\Aseprite\aseprite.exe"
%ASEPRITE% -b --list-layers sprite.ase > _tmp_layers.txt
for /F "tokens=*" %%A in (_tmp_layers.txt) do mkdir "%%A"
del _tmp_layers.txt
@dacap
dacap / en.ini.diff
Created April 3, 2018 23:13
Aseprite en.ini differences between v1.2.7.3 and v1.2.8
diff --git a/data/strings/en.ini b/data/strings/en.ini
index ffdf9e1..cd83ff8 100644
--- a/data/strings/en.ini
+++ b/data/strings/en.ini
@@ -505,10 +505,16 @@ go_forward_button_tooltip = Go forward one folder
go_up_button_tooltip = Up to parent folder
new_folder_button_tooltip = New folder
file_name = File name:
file_type = File type: