English Amiga Board

English Amiga Board (https://eab.abime.net/index.php)
-   Coders. C/C++ (https://eab.abime.net/forumdisplay.php?f=118)
-   -   Flickering problem (https://eab.abime.net/showthread.php?t=76261)

Sparticle 21 December 2014 12:09

Flickering problem
 
Hi all,

I'm trying to do a Flappy bird clone on classic amiga. I want the game to be played inside a moveable window attatched to a custom screen. For the bird Im using a simple hardware sprite. the background is using an Image structure and the floor which is drawn on top of the background is also an Image struture. I wanted to use an Image instead of sprites for simplicity. Everything is working ok except the floor flickers as its being drawn.

Is there an easy way to do a double buffer using intuition usig the DrawImage() method?

p.s. here's a version I wrote in js http://natashaz-place.bugs3.com
Just wanted to see if I can do similar on amiga:)
Thanks :xmas:xmas:xmas

Hewitson 21 December 2014 14:37

Not able to offer much advice regarding the programming but why would you use a moveable window instead of having the game fullscreen?

Sparticle 22 December 2014 09:07

Quote:

Originally Posted by Hewitson (Post 992931)
Not able to offer much advice regarding the programming but why would you use a moveable window instead of having the game fullscreen?

I just wanted to do it differently. Most games don't use a window so I thought it would be good if you can have the game running and still do other tasks at the same time.

Hewitson 22 December 2014 16:07

Quote:

Originally Posted by Sparticle (Post 993031)
I just wanted to do it differently. Most games don't use a window so I thought it would be good if you can have the game running and still do other tasks at the same time.

But if you're running the game on it's own screen you can do that anyway. The window serves no purpose.

thomas 22 December 2014 16:49

Quote:

Originally Posted by Sparticle (Post 992904)
Is there an easy way to do a double buffer using intuition usig the DrawImage() method?

Set up a temporary bitmap using AllocBitMap, InitRastPort. Then draw into this temp bitmap/rastport and when you are done, blit it into the window using BltBitMapRastPort.

Be warned that an off-screen rastport does not do automatic clipping, so make sure that you don't draw outside of the bitmap's storage.

Sparticle 23 December 2014 04:12

Quote:

Originally Posted by Hewitson (Post 993079)
But if you're running the game on it's own screen you can do that anyway. The window serves no purpose.

Yes true, but you wouldn't be able to position the game where you like on the screen. :)

Sparticle 23 December 2014 04:19

Quote:

Originally Posted by thomas (Post 993084)
Set up a temporary bitmap using AllocBitMap, InitRastPort. Then draw into this temp bitmap/rastport and when you are done, blit it into the window using BltBitMapRastPort.

Be warned that an off-screen rastport does not do automatic clipping, so make sure that you don't draw outside of the bitmap's storage.

Thanks for that its now working nicely :great
Had me baffled for a while though as it was just painting a blank window
This was down to the last parameter of the BltBitMapRastPort method as I was just passing it a 0 instead of 0xC0 for a straight copy.

Thanks


All times are GMT +2. The time now is 16:43.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.

Page generated in 0.04140 seconds with 11 queries