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

Pages: [1]
1
General discussions / Re: SFML 2.5.0 released
« on: May 10, 2018, 01:07:57 pm »
Oh okay, thanks for the response!

2
SFML projects / Re: Squatbot: A Mobile Platformer
« on: May 10, 2018, 01:08:40 am »
wow, looks really clean! Not bad, wish you the best success! :)

3
General discussions / Re: SFML 2.5.0 released
« on: May 10, 2018, 12:59:50 am »
Awesome, thanks for the ongoing development of this marvelous project!!  ;D

Haven't tried out 2.5 yet, but have a little question: On the previous version the kind and versionf of the compiler (IDE) was irrelevant, as far as I remember. Now the download page says "The compiler versions have to match 100%!", what has changed that made the downloads compiler-dependent? :)

4
Window / Re: Resizing window without having its content stretched?
« on: June 11, 2017, 09:03:14 pm »
Oh, then I'm sorry. I searched in the RendererWindow docu (https://www.sfml-dev.org/documentation/2.4.2/classsf_1_1Window.php#ab94ea32f22d15c0df11588e319de2546) but couldn't found it, my fault..

But thanks for the quick answer!!

5
Hallo again SFML community,

I ran into another problem. I made a project that starts in a window where multiple mini games are displayed, from which you can choose from which to start. Depending on the the game which is selected I wanted to resize the existing window through using the .setSize(sf::Vector2()) function.
But everything gets stretched with it, is there a way to prevent this (Except opening up a whole new window and shutting the old one down)?

Thanks in advance, I hope this wasn't asked already.

6
General / Re: Question about life time of sf::Texture
« on: May 28, 2017, 08:54:22 pm »

hmm..
I think I will stick with the current method, even if I have to consider to afterwards delete the textures properly as working with pointers tends to lead to memory leaks if I remember correctly..

Or I just make another static vector living on the class scope which just holds the textures, that would be what you said if I understood correctly..

Thanks for the quick response, it kinda makes sense now in hindsight, but okay: It always does afterwards :D!

7
General / Question about life time of sf::Texture
« on: May 27, 2017, 11:38:21 pm »
 ;DHello everybody,

first post by me.

In my project, I have a class that should handle Sprites that are made of a pixel array.
The class has a vector of Sprites, which is looped over and the individual Sprites should be drawn every update cycle. Now I made a method that creates new sprites of the pixel array and pushes them onto the vector.

sth like this (shortened pseudocode version):
Quote from: pseudecode

void CSpriteHandleClass::createButton(/*params*/){
sf::Image image;
sf::Sprite sprite;
sf::Texture texture;

//create UInt8 pixel array & fill it
//create image from the pixel array
//set texture from the image
//set sprite from the texture

global_spritevector.push_pack(sprite);

}

(in main it loops over the vector and draws every sprite)


When I then run the code, everything seemed okay except that the texture of the sprite had no color (it should've been red, as I filled it that way). I found out, that if I declare the Texture in the pseudocode as a pointer (sf::Texture* texture = new sf::Texture) it would work and the colors showed up.

I guess the Sprite is only storing a pointer to the texture which dies when getting out of the scope (method)?

But why does the Sprite itself live on and the Texture not? They should both be copied into the vector I thought, so technically even as a non-pointer the data should be there, doesn't it?? I looked up the reference (https://www.sfml-dev.org/documentation/2.4.2/classsf_1_1Texture.php#details) but except "it lives in the graphics card" nothing regarding the life time of the texture object is said. I'm really confused, would love if someone could help me understand whats going on.

Greetings!


Pages: [1]