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

Pages: [1]
1
Graphics / Re: Drawing pixels
« on: October 06, 2015, 10:56:14 pm »
Oh, I see. I somehow overlooked Texture::update and was sure I'd have to call Texture::loadFromImage every time. I guess I should have read the documentation more carefully. Thank you for help.

2
Graphics / Drawing pixels
« on: October 06, 2015, 10:38:37 pm »
Hello.
I'm making a paint-like tool in SFML. I'd like to be able to draw the canvas as a whole, while being able to change the color of single pixels - and to do it somewhat quickly. The thing is, I can't figure out a way to do this efficiently - using an Image sounded great, until I learned that I'd have to load it to a texture every time I want to change anything. Since I'd be passing millions of vertices, I doubt a VertexArray would be great - unless there's something I'm missing.
So, is there any efficient way of doing it, or am I stuck with lower level libraries?

4
Graphics / Re: Text position and height
« on: March 19, 2015, 08:10:54 pm »
Thank you, this has fixed my problem. I assumed LocalBounds().top would always be 0, which isn't the case there.

5
Graphics / Text position and height
« on: March 19, 2015, 01:25:33 am »
Hello,
I've ran into an issue I have no idea how to resolve.
I have a scoreboard, which is made up of a RectangleShape (back) and three Texts (caption (bold, with bigger font size), names and scores (parallel to names)). The caption is supposed to be centered on top of the rectangle, with names and scores directly below it, and the back is supposed to be 200 pixels wide and exactly as tall as the sum of caption's and names' height (of course I'm going to add some indentation after I resolve this problem).
The problem is that after using the following code (well, the following code is stripped down to the essential parts), nothing besides back's position is what I imagined it to be on the y axis (positions on the x axis work fine). The behaviour caused by this code is pictured in the attachment.
   // Some initialization code I skipped (loading texts and back, tested to work as intended)
   back.setSize(Vector2f(200.f, names.getLocalBounds().height+caption.getLocalBounds().height));
   back.setPosition(pwindow->mapPixelToCoords(Vector2i((int)(pwindow->getSize().x-back.getSize().x), 0)));
   caption.setPosition(back.getPosition().x+(back.getSize().x-caption.getLocalBounds().width)/2, back.getPosition().y); //this text should start at the top of back
   float y=caption.getPosition().y+caption.getLocalBounds().height;
   names.setPosition(back.getPosition().x+indentH, y); //this should move names directly under caption
   points.setPosition(back.getPosition().x+back.getSize().x-indentH, y); //points has origin in upper right corner, in case you were wondering
 
So, is there something I don't understand about the way Text behaves (particularly setPosition() and getLocalBounds())?
If this makes a difference, I haven't moved the project from SFML 2.1 yet, but according to the changelog, nothing changed in this aspect.
Thank you for your attention, hopefully the code is readable.

Pages: [1]
anything