Commits

Trammell Hudson committed 01e8086

draw marker for local noon

  • Participants
  • Parent commits 76e1449

Comments (0)

Files changed (1)

File worldmap/src/worldmap.c

  *
  * Image from: http://commons.wikimedia.org/wiki/File:Northern_Hemisphere_Azimuthal_projections.svg
  *
+ * Feature ideas:
+ * - Sunset/sunrise terminator markers (seasonally adjusted)
+ * - Moon phase?
  */
 #include <pebble_os.h>
 #include <pebble_app.h>
 #include <pebble_fonts.h>
 
+// Update once per second to test things
+#undef CONFIG_DEBUG
+
 PBL_APP_INFO(
 	"Polar Map",
 	"hudson",
 );
 
 static Window window;
-
 static RotBmpPairContainer map_container;
+static Layer marker_layer;
 
 static char time_text[8];
 static TextLayer time_layer;
 static const int gmt_offset = -4; // hours from GMT
 
-/** Called once per minute */
+/** Update the line markers. */
+static void
+marker_layer_update(
+        Layer * const me,
+        GContext * ctx
+)
+{
+	(void) me;
+
+	for (int i = 0 ; i < 168/2 ; i += 8)
+	{
+		graphics_draw_line(
+			ctx,
+			GPoint(144/2,168/2 + i),
+			GPoint(144/2,168/2 + i + 1)
+		);
+	}
+}
+
+
+
+/** Called once per minute.
+ * Update the map rotation angle and flag it as dirty to force
+ * a redraw..
+ */
 static void
 handle_tick(
 	AppContextRef ctx,
 )
 {
 	(void) ctx;
-#undef CONFIG_DEBUG
 #ifdef CONFIG_DEBUG
 	// Fake the time
 	PblTm real_ptm = { .tm_hour = 17, .tm_min = 27 };
 	PblTm * ptm = &real_ptm;
-/*
 	static int h = 0;
 	if (++h == 24)
 		h = 0;
 	ptm->tm_hour = h;
-*/
 #else
 	// real time
 	const PblTm * const ptm = event->tick_time;
 		time_layer.layer.frame.origin = GPoint(90, -6);
 	}
 
-#ifdef CONFIG_DBEUG
+#ifdef CONFIG_DEBUG
 	ptm->tm_min = q;
 #endif
 
 		GRect(90, -6, 60, 20),
 		font
 	);
+
+	layer_init(&marker_layer, GRect(0, 0, 144, 168));
+	marker_layer.update_proc = marker_layer_update;
+	layer_add_child(&window.layer, &marker_layer);
+	layer_mark_dirty(&marker_layer);
 }