added online help
authorThomas Thurman <tthurman@gnome.org>
Sat, 22 Aug 2009 22:16:20 +0000 (18:16 -0400)
committerThomas Thurman <tthurman@gnome.org>
Sat, 22 Aug 2009 22:16:20 +0000 (18:16 -0400)
Makefile
debian/changelog
help.html [new file with mode: 0644]
rfk.c

index ad263b5..d77aa9f 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -3,7 +3,7 @@
 all: rfk
 
 rfk: rfk.c
-       gcc -Wall -g rfk.c -o rfk `pkg-config --cflags --libs gtk+-2.0` `pkg-config hildon-1 --cflags --libs`
+       gcc -Wall -g rfk.c -o rfk `pkg-config --cflags --libs gtk+-2.0 hildon-1 dbus-glib-1 dbus-1`
 
 clean:
        rm -f rfk
@@ -22,3 +22,4 @@ install: rfk rfk.png rfk-robot.png rfk-love.png rfk-kitten.png rfk.desktop
        install rfk-love.png ${DESTDIR}/usr/share/rfk
        install rfk-kitten.png ${DESTDIR}/usr/share/rfk
        install non-kitten-items.rfk ${DESTDIR}/usr/share/rfk
+       install help.html ${DESTDIR}/usr/share/rfk
index ef479ff..b991a9c 100644 (file)
@@ -1,3 +1,12 @@
+rfk (1.30-1) unstable; urgency=low
+
+  * Robot can move diagonally
+  * Robot can run until an obstacle is found
+  * Items moved into a separate file
+  * Items converted to UTF-8
+
+ -- Thomas Thurman <tthurman@gnome.org>  Tue, 27 May 2009 21:33:32 -0400
+       
 rfk (1.20-1) unstable; urgency=low
 
   * Fix icon
diff --git a/help.html b/help.html
new file mode 100644 (file)
index 0000000..530a85b
--- /dev/null
+++ b/help.html
@@ -0,0 +1,99 @@
+<html>
+<head><title>robotfindskitten</title></head>
+<style type="text/css">
+body {
+       color: green;
+       background-color: black;
+       text-align: center;
+       font-size: 20pt;
+       font-family: serif;
+}
+h1 {
+       font-size: 40pt;
+}
+a {
+       color: yellow;
+}
+</style>
+<body>
+<h1>robotfindskitten</h1>
+
+<p>robotfindskitten is a Zen simulation.  robot must find kitten
+in an area full of non-kitten items.  The original version was
+written in 1997 by the illustrious Leonard Richardson for the Nerth
+Pork robotfindskitten contest.  This Maemo port was written by
+Thomas Thurman in 2009.</p>
+
+<p>You may learn more at <a href="http://www.robotfindskitten.org">the
+robotfindskitten website</a>.</p>
+
+<p>You may scroll this help text.  When you
+are done, you may close this window and return
+to robotfindskitten</a>.</p>
+
+<h2>Moving robot around</h2>
+
+<p>There are three ways to move robot around.  Firstly, you may tap
+on any side of robot to move robot in that direction, including
+diagonally.</p>
+
+<p>Secondly, you may use the arrow keys on the keyboard.  However,
+this does not allow you to move diagonally.</p>
+
+<p>Thirdly, you may use the vi keys (also called the nethack keys).
+They are:</p>
+<center>
+<big><big><pre>
+y  k  u
+h  &middot;  l
+b  j  n
+</pre></big></big>
+</center>
+</p>
+
+<h2>Run, robot, run!</h2>
+<p>If you are controlling robot with the keyboard, then holding
+down Shift as you move will make robot run until meeting
+an item or the wall.</p>
+
+<h2>Adding new non-kitten items</h2>
+<p>There is no way to do this.  It should be in the next release.</p>
+
+<h2>Background</h2>
+<p>&quot;Day and night I feverishly worked upon the
+machine, creating both a soul which could desire
+its goal, and a body with which it could realize
+it. Many who saw my creation called it an
+abomination, and denied me grant money. But they
+could not dissuade me from my impossible task. It
+was a spectre that tormented me always, a ghost I
+had to give a form and a life, lest it consume me
+from the inside.  And when at last my task was
+done, when the grey box on wheels was complete and
+when it, as well as I, knew what had to be done, I
+felt deep sympathy for the machine.  For I had not
+destroyed the phantom, but merely exorcized it
+into another body. The robot knew not why this
+task had to be performed, for I could not imbue it
+with knowledge I did not myself posess. And at the
+same time, I felt a sweeping sense of relief sweep
+over me, that somehow, the dream that had driven
+me for my entire life had come one step closer to
+fruition.  &quot;As I vocally activated the robot, I
+realized that it was following my instructions,
+but not out of any desire to obey me. Had I
+remained silent, it would have performed
+exactly the same operations. We were two beings
+controlled by the same force now. And yet, seeking
+vainly to hold some illusion of control over the
+machine I thought I had created, I gave my final
+command.</p>
+
+<p>&quot;`GO!' I told the box as it began to roll out of
+my workshop into the frozen desert beyond. `FIND
+KITTEN!'&quot;</p>
+
+<p><cite>&mdash; The Book of Found Kittens</cite>, pages 43-4, author unknown</p>
+
+</body>
+</html>
diff --git a/rfk.c b/rfk.c
index e63edae..40785b3 100644 (file)
--- a/rfk.c
+++ b/rfk.c
@@ -3,9 +3,10 @@
  *  ported to maemo by Thomas Thurman, 2009
  *  suggestions welcome
  *  Compile with:
- *  gcc -Wall -g rfk.c -o rfk `pkg-config --cflags --libs gtk+-2.0 hildon-1`
+ *  gcc -Wall -g rfk.c -o rfk `pkg-config --cflags --libs gtk+-2.0 hildon-1 dbus-glib-1 dbus-1`
  */
 
+#include <dbus/dbus-glib.h>
 #include <gtk/gtk.h>
 #include <stdlib.h>
 #include <glib.h>
@@ -120,7 +121,8 @@ show_message (const char *message)
 {
   HildonNote* note = HILDON_NOTE
     (hildon_note_new_information (GTK_WINDOW (window),
-                                 message));
+                                 message?message:
+                                 "Some message was supposed to be here."));
   gtk_dialog_run (GTK_DIALOG (note));
   gtk_widget_destroy (GTK_WIDGET (note));
 }
@@ -467,10 +469,41 @@ set_up_game (void)
   gtk_widget_show_all (window);
 }
 
-void
+/****************************************************************/
+/* Online help.                                                 */
+/****************************************************************/
+gboolean
 get_help (gpointer button, gpointer data)
 {
-  show_message ("Not yet implemented.");
+  DBusGConnection *connection;
+  GError *error = NULL;
+  DBusGProxy *proxy;
+
+  connection = dbus_g_bus_get (DBUS_BUS_SESSION,
+                               &error);
+  if (connection == NULL)
+    {
+      show_message (error->message);
+      g_error_free (error);
+      return FALSE;
+    }
+
+  proxy = dbus_g_proxy_new_for_name (connection,
+                                     "com.nokia.osso_browser",
+                                     "/com/nokia/osso_browser/request",
+                                     "com.nokia.osso_browser");
+
+  error = NULL;
+  if (!dbus_g_proxy_call (proxy, "load_url", &error,
+                         G_TYPE_STRING, "/usr/share/rfk/help.html",
+                         G_TYPE_INVALID,
+                         G_TYPE_INVALID))
+    {
+      show_message (error->message);
+      g_error_free (error);
+      return FALSE;
+    }
+  return FALSE;
 }
 
 void