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

Recent Posts

Pages: [1] 2 3 ... 10
Graphics / Re: Inheritance of sf::Sprite
« Last post by Haze on Today at 06:27:59 pm »
Sprite objects do not own a copy of a texture object (and do not allocate textures objects), they only point to an already existing texture.

From sprite setTexture documentation:

The texture argument refers to a texture that must exist as long as the sprite uses it. Indeed, the sprite
doesn't store its own copy of the texture, but rather keeps a pointer to the one that you passed to this function.

Multiple sprite objects can point to the same texture. You need to manage life cycle of your texture objects separately, and you should not attempt to deallocate textures when a sprite is deleted.
General / Re: To keep a RenderWindow's partial region unrefreshed
« Last post by Irunfold on Today at 06:07:07 pm »
That is what i did, but since il developing in C#, the process of copying pixels one by one is rather slow, for an area of 770x770, i dropped from 50fps to 15fps using SetPixel , the loop alone in c# spends lots of time to go through..
General / Re: To keep a RenderWindow's partial region unrefreshed
« Last post by Laurent on Today at 05:58:17 pm »
Can't you provide a HDC to an off-screen area to the external app, let it do whatever it wants there, and use it as a source to update a sf::Texture whenever it is changed? This way you don't really mix SFML and the external app on the same surface.
System / Big O of sf::Clock::restart()
« Last post by xanderxylona on Today at 05:48:31 pm »
How fast is sf::Clock::restart()? That is to say, what is O(n) where n is the amount of times restart() is called? I am predisposed to assume that all ∆ time incurrence is linearithmic, but I'm not sure this is true for SFML.
Graphics / Inheritance of sf::Sprite
« Last post by xanderxylona on Today at 04:13:40 pm »
I'm trying to make an AnimatedSprite class that inherits sf::Sprite and provides some auxiliary functions to make animation easier. In the docs it doesn't look like sf::Sprite has any destructor whatever with exception of those inherited from sf::Drawable and sf::Transformable. Should I call
delete getTexture()
or leave it alone and let it automatically call ~Drawable?
General / Re: To keep a RenderWindow's partial region unrefreshed
« Last post by Irunfold on Today at 04:13:16 pm »
Thank you for your answer Laurent, that is an interesting suggestion.

TL;DR : 2 likely possible issues using this method:
  • Area flicker between Display() and the external app to finish its drawing
  • External app probably refreshes only some parts of the area each frame

Long version:
I am not sure yet, but I could maybe ask for the client to adapt his external app's code to refresh the window right after I trigger an event meaning "I just called Display(), now you need to draw/refresh your area again".

Although the issue will probably be a flickering display, because, during the short time interval between my event and the external app to finish its drawing, there will be something else drawn by the SFML on the screen, different than what the client intends to display.

Also, I don't know yet either but the external app might be redrawing only some parts of the area (the area I want to share and keep unrefreshed). In this last case, asking the external app to refresh after the SFML redraw would not work.

I am currently waiting for an answer from the client which develops the external app and I will come back when I will have more information.
SFML projects / SFML Daily Show
« Last post by Chris Jozwiak on Today at 01:59:36 pm »
Hey guys!
I'm planning on creating a daily show on my youtube channel making sfml videos kinda like tutorials but more just fun video's about game developmemt. It's going to be challenging keeping them in short episodic pieces. I was wondering if anyone here could give me some support once i start going with it. That stated, wondering if therea a certain place om the forum I could post each video where it didn't get in the way but where people would find it also. I'd also like to do q  & a once a week atleast. Thoughts?
General / Re: SFML Game Development Chapter 3 question
« Last post by Laurent on Today at 07:49:43 am »
I haven't read the book, but most likely derived classes will override it and put something meaningful inside. The base class, an abstract scene node, has nothing to draw itself.
General / Re: To keep a RenderWindow's partial region unrefreshed
« Last post by Laurent on Today at 07:46:51 am »
What can I do?
Have you external app refresh its area whenever you redraw with SFML.
General / SFML Game Development Chapter 3 question
« Last post by Pantasilea on Today at 05:01:18 am »
I don't understand: why in the class SceneNode the member function drawCurrent() is empty, but it seems it has functionality.
The book says (page 58):
We also provide a new virtual function drawCurrent() which only draws the current object (but not the children).

The function definition is (in the GitHub https://github.com/SFML/SFML-Game-Development-Book/blob/master/03_World/Source/SceneNode.cpp):
void SceneNode::drawCurrent(sf::RenderTarget&, sf::RenderStates) const

        // Do nothing by default


Also, this is quite the chapter haha.
Pages: [1] 2 3 ... 10