[gcompris] core: added the method gc_score_set_max to set the max score on next call to gc_score_set



commit 5c09d4016efd250c5298c96ba2426edea0fbc6ee
Author: Bruno Coudoin <bruno coudoin free fr>
Date:   Sat Aug 20 12:20:11 2011 +0200

    core: added the method gc_score_set_max to set the max score on next call to gc_score_set

 src/gcompris/score.c |   19 +++++++++++++++++++
 src/gcompris/score.h |    2 ++
 src/gcompris/sugar.c |    7 +++++++
 3 files changed, 28 insertions(+), 0 deletions(-)
---
diff --git a/src/gcompris/score.c b/src/gcompris/score.c
index 748296f..aa53fbb 100644
--- a/src/gcompris/score.c
+++ b/src/gcompris/score.c
@@ -75,6 +75,12 @@ score_end()
 }
 
 static void
+score_set_max(guint gmax)
+{
+  max = gmax;
+}
+
+static void
 score_set(guint value)
 {
 
@@ -180,6 +186,19 @@ gc_score_end ()
         custom_score->end ();
 }
 
+/**
+ * Set a new max score, will be displayed at next call
+ * to score_set
+ */
+void
+gc_score_set_max(guint max)
+{
+    if (custom_score == NULL)
+      score_set_max(max);
+    else if (custom_score->set_max != NULL)
+        custom_score->set_max (max);
+}
+
 void
 gc_score_set (guint value)
 {
diff --git a/src/gcompris/score.h b/src/gcompris/score.h
index e81527a..a0102b6 100644
--- a/src/gcompris/score.h
+++ b/src/gcompris/score.h
@@ -29,6 +29,7 @@ typedef enum
 
 void gc_score_start (ScoreStyleList style, guint x, guint y, guint max);
 void gc_score_end();
+void gc_score_set_max(guint max);
 void gc_score_set(guint value);
 
 typedef struct
@@ -36,6 +37,7 @@ typedef struct
   void (*start) (ScoreStyleList style, guint x, guint y, guint max);
   void (*end) ();
   void (*set) (guint value);
+  void (*set_max) (guint max);
 } Score;
 
 void gc_score_register (Score *score);
diff --git a/src/gcompris/sugar.c b/src/gcompris/sugar.c
index 72b2fda..ba37868 100644
--- a/src/gcompris/sugar.c
+++ b/src/gcompris/sugar.c
@@ -57,6 +57,7 @@ Score sugar_score = {
   score_start,
   score_end,
   score_set
+  score_set_max,
 };
 
 typedef struct {
@@ -349,6 +350,12 @@ score_set(guint value)
 }
 
 static void
+score_set_max(guint max)
+{
+  max_score = max;
+}
+
+static void
 bar_set_level(GcomprisBoard *board)
 {
   if (board == NULL)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]