--- /dev/null
+Makefile.in*
+aclocal.m4
+autom4te.cache/
+compile
+config.guess
+config.guess.cdbs-orig
+config.h*
+config.log
+config.status*
+config.sub*
+configure
+debian/files
+debian/dirs
+debian/stamp-autotools-files
+debian/stamp-makefile-build
+debian/stamp-patched
+debian/tmp/
+depcomp
+install-sh
+libtool
+ltmain.sh
+missing
+mkinstalldirs
+stamp-h1
+patches
+src/*.o
+src/.libs
+*.substvars
+*.debhelper
+*.pot
+*~
+*.deb
+*.dsc
+src/build-stamp
+src/mancala
+build-stamp
+debian/docs
+debian/maemo-mancala/
+
-
- NOTE! This copyright does *not* cover user programs that use kernel
- services by normal system calls - this is merely considered normal use
- of the kernel, and does *not* fall under the heading of "derived work".
- Also note that the GPL below is copyrighted by the Free Software
- Foundation, but the instance of code that it refers to (the Linux
- kernel) is copyrighted by me and others who actually wrote it.
-
- Also note that the only valid version of the GPL as far as the kernel
- is concerned is _this_ particular version of the license (ie v2, not
- v2.2 or v3.x or whatever), unless explicitly otherwise stated.
-
- Linus Torvalds
-
-----------------------------------------
-
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.
- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
-the GNU Library General Public License instead.) You can apply it to
+the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
The precise terms and conditions for copying, distribution and
modification follow.
-\f
+
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
-\f
+
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
-\f
+
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
-\f
+
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
-\f
+
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
-library. If this is what you want to do, use the GNU Library General
+library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.
--- /dev/null
+# Copyright (C) 2009 Reto Zingg
+
+subsystem:
+ $(MAKE) -C src
+
+install:
+ $(MAKE) -C src install
+ mkdir -p $(DESTDIR)/usr/share/applications/hildon
+ mkdir -p $(DESTDIR)/usr/share/icons/hicolor/48x48/apps
+ mkdir -p $(DESTDIR)/usr/share/dbus-1/services
+ cp maemo/mancala.desktop $(DESTDIR)/usr/share/applications/hildon
+ cp res/icon.png $(DESTDIR)/usr/share/icons/hicolor/48x48/apps/mancala.png
+ cp res/pick.wav $(DESTDIR)/usr/share/pixmaps/mancala
+ cp maemo/com.nokia.mancala.service $(DESTDIR)/usr/share/dbus-1/services/
+
+clean:
+ rm -f build-stamp config.guess config.sub
+ $(MAKE) -C src clean
+
+clobber: clean
+ $(MAKE) -C src clobber
+
+.PHONY: clobber clean install subsystem
+
--- /dev/null
+make targed for:
+git archive --format=tar --prefix=maemo-mancala-0.1.8-1/ working/0.1.8-1.1 | gzip > ../maemo-mancala-0.1.8-1.tar.gz
+or
+dpkg-buildpackage -rfakeroot -sa -S -us -uc -i -I.git
+
+fixed 20090816:
+- it is possible to move from empty pitch...
--- /dev/null
+maemo-mancala (0.1.8-3) unstable; urgency=low
+
+ * add dependency to libosso-dev
+
+ -- Reto Zingg <g.d0b3rm4n@gmail.com> Fri, 28 Aug 2009 15:15:24 +0300
+
+maemo-mancala (0.1.8-2) unstable; urgency=low
+
+ * add dependency to libhildon1-dev
+
+ -- Reto Zingg <g.d0b3rm4n@gmail.com> Fri, 28 Aug 2009 15:04:46 +0300
+
+maemo-mancala (0.1.8-1) unstable; urgency=low
+
+ * added icon in debian/control and updated the help text
+
+ -- Reto Zingg <g.d0b3rm4n@gmail.com> Fri, 28 Aug 2009 12:57:39 +0300
+
+maemo-mancala (0.1.7-1) unstable; urgency=low
+
+ * add pannable text area
+
+ -- Reto Zingg <g.d0b3rm4n@gmail.com> Wed, 26 Aug 2009 20:27:34 +0300
+
+maemo-mancala (0.1.6-1) unstable; urgency=low
+
+ * change the used font to SwaRR4nh.ttf
+
+ -- Reto Zingg <g.d0b3rm4n@gmail.com> Wed, 26 Aug 2009 16:16:47 +0300
+
+maemo-mancala (0.1.5-1) unstable; urgency=low
+
+ * better sdl cleanup
+ * fixed empty hole move
+
+ -- Reto Zingg <g.d0b3rm4n@gmail.com> Sun, 16 Aug 2009 13:02:11 +0300
+
+maemo-mancala (0.1.4-1) unstable; urgency=low
+
+ * added help and start button
+
+ -- Reto Zingg <g.d0b3rm4n@gmail.com> Sat, 15 Aug 2009 18:02:11 +0300
+
+maemo-mancala (0.1.3-1) unstable; urgency=low
+
+ * code clean up
+
+ -- Reto Zingg <g.d0b3rm4n@gmail.com> Sat, 15 Aug 2009 18:02:11 +0300
+
+maemo-mancala (0.1.2-1) unstable; urgency=low
+
+ * use libosso
+ * start in separate window
+
+ -- Reto Zingg <g.d0b3rm4n@gmail.com> Sat, 15 Aug 2009 17:03:11 +0300
+
+maemo-mancala (0.1.1-1) unstable; urgency=low
+
+ * added a sound effect
+ * made the board bigger
+
+ -- Reto Zingg <g.d0b3rm4n@gmail.com> Fri, 14 Aug 2009 15:08:11 +0300
+
+maemo-mancala (0.1.0-3) unstable; urgency=low
+
+ * add original docs
+
+ -- Reto Zingg <g.d0b3rm4n@gmail.com> Thu, 13 Aug 2009 17:02:43 +0300
+
+maemo-mancala (0.1.0-2) unstable; urgency=low
+
+ * added Icon and Desktop launch
+
+ -- Reto Zingg <g.d0b3rm4n@gmail.com> Thu, 13 Aug 2009 16:10:43 +0300
+
+maemo-mancala (0.1.0-1) unstable; urgency=low
+
+ * Initial release
+
+ -- Reto Zingg <g.d0b3rm4n@gmail.com> Wed, 12 Aug 2009 17:19:19 +0300
+
--- /dev/null
+Source: maemo-mancala
+Section: games
+Priority: extra
+Maintainer: Reto Zingg <g.d0b3rm4n@gmail.com>
+Build-Depends: debhelper (>= 5), libhildon1-dev, libosso-dev, autotools-dev, libsdl-image1.2-dev, libsdl-ttf2.0-dev, libsdl1.2-dev, libsdl-mixer1.2-dev
+Standards-Version: 3.7.2
+
+Package: maemo-mancala
+Architecture: any
+Section: user/games
+Depends: ${shlibs:Depends}, ${misc:Depends}, eff-content-fonts
+Description: Mancala, the ancient African game of skill!
+ Maemo version of mancala from http://cmancala.sourceforge.net/
+Xb-Maemo-Display-Name: Mancala
+Xb-Maemo-Icon-26:
+ iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAABmJLR0QA/wD/AP+gvaeTAAAACXBI
+ WXMAAAsSAAALEgHS3X78AAAAB3RJTUUH1AEDFSo7riM2UAAAE05JREFUeJzFmmmwpVd1np+1h284
+ 0x17VA9q1JqQ1AgXgk5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l2FvFNnXaps9Ozant0/NdPZvXNdp/vZvP/5X+n/bsUGX
+ Ay13vnNdT7VnBzd99Ac/1ksXd3/gKqkbL7fdtbftqzjXsjopas+48qSJVsQYtZHwqst61dxMNsgy
+ Nf75jx953o3LX8Xue+/lIp/75W3yc390ON7xT7eLbxw/94cLP9m3R35M+6+/OCNz0zPKqCQYo8jT
+ VI6dPJnNzffKN96yJ6gYS33nr+2QiJeIl8+/Y8tf+9sqL2YP/vbfEIA7b96pv/rBKwRgZmp9OhzV
+ W/sr/c7SqWpmuDzM67LeEMZBAfwfddteBC/sLi8AAAAASUVORK5CYII=
+
--- /dev/null
+This package was debianized by Reto Zingg <g.d0b3rm4n@gmail.com> on
+Thu, 13 Aug 2009 17:03:19 +0300.
+
+It was downloaded from http://cmancala.sourceforge.net/
+http://downloads.sourceforge.net/project/cmancala/mancala-gui/mancala-gui-0.1.0/mancala-gui-0.1.0.tar.gz
+
+Upstream Author: Kevin Riggle
+
+Copyright: 2002, 2003, 2004 Kevin Riggle
+Copyright: 2009 Reto Zingg
+
+
+License:
+GPL
+see COPYING file.
+
+
+The Debian packaging is (C) 2009, Reto Zingg <g.d0b3rm4n@gmail.com> and
+is licensed under the GPL, see `/usr/share/common-licenses/GPL'.
+
+
+res/pick.wav is taken from the game knetwalk and is called there "connect.wav"
+http://websvn.kde.org/trunk/KDE/kdegames/knetwalk/src/sounds/connect.wav?view=log
+
+KNetWalk, a game for system administrators.
+
+(C) 2004-2005 Andi Peredri, ported to KDE by Thomas Nagy
+(C) 2007-2008 Fela Winkelmolen
+
+License: GNU General Public License Version 2
--- /dev/null
+COPYING
+INSTALL
+README
--- /dev/null
+#!/bin/sh
+
+echo "update the icon cache"
+gtk-update-icon-cache -f /usr/share/icons/hicolor
+
--- /dev/null
+#!/usr/bin/make -f
+# -*- makefile -*-
+# Sample debian/rules that uses debhelper.
+# This file was originally written by Joey Hess and Craig Small.
+# As a special exception, when this file is copied by dh-make into a
+# dh-make output file, you may use that output file without restriction.
+# This special exception was added by Craig Small in version 0.37 of dh-make.
+
+# Uncomment this to turn on verbose mode.
+export DH_VERBOSE=0
+
+
+# These are used for cross-compiling and for saving the configure script
+# from having to guess our platform (since we know it already)
+DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
+DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
+
+
+CFLAGS = -Wall -g
+
+ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
+ CFLAGS += -O0
+else
+ CFLAGS += -O2
+endif
+
+config.status:
+ dh_testdir
+ # Add here commands to configure the package.
+
+build: build-stamp
+
+build-stamp: config.status
+ dh_testdir
+
+ # Add here commands to compile the package.
+ $(MAKE)
+ touch $@
+
+clean:
+ dh_testdir
+ dh_testroot
+ rm -f build-stamp
+
+ # Add here commands to clean up after the build process.
+ -$(MAKE) clean
+ifneq "$(wildcard /usr/share/misc/config.sub)" ""
+ cp -f /usr/share/misc/config.sub config.sub
+endif
+ifneq "$(wildcard /usr/share/misc/config.guess)" ""
+ cp -f /usr/share/misc/config.guess config.guess
+endif
+
+
+ dh_clean
+
+install: build
+ dh_testdir
+ dh_testroot
+ dh_clean -k
+ dh_installdirs
+
+ # Add here commands to install the package into debian/maemo-mancala
+ $(MAKE) DESTDIR=$(CURDIR)/debian/maemo-mancala install
+
+
+# Build architecture-independent files here.
+binary-indep: build install
+# We have nothing to do by default.
+
+# Build architecture-dependent files here.
+binary-arch: build install
+ dh_testdir
+ dh_testroot
+ dh_installchangelogs
+ dh_installdocs -XFAQ -XNEWS -XBUGS -XREADME.translators -XTODO
+# dh_installexamples
+ dh_install --sourcedir=debian/tmp
+# dh_installmenu
+# dh_installdebconf
+# dh_installlogrotate
+# dh_installemacsen
+# dh_installpam
+# dh_installmime
+# dh_python
+# dh_installinit
+# dh_installcron
+# dh_installinfo
+# dh_installman --sourcedir=debian/tmp
+ dh_link
+ dh_strip
+ dh_compress
+ dh_fixperms
+# dh_perl
+# dh_makeshlibs
+ dh_installdeb
+ dh_shlibdeps
+ dh_gencontrol
+ dh_md5sums
+ dh_builddeb
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install
--- /dev/null
+[D-BUS Service]
+Name=com.nokia.mancala
+Exec=/usr/bin/mancala
--- /dev/null
+[Desktop Entry]
+Encoding=UTF-8
+Version=0.1
+Name=Mancala
+Comment=Mancala game for Maemo devices
+Exec=/usr/bin/mancala
+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
+
+
# GNU Makefile -- Makefile
# Kevin Riggle
+# 2009 Reto Zingg
# http://cmancala.sourceforge.net
# $Source: /cvsroot/cmancala/mancala/src/Attic/Makefile,v $
# $Revision: 1.10.2.7 $
# the LD_LIBRARY_PATH environment variable to include /usr/local/lib in
# order to compile with SDL_ttf.
-#Linux-dependent right now, modify for platform-independency later
+# Linux-dependent right now, modify for platform-independency later
+# is now adapted for maemo (and dh_* scripts)
+
CC = gcc
DBG = gdb
STD = _GNU_SOURCE
-CFLAGS = `sdl-config --cflags` -I/usr/local/include/SDL
-LFLAGS = `sdl-config --static-libs` -lSDL_image -lSDL_ttf
+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`
-MAIN_OBJ = main.o graphics.o mancala.o
+MAIN_OBJ = main.o graphics.o mancala.o sounds.o play.o
TEST_OBJ = ai-test.o mancala.o
NORMAL = ai.o
$(CC) $(TEST_OBJ) $(ULTIMATE) $(LFLAGS) -o ai-test
install: all
- mkdir /usr/share/pixmaps/mancala
- cp ../res/*.png /usr/share/pixmaps/mancala
- cp ./mancala /usr/bin
+ mkdir -p $(DESTDIR)/usr/share/pixmaps/mancala
+ mkdir -p $(DESTDIR)/usr/bin/
+ cp ../res/*.png $(DESTDIR)/usr/share/pixmaps/mancala
+ cp ./mancala $(DESTDIR)/usr/bin/
uninstall:
- rm -rf /usr/share/pixmaps/mancala
- rm /usr/bin/mancala
+ rm -rf $(DESTDIR)/usr/share/pixmaps/mancala
+ rm $(DESTDIR)/usr/bin/mancala
clean:
rm -f *.o *.core *.swp *~ *.log
*
* Copyright (C) 2003 Kevin Riggle
* http://cmancala.sourcefoge.net
+ * Copyright (C) 2009 Reto Zingg
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
#include "graphics.h"
#include "main.h"
#include "mancala.h"
+#include "play.h"
static SDL_Surface *ShiftColors(SDL_Surface *old, Uint8 red, Uint8 blue, Uint8 green, Uint8 alpha);
--- /dev/null
+/*
+* Copyright (C) 2009 Reto Zingg
+*
+* Some of the code is based on the examples on:
+* http://wiki.maemo.org/Documentation/Maemo_5_Developer_Guide
+*
+* This program is free software; you can redistribute it and/or modify it
+* under the terms of the GNU General Public License as published by the
+* Free Software Foundation; either version 2, or (at your option) any
+* later version.
+*
+* This program 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
+* General Public License for more details, a copy of which may be found in
+* the file COPYING provided in the main directory of this release.
+*
+*/
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+#include <hildon/hildon.h>
+#include <libosso.h>
+#include <gtk/gtk.h>
+
+
+#include "play.h"
+
+#define OSSO_SERVICE "com.nokia.mancala"
+
+osso_context_t *ossoContext = NULL;
+
+gint
+dbus_callback (const gchar *interface, const gchar *method,
+ GArray *arguments, gpointer data,
+ osso_rpc_t *retval)
+{
+ printf ("Msg dbus: %s, %s\n", interface, method);
+
+ if (!strcmp (method, "top_application"))
+ gtk_window_present (GTK_WINDOW (data));
+
+ retval->type = DBUS_TYPE_INVALID;
+ return OSSO_OK;
+}
+
+
+void play_wrapper (GtkWidget *win)
+{
+
+ fprintf(stderr, "Button start-play pressed\n");
+ if (play() > 0){
+ fprintf(stderr, "start play failed\n");
+ }
+ else{
+ fprintf(stderr, "successfull played...\n");
+ }
+
+ osso_application_top(ossoContext, OSSO_SERVICE, NULL);
+
+}
+
+static HildonAppMenu* create_menu (GtkWidget *win)
+ {
+ int i;
+ gchar *command_id;
+ GtkWidget * button;
+ HildonAppMenu *menu = HILDON_APP_MENU (hildon_app_menu_new ());
+ for (i = 1; i <= 2; i++) {
+ /* Create menu entries */
+ button = hildon_gtk_button_new (HILDON_SIZE_AUTO);
+ command_id = g_strdup_printf ("Menu command %d", i);
+ gtk_button_set_label (GTK_BUTTON (button), command_id);
+
+ /* Attach callback to clicked signal */
+ switch (i) {
+ // Start game
+ case 1:
+ command_id = g_strdup_printf ("Play");
+ gtk_button_set_label (GTK_BUTTON (button), command_id);
+ g_signal_connect_after (button, "clicked",
+ G_CALLBACK (play_wrapper),win);
+ break;
+ // Show help
+ case 2:
+ command_id = g_strdup_printf ("Quit");
+ gtk_button_set_label (GTK_BUTTON (button), command_id);
+ g_signal_connect_after (button, "clicked",
+ G_CALLBACK (gtk_main_quit), NULL);
+ break;
+ }
+ /* Add entry to the view menu */
+ hildon_app_menu_append (menu, GTK_BUTTON (button));
+ }
+
+ gtk_widget_show_all (GTK_WIDGET (menu));
+ return menu;
+}
+
+
+int main (int argc, char **argv) {
+
+ osso_return_t ret;
+
+ g_print("Initializing LibOSSO\n");
+ ossoContext = osso_initialize(OSSO_SERVICE, "0.1", FALSE, NULL);
+ if (ossoContext == NULL) {
+ g_error("Failed to initialize LibOSSO\n");
+ }
+
+ GtkWidget *win;
+ GtkWidget *textbox;
+ GtkTextBuffer *textbox_buffer;
+ gchar *textbox_text;
+ GtkBox *vbox;
+ HildonAppMenu *menu;
+ PangoFontDescription *font_desc;
+ GtkWidget * button;
+ gchar *button_lable_text;
+ GtkWidget *pannable_text;
+
+ hildon_gtk_init (&argc, &argv);
+ win = hildon_window_new ();
+
+ /* 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);
+
+
+ vbox = GTK_BOX (gtk_vbox_new (FALSE, 2));
+
+ button = hildon_button_new (HILDON_SIZE_AUTO | HILDON_SIZE_FINGER_HEIGHT,
+ HILDON_BUTTON_ARRANGEMENT_VERTICAL);
+ button_lable_text = g_strdup_printf ("Play");
+ gtk_button_set_label (GTK_BUTTON (button), button_lable_text);
+ g_signal_connect_after (button, "clicked",
+ G_CALLBACK (play_wrapper),win);
+
+ gtk_box_pack_start (vbox, button, FALSE, TRUE, 1);
+ gtk_box_pack_start (vbox, pannable_text, TRUE, TRUE, 1);
+
+ /* Create menu */
+ menu = create_menu (win);
+
+ /* Attach menu to the window */
+ hildon_window_set_app_menu (HILDON_WINDOW (win), menu);
+
+ /* Add label's box to window */
+ gtk_container_add (GTK_CONTAINER (win), GTK_WIDGET (vbox));
+
+ g_signal_connect (win, "delete_event", G_CALLBACK (gtk_main_quit), NULL);
+
+ gtk_widget_show_all (win);
+
+ ret = osso_rpc_set_default_cb_f (ossoContext, dbus_callback, GTK_WINDOW(win));
+ if (ret != OSSO_OK)
+ {
+ fprintf (stderr, "osso_rpc_set_default_cb_f failed: %d.\n", ret);
+ exit (1);
+ }
+
+ gtk_main ();
+
+ osso_deinitialize(ossoContext);
+ ossoContext = NULL;
+
+ return 0;
+}
+
--- /dev/null
+/*
+* Copyright (C) 2009 Reto Zingg
+*
+* This program is free software; you can redistribute it and/or modify it
+* under the terms of the GNU General Public License as published by the
+* Free Software Foundation; either version 2, or (at your option) any
+* later version.
+*
+* This program 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
+* General Public License for more details, a copy of which may be found in
+* the file COPYING provided in the main directory of this release.
+*
+*/
+
+
+
+
* $Revision: 1.4.2.1 $
* $Date: 2003/12/29 05:49:52 $
*
+ * Copyright (C) 2003, 2004 Kevin Riggle
+ * Copyright (C) 2009 Reto Zingg
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2, or (at your option) any
+ * later version.
+ *
+ * This program 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
+ * General Public License for more details, a copy of which may be found in
+ * the file COPYING provided in the main directory of this release.
+ *
*/
#include <stdlib.h>
currentPosition = activeBoard + move;
- /* Pick up the stones. */
stones = *(activeBoard + move);
- *(activeBoard + move) = 0;
-
- /* Loop for each stone. */
- for (; stones>0; stones--) {
-
- /* Move to the next board location. */
- if (currentPosition == activeBoard)
- currentPosition = passiveBoard + BOARD_MAX;
- else if (currentPosition == passiveBoard + 1)
- currentPosition = activeBoard + BOARD_MAX;
- else
- currentPosition--;
-
- /* Drop a stone. */
- (*currentPosition)++;
-
+ if (stones > 0){
+ /* Pick up the stones. */
+ *(activeBoard + move) = 0;
+
+ /* Loop for each stone. */
+ for (; stones>0; stones--) {
+ /* Move to the next board location. */
+ if (currentPosition == activeBoard)
+ currentPosition = passiveBoard + BOARD_MAX;
+ else if (currentPosition == passiveBoard + 1)
+ currentPosition = activeBoard + BOARD_MAX;
+ else
+ currentPosition--;
+ /* Drop a stone. */
+ (*currentPosition)++;
+ }
+
+ /* If the last stone lands on an empty hole... */
+ if (*currentPosition == 1 && activeBoard < currentPosition &&
+ currentPosition <= (activeBoard + BOARD_MAX)) {
+ /* ...calculate the position of the opposite hole... */
+ int oppHole = (BOARD_MAX + 1) - (currentPosition - activeBoard);
+ /* ...and make the capture. */
+ *activeBoard = *activeBoard + *(passiveBoard + oppHole);
+ printf("Captured %d stones.\n", *(passiveBoard + oppHole));
+ *(passiveBoard + oppHole) = 0;
+ }
+
+ return currentPosition - activeBoard;
}
-
- /* If the last stone lands on an empty hole... */
- if (*currentPosition == 1 && activeBoard < currentPosition &&
- currentPosition <= (activeBoard + BOARD_MAX)) {
-
- /* ...calculate the position of the opposite hole... */
- int oppHole = (BOARD_MAX + 1) - (currentPosition - activeBoard);
-
- /* ...and make the capture. */
- *activeBoard = *activeBoard + *(passiveBoard + oppHole);
- printf("Captured %d stones.\n", *(passiveBoard + oppHole));
- *(passiveBoard + oppHole) = 0;
+ else{
+ printf("move from empty hole...\n");
+ /* return 0 so human can make a move again */
+ return 0;
}
-
- return currentPosition - activeBoard;
}
-/*
- * Main Mancala Program Module Source -- main.c
- * $Id: main.c,v 1.7.2.25 2004/01/17 06:56:23 sparrow_hawk Exp $
- *
- * Copyright (C) 2003 Kevin Riggle
- * http://cmancala.sourcefoge.net
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2, or (at your option) any
- * later version.
- *
- * This program 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
- * General Public License for more details, a copy of which may be found in
- * the file COPYING provided in the main directory of this release.
- *
- */
+/*
+* for Maemo renamed to play.c and some bugfixes (2009, Reto Zingg)
+*
+* Main Mancala Program Module Source -- main.c
+* $Id: main.c,v 1.7.2.25 2004/01/17 06:56:23 sparrow_hawk Exp $
+*
+* Copyright (C) 2003 Kevin Riggle
+* http://cmancala.sourcefoge.net
+* Copyright (C) 2009 Reto Zingg
+*
+* This program is free software; you can redistribute it and/or modify it
+* under the terms of the GNU General Public License as published by the
+* Free Software Foundation; either version 2, or (at your option) any
+* later version.
+*
+* This program 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
+* General Public License for more details, a copy of which may be found in
+* the file COPYING provided in the main directory of this release.
+*
+*/
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
+#include <hildon/hildon.h>
+#include "SDL_mixer.h"
#include "SDL.h"
#include "SDL_image.h"
#include "SDL_ttf.h"
-#include "main.h"
#include "graphics.h"
#include "mancala.h"
#include "ai.h"
+#include "sounds.h"
+#include "play.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;
+
+
+void sdl_clean_up(){
+
+ int i = 0;
+
+ SDL_FreeSurface(board);
+ SDL_FreeSurface(tile);
+ SDL_FreeSurface(exit_text);
+ SDL_FreeSurface(title_text);
+ for(i=0; i<=STONE_MAX; i++)
+ SDL_FreeSurface(stone[i]);
+ SDL_FreeSurface(screen);
+ TTF_CloseFont(title_font);
+ TTF_CloseFont(board_font);
+ TTF_CloseFont(home_font);
+ Mix_FreeChunk(pick);
+ /* Make sure we clean up after ourselves */
+ TTF_Quit();
+ Mix_CloseAudio();
+ SDL_Quit();
+ return;
+}
-#define HMN_WAIT 1
-#define HMN_MOVE 2
-#define CMP_WAIT 3
-#define CMP_MOVE 4
-#define GAME_WON 0
-
-int main(int argc, char **argv) {
-
- SDL_Surface *screen, *board, *title_text, *tile, *stone[STONE_MAX+1];
- SDL_Rect board_rect, title_rect;
- SDL_Color font_color;
- SDL_Event event;
-
- TTF_Font *title_font, *home_font, *board_font;
-
- char tile_path[STRING_MAX], stone_path[STRING_MAX];
- char icon_path[STRING_MAX], title_path[STRING_MAX];
- char home_path[STRING_MAX], board_path[STRING_MAX];
- int aiBoard[BOARD_MAX+1], humanBoard[BOARD_MAX+1];
- int i, redraw_board, highlight, old_highlight, active;
- int current_move, ai_last_move, human_last_move, state;
-
- /* Set up the game board and game variables. */
- gameInit(aiBoard, humanBoard);
- current_move = 0;
- ai_last_move = human_last_move = -99;
-
- /* initialize our libraries */
- if (SDL_Init(SDL_INIT_VIDEO|SDL_INIT_TIMER) < 0) {
- fprintf(stderr, "Unable to initialize SDL: %s\n",
- SDL_GetError());
- exit(1);
- }
-
- if (TTF_Init() < 0) {
- fprintf(stderr, "Unable to initialize SDL_ttf: %s\n",
- SDL_GetError());
- exit(1);
- }
-
- /* Make sure we clean up after ourselves */
- atexit(SDL_Quit);
- atexit(TTF_Quit);
-
- /* Load our images... PNGs now, maybe XPMs later */
- sprintf(tile_path, "%s/tile.png", RES_PATH);
- if ((tile = LoadRes(tile_path)) == NULL) {
- fprintf(stderr, "Unable to load resource: %s\n",
- SDL_GetError());
- return 1;
- }
-
- for (i=0; i<=STONE_MAX; i++) {
- if (sprintf(stone_path, "%s/stone%02d.png", RES_PATH, i) == 0)
- fprintf(stderr, "Problems assembling path.\n");
- if (!(stone[i] = LoadRes(stone_path))) {
- fprintf(stderr, "Unable to load resource: %s\n",
- SDL_GetError());
- return 1;
- }
- }
-
- /* Load our font(s) */
- if (sprintf(title_path, "%s/VeraSeBd.ttf", FONT_PATH) == 0)
- fprintf(stderr, "Problems assembling path.\n");
- if (!(title_font = TTF_OpenFont(title_path, TITLE_SIZE))) {
- fprintf(stderr, "Could not load font: %s\n", TTF_GetError());
- exit(1);
- }
-
- if (sprintf(board_path, "%s/VeraSeBd.ttf", FONT_PATH) == 0)
- fprintf(stderr, "Problems assembling path.\n");
- if (!(board_font = TTF_OpenFont(board_path, BOARD_SIZE))) {
- fprintf(stderr, "Could not load font: %s\n", TTF_GetError());
- exit(1);
- }
-
- if (sprintf(home_path, "%s/VeraSeBd.ttf", FONT_PATH) == 0)
- fprintf(stderr, "Problems assembling path.\n");
- if (!(home_font = TTF_OpenFont(home_path, HOME_SIZE))) {
- fprintf(stderr, "Could not load font: %s\n", TTF_GetError());
- exit(1);
- }
-
- /* store the font's color */
- font_color.r = 255;
- font_color.b = 255;
- font_color.g = 255;
-
- /* render the title text
- if (!(title_text = TTF_RenderText_Solid(title_font,
- "Mancala", font_color)))
- fprintf(stderr, "TTF: %s\n", TTF_GetError());
-*/
- title_text = NULL;
-
- /* set window properties and create it */
- SDL_WM_SetCaption("Mancala", "Mancala");
- if (sprintf(icon_path, "%s/icon.png", RES_PATH) == 0)
- fprintf(stderr, "Problems assembling icon path.\n");
- SDL_WM_SetIcon(LoadRes(icon_path), NULL);
- if ((screen = SDL_SetVideoMode(tile->w*8, tile->h*2, 16, SDL_SWSURFACE))
- == NULL) {
- fprintf(stderr, "Unable to set %dx%d video: %s", tile->w*8,
- tile->h*2, SDL_GetError());
- exit(1);
- }
-
-
- state = HMN_WAIT;
- redraw_board = 1;
- old_highlight = 0;
- highlight = 0;
- active = 0;
-
- /* GAME LOOP */
- while (state != GAME_WON) {
- /* figure out if anything important happened */
- old_highlight = highlight;
- while (SDL_PollEvent(&event)) {
- /* BAIL OUT! BAIL OUT! */
- if (event.type == SDL_QUIT) {
- SDL_FreeSurface(board);
- SDL_FreeSurface(tile);
- for(i=0; i<=STONE_MAX; i++)
- SDL_FreeSurface(stone[i]);
- TTF_CloseFont(title_font);
- TTF_CloseFont(board_font);
- TTF_CloseFont(home_font);
- exit(0);
- }
- /* get events */
- if (state == HMN_WAIT) {
- switch (event.type) {
- case SDL_MOUSEBUTTONDOWN:
- if ((event.button.button = 1) &&
- (event.button.y < tile->h)) {
- current_move = event.button.x / tile->w;
- state = HMN_MOVE;
- }
- break;
- case SDL_MOUSEMOTION:
- if (event.motion.y < tile->h) {
- highlight = event.motion.x / tile->w;
- }
- else
- highlight = 0;
- break;
- case SDL_ACTIVEEVENT:
- if (event.active.gain == 0)
- highlight = 0;
- break;
- }
- }
- }
- SDL_Delay(DELAY_MAX);
-
- /* GAME LOGIC */
- if (gameWon(aiBoard, humanBoard) == 1)
- state = GAME_WON;
-
- /* happy happy state machine */
- switch(state) {
- case HMN_WAIT:
- active = 0;
- if (highlight != old_highlight)
- redraw_board = 1;
- break;
- case HMN_MOVE:
- human_last_move = move(humanBoard,aiBoard,current_move);
- redraw_board = 1;
- if (human_last_move == 0)
- state = HMN_WAIT;
- else
- state = CMP_WAIT;
- printf("Human moving from %d to %d, now %d\n", current_move, human_last_move, state);
- break;
- case CMP_WAIT:
- SDL_Delay(5000);
- active = 1;
- current_move = aiMove(aiBoard, humanBoard);
- state = CMP_MOVE;
- break;
- case CMP_MOVE:
- printf("Computer moving\n");
- ai_last_move = move(aiBoard,humanBoard,current_move);
- redraw_board = 1;
- if (ai_last_move == 0)
- state = CMP_WAIT;
- else
- state = HMN_WAIT;
- break;
- case GAME_WON:
- if (aiBoard[0] > humanBoard[0]) {
- if (!(title_text = TTF_RenderText_Blended(title_font,
- "Computer Wins!", font_color)))
- fprintf(stderr, "TTF: %s\n", TTF_GetError());
- }
- else {
- if (!(title_text = TTF_RenderText_Blended(title_font,
- "Human Wins!", font_color)))
- fprintf(stderr, "TTF: %s\n", TTF_GetError());
- }
- redraw_board = 1;
- break;
- }
-
- /* redraw the board if needed */
- if (redraw_board == 1) {
- /*printf("redrawing board\n");*/
-
- /* draw and blit the board */
- board = DrawBoard(aiBoard, humanBoard, board_font,
- home_font, tile, stone, active,
- highlight);
- if (!board) {
- fprintf(stderr, "Could not draw the board.\n");
- }
- else {
- board_rect = SurfaceToRect(board);
- SDL_BlitSurface(board, NULL, screen,
- &board_rect);
- }
-
- /* draw, center, and blit the title */
- if (title_text) {
- title_rect = SurfaceToRect(title_text);
- title_rect.x = ((screen->w - title_rect.w)/2);
- title_rect.y = ((screen->h - title_rect.h)/2);
- SDL_BlitSurface(title_text, NULL, screen,
- &title_rect);
- }
-
- SDL_UpdateRect(screen, 0,0,0,0);
-
- redraw_board = 0;
- }
-
- }
-
- SDL_Delay(5000);
-
- return 0;
-
+int play() {
+
+ SDL_Rect board_rect, title_rect, exit_rect;
+ SDL_Color font_color;
+ SDL_Event event;
+ SDL_Color font_color_exit;
+
+ char tile_path[STRING_MAX], stone_path[STRING_MAX];
+ char icon_path[STRING_MAX], title_path[STRING_MAX];
+ char home_path[STRING_MAX], board_path[STRING_MAX];
+ char pick_path[STRING_MAX];
+ int aiBoard[BOARD_MAX+1], humanBoard[BOARD_MAX+1];
+ int i, redraw_board, highlight, old_highlight, active;
+ int current_move, ai_last_move, human_last_move, state;
+
+ /* Set up the game board and game variables. */
+ gameInit(aiBoard, humanBoard);
+ current_move = 0;
+ ai_last_move = human_last_move = -99;
+
+ /* initialize our libraries */
+ //if (SDL_Init(SDL_INIT_VIDEO|SDL_INIT_TIMER|SDL_INIT_AUDIO) < 0) {
+ if (SDL_Init(SDL_INIT_EVERYTHING) < 0) {
+ fprintf(stderr, "Unable to initialize SDL: %s\n",
+ SDL_GetError());
+ sdl_clean_up();
+ return 1;
+ }
+
+ if (TTF_Init() < 0) {
+ fprintf(stderr, "Unable to initialize SDL_ttf: %s\n",
+ SDL_GetError());
+ sdl_clean_up();
+ return 1;
+ }
+
+ //Initialize SDL_mixer
+
+ if( Mix_OpenAudio( 22050, MIX_DEFAULT_FORMAT, 2, 4096 ) == -1 )
+ {
+ fprintf(stderr, "Unable to initialize Mix_OpenAudio: %s\n",
+ SDL_GetError());
+ sdl_clean_up();
+ return 1;
+ }
+
+
+ /* Load our images... PNGs now, maybe XPMs later */
+ sprintf(tile_path, "%s/tile.png", RES_PATH);
+ if ((tile = LoadRes(tile_path)) == NULL) {
+ fprintf(stderr, "Unable to load resource: %s\n",
+ SDL_GetError());
+ sdl_clean_up();
+ return 1;
+ }
+
+ for (i=0; i<=STONE_MAX; i++) {
+ if (sprintf(stone_path, "%s/stone%02d.png", RES_PATH, i) == 0)
+ fprintf(stderr, "Problems assembling path.\n");
+ if (!(stone[i] = LoadRes(stone_path))) {
+ fprintf(stderr, "Unable to load resource: %s\n",
+ SDL_GetError());
+ sdl_clean_up();
+ return 1;
+ }
+ }
+
+ /* Load our font(s) */
+ if (sprintf(title_path, "%s/SwaRR4nh.ttf", FONT_PATH) == 0)
+ fprintf(stderr, "Problems assembling path.\n");
+ if (!(title_font = TTF_OpenFont(title_path, TITLE_SIZE))) {
+ fprintf(stderr, "Could not load font: %s\n", TTF_GetError());
+ sdl_clean_up();
+ return 1;
+ }
+
+ if (sprintf(board_path, "%s/SwaRR4nh.ttf", FONT_PATH) == 0)
+ fprintf(stderr, "Problems assembling path.\n");
+ if (!(board_font = TTF_OpenFont(board_path, BOARD_SIZE))) {
+ fprintf(stderr, "Could not load font: %s\n", TTF_GetError());
+ sdl_clean_up();
+ return 1;
+ }
+
+ if (sprintf(home_path, "%s/SwaRR4nh.ttf", FONT_PATH) == 0)
+ fprintf(stderr, "Problems assembling path.\n");
+ if (!(home_font = TTF_OpenFont(home_path, HOME_SIZE))) {
+ fprintf(stderr, "Could not load font: %s\n", TTF_GetError());
+ sdl_clean_up();
+ return 1;
+ }
+
+ /* Load sound effects */
+ sprintf(pick_path, "%s/pick.wav", RES_PATH);
+ if ((pick = Mix_LoadWAV(pick_path)) == NULL) {
+ fprintf(stderr, "Unable to load sound: %s\n",
+ SDL_GetError());
+ sdl_clean_up();
+ return 1;
+ }
+
+ /* store the font's color */
+ font_color.r = 255;
+ font_color.b = 255;
+ font_color.g = 255;
+
+ /* render the title text
+ if (!(title_text = TTF_RenderText_Solid(title_font,
+ "Mancala", font_color)))
+ fprintf(stderr, "TTF: %s\n", TTF_GetError());
+ */
+ title_text = NULL;
+
+
+ /* define the position of the board in the screen */
+ board_rect.x = 0;
+ board_rect.y = Y_OFFSET;
+ board_rect.w = 0;
+ board_rect.h = 0;
+
+ /* set window properties and create it */
+ SDL_WM_SetCaption("Mancala", "Mancala");
+ if (sprintf(icon_path, "%s/icon.png", RES_PATH) == 0)
+ fprintf(stderr, "Problems assembling icon path.\n");
+ SDL_WM_SetIcon(LoadRes(icon_path), NULL);
+ if ((screen = SDL_SetVideoMode(tile->w*8, (tile->h*2) + Y_OFFSET, 16, SDL_FULLSCREEN))
+ == NULL) {
+ fprintf(stderr, "Unable to set %dx%d video: %s", tile->w*8,
+ tile->h*2, SDL_GetError());
+ sdl_clean_up();
+ return 1;
+ }
+
+
+ /* define the font color fot the exit text */
+ font_color_exit.r = 255;
+ font_color_exit.r = 255;
+ font_color_exit.r = 255;
+
+
+
+ if (!(exit_text = TTF_RenderText_Blended(home_font, "EXIT",
+ font_color_exit))) {
+ fprintf(stderr, "SDL_ttf: %s\n", TTF_GetError());
+ return 1;
+ }
+
+ exit_rect.x = 400;
+ exit_rect.y = 0;
+ exit_rect.w = 0;
+ exit_rect.h = 0;
+
+ SDL_BlitSurface(exit_text, NULL, screen, &exit_rect);
+
+ state = HMN_WAIT;
+ redraw_board = 1;
+ old_highlight = 0;
+ highlight = 0;
+ active = 0;
+
+ /* GAME LOOP */
+ while (state != GAME_WON) {
+
+ /* check for GTK events... */
+ /* otherwise hildon thinks the app hangs... */
+ while (gtk_events_pending ())
+ gtk_main_iteration ();
+
+ /* figure out if anything important happened */
+ old_highlight = highlight;
+ while (SDL_PollEvent(&event)) {
+ /* BAIL OUT! BAIL OUT! */
+ if (event.type == SDL_KEYDOWN){
+ fprintf(stderr, "event SDL_KEYDOWN found....\n");
+ if ( event.key.keysym.sym == SDLK_q )
+ {
+ fprintf(stderr, "event SDLK_q found....\n");
+ SDL_Event quit_event;
+ quit_event.type = SDL_QUIT;
+ SDL_PushEvent(&quit_event);
+ }
+ }
+
+ if (event.type == SDL_MOUSEBUTTONDOWN) {
+ if ((event.button.button = 1) &&
+ (event.button.y < Y_OFFSET)) {
+ fprintf(stderr, "clicked out side the board in exit area...\n");
+ SDL_Event quit_event;
+ quit_event.type = SDL_QUIT;
+ SDL_PushEvent(&quit_event);
+ }
+ }
+
+ if (event.type == SDL_QUIT) {
+ fprintf(stderr, "event SDL_QUIT found....\n");
+ sdl_clean_up();
+ return 0;
+ }
+
+ /* get events */
+ if (state == HMN_WAIT) {
+ switch (event.type) {
+ case SDL_MOUSEBUTTONDOWN:
+ if ((event.button.button = 1) &&
+ (event.button.y < tile->h) &&
+ (event.button.y > Y_OFFSET)) {
+
+ int pitch=0;
+ pitch = event.button.x / tile->w;
+
+ // pitch 0 and 7 are the homebases which you can't play
+ if ( pitch == 0 || pitch == 7 ){
+ fprintf(stderr, "clicked out side the board...\n");
+ }
+ else{
+ current_move = pitch;
+ state = HMN_MOVE;
+ }
+ }
+ break;
+ case SDL_MOUSEMOTION:
+ if (event.motion.y < tile->h) {
+ highlight = event.motion.x / tile->w;
+ }
+ else
+ highlight = 0;
+ break;
+ case SDL_ACTIVEEVENT:
+ if (event.active.gain == 0)
+ highlight = 0;
+ break;
+ }
+ }
+ }
+ SDL_Delay(DELAY_MAX);
+
+ /* GAME LOGIC */
+ if (gameWon(aiBoard, humanBoard) == 1)
+ state = GAME_WON;
+
+ /* happy happy state machine */
+ switch(state) {
+ case HMN_WAIT:
+ active = 0;
+ if (highlight != old_highlight)
+ redraw_board = 1;
+ break;
+ case HMN_MOVE:
+ human_last_move = move(humanBoard,aiBoard,current_move);
+ play_sound(pick);
+ redraw_board = 1;
+ if (human_last_move == 0)
+ state = HMN_WAIT;
+ else
+ state = CMP_WAIT;
+ printf("Human moving from %d to %d, now %d\n", current_move, human_last_move, state);
+ break;
+ case CMP_WAIT:
+ SDL_Delay(DELAY_AI);
+ active = 1;
+ current_move = aiMove(aiBoard, humanBoard);
+ state = CMP_MOVE;
+ break;
+ case CMP_MOVE:
+ printf("Computer moving\n");
+ ai_last_move = move(aiBoard,humanBoard,current_move);
+ play_sound(pick);
+ redraw_board = 1;
+ if (ai_last_move == 0)
+ state = CMP_WAIT;
+ else
+ state = HMN_WAIT;
+ break;
+ case GAME_WON:
+ if (aiBoard[0] > humanBoard[0]) {
+ if (!(title_text = TTF_RenderText_Blended(title_font,
+ "Computer Wins!", font_color)))
+ fprintf(stderr, "TTF: %s\n", TTF_GetError());
+ }
+ else {
+ if (!(title_text = TTF_RenderText_Blended(title_font,
+ "Human Wins!", font_color)))
+ fprintf(stderr, "TTF: %s\n", TTF_GetError());
+ }
+ redraw_board = 1;
+ break;
+ }
+
+ /* redraw the board if needed */
+ if (redraw_board == 1) {
+ /*printf("redrawing board\n");*/
+
+ /* draw and blit the board */
+ board = DrawBoard(aiBoard, humanBoard, board_font,
+ home_font, tile, stone, active,
+ highlight);
+ if (!board) {
+ fprintf(stderr, "Could not draw the board.\n");
+ }
+ else {
+ // board_rect = SurfaceToRect(board);
+ SDL_BlitSurface(board, NULL, screen,
+ &board_rect);
+ }
+
+ /* draw, center, and blit the title */
+ if (title_text) {
+ title_rect = SurfaceToRect(title_text);
+ title_rect.x = ((screen->w - title_rect.w)/2);
+ title_rect.y = ((screen->h - title_rect.h)/2);
+ SDL_BlitSurface(title_text, NULL, screen,
+ &title_rect);
+ }
+
+ SDL_UpdateRect(screen, 0,0,0,0);
+
+ redraw_board = 0;
+ }
+
+ }
+
+ SDL_Delay(DELAY_AI);
+
+ sdl_clean_up();
+ return 0;
+
}
-/* End main.c */
-/*
- * Main Mancala Program Module Header -- main.h
- * $Id: main.h,v 1.1.2.8 2004/01/16 20:49:30 sparrow_hawk Exp $
- *
- * Copyright (C) 2003 Kevin Riggle
- * http://cmancala.sourcefoge.net
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2, or (at your option) any
- * later version.
- *
- * This program 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
- * General Public License for more details, a copy of which may be found in
- * the file COPYING provided in the main directory of this release.
- *
- */
+/*
+* for Maemo renamed to play.h and adapted (2009, Reto Zingg)
+*
+* Main Mancala Program Module Header -- main.h
+* $Id: main.h,v 1.1.2.8 2004/01/16 20:49:30 sparrow_hawk Exp $
+*
+* Copyright (C) 2003 Kevin Riggle
+* http://cmancala.sourcefoge.net
+*
+* This program is free software; you can redistribute it and/or modify it
+* under the terms of the GNU General Public License as published by the
+* Free Software Foundation; either version 2, or (at your option) any
+* later version.
+*
+* This program 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
+* General Public License for more details, a copy of which may be found in
+* the file COPYING provided in the main directory of this release.
+*
+*/
/* path to resource files */
#define RES_PATH "/usr/share/pixmaps/mancala"
-#define FONT_PATH "/usr/share/fonts/bitstream-vera"
+#define FONT_PATH "/usr/share/fonts/"
/* various constants */
#define STRING_MAX 1000
#define STONE_MAX 10
#define DELAY_MAX 1
+#define DELAY_AI 3000
/* font sizes */
#define TITLE_SIZE 75
#define HOME_SIZE 50
#define BOARD_SIZE 35
-/* End main.h */
+#define HMN_WAIT 1
+#define HMN_MOVE 2
+#define CMP_WAIT 3
+#define CMP_MOVE 4
+#define GAME_WON 0
+
+#define Y_OFFSET 70
+
+extern int play();
+
--- /dev/null
+/*
+ * Sounds Routines -- sounds.c
+ *
+ * Copyright (C) 2009 Reto Zingg
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2, or (at your option) any
+ * later version.
+ *
+ * This program 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
+ * General Public License for more details, a copy of which may be found in
+ * the file COPYING provided in the main directory of this release.
+ *
+ */
+
+#include <stdio.h>
+#include "SDL.h"
+#include "SDL_mixer.h"
+
+int play_sound(Mix_Chunk *chunk){
+ //Play the scratch effect
+ if( Mix_PlayChannel( -1, chunk, 0 ) == -1 )
+ {
+ fprintf(stderr, "Unable to load sound: %s\n",
+ SDL_GetError());
+ exit(1);
+ }
+ else{
+ return 0;
+ }
+}
--- /dev/null
+/*
+ * Sounds Routines Header -- sounds.h
+ *
+ * Copyright (C) 2009 Reto Zingg
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2, or (at your option) any
+ * later version.
+ *
+ * This program 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
+ * General Public License for more details, a copy of which may be found in
+ * the file COPYING provided in the main directory of this release.
+ *
+ */
+
+extern int play_sound(Mix_Chunk *chunk);
+
+