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

Pages: [1]
1
Graphics / Problems with Display
« on: September 28, 2009, 10:07:11 pm »
Quote from: "Tank"
Quote from: "Laurent"
Quote
So is there a way to take an area of the screen and redisplay it each frame without having to redraw every string?

Not in SFML 1.x. SFML 2 will provide solutions to this kind of problems.

By using render-to-image or another solution?


Done, and it works and gives me 300 FPS (not as good as before but not a problem).

2
Graphics / Problems with Display
« on: September 28, 2009, 01:29:01 pm »
What I'm trying to achieve is a roguelike made in SFML so that eventualy it can easily use sprites instead and also because it's a hell of a lot easier than a curses library.

So what I'm doing is displaying a string for each tile of the roguelike and each of these tiles is stored inside a Tile class with tile classes stored in the RogueGrid class called defGrid. (In fact I've just had a thought that may help to optimize it as I think I may be making a new string in every tile while I could just use one for the RogueGrid and change it for each tile after drawing it.)

3
Graphics / Problems with Display
« on: September 28, 2009, 11:09:17 am »
The thing is I want to cut down on the amount of rendering of a particular part of the screen. A large section of it is made up of sf::Strings which have only a single character so it runs quite slowly when rendering it (about 8 FPS) but if I do what I do now it is faster (700 FPS+, I have managed to have it work but it's different each time the app is run).

So is there a way to take an area of the screen and redisplay it each frame without having to redraw every string?

4
Graphics / Problems with Display
« on: September 28, 2009, 09:32:02 am »
I also get it for the following code which does draw something each frame:

Code: [Select]
sf::Shape Rect = sf::Shape::Rectangle( 0, 650, 50, 675, sf::Color( 255, 0, 0 ) );

while( 1 )
{

//App.Clear( iniFile.GetColorSfBg() );

sf::Event Event;
while( App.GetEvent( Event ) )
{

if( Event.Type == sf::Event::Closed )
{

App.Clear();
App.Close();
defGrid.XYGridPointers.clear();
return 0;

}

}

float FrameRate = 1.f / App.GetFrameTime();
std::stringstream FPSString;
FPSString << (int)FrameRate;

App.Draw( Rect );

sf::String Text( FPSString.str(), MyFont, iniFile.GetFontSize() );
Text.SetPosition( 0, 650 );
Text.SetColor( iniFile.GetColorSfFg() );
App.Draw( Text );

if( defGrid.HasChanged() )
{

App.Clear( sf::Color( 0, 255, 0 ) );
defGrid.Draw( App, MyFont, iniFile );

}

App.Display();

}

5
Graphics / Problems with Display
« on: September 27, 2009, 11:42:00 pm »
I'm having problems with the Display function of RenderWindow.

Every other call seems to display something strange while the other call displays what it should. Is there anything I might be doing that would cause this?

This is my main loop, if anything else is needed then i can post it but otherwise there is a fair amount of code:

Code: [Select]
while( 1 )
{

sf::Event Event;
while( App.GetEvent( Event ) )
{

if( Event.Type == sf::Event::Closed )
{

App.Clear();
App.Close();
defGrid.XYGridPointers.clear();
return 0;

}

}

if( defGrid.HasChanged() )
{

App.Clear( sf::Color( 0, 255, 0 ) );
defGrid.Draw( App, MyFont, iniFile );

}

App.Display();

}

Pages: [1]
anything