Skip to content

Instantly share code, notes, and snippets.

@Helco
Helco / ExtendingFairyIcons.md
Last active April 6, 2024 09:59
Zanzarah extending fairy icons

I have not tested this patch.

Small enemy icons

Icons are stored in textures/misc/mpi000, a square texture that is used as follows:

  • The first 0.390625% from the top and left are ignored.
    For the original size 256 this amounts to exactly one pixel.
  • There is a twelve by twelve grid using 8.204125% per tile.
    For ths original size 256 this amounts to exactly 21 pixels.
  • The last original tile 143 is reserved for the selection rectangle

To extend this, the easiest way would be to increase the texture size to 512x512.

@Helco
Helco / qemu_control_test.js
Created November 4, 2018 19:17
Small nodejs script to test out qemu control communication with RebbleOS
const net = require("net");
const repl = require("repl");
const sock = net.connect(63771);
sock.on('close', () => process.exit(0));
function flat(arr)
{
if (!Array.isArray(arr))
return [ arr ];
return arr
@Helco
Helco / Full_Macro_Jacket.h
Last active March 14, 2018 13:18
NGFX Test Framework styles
// testframework.h
// tl;dr module has to be identifier, name does not, only one point to add tests
#define NGFX_BIG_TEST(module, name, code) // stub
#define NGFX_SMALL_TEST(module, name, code) // stub
#define NGFX_ASSERT(cond, msg) // see assert.h
// some_test.h
NGFX_TEST(GBitmap, Some important test, {
NGFX_ASSERT_EQ(true, false);
})
@Helco
Helco / menu_layer.h
Last active February 7, 2018 18:04
Non-original menu_layer extensions
// menu_layer_set_column_number would be used to implement the ActionMenuLevelDisplayModeThin functionality
// menu_layer_set_reload_behaviour tp implement the action menu on chalk (as the highlighted cell takes up more space than non-highlighted)
// my biggest doubt is MenuLayerReloadBehaviourOnRender as I don't see a use-case for it, I included it for completion reasons
//! Sets the number of columns for the \ref MenuLayer. A cell then has a width of
//! `frame.size.w / num_columns`. The height of a particular row is determined by the
//! maximum height of the cells (and the separators). If there are less than
//! `num_columns` in a row the additional space is not touched.
//! @param menu_layer Pointer to the \ref MenuLayer for which to set the column number.
//! @param num_columns The number of columns to set for the \ref MenuLayer.
@Helco
Helco / gist:d2ba785e1d9d298abfaecf7e870cc5da
Created January 28, 2018 20:08
backup chalk draw watchface cell
void menu_cell_chalk_draw(GContext *ctx, const Layer *layer, const char *previous, MenuItem *selected, const char *next)
{
GRect frame = layer_get_frame(layer);
// Draw the selected item:
const char *selected_title = selected->text;
bool has_icon = selected->image_res_id == 0 ? false : true;
if (selected_title)
@Helco
Helco / test.c
Last active February 10, 2018 18:02
RebbleOS - Menu layer test app
/* test.c
* routines for [...]
* RebbleOS
*
* Author: Hermann Noll
*/
#include "rebbleos.h"
#include "test.h"
#include "librebble.h"