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 - Construct

Pages: [1]
1
Graphics / First Background image, then Foreground image
« on: November 12, 2009, 03:19:32 pm »
Hi there thanks for your answers :>

Quote
Why don't you just render the stuff that's visible on the screen? There's no need to always draw the whole map.


Mhh when it's not possible with sfml 1.5 (where to get 2.0 btw?) I think i should try that.

Ok then i need to think about it. I though I make a whol map image and when moving out of frame just setting the map's position to -X and -Y ( even though i wanted to draw stuff like dead people, blood, dirt etc.. This stuff would dissapear when moving out of screen and back. when i redraw all visible tiles every frame).

2
Graphics / First Background image, then Foreground image
« on: November 12, 2009, 07:23:16 am »
Hello there, i'm new to sfml :D
Is it possible to create a background image. Then display it and then display another image onto this?

for example:

I create the Background with 64x64 sprites(e.g. small grass sprites)...
Code: [Select]

//Inside game loop
for(int i=0;i <= 1024;i +=64)
{
for(int j=0;j <= 768;j +=64)
{
sprite.setPosition((float)i,(float)j);
app.draw(sprite);
}
}

This works fine, but when i got a map with a dimension of 36326346x35346346 Pixels (;D) this will cost a lot of time...so i want to create the background at first in a separate sprite/image, then create the foreground image and then display the stuff somehow...but i donno how to add "sprite" into another image/sprite with positioning.

Thought of something like this:
Code: [Select]

sf::Sprite tile;
//then loading the image etc...

sf::Sprite background;
for(...)
   background.Draw(tile,x,y);

//Same with foreground

//Mainloop here
app.Draw(background);
app.Draw(AllNPCsAndStuff);
app.Draw(foregound);


it's similar to the RPGMaker. Backgroundtiles first, then the NPCs and then the foreground tiles.

Hope somebody can help me :>

Pages: [1]