aseprite/src/README.md

99 lines
3.5 KiB
Markdown
Raw Permalink Normal View History

2013-08-05 18:40:48 -07:00
# Aseprite Source Code
2013-08-05 18:40:48 -07:00
If you are here is because you want to learn about Aseprite source
code. We'll try to write in these `README.md` files a summary of each
module/library.
2013-08-05 18:40:48 -07:00
# Modules & Libraries
Aseprite is separated in the following layers/modules:
## Level 0: Completely independent modules
These libraries are easy to be used and embedded in other software
because they don't depend on any other component.
2016-08-01 06:29:21 -07:00
* [clip](https://github.com/aseprite/clip): Clipboard library.
* [fixmath](fixmath/): Fixed point operations (original code from Allegro code by Shawn Hargreaves).
2016-08-01 06:29:21 -07:00
* [flic](https://github.com/aseprite/flic): Library to load/save FLI/FLC files.
2021-03-05 13:39:36 -08:00
* laf/[base](https://github.com/aseprite/laf/tree/main/base): Core/basic stuff, multithreading, utf8, sha1, file system, memory, etc.
* laf/[gfx](https://github.com/aseprite/laf/tree/main/gfx): Abstract graphics structures like point, size, rectangle, region, color, etc.
2018-08-23 13:45:42 -07:00
* [observable](https://github.com/aseprite/observable): Signal/slot functions.
2015-10-28 15:45:01 -07:00
* [scripting](scripting/): JavaScript engine.
* [steam](steam/): Steam API wrapper to avoid static linking to the .lib file.
2016-08-01 06:29:21 -07:00
* [undo](https://github.com/aseprite/undo): Generic library to manage a history of undoable commands.
2013-08-05 18:40:48 -07:00
## Level 1
* [cfg](cfg/) (base): Library to load/save .ini files.
* [gen](gen/) (base): Helper utility to generate C++ files from different XMLs.
* [net](net/) (base): Networking library to send HTTP requests.
2021-03-05 13:39:36 -08:00
* laf/[os](https://github.com/aseprite/laf/tree/main/os) (base, gfx, wacom): OS input/output.
2013-08-05 18:40:48 -07:00
## Level 2
* [doc](doc/) (base, fixmath, gfx): Document model library.
2018-10-18 11:29:16 -07:00
* [ui](ui/) (base, gfx, os): Portable UI library (buttons, windows, text fields, etc.)
* [updater](updater/) (base, cfg, net): Component to check for updates.
## Level 3
2018-10-18 11:29:16 -07:00
* [dio](dio/) (base, doc, fixmath, flic): Load/save sprites/documents.
* [filters](filters/) (base, doc, gfx): Effects for images.
* [render](render/) (base, doc, gfx): Library to render documents.
2013-08-05 18:40:48 -07:00
## Level 4
2013-08-05 18:40:48 -07:00
2018-08-24 07:33:21 -07:00
* [app](app/) (base, doc, dio, filters, fixmath, flic, gfx, pen, render, scripting, os, ui, undo, updater)
2018-10-18 11:29:16 -07:00
* [desktop](desktop/) (base, doc, dio, render): Integration with the desktop (Windows Explorer, Finder, GNOME, KDE, etc.)
2018-10-18 11:29:16 -07:00
## Level 5
2018-08-09 08:58:43 -07:00
* [main](main/) (app, base, os, ui)
# Debugging Tricks
2017-08-15 11:47:06 -07:00
When Aseprite is compiled with `ENABLE_DEVMODE`, you have the
following extra commands/features available:
2017-08-15 11:47:06 -07:00
* `F5`: On Windows shows the amount of used memory.
* `F1`: Switch new/old render engine.
* `Ctrl+F1`: Switch/test Screen/UI Scaling values.
2017-08-15 11:47:06 -07:00
* `Ctrl+Alt+Shift+Q`: crashes the application in case that you want to
test the anticrash feature or your need a memory dump file.
* `Ctrl+Alt+Shift+R`: recover the active document from the data
recovery store.
* `aseprite.ini`: `[perf] show_render_time=true` shows a performance
clock in the Editor.
In Debug mode (`_DEBUG`):
* [`TRACEARGS`](https://github.com/aseprite/laf/blob/f3222bdee2d21556e9da55343e73803c730ecd97/base/debug.h#L40):
in debug mode, it prints in the terminal/console each given argument
# Detect Platform
You can check the platform using some `laf` macros:
#if LAF_WINDOWS
// ...
#elif LAF_MACOS
// ...
#elif LAF_LINUX
// ...
#endif
Or using platform-specific macros:
#ifdef _WIN32
#ifdef _WIN64
// Windows x64
#else
// Windows x86
#endif
#elif defined(__APPLE__)
// macOS
#else
// Linux
#endif