PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

Problems with compiling Conan's sprite example

Lord Dagger · 16 Jul 2005, 12:55 UTC
Hi to all! I have a compiling problem with the Conan's sprite example
http://www.sundialsoft.freeserve.co.uk/pocket_frog_Ch4.htm
I'm using Pocket Frog 0.81 and have already fixed some function calls as mentioned in this tread: http://www.pocketmatrix.com/forums/viewtopic.php?t=17619&postdays=0&postorder=asc&start=30
But the app crashes on the display->Update(); call here:
Code:

// fade out the text
int blend = 10;// start blend amount
for (int x = 0; x < 16; ++x)
{
display->SetBlending(blend);//transparent rect over key pressed
display->FillRect(m_screen,Color(10,1,129));
display->Update();
blend+=2;// change blend amount
Sleep(70);// pause in between fades
}

The display->GetBackBuffer() call before display->Update doesn't help...
How could I fix it?
Nice to see another Dagger from Moscow ;)

pDisplay->Update(); in 0.8.1 should be called after the pDisplay = GetDisplay(); and if I remember correct it will crash in Init.

So call pDisplay->Update() at the end of GameLoop(only once per loop not in for()) and only aftere GetDisplay();

That is another difference of PF0.8.1

And do NOT call GetDisplay(); in GameInit, as I remember it could also lead to unexpected crash
Lord Dagger · 16 Jul 2005, 13:53 UTC
BIGBEN wrote:Nice to see another Dagger from Moscow ;)

pDisplay->Update(); in 0.8.1 should be called after the pDisplay = GetDisplay(); and if I remember correct it will crash in Init.

So call pDisplay->Update() at the end of GameLoop(only once per loop not in for()) and only aftere GetDisplay();

That is another difference of PF0.8.1

And do NOT call GetDisplay(); in GameInit, as I remember it could also lead to unexpected crash

Hmm... In there are some SetDisplayDevice() & LoadImage() calls in GameInit, so if I remove the GetDisplay(); it doesn't work:(
However, then I removed the display->Update from loop, the app still crashes...
Code:
// fade out the text
int blend = 10;// start blend amount
for (int x = 0; x < 16; ++x)
{
display->SetBlending(blend);//transparent rect over key pressed
display->FillRect(m_screen,Color(10,1,129));
//display->Update();
blend+=2;// change blend amount
Sleep(70);// pause in between fades
}

Debugging says that after display->FillRect(m_screen,Color(10,1,129)); function call
Code:
m_raster->FillRect( *m_surface->m_buffer, r, color );
try to operate on empty buffer.
Maybe I need to make more complicated changes in the GameLoop?
Lord Dagger · 16 Jul 2005, 13:59 UTC
Here are the sources. Excuse my disturbing you, but maybe you can take a look on it?
Attachments:
sprites.rar (5 KB)
Ok here is small patch that will help the app compile in PF081 (compiles and runs on my PC)

Please try it also on PPC and if it has no crash (because of multiple Updates and GetDisplay in main loop) then it's OK.

If everything works well, then I ask Conan to post this small fix on his page for the users of PF081 ;)
Attachments:
sprites081.zip (8 KB)
I use several getDisplay() calls in my gameInit - I just make sure a have an Update() for each...
It seems you are right, in old times I just used GetDisplay without Update in GameInit, just to get a pointer (which was valid in non-PHAL frog).
Lord Dagger · 16 Jul 2005, 21:11 UTC
BIGBEN wrote:Ok here is small patch that will help the app compile in PF081 (compiles and runs on my PC)

Please try it also on PPC and if it has no crash (because of multiple Updates and GetDisplay in main loop) then it's OK.

If everything works well, then I ask Conan to post this small fix on his page for the users of PF081 ;)

Your update works fine on my PC (compiled with Visual Studio 2003) and on Pocket PC 2002 emulator(compiled by eVC++ 3.0)
So thank you very much!
But on my Cassiopeia 200 image is heavily flickering, and the are some opacity glitches on the bottom of the screen - it remains to be blue, but then you press the Jog button corresponding message appears for a few seconds. I'l try to make a screenshot and upload it here...
P.S. - All the original samples from Pocket Frog 0.8.1 and your game !PIROMANIA! worked fine...
Lord Dagger · 16 Jul 2005, 21:19 UTC
Here is it...
Attachments:
capture002.jpg
offtop
That must be my Evil Twin... hey, wait, i am evil... it's must be my good twin :D
Hey guys (about evil ;) ) - what the other members would think about russians, when there are already two "Daggers"(!) (heh, well, there are still no "Clubs" or "Torches" :lol: )

But wait a minute, hmmmm the BIGBEN, such a strange nickname...

Hey, I want a miniben twin!

To The Lord Dagger:

This could happen because of GetBackBuffer in the code, but it's only for older devices (such as my Casio E-125 or probably E-200).
So it's better to clear the whole screen and just draw on it.
The PocketFrog alpha sample (with a girl with a shell) also would run different on E-125 and some modern device. The girl at the start would be blended over the black or over the previous background screen (the one you saw before tapping the alpha.exe).
Lord Dagger · 17 Jul 2005, 07:24 UTC
DaGGeR wrote:offtop
That must be my Evil Twin... hey, wait, i am evil... it's must be my good twin :D

[offtop]Hmm... Take a look on it:
http://www.uniqueandunusualgifts.com/dragon-lord-dagger.html
http://www.kultofathena.com/images/HK248.jpg
It's nice, isn't it? :) However, it's not a true origin of my nick;)
Remeber good old 80-th, the age of BBS and text rpg's... And the age of the great "computer rebels", such as KnightLegion or Dark Dante 8)
The time had passed, and it's the memory :roll:
[/offtop]
Lord Dagger · 17 Jul 2005, 07:35 UTC
BIGBEN wrote:Hey guys (about evil ;) ) - what the other members would think about russians, when there are already two "Daggers"(!) (heh, well, there are still no "Clubs" or "Torches" :lol: )

If we are italians, maybe that's right, but I think it's really hard to associate
the "russian" and the "dagger" :D
But wait a minute, hmmmm the BIGBEN, such a strange nickname...

Hey, I want a miniben twin!

To The Lord Dagger:

This could happen because of GetBackBuffer in the code, but it's only for older devices (such as my Casio E-125 or probably E-200).
So it's better to clear the whole screen and just draw on it.
The PocketFrog alpha sample (with a girl with a shell) also would run different on E-125 and some modern device. The girl at the start would be blended over the black or over the previous background screen (the one you saw before tapping the alpha.exe).

Maybe you are right. Can you take a link of that alpha sample?
I'll try to perform the additional testing.. Compability with older hardware is also important..
It's "alpha" sample in PocketFrog_0_8_1
Lord Dagger · 18 Jul 2005, 19:44 UTC
BIGBEN wrote:It's "alpha" sample in PocketFrog_0_8_1

I've tested this sample and all othes that uses BackBuffer. It works correctly, but the girl is blended over the black screen in the beginnig..
But this effect is on all platforms, such as PC, emulator and the Pocket PC. So I think that it works properly.
The problem is in the 'improper' source maybe :lol:
If I remember correct, on my E-125 the girl would be blended over previous seen background(not black). Maybe because E125 has no backbuffer(?) and all the updates come directly to the screen(?)
Lord Dagger · 21 Jul 2005, 07:49 UTC
BIGBEN wrote:If I remember correct, on my E-125 the girl would be blended over previous seen background(not black). Maybe because E125 has no backbuffer(?) and all the updates come directly to the screen(?)

Maybe. But the E125 is much older than E200, so it's technical capabilities is lower too.