[Glade-users] a code problem




I am working on a fruit machine game.  I have a trial version of one 
working already in doze.

I am in the process of adapting the CBuilder/C++ code for Linux.  My 
CBuilder is an old version and rather than shelling out the thousand bucks 
version X with a Linux compiler would cost I chose to learn a new language 
instead.  As a diehard minimalist, I don't want my Linux version to have 
any unnecessary dependencies.

I have the start of a Linux version underway using Glade and GTK+.  But I 
am stumped at the basic level of getting the form to remember a number.  I 
have a button which increments a number and then reloads its icon.  But it 
only works once because as far as I can tell the number keeps resetting to 
0.  It's like I am stuck with a static no matter what I do.  I want it to 
be global and permanently changeable for the duration the form lives.

Here's how the number is declared and used in my original sources file 
added to the Glade project.  Other methods in my .c file do work.

/* in the .h file  */
volatile int tobet[2];


/* the .c file function */

int upBet(void)
{
   const int tbets[7] = { 1, 2, 3, 5, 10, 15, 25 };
   int ubet = tobet[0];
   ubet++;
   if (ubet > 6) ubet = 0;
   tobet[0] = ubet;
   tobet[1] = tbets[ubet];
   hiRoll(ubet, (tbets[ubet]));
}


I have tried it with uninstantiated declarations in a header, within and 
without a struct.  I always get the same result.

Have I forgotten something in my method-driven haste?  Do I need a signal 
for this?

Screenshots of the game are at http://home.ozconnect.net/skull/.

Cheers!

Paul Kielly. 





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