Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/ClusterM/pebble-dos.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexey 'Cluster' Avdyukhin <ClusterM@users.noreply.github.com>2015-04-13 11:20:50 +0300
committerAlexey 'Cluster' Avdyukhin <ClusterM@users.noreply.github.com>2015-04-13 11:20:50 +0300
commit238a770533dd876b1e01aaf46e0a73c5f15b071f (patch)
tree0de15b19ae1d6c7375617310112643418fef77cd
parent9a7de094a5d7eb76e85d37770aa6e01983f011f8 (diff)
First release
-rw-r--r--appinfo.json26
-rw-r--r--resources/fonts/terminal.ttfbin0 -> 74212 bytes
-rw-r--r--src/dos.c112
-rw-r--r--wscript57
4 files changed, 195 insertions, 0 deletions
diff --git a/appinfo.json b/appinfo.json
new file mode 100644
index 0000000..a472272
--- /dev/null
+++ b/appinfo.json
@@ -0,0 +1,26 @@
+{
+ "appKeys": {},
+ "capabilities": [
+ ""
+ ],
+ "companyName": "clusterrr@clusterrr.com",
+ "longName": "DOS Terminal",
+ "projectType": "native",
+ "resources": {
+ "media": [
+ {
+ "file": "fonts/terminal.ttf",
+ "name": "FONT_TERMINAL_32",
+ "type": "font"
+ }
+ ]
+ },
+ "sdkVersion": "2",
+ "shortName": "DOS Terminal",
+ "uuid": "701939f5-5804-40d0-91ec-16a098fa8bb5",
+ "versionCode": 1,
+ "versionLabel": "1.0",
+ "watchapp": {
+ "watchface": true
+ }
+}
diff --git a/resources/fonts/terminal.ttf b/resources/fonts/terminal.ttf
new file mode 100644
index 0000000..b880c3f
--- /dev/null
+++ b/resources/fonts/terminal.ttf
Binary files differ
diff --git a/src/dos.c b/src/dos.c
new file mode 100644
index 0000000..cb0b0ed
--- /dev/null
+++ b/src/dos.c
@@ -0,0 +1,112 @@
+#include <pebble.h>
+
+Window *window;
+TextLayer *text_layer;
+GFont *font;
+AppTimer *timer;
+
+char text[300];
+int time_ticks = 0;
+int state = 0;
+int interval = 150;
+char cursor = 0;
+
+void draw_text();
+
+void app_timer(void * data)
+{
+ time_ticks++;
+ draw_text();
+}
+
+void draw_text()
+{
+ time_t t = time(NULL);
+ struct tm * tick_time = localtime(&t);
+ snprintf(text, sizeof(text), "C:\\>time /t\n%02d:%02d\n\nC:\\>date /t\n%02d.%02d.%04d", tick_time->tm_hour, tick_time->tm_min, tick_time->tm_mday, tick_time->tm_mon+1, tick_time->tm_year+1900);
+
+ if (time_ticks >= 2)
+ {
+ state++;
+ time_ticks = 0;
+ }
+
+ cursor ^= 1;
+
+ if (state <= 6)
+ {
+ text[4+state] = cursor ? '_' : ' ';
+ text[5+state] = 0;
+ }
+ else if (state < 14)
+ {
+ text[16+state] = cursor ? '_' : ' ';
+ text[17+state] = 0;
+ } else timer = NULL;
+ if (state < 14)
+ {
+ timer = app_timer_register(interval, app_timer, NULL);
+ }
+ text_layer_set_text(text_layer, text);
+}
+
+void start_draw()
+{
+ time_ticks = state = 0;
+ draw_text();
+}
+
+void tick(struct tm *tick_time, TimeUnits units_changed)
+{
+ //if (!timer)
+ start_draw();
+}
+
+void handle_init(void) {
+ // Create a window and text layer
+ window = window_create();
+ window_set_background_color(window, GColorBlack);
+ text_layer = text_layer_create(GRect(2, -5, 144, 168));
+
+ font = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_TERMINAL_32));
+
+ // Set the text, font, and text alignment
+ text_layer_set_font(text_layer, font);
+ text_layer_set_text_alignment(text_layer, GTextAlignmentLeft);
+ text_layer_set_text_color(text_layer, GColorWhite);
+ text_layer_set_background_color(text_layer, GColorClear);
+ text_layer_set_text(text_layer, "C:\\>");
+
+ // Add the text layer to the window
+ layer_add_child(window_get_root_layer(window), text_layer_get_layer(text_layer));
+
+ // Push the window
+ window_stack_push(window, true);
+
+ tick_timer_service_subscribe(MINUTE_UNIT, tick);
+
+ //start_draw();
+ // App Logging!
+ APP_LOG(APP_LOG_LEVEL_DEBUG, "Just pushed a window!");
+}
+
+void handle_deinit(void) {
+ // Stop timers
+ tick_timer_service_unsubscribe();
+ if (timer) app_timer_cancel(timer);
+
+ // Destroy the text layer
+ text_layer_destroy(text_layer);
+
+ // Destroy the window
+ window_destroy(window);
+
+ // Unload font
+ fonts_unload_custom_font(font);
+}
+
+int main(void) {
+ handle_init();
+ app_event_loop();
+ handle_deinit();
+}
diff --git a/wscript b/wscript
new file mode 100644
index 0000000..fbc4753
--- /dev/null
+++ b/wscript
@@ -0,0 +1,57 @@
+
+#
+# This file is the default set of rules to compile a Pebble project.
+#
+# Feel free to customize this to your needs.
+#
+
+import os.path
+try:
+ from sh import CommandNotFound, jshint, cat, ErrorReturnCode_2
+ hint = jshint
+except (ImportError, CommandNotFound):
+ hint = None
+
+top = '.'
+out = 'build'
+
+def options(ctx):
+ ctx.load('pebble_sdk')
+
+def configure(ctx):
+ ctx.load('pebble_sdk')
+ global hint
+ if hint is not None:
+ hint = hint.bake(['--config', 'pebble-jshintrc'])
+
+def build(ctx):
+ if False and hint is not None:
+ try:
+ hint([node.abspath() for node in ctx.path.ant_glob("src/**/*.js")], _tty_out=False) # no tty because there are none in the cloudpebble sandbox.
+ except ErrorReturnCode_2 as e:
+ ctx.fatal("\nJavaScript linting failed (you can disable this in Project Settings):\n" + e.stdout)
+
+ # Concatenate all our JS files (but not recursively), and only if any JS exists in the first place.
+ ctx.path.make_node('src/js/').mkdir()
+ js_paths = ctx.path.ant_glob(['src/*.js', 'src/**/*.js'])
+ if js_paths:
+ ctx(rule='cat ${SRC} > ${TGT}', source=js_paths, target='pebble-js-app.js')
+ has_js = True
+ else:
+ has_js = False
+
+ ctx.load('pebble_sdk')
+
+ ctx.pbl_program(source=ctx.path.ant_glob('src/**/*.c'),
+ target='pebble-app.elf')
+
+ if os.path.exists('worker_src'):
+ ctx.pbl_worker(source=ctx.path.ant_glob('worker_src/**/*.c'),
+ target='pebble-worker.elf')
+ ctx.pbl_bundle(elf='pebble-app.elf',
+ worker_elf='pebble-worker.elf',
+ js='pebble-js-app.js' if has_js else [])
+ else:
+ ctx.pbl_bundle(elf='pebble-app.elf',
+ js='pebble-js-app.js' if has_js else [])
+