*.dsc
src/build-stamp
src/mancala
+src/launcher/mancala-launcher
+src/plugin/mancala-ui-plugin.o
+src/plugin/mancala-ui-plugin.so
build-stamp
debian/docs
debian/maemo-mancala/
mkdir -p $(DESTDIR)/usr/share/applications/hildon
mkdir -p $(DESTDIR)/usr/share/icons/hicolor/40x40/apps
mkdir -p $(DESTDIR)/usr/share/dbus-1/services
+ mkdir -p $(DESTDIR)/home/opt/mancala/data/
+ mkdir -p $(DESTDIR)/home/opt/mancala/bin/
cp data/mancala.desktop $(DESTDIR)/usr/share/applications/hildon
cp data/mancala.png $(DESTDIR)/usr/share/icons/hicolor/40x40/apps/mancala.png
cp data/com.nokia.mancala.service $(DESTDIR)/usr/share/dbus-1/services/
+ cp data/com.nokia.mancala_startup.service $(DESTDIR)/usr/share/dbus-1/services/
+ cp data/mancala.conf $(DESTDIR)/home/opt/mancala/data/
+ cp data/mancala.sh $(DESTDIR)/home/opt/mancala/bin/
clean:
rm -f build-stamp config.guess config.sub
[D-BUS Service]
Name=com.nokia.mancala
-Exec=/home/opt/mancala/bin/mancala
+Exec=/home/opt/mancala/bin/mancala-launcher
--- /dev/null
+[D-BUS Service]
+Name=com.nokia.mancala_startup
+Exec=/home/opt/mancala/bin/mancala.sh
--- /dev/null
+[Startup Entry]
+# the name of the application
+Name=mancala
+# the current version of the application
+Version=0.2
+# the title that is used, if not specified by the GettextPackage
+Title=Mancala
+# the GettextPackage to be used to locate the title string
+# GettextPackage=example
+# if the TitleId is defined, it searches for it inside the gettext package
+# TitleId=example_title
+# if the game has a plug-in
+PluginPath=/home/opt/mancala/plugin/mancala-ui-plugin.so
+# the games-startup screen image
+Image=/home/opt/mancala/data/mancala.png
+# the D-BUS service, path and interface names
+ServiceName=com.nokia.mancala
+PathName=/com/nokia/mancala
+InterfaceName=com.nokia.mancala
+
[Desktop Entry]
Encoding=UTF-8
-Version=0.1
+Version=0.2
Name=Mancala
Comment=Mancala game for Maemo devices
-Exec=/home/opt/mancala/bin/mancala
+Exec=/home/opt/mancala/bin/mancala.sh
Icon=mancala
-Terminal=false
Type=Application
Categories=Games
X-HildonDesk-ShowInToolbar=true
-X-Osso-Type=application/x-executable
X-Window-Icon=mancala
-X-Osso-Service=com.nokia.mancala
-
-
+X-Osso-Service=com.nokia.mancala_startup
\ No newline at end of file
--- /dev/null
+mancala
+/home/opt/mancala/bin/mancala
+com.nokia.mancala
+/com/nokia/mancala
+com.nokia.mancala
+0.2
+
--- /dev/null
+#!/bin/sh
+
+/usr/bin/osso_games_startup /home/opt/mancala/data/mancala.conf
+
+mancala (0.2.0-2) unstable; urgency=low
+
+ * with plugin
+
+ -- Reto Zingg <g.d0b3rm4n@gmail.com> Fri, 25 Dec 2009 18:01:34 +0200
+
+mancala (0.2.0-1) unstable; urgency=low
+
+ * refractoring
+
+ -- Reto Zingg <g.d0b3rm4n@gmail.com> Fri, 25 Dec 2009 13:40:07 +0200
+
mancala (0.1.10-2) unstable; urgency=low
* updated control file
Package: mancala
Architecture: any
Section: user/games
-Depends: ${shlibs:Depends}, ${misc:Depends}
+Depends: ${shlibs:Depends}, ${misc:Depends}, osso-games-startup
Description: Mancala, the ancient African game of skill!
Maemo version of mancala from http://cmancala.sourceforge.net/
Please file bugs here for this maemo version:
DBG = gdb
STD = _GNU_SOURCE
CFLAGS = `sdl-config --cflags` -I/usr/local/include/SDL `pkg-config hildon-1 --cflags` -I/usr/include/dbus-1.0/ -I/usr/lib/dbus-1.0/include/
-LFLAGS = `sdl-config --static-libs ` -lSDL_image -lSDL_ttf -lSDL_mixer `pkg-config hildon-1 --libs` `pkg-config --libs libosso`
+LFLAGS = `sdl-config --static-libs ` -lSDL_image -lSDL_ttf -lSDL_mixer `pkg-config hildon-1 --libs` `pkg-config --libs libosso` -lhgw
-MAIN_OBJ = main.o graphics.o mancala.o sounds.o play.o
+# MAIN_OBJ = main.o graphics.o mancala.o sounds.o play.o
+MAIN_OBJ = graphics.o mancala.o sounds.o play.o callbacks.o
TEST_OBJ = ai-test.o mancala.o
NORMAL = ai.o
RECURSE = ai-init.o ai-recurse.o
ULTIMATE = ai-init.o ai-ultimate.o
+subsystem:
+ $(MAKE) -C launcher
+ $(MAKE) -C plugin
+
#'$<' is filename of input, '$@' is filename of output
.c.o:
$(CC) -c -g$(DBG) -Wall $(CFLAGS) -D$(STD) $<
$(CC) -c -g$(DBG) -Wall $(CFLAGS) -D$(STD) $<
all: $(MAIN_OBJ) $(NORMAL)
+ $(MAKE) -C launcher all
+ $(MAKE) -C plugin all
$(CC) $(MAIN_OBJ) $(NORMAL) $(LFLAGS) -o mancala
recurse: $(MAIN_OBJ) $(RECURSE)
cp ../data/*.png $(DESTDIR)/home/opt/mancala/data/
cp ../data/*.wav $(DESTDIR)/home/opt/mancala/data/
cp ../data/*.ttf $(DESTDIR)/home/opt/mancala/data/
+ $(MAKE) -C launcher install
+ $(MAKE) -C plugin install
uninstall:
clean:
rm -f *.o *.core *.swp *~ *.log
+ $(MAKE) -C launcher clean
+ $(MAKE) -C plugin clean
clobber: clean
rm -f mancala ai-test
+ $(MAKE) -C launcher clobber
+ $(MAKE) -C plugin clobber
distclean: clobber
@echo "No configuration files to distclean yet."
--- /dev/null
+/*
+* This file is part of Crazy Parking
+*
+* Copyright (C) 2006 INdT - Instituto Nokia de Tecnologia
+* http://www.indt.org/maemo
+*
+* This software is free software; you can redistribute it and/or
+* modify it under the terms of the GNU Lesser General Public License
+* as published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful, but
+* WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA
+*
+*/
+#include <stdio.h>
+#include <hgw/hgw.h>
+#include "callbacks.h"
+// #include "images.h"
+// #include "level.h"
+
+// Pause the game
+int exit_callback(int errcode) {
+// FILE *han;
+
+// // Save state
+// han = fopen("/tmp/.crazyparking-save", "wb");
+// if (han) {
+// fwrite(&actual_level, sizeof(int), 1, han);
+// fwrite(&moves, sizeof(int), 1, han);
+// fwrite(car, sizeof(struct CAR), cars, han);
+// fclose(han);
+// }
+ fprintf(stderr, "exit_callback called...\n");
+
+ return 0;
+}
+
+// Quit game
+int quit_callback(int errcode) {
+// remove("/tmp/.crazyparking-save");
+ fprintf(stderr, "quit_callback called...\n");
+ hgw_context_compat_destroy_quit(hgw_context);
+ return 0;
+}
+
+int flush_callback(int errcode) {
+// remove("/tmp/.crazyparking-save");
+ fprintf(stderr, "quit_callback called...\n");
+ return 0;
+}
--- /dev/null
+/*
+* This file is part of Crazy Parking
+*
+* Copyright (C) 2006 INdT - Instituto Nokia de Tecnologia
+* http://www.indt.org/maemo
+*
+* This software is free software; you can redistribute it and/or
+* modify it under the terms of the GNU Lesser General Public License
+* as published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful, but
+* WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA
+*
+*/
+extern HgwContext *hgw_context;
+
+int exit_callback(int errcode/*, AppData *app_data*/);
+int quit_callback(int errcode/*, AppData *app_data*/);
+int flush_callback(int errcode);
--- /dev/null
+# GNU Makefile -- Makefile
+# 2009 Reto Zingg
+
+
+CC = gcc
+# DBG = gdb
+# STD = _GNU_SOURCE
+# CFLAGS = `sdl-config --cflags` -I/usr/local/include/SDL `pkg-config hildon-1 --cflags` -I/usr/include/dbus-1.0/ -I/usr/lib/dbus-1.0/include/
+# LFLAGS = `sdl-config --static-libs ` -lSDL_image -lSDL_ttf -lSDL_mixer `pkg-config hildon-1 --libs` `pkg-config --libs libosso` -lhgw
+
+# MAIN_OBJ = main.o graphics.o mancala.o sounds.o play.o
+# MAIN_OBJ = graphics.o mancala.o sounds.o play.o callbacks.o
+# TEST_OBJ = ai-test.o mancala.o
+
+# NORMAL = ai.o
+# RECURSE = ai-init.o ai-recurse.o
+# ULTIMATE = ai-init.o ai-ultimate.o
+
+#'$<' is filename of input, '$@' is filename of output
+# .c.o:
+# $(CC) -c -g$(DBG) -Wall $(CFLAGS) -D$(STD) $<
+# .h.o:
+# $(CC) -c -g$(DBG) -Wall $(CFLAGS) -D$(STD) $<
+
+all:
+ $(CC) mancala-launcher.c -o mancala-launcher
+
+install: all
+ mkdir -p $(DESTDIR)/home/opt/mancala/bin/
+ cp ./mancala-launcher $(DESTDIR)/home/opt/mancala/bin/mancala-launcher
+
+uninstall:
+ rm -rf $(DESTDIR)/home/opt/mancala/mancala-launcher
+
+clean:
+ rm -f *.o *.core *.swp *~ *.log
+
+clobber: clean
+ rm -f mancala-launcher
+
+distclean: clobber
+ @echo "No configuration files to distclean yet."
+ @echo "I will do my best to make some! ;-)"
+
+# End Makefile
--- /dev/null
+/**
+ @file crazyparking.c
+
+ Wrapper crazyparking launcher
+ <p>
+ Copyright (c) 2005 INdT. All eigths reserved.
+
+ @author Andre Moreira Magalhaes <andre.magalhaes@indt.org.br>
+*/
+
+#include <stdio.h>
+#include <unistd.h>
+
+char *argh[] = { "/usr/games/wrapper/wrapper",
+ "/home/opt/mancala/data/mancala.game",
+ NULL };
+
+int main(int argc, char *argv[])
+{
+ fprintf(stderr, "exec laucher...\n");
+
+ if (execv ("/usr/games/wrapper/wrapper", argh) == -1) {
+ fprintf(stderr, "can not execute wrapper\n");
+ }
+
+ return 0;
+}
*/
#include <hildon/hildon.h>
+#include <hgw/hgw.h>
+#include <unistd.h>
#include "SDL_mixer.h"
#include "SDL.h"
#include "sounds.h"
#include "play.h"
+#include "callbacks.h"
+
// the surfaces
SDL_Surface *screen, *board, *title_text, *tile, *stone[STONE_MAX+1], *exit_text;
// the fonts
TTF_Font *title_font, *home_font, *board_font;
// The sound effects that will be used
Mix_Chunk *pick = NULL;
-
+// the hildon-game-wrapper context
+HgwContext *hgw_context = NULL;
void sdl_clean_up(){
}
+
+int main(int argc, char **argv) {
+
+// #if HGW_FUNC
+ hgw_context = hgw_context_compat_init(argc, argv);
+ if (!hgw_context) {
+ fprintf(stderr, "Cannot init hildon-games-startup!\n");
+ return 0;
+ }
+ hgw_compat_set_cb_exit(hgw_context, exit_callback);
+ hgw_compat_set_cb_quit(hgw_context, quit_callback);
+ hgw_compat_set_cb_flush(hgw_context, flush_callback);
+ if(!hgw_context_compat_check(hgw_context)) return 0;
+
+ /* hildon-games-wrapper part */
+ hgw_msg_compat_receive(hgw_context, 0);
+ usleep(100);
+// #endif
+ // Main game
+ play();
+
+// #if HGW_FUNC
+ hgw_context_compat_destroy_deinit(hgw_context);
+// #endif
+
+ return 0;
+}
+
--- /dev/null
+# GNU Makefile -- Makefile
+# 2009 Reto Zingg
+
+CC = gcc
+DBG = gdb
+STD = _GNU_SOURCE
+CFLAGS = `pkg-config hildon-1 --cflags` -I/usr/include/dbus-1.0/ -I/usr/lib/dbus-1.0/include/
+LFLAGS = -shared `pkg-config hildon-1 --libs`
+
+MAIN_OBJ = mancala-ui-plugin.o
+
+
+
+#'$<' is filename of input, '$@' is filename of output
+.c.o:
+ $(CC) -c -g$(DBG) -Wall $(CFLAGS) -D$(STD) $<
+.h.o:
+ $(CC) -c -g$(DBG) -Wall $(CFLAGS) -D$(STD) $<
+
+all: $(MAIN_OBJ)
+ $(CC) $(LFLAGS) $(MAIN_OBJ) -o mancala-ui-plugin.so
+
+install: all
+ mkdir -p $(DESTDIR)/home/opt/mancala/plugin/
+ cp mancala-ui-plugin.so $(DESTDIR)/home/opt/mancala/plugin/
+
+clean:
+ rm -f *.o *.core *.swp *~ *.log
+
+clobber: clean
+ rm -f mancala-ui-plugin.so
+
+distclean: clobber
+ @echo "No configuration files to distclean yet."
+ @echo "I will do my best to make some! ;-)"
+
+# End Makefile
--- /dev/null
+/*
+* This file is part of Crazyparking
+*
+* Copyright (C) 2005 INdT - Instituto Nokia de Tecnologia
+* http://www.indt.org/maemo
+*
+* This software is free software; you can redistribute it and/or
+* modify it under the terms of the GNU Lesser General Public License
+* as published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful, but
+* WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA
+*
+*/
+
+
+#include <stdio.h>
+#include <hildon/hildon.h>
+#include <gtk/gtk.h>
+#include <startup_plugin.h>
+
+
+static GtkWidget *load_plugin (void);
+static void unload_plugin (void);
+static void write_config (void);
+static GtkWidget **load_menu (guint *);
+static void update_menu (void);
+
+static GameStartupInfo gs;
+
+
+GtkWidget *settings_item;
+GtkWidget *settings_menu;
+GtkWidget *difficulty_item;
+GtkWidget *difficulty_menu;
+GtkWidget *menu_items[2];
+
+static StartupPluginInfo plugin_info = {
+ load_plugin,
+ unload_plugin,
+ write_config,
+ load_menu,
+ update_menu,
+ NULL
+};
+
+
+STARTUP_INIT_PLUGIN(plugin_info, gs, FALSE, FALSE)
+
+static GtkWidget *load_plugin (void)
+{
+ GtkWidget *textbox;
+ GtkTextBuffer *textbox_buffer;
+ gchar *textbox_text;
+ PangoFontDescription *font_desc;
+ GtkWidget *pannable_text;
+
+ /* Create and pack labels */
+ textbox_text = g_strdup_printf("Welcome to Mancala, the ancient African game of skill!\n\nMancala is a very simple, easy-to-learn game. Each player begins with a horizontal row of holes or pits filled with a certain number of stones. At either end of the board are the players' home pits, which are used to keep score. In this case, the human player has the left home pit and the upper row holes. A move is made by clicking into the hole you wish to move from. The stones are then picked up and distributed, one to each hole, moving toward your home pit is reached, and then moving through your opponent's row, bypassing his/her home, and moving back towards in a circle (counterclockwise), until all the stones have been distributed.\n\nIf the last stone is placed in your home, you receive an extra turn. If the last stone lands in an empty hole on your side, you 'capture' the stones in the opposite hole on your opponent's side, moving them to your home.\n\nThe game ends when one player cannot play (ie. there are no stones on his/her side of the board. The player who has the most stones on his/her *side* wins.");
+
+ textbox = hildon_text_view_new();
+ gtk_text_view_set_editable(GTK_TEXT_VIEW(textbox), FALSE);
+ // gtk_text_view_set_cursor_visible(GTK_TEXT_VIEW(textbox), FALSE);
+ gtk_text_view_set_indent(GTK_TEXT_VIEW(textbox), 10);
+ gtk_text_view_set_left_margin(GTK_TEXT_VIEW(textbox), 10);
+ gtk_text_view_set_right_margin(GTK_TEXT_VIEW(textbox), 10);
+ gtk_text_view_set_pixels_above_lines(GTK_TEXT_VIEW(textbox), 3);
+ gtk_text_view_set_pixels_below_lines(GTK_TEXT_VIEW(textbox), 2);
+ gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(textbox), GTK_WRAP_WORD);
+ // gtk_widget_set_sensitive(textbox, FALSE);
+ font_desc = pango_font_description_from_string ("vera 18");
+ gtk_widget_modify_font(textbox, font_desc);
+ pango_font_description_free (font_desc);
+
+ textbox_buffer = hildon_text_view_get_buffer (HILDON_TEXT_VIEW (textbox));
+
+ gtk_text_buffer_set_text(textbox_buffer, textbox_text, -1);
+
+
+ pannable_text = hildon_pannable_area_new();
+ hildon_pannable_area_add_with_viewport (HILDON_PANNABLE_AREA(pannable_text), textbox);
+
+ return GTK_WIDGET(pannable_text);
+}
+
+static void
+unload_plugin (void)
+{
+
+}
+
+static void
+write_config (void)
+{
+
+}
+
+static GtkWidget **load_menu (guint *nitems)
+{
+
+ int enable_sound;
+ //number of entries in osso-games-startup main menu for this game
+ *nitems = 1;
+
+ settings_item = gtk_menu_item_new_with_label ("Settings");
+ settings_menu = gtk_menu_new ();
+ menu_items[0] = settings_item;
+ gtk_menu_item_set_submenu (GTK_MENU_ITEM (settings_item), settings_menu);
+
+ //difficulty settings
+ difficulty_menu = gtk_menu_new ();
+ difficulty_item = gtk_menu_item_new_with_label ("Difficulty");
+ gtk_menu_item_set_submenu (GTK_MENU_ITEM (difficulty_item), difficulty_menu);
+ gtk_menu_append (GTK_MENU (settings_menu), difficulty_item);
+
+
+ return GTK_WIDGET(menu_items);
+}
+
+
+
+static void update_menu (void)
+{
+
+}
\ No newline at end of file