Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - ExarKun

Pages: [1]
1
Window / Re: Question about redrawing the background
« on: July 05, 2017, 06:59:48 pm »
Thank you very much for both of your quick replies!
I am not programming for retro hardware, but rather a retro game on modern hardware. However, my question was of a more general nature rather than actually related to the current state of my project. I just used a very basic example to get my point across. I was just curious if there were any alternatives to the way I'm currently doing it/learned to do it from tutorials.

Thank you very much Hapax, I think what you described in your 2nd paragraph Is exactly what I need. I think that'll be a huge help moving forward. Also thanks for the insight into hardware! Always love to learn new things.

Thanks again for answering my question. Really didn't expect such great answers in so little time!


2
Window / Question about redrawing the background
« on: July 04, 2017, 07:33:44 pm »
Hi!

So this is probably a very basic question and I'm sure it has been answered before, but I wasn't able to find anything. So I recently started doing some SFML and I have a general question about the way things are redrawn each frame. Currently what I have been doing (and what I found in tutorials all over the net) is that you clear the screen with any color, redraw the background and then redraw whatever else you have.
So as a simple example: Let's say I have some random image as a background and a player sprite. What I do right now is use Window.clear() and then I draw the background image and afterwards the player sprite.

Now what I wonder is, isn't there some way to only clear the sprite? Even when talking about a game running at 60 fps it seems awfully inefficient to redraw the background 60 times a second when you really only need to clear the sprite. I thought that maybe there was a way to sorta layer several windows on top of each other. So you'd have one with the background which you never clear and one for the player sprite which you do clear.
Is something like that possible or is it really the default way to clear the entire screen once every frame?
I'm just having a hard time imagining a NES redrawing the background 30 times a second.

Thanks in advance and sorry again for asking what is probably a very basic question. I just couldn't find any answers.

Pages: [1]