PROGRAMMING > Freebasic

TinyPTC and FPS

(1/4) > >>

ttemper:


So I've been messing with some more code using TinyPTC++, and with much thanks to Raizor, the variable width scroller is now working as intended.

When blitting my scroller to screen and vsync on, its a constant 60fps. But since I've added in a 800x600 res background graphic that blits to screen in replacement of 'ERASE BUFFER', the fps slows to ~50fps.

My question is...

Is there a way to blit a full screen image using a faster technique in order to keep the screen synced to the refresh rate of the monitor?

Fullscreen mode is 800x600, my background image is also this size. Scroller only at 60fps, nice and smooth, add in the background image and its 50fps and not smooth. :/

Attached is a couple of screen shots 'so far'

*note.. 100% of the graphics I drew from scratch.

Shockwave:
You could use memcpy, it's part of crt.bi I think so you'd just need to include crt.bi and then use memcpy to copy from one buffer to another.  That's going to be one of the quickest and simplest ways of doing it.

Also if you're not drawing over the whole screen you could just erase and update the parts that are moving.

ttemper:
@Shockwave, ok thanks, I'll google around and have a read.

For every two steps forward I seem to take one step backwards. I'm slowly learning though, and I'ts a lot more involved than I thought.

Shockwave:
You should be able to find at least half a dozen examples of memcpy on this forum if you use the search box.  I'd post the links but I'm using my phone to post sorry.

ttemper:
Yeh, I did search on here and did find a few examples... but yet again I'm stuck. I'll figure it out in time I guess. Not real sure how to set it all up just yet. Feeling absolute 'meh' too due to illness doesn't help my cause either.

I think I really need to sit down and study tiny_ptc.bi, windows.bi, crt.bi etc to actually get to grips with understanding what they all do first and the functions, as all these pointers and memory swapping tends to get me lost very quick at the moment.

Although in the hunt for things, I noticed that I can use

--- Code: ---MEMSET(@BUFFER(0),0,XRES*YRES*4)
--- End code ---
to clear the screen from crt.bi, so I will be able to use screen coordinates to only clear the part of the screen which is moving if needed.

Thanks again guys.

*EDIT...

So I've messed around with memset (haven't touched memcpy yet), and I've 'sorta got' a solution, it's not entirely what I wanted, but it did speed up the fps from ~41fps to ~180fps (fullscreen mode was vsynced to 60fps).

What I did was put my...

--- Code: ---BGDRAWIMAGEDATA(0,0)
--- End code ---
outside of the loop (before the "do"), then inside the loop, I changed...

--- Code: ---ERASE BUFFER
--- End code ---
to

--- Code: ---MEMSET(@BUFFER(800*390),&h808080,800*840)
--- End code ---
which works, but again, not entirely what I wanted, as it chops out the bottom part of the background, and just replaces it with the colour RGB(80,80,80).

A screen shot is attached to show the overall screen after the memset changes.

More learning to follow..... :)

Navigation

[0] Message Index

[#] Next page

Go to full version