summaryrefslogtreecommitdiff
path: root/lcolonq
diff options
context:
space:
mode:
Diffstat (limited to 'lcolonq')
-rw-r--r--lcolonq/.gitignore2
-rw-r--r--lcolonq/package.json32
-rw-r--r--lcolonq/src/c/lcolonq.c51
-rw-r--r--lcolonq/wscript54
4 files changed, 139 insertions, 0 deletions
diff --git a/lcolonq/.gitignore b/lcolonq/.gitignore
new file mode 100644
index 0000000..9372ea5
--- /dev/null
+++ b/lcolonq/.gitignore
@@ -0,0 +1,2 @@
+build/*
+.lock* \ No newline at end of file
diff --git a/lcolonq/package.json b/lcolonq/package.json
new file mode 100644
index 0000000..3a4ea11
--- /dev/null
+++ b/lcolonq/package.json
@@ -0,0 +1,32 @@
+{
+ "name": "lcolonq",
+ "author": "lcolonq",
+ "version": "1.0.0",
+ "keywords": ["pebble-app"],
+ "private": true,
+ "dependencies": {},
+ "pebble": {
+ "displayName": "lcolonq",
+ "uuid": "92d45f5e-656e-49c7-83b2-997ab8f35581",
+ "sdkVersion": "3",
+ "enableMultiJS": true,
+ "targetPlatforms": [
+ "aplite",
+ "basalt",
+ "chalk",
+ "diorite",
+ "emery",
+ "flint",
+ "gabbro"
+ ],
+ "watchapp": {
+ "watchface": true
+ },
+ "messageKeys": [
+ "dummy"
+ ],
+ "resources": {
+ "media": []
+ }
+ }
+}
diff --git a/lcolonq/src/c/lcolonq.c b/lcolonq/src/c/lcolonq.c
new file mode 100644
index 0000000..ad44905
--- /dev/null
+++ b/lcolonq/src/c/lcolonq.c
@@ -0,0 +1,51 @@
+#include <pebble.h>
+
+static Window *WINDOW;
+static TextLayer *TIME_TEXT_LAYER;
+
+static void tick_handler(struct tm *tick_time, TimeUnits units_changed) {
+ (void) units_changed;
+ static char buf[16];
+ // time_t temp = time(NULL);
+ // struct tm *tick_time = localtime(&temp);
+ strftime(buf, sizeof(buf), "%H:%M", tick_time);
+ text_layer_set_text(TIME_TEXT_LAYER, buf);
+}
+
+static void main_window_load(Window *window) {
+ Layer *window_layer = window_get_root_layer(window);
+ GRect bounds = layer_get_bounds(window_layer);
+ TIME_TEXT_LAYER = text_layer_create(GRect(0, 52, bounds.size.w, 50));
+ text_layer_set_background_color(TIME_TEXT_LAYER, GColorClear);
+ text_layer_set_text_color(TIME_TEXT_LAYER, GColorWhite);
+ text_layer_set_font(TIME_TEXT_LAYER, fonts_get_system_font(FONT_KEY_BITHAM_42_BOLD));
+ text_layer_set_text_alignment(TIME_TEXT_LAYER, GTextAlignmentCenter);
+ layer_add_child(window_layer, text_layer_get_layer(TIME_TEXT_LAYER));
+}
+static void main_window_unload(Window *window) {
+ text_layer_destroy(TIME_TEXT_LAYER);
+}
+
+static void init() {
+ WINDOW = window_create();
+ window_set_background_color(WINDOW, GColorBlack);
+ window_set_window_handlers(WINDOW, (WindowHandlers) {
+ .load = main_window_load,
+ .unload = main_window_unload
+ });
+ window_stack_push(WINDOW, true);
+ time_t temp = time(NULL);
+ struct tm *tick_time = localtime(&temp);
+ tick_handler(tick_time, MINUTE_UNIT);
+ tick_timer_service_subscribe(MINUTE_UNIT, tick_handler);
+}
+
+static void deinit() {
+ window_destroy(WINDOW);
+}
+
+int main(void) {
+ init();
+ app_event_loop();
+ deinit();
+}
diff --git a/lcolonq/wscript b/lcolonq/wscript
new file mode 100644
index 0000000..5238bc8
--- /dev/null
+++ b/lcolonq/wscript
@@ -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')