Commit bb59d481 authored by Christian Persch's avatar Christian Persch

Make clutter in aisleriot optional.

svn path=/trunk/; revision=8178
parent 84ec7559
......@@ -17,20 +17,11 @@ scm_DATA = \
bin_PROGRAMS = sol
sol_SOURCES = \
baize.c \
baize.h \
board.c \
board.h \
card.c \
card.h \
card-cache.c \
card-cache.h \
conf.c \
conf.h \
game.c \
game.h \
slot-renderer.c \
slot-renderer.h \
sol.c \
stats-dialog.c \
stats-dialog.h \
......@@ -40,6 +31,24 @@ sol_SOURCES = \
window.h \
$(NULL)
if HAVE_CLUTTER
sol_SOURCES += \
board.c \
baize.c \
baize.h \
card.c \
card.h \
card-cache.c \
card-cache.h \
slot-renderer.c \
slot-renderer.h \
$(NULL)
else
sol_SOURCES += \
board-noclutter.c \
$(NULL)
endif
if !HAVE_GUILE_1_8
sol_SOURCES += guile16-compat.h
endif
......@@ -59,8 +68,6 @@ sol_CPPFLAGS = \
sol_CFLAGS = \
$(GTK_CFLAGS) \
$(CLUTTER_CFLAGS) \
$(CLUTTER_GTK_CFLAGS) \
$(GUILE_CFLAGS) \
$(AM_CFLAGS)
......@@ -70,8 +77,6 @@ sol_LDFLAGS = \
sol_LDADD = \
$(top_builddir)/libgames-support/libgames-support.la \
$(GTK_LIBS) \
$(CLUTTER_LIBS) \
$(CLUTTER_GTK_LIBS) \
$(GUILE_LIBS)
if HAVE_HILDON
......@@ -95,6 +100,11 @@ sol_CFLAGS += $(GHTREAD_CFLAGS)
sol_LDADD += $(GTHREAD_LIBS)
endif
if HAVE_CLUTTER
sol_CFLAGS += $(CLUTTER_CFLAGS)
sol_LDADD += $(CLUTTER_LIBS)
endif
desktop_in_files = \
sol.desktop.in.in
......
......@@ -33,11 +33,14 @@
#include <glib.h>
#include <glib/gi18n.h>
#ifdef HAVE_CLUTTER
#include <clutter/clutter-actor.h>
#endif
#include "conf.h"
#include "util.h"
#include <libgames-support/games-runtime.h>
#include <clutter/clutter-actor.h>
#include "game.h"
......@@ -238,13 +241,17 @@ clear_slots (AisleriotGame *game,
for (i = 0; i < n_slots; ++i) {
Slot *slot = game->slots->pdata[i];
#ifdef HAVE_CLUTTER
if (slot->slot_renderer) {
clutter_actor_destroy (slot->slot_renderer);
g_object_unref (slot->slot_renderer);
}
g_byte_array_free (slot->cards, TRUE);
g_byte_array_free (slot->old_cards, TRUE);
#else
g_ptr_array_free (slot->card_images, TRUE);
#endif /* HAVE_CLUTTER */
g_byte_array_free (slot->cards, TRUE);
g_slice_free (Slot, slot);
}
......@@ -579,7 +586,6 @@ cscmi_add_slot (SCM slot_data)
slot->id = scm_to_int (SCM_CAR (slot_data));
slot->cards = g_byte_array_sized_new (SLOT_CARDS_N_PREALLOC);
slot->old_cards = g_byte_array_sized_new (SLOT_CARDS_N_PREALLOC);
slot->exposed = 0;
slot->x = scm_num2dbl (SCM_CAR (SCM_CADR (SCM_CADDR (slot_data))), NULL);
slot->y = scm_num2dbl (SCM_CADR (SCM_CADR (SCM_CADDR (slot_data))), NULL);
......@@ -590,6 +596,12 @@ cscmi_add_slot (SCM slot_data)
slot->expanded_down = expanded_down != FALSE;
slot->expanded_right = expanded_right != FALSE;
#ifdef HAVE_CLUTTER
slot->old_cards = g_byte_array_sized_new (SLOT_CARDS_N_PREALLOC);
#else
slot->card_images = g_ptr_array_sized_new (SLOT_CARDS_N_PREALLOC);
#endif
slot->needs_update = TRUE;
/* this will update the slot length too */
......@@ -2068,6 +2080,8 @@ aisleriot_game_deal_cards (AisleriotGame *game)
aisleriot_game_test_end_of_game (game);
}
#ifdef HAVE_CLUTTER
void
aisleriot_game_get_card_offset (Slot *slot,
guint card_num,
......@@ -2101,3 +2115,5 @@ aisleriot_game_reset_old_cards (Slot *slot)
g_byte_array_append (slot->old_cards, slot->cards->data, slot->cards->len);
slot->old_exposed = slot->exposed;
}
#endif /* HAVE_CLUTTER */
......@@ -24,7 +24,10 @@
#include <gdk/gdktypes.h>
#include <libgames-support/games-card.h>
#ifdef HAVE_CLUTTER
#include <clutter/clutter-actor.h>
#endif
G_BEGIN_DECLS
......@@ -34,9 +37,11 @@ typedef struct {
int id;
GByteArray *cards;
#ifdef HAVE_CLUTTER
/* The old state of the cards so we can check for differences */
guint old_exposed;
GByteArray *old_cards;
#endif /* HAVE_CLUTTER */
/* the topmost |exposed| cards are shown on the pile */
guint exposed;
......@@ -58,8 +63,13 @@ typedef struct {
/* The location in pixel units. Filled in by the scaling code. */
GdkRectangle rect;
#ifdef HAVE_CLUTTER
/* Actor for the slot */
ClutterActor *slot_renderer;
#else
/* GdkPixbuf* or GdkPixmap*, no reference owned */
GPtrArray *card_images;
#endif /* HAVE_CLUTTER */
guint expanded_right : 1;
guint expanded_down : 1;
......
......@@ -33,7 +33,10 @@
#include <gtk/gtkicontheme.h>
#include <gtk/gtkmain.h>
#include <gtk/gtkmessagedialog.h>
#ifdef HAVE_CLUTTER
#include <clutter-gtk/gtk-clutter-embed.h>
#endif
#ifdef HAVE_HILDON
#include <libosso.h>
......@@ -538,7 +541,10 @@ main_prog (void *closure, int argc, char *argv[])
games_sound_enable (FALSE);
games_sound_add_option_group (option_context);
#ifdef HAVE_CLUTTER
/* FIXMEchpe: use option group instead */
gtk_clutter_init (&argc, &argv);
#endif
g_option_context_add_group (option_context, gtk_get_option_group (TRUE));
#ifdef WITH_SMCLIENT
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment