pebble / mario / src / main.c

/* ***************************************************************************
// This code is distributed under the GNU Public License
//		which can be found at
**************************************************************************** */

// MarioChron: Mario Themed Clock Face
// Initial work based on InvaderChron by Dataman
// By: techninja (James T) & Super-Awesome Sylvia
// Ported to Pebble by Trammell Hudson <>
// Originally created for Sylvia's Super-Awesome Mini Maker Show Episode S02E03

#include <pebble_os.h>
#include <pebble_app.h>
#include <pebble_fonts.h>

#include <string.h>
#include <stdlib.h>
#include <stdint.h>
#include <math.h>

	1, // Version

volatile uint8_t time_s, time_m, time_h;
volatile uint8_t old_m, old_h;
volatile uint8_t date_m, date_d, date_y;
volatile uint8_t alarming, alarm_h, alarm_m;
volatile uint8_t time_format;
volatile uint8_t region;
volatile uint8_t score_mode;
volatile uint8_t write_font;

volatile uint8_t minute_changed, hour_changed;

static Window window;
static Layer layer;

static void
	Layer * const me,
	GContext * ctx

static void
	AppContextRef ctx,
	PebbleTickEvent * const event
	(void) ctx;
	const PblTm * const ptm = event->tick_time;

	time_s = ptm->tm_sec;
	time_m = ptm->tm_min;
	time_h = ptm->tm_hour;
	date_m = ptm->tm_mon + 1;
	date_d = ptm->tm_mday;
	date_y = ptm->tm_year;


static void
	AppContextRef ctx
	(void) ctx;

	window_init(&window, "MarioChron");
	window_stack_push(&window, true);

	// Mario Layer
	layer_init(&layer, GRect(0,0, 128, 64));
	layer.update_proc = layer_update;
	layer_add_child(&window.layer, &layer);

	void * const params
	PebbleAppHandlers handlers = {
		.init_handler	= &handle_init,
		.tick_info	= {
			.tick_handler = &handle_tick,
			.tick_units = SECOND_UNIT,

	app_event_loop(params, &handlers);
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.