GP32 2 things to go until game release


StudioX64

Still Fresh
Joined
Mar 30, 2003
Messages
71
Location
UK
Website
www.studiox64.com
Many thanks out to everyone for all of their great help, this forum has been a god send! - I have 2 problem bits of code to figure out and my game is finally ready for release.

1. I need some code to return my palette back to the GP32 default, after making changes to it. Changes were made using the following code snippet:

h_pal = GpPaletteCreate(256, (GP_PALETTEENTRY*)stxlogo_Pal);
GpPaletteSelect(h_pal);
GpPaletteRealize();
GpPaletteDelete(h_pal);
h_pal = NULL;

2. I need my timer count to run on 1 second intervalls. I am creating a timer using the following code, however when I run it on the GP32 it never quite matches up real time 1 seconds = 1 second etc:

if(GPOS_ERR_ALREADY_USED == GpTimerOptSet(0,6,100,UpdateTimer0)) GpTimerKill(0);
GpTimerSet(0);

My timer interrupt code simply subtracts 1 from the second count each int. Any help would be much appreciated. Thanks in advance.
 
i think GpPaletteSelect returns the previous palette handle much like GDI cr@p in win32
just keep hold of this handle for later when you want to switch back
something like...
Code:
GP_HPALETTE h_pal = GpPaletteCreate(256, (GP_PALETTEENTRY*)stxlogo_Pal);
GP_HPALETTE h_oldpal = GpPaletteSelect(h_pal);
GpPaletteRealize();
GpPaletteDelete(h_pal);
h_pal = NULL;
.
[ do a load of cr@p! ]
.
GpPaletteSelect(h_oldpal);
GpPaletteRealize();
i haven't done anything with timers yet ... but looking at the docs it looks like it should be...
Code:
if(GPOS_ERR_ALREADY_USED == GpTimerOptSet(0,1,0,UpdateTimer0)) GpTimerKill(0);
GpTimerSet(0);
let me know how you get on ... hope it's not all bollocks! :lol:
 
Well I hope the palette thing works cos I have no idea how to do that :) For the timer, you could use GpTickCountGet and mod it with whatever, I think 1000, and if GpTickCountGet % 1000 == 0 then a second has passed exactly.

- Rico
 
Thanks for the code both of you. Feeblez the palette code worked a treat :) - Rico although I didn't use the %1000 I did take your advice and switched to using GpTickCountGet. I just read the time at the start of each level and store, then compare the current tick time - previous read and when >= 1000 I update my second count. Appears to be working fine now. Have to finish testing game over the next couple of hours but hopefully will upload it somewhere this afternoon :) fingers crossed. Thanks peeps!
 
Cool :) Haven't tried it, I will shortly.

As for the % 1000, it does the exact same thing, but I don't suppose you care anymore :)
 
Back
Top