Initial code commit

This commit is contained in:
2026-07-24 19:06:21 -04:00
parent 134e6fec4e
commit 9ad937b299
15 changed files with 288 additions and 2 deletions
+7
View File
@@ -0,0 +1,7 @@
---
BasedOnStyle: LLVM
TabWidth: 4
IndentWidth: 4
UseTab: ForIndentation
ColumnLimit: 0
...
+5
View File
@@ -0,0 +1,5 @@
/build
/.clangd
/.lock-waf*
/package-lock.json
/node_modules
+18 -2
View File
@@ -1,3 +1,19 @@
# Stoner-Alarm
# Stoner Alarm
An alarm designed to reliably wake a snoozing stoner. Seize the day (or at least don't get fired)!
An alarm designed to reliably wake a snoozing stoner.
## The Pitch
### Simple
The app only has one page. You can only set one alarm. There is no snooze, there is no weekly schedule, and there is no way to disable the alarm (you'll always have one set - every day- like it or not).
### Persistent
The alarm cannot be stopped until the drowsy stoner completes a thematically appropriate, touch-based game. Play well enough and quickly enough to prove you're awake and defuse the alarm.
#### "What if I just force-close the app in my sleep?"
Then it will schedule itself to re-open ASAP :)
### The Game
The alarm-defusing game requires you to serve some customers at a flower bar. There are three stages, with each stage having its own meter to fill before progressing to the next.
#### The Stages
1. Grind the flower
- Quickly move your finger in a circle to utilize the grinder
2. Fill the bowls
- Drag the ground flower into each bowl
3. Light the bowls
- Swipe in the prompted direction with good reaction time to use the lighter
Executable
+20
View File
@@ -0,0 +1,20 @@
#!/usr/bin/env zsh
echo "CompileFlags:
Add:
[
-DPBL_DISPLAY_WIDTH=200,
-DPBL_DISPLAY_HEIGHT=228,
-xc,
-nostdinc,
-DPBL_COLOR,
-DPBL_RECT,
-I${HOME}/.pebble-sdk/SDKs/current/sdk-core/pebble/emery/include,
-include$(pwd)/build/include/message_keys.auto.h,
-I$(pwd)/build/emery,
-include${HOME}/.pebble-sdk/SDKs/current/toolchain/arm-none-eabi/arm-none-eabi/include/stdint.h,
-include${HOME}/.pebble-sdk/SDKs/current/toolchain/arm-none-eabi/arm-none-eabi/include/stdlib.h,
-include${HOME}/.pebble-sdk/SDKs/current/toolchain/arm-none-eabi/arm-none-eabi/include/time.h,
-include${HOME}/.pebble-sdk/SDKs/current/toolchain/arm-none-eabi/arm-none-eabi/include/string.h,
-include${HOME}/.pebble-sdk/SDKs/current/toolchain/arm-none-eabi/lib/gcc/arm-none-eabi/14.2.1/include/stddef.h,
-include${HOME}/.pebble-sdk/SDKs/current/toolchain/arm-none-eabi/lib/gcc/arm-none-eabi/14.2.1/include/stdbool.h,
]" > ./.clangd
+41
View File
@@ -0,0 +1,41 @@
{
"name": "stoner-alarm",
"author": "RandyTheSilly",
"version": "1.0.0",
"keywords": ["alarm"],
"private": true,
"dependencies": {},
"pebble": {
"displayName": "Stoner Alarm",
"uuid": "293cd38c-4e8c-46ae-a3dc-c789d7ce93ab",
"sdkVersion": "3",
"enableMultiJS": true,
"targetPlatforms": [
"emery",
"gabbro"
],
"watchapp": {
"watchface": false
},
"messageKeys": [
],
"resources": {
"media": [
{
"file": "leaf.png",
"memoryFormat": "Smallest",
"name": "LEAF",
"spaceOptimization": "storage",
"type": "bitmap"
},
{
"file": "clock.png",
"memoryFormat": "Smallest",
"name": "CLOCK",
"spaceOptimization": "storage",
"type": "bitmap"
}
]
}
}
}
+8
View File
@@ -0,0 +1,8 @@
# Leaf Icon
[marijuana leaf by Rachel Fredericks](https://thenounproject.com/icon/marijuana-leaf-6959339/) (CC BY 3.0)
# Check Icon
[checkmark by Asmuh](https://thenounproject.com/icon/checkmark-2193586/) (CC BY 3.0)
# Clock Icon
[pebble-dev/iconography](https://raw.githubusercontent.com/pebble-dev/iconography/refs/heads/master/pebbleos/Pebble_50x50_Alarm_clock.svg)
+5
View File
@@ -0,0 +1,5 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" version="1.1" style="shape-rendering:geometricPrecision;text-rendering:geometricPrecision;image-rendering:optimizeQuality;" viewBox="0 0 847 1058.75" x="0px" y="0px" fill-rule="evenodd" clip-rule="evenodd"><defs><style type="text/css">
.fil0 {fill:black}
</style></defs><g><polygon class="fil0" points="308,507 708,107 824,223 308,739 23,455 139,339 "/></g><text x="0" y="862" fill="#000000" font-size="5px" font-weight="bold" font-family="'Helvetica Neue', Helvetica, Arial-Unicode, Arial, Sans-serif">Created by Asmuh</text><text x="0" y="867" fill="#000000" font-size="5px" font-weight="bold" font-family="'Helvetica Neue', Helvetica, Arial-Unicode, Arial, Sans-serif">from the Noun Project</text></svg>

After

Width:  |  Height:  |  Size: 824 B

+13
View File
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 18.1.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Comments" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 50 50" enable-background="new 0 0 50 50" xml:space="preserve">
<polygon display="inline" fill="#FFFFFF" stroke="#000000" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" points="
7.5,18.5 17.5,8.5 31.5,8.5 41.5,18.5 41.5,32.5 31.5,42.5 17.5,42.5 7.5,32.5 "/>
<line display="inline" fill="none" stroke="#000000" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" x1="5.5" y1="13.5" x2="12.5" y2="6.5"/>
<line display="inline" fill="none" stroke="#000000" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" x1="36.5" y1="6.5" x2="43.5" y2="13.5"/>
<line display="inline" fill="none" stroke="#000000" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" x1="11.5" y1="36.5" x2="9.5" y2="44.5"/>
<line display="inline" fill="none" stroke="#000000" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" x1="37.5" y1="36.5" x2="39.5" y2="44.5"/>
<line display="inline" fill="none" stroke="#000000" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" x1="18.5" y1="31.5" x2="24.5" y2="25.5"/>
<line display="inline" fill="none" stroke="#000000" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" x1="24.5" y1="13.5" x2="24.5" y2="25.5"/>
</svg>

After

Width:  |  Height:  |  Size: 1.6 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 333 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 624 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 952 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

+80
View File
@@ -0,0 +1,80 @@
#include <pebble.h>
// layer-age
static Window *s_window;
static BitmapLayer *s_leaf_layer;
static Layer *s_top_bar_layer;
static Layer *s_bottom_bar_layer;
// bitmaps
static GBitmap *s_leaf_bmp;
// global vars
static GColor s_bar_color = GColorDarkGreen;
// constants
static const uint8_t s_edge_bar_height = ((PBL_DISPLAY_HEIGHT / 7) * 2);
static void game1_window_load() {}
static void game1_window_unload() {}
/////////////////////////////////
static void rect_fill_layer_update_proc(Layer *layer, GContext *ctx) {
graphics_context_set_fill_color(ctx, s_bar_color);
graphics_fill_rect(ctx, layer_get_bounds(layer), 0, GCornerNone);
}
static void setter_window_load() {
window_set_background_color(s_window, GColorMintGreen);
// leaf
s_leaf_bmp = gbitmap_create_with_resource(RESOURCE_ID_LEAF);
s_leaf_layer = bitmap_layer_create(GRect(PBL_IF_ROUND_ELSE(0, -4), PBL_IF_ROUND_ELSE(0, 7), PBL_IF_ROUND_ELSE(PBL_DISPLAY_WIDTH, PBL_DISPLAY_WIDTH + 8), PBL_DISPLAY_HEIGHT));
bitmap_layer_set_alignment(s_leaf_layer, GAlignCenter);
bitmap_layer_set_compositing_mode(s_leaf_layer, GCompOpSet);
bitmap_layer_set_bitmap(s_leaf_layer, s_leaf_bmp);
// top&bottom bars
s_top_bar_layer = layer_create(GRect(0, 0, PBL_DISPLAY_WIDTH, s_edge_bar_height));
layer_set_update_proc(s_top_bar_layer, rect_fill_layer_update_proc);
s_bottom_bar_layer = layer_create(GRect(0, PBL_DISPLAY_HEIGHT - s_edge_bar_height, PBL_DISPLAY_WIDTH, s_edge_bar_height));
layer_set_update_proc(s_bottom_bar_layer, rect_fill_layer_update_proc);
Layer *window_layer = window_get_root_layer(s_window);
layer_add_child(window_layer, bitmap_layer_get_layer(s_leaf_layer));
layer_add_child(window_layer, s_top_bar_layer);
layer_add_child(window_layer, s_bottom_bar_layer);
}
static void setter_window_unload() {
layer_destroy(s_bottom_bar_layer);
layer_destroy(s_top_bar_layer);
bitmap_layer_destroy(s_leaf_layer);
gbitmap_destroy(s_leaf_bmp);
}
static void init() {
s_window = window_create();
switch (launch_reason()) {
case APP_LAUNCH_WAKEUP:
break; // TODO alarm game time!
default:
window_set_window_handlers(
s_window,
(WindowHandlers){.load = setter_window_load, .unload = setter_window_unload});
window_stack_push(s_window, false);
};
}
static void deinit() {
window_destroy(s_window);
}
int main(void) {
init();
app_event_loop();
deinit();
}
+54
View File
@@ -0,0 +1,54 @@
#
# This file is the default set of rules to compile a Pebble application.
#
# Feel free to customize this to your needs.
#
import os.path
top = '.'
out = 'build'
def options(ctx):
ctx.load('pebble_sdk')
def configure(ctx):
"""
This method is used to configure your build. ctx.load(`pebble_sdk`) automatically configures
a build for each valid platform in `targetPlatforms`. Platform-specific configuration: add your
change after calling ctx.load('pebble_sdk') and make sure to set the correct environment first.
Universal configuration: add your change prior to calling ctx.load('pebble_sdk').
"""
ctx.load('pebble_sdk')
def build(ctx):
ctx.load('pebble_sdk')
build_worker = os.path.exists('worker_src')
binaries = []
cached_env = ctx.env
for platform in ctx.env.TARGET_PLATFORMS:
ctx.env = ctx.all_envs[platform]
ctx.set_group(ctx.env.PLATFORM_NAME)
app_elf = '{}/pebble-app.elf'.format(ctx.env.BUILD_DIR)
ctx.pbl_build(source=ctx.path.ant_glob('src/c/**/*.c'), target=app_elf, bin_type='app')
if build_worker:
worker_elf = '{}/pebble-worker.elf'.format(ctx.env.BUILD_DIR)
binaries.append({'platform': platform, 'app_elf': app_elf, 'worker_elf': worker_elf})
ctx.pbl_build(source=ctx.path.ant_glob('worker_src/c/**/*.c'),
target=worker_elf,
bin_type='worker')
else:
binaries.append({'platform': platform, 'app_elf': app_elf})
ctx.env = cached_env
ctx.set_group('bundle')
ctx.pbl_bundle(binaries=binaries,
js=ctx.path.ant_glob(['src/pkjs/**/*.js',
'src/pkjs/**/*.json',
'src/common/**/*.js']),
js_entry_file='src/pkjs/index.js')