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

Pages: 1 [2] 3 4 ... 11
16
General / Re: Why getOrigin() doesnt return current position of object
« on: January 09, 2019, 10:12:43 pm »
No, i know what is setOrigin and getOrigin,
Why getOrigin after setOrigin and moving object doesnt return current pos of origin?

Because getOrigin returns origin. If you have a (50, 50) sized rectangle and setOrigin(25, 25) to place the origin at the center of the rectangle, and then position the rectangle at (1000, 1000) world coordinates, getOrigin would return (25, 25) and getPosition would return (1000,1000). What you are doing by setting origin is changing which pixel of the rectangle will be "sitting on" (1000, 1000).

17
General / Re: Why getOrigin() doesnt return current position of object
« on: January 08, 2019, 07:39:46 am »
You seem to be confusing get functions and set functions. You can consult the official tutorials for examples:

https://www.sfml-dev.org/tutorials/2.5/graphics-transform.php

18
Feature requests / Multiple Colors in sf::Text
« on: January 06, 2019, 09:26:10 am »
Would it be possible to have sf::Text use multiple colors? As far as implementation goes, it could hold a vector of strings instead of one and you could do something like

txtObject.addString("str", sf::Color::Red)

instead of just setString().

19
Graphics / Re: Quick sf::RenderTexture question
« on: January 05, 2019, 12:48:28 pm »
Points well taken. Thank you very much for the replies.

20
Graphics / Re: Quick sf::RenderTexture question
« on: January 05, 2019, 11:40:09 am »
To imagine that, look at any 3D game with a reasonably complex scene, and try to estimate how many different surface textures you see on the terrain, models, and UI. Even if some of them share an actual hardware texture, you can still do a lot.

In the end, just run a test to see if it's killing performance. It's hard to estimate the impact without knowing the specifics, but I would not optimize prematurely if it makes your application considerably more complex.

As far as I know, a professionally-made game like that would use texture arrays and have the entire scene be drawn in a single draw call, but that's not really something I know much about.

I usually see advice like "don't go over 10 draw calls if you're making a mobile game" online. If I stop batching now, the UI alone will have up to 10 texture changes along with all the font / text state changes.
I feel like I can save a ton time if I prepare my classes to batch / group stuff properly while I'm still coding.

21
Graphics / Re: Quick sf::RenderTexture question
« on: January 05, 2019, 07:32:22 am »
I'm rendering into it every frame with 2 different textures and text with differing sizes/colors so I batch it as if I was batching for opengl state changes like so:

draw texture 1 for each open panel
draw text font 1 size 1 color 1 for each open panel
draw text font 1 size 2 color 1 for each open panel
draw text font 1 size 2 color 2  (so on and on for all differently colored/sized text)
draw texture 2 for each open panel (this has to be on top of text)

It would be so convenient to have each panel draw its own texture1, texts, and texture2; but if the cost of texture switching is the same as actual rendering, then I don't even have to bother testing this way because it's just too many texture changes it would definitely kill performance.

22
Graphics / Quick sf::RenderTexture question
« on: January 04, 2019, 07:58:50 pm »
I'm confused about something: If I'm drawing everything into sf::RenderTexture first, do I still need to batch for performance (like minimizing state changes) or does it not matter? I thought it did, but now some source is telling me that it doesn't matter because it's pre-rendering.

23
Graphics / Re: Glyph space inconsistency is killing me
« on: January 04, 2019, 10:46:24 am »
Yes, but what I mean is: is there the same extra gap between 'V' and 'e' with all the fonts you tried?

If you look at my attachment at the second post you can see that the word "Versus" is more consistent with that particular font. No extra space between V and e.

24
Graphics / Re: Glyph space inconsistency is killing me
« on: January 02, 2019, 10:05:44 pm »
Is the inconsistent spacing consistent with different fonts? I mean, if you print the same words with different fonts, does the spacing look to be the same? Or are the results totally random?

I did comparisons with a number of fonts and there are inconsistencies in most of them. For example with the last font I tried, in the phrase "Versus the AI" there was an obvious space between the "V" and the "e". I compared it to PS and Word and noticed that, at character size 15, there was a 1 pixel gap between the "V" and the "e" where as the rest of the phrase was the same length. All the fonts I tried look perfectly fine in PS and Word.

25
Graphics / Re: Glyph space inconsistency is killing me
« on: January 02, 2019, 04:14:24 pm »
I have been doing a lot of letter spacing and line spacing tests since I started this topic. SFML's rendering often looks downright absurd. Just look at the attachment in my original post where "not" and "yet" look like they have spaces between them where as the word "available" looks fine. If I narrow down the letter spacing, then the word "available" looks absurd by the time the two other words look normal.

SFML has other issues when the comes to fonts as well: it seems utterly random which monospace font will work and which will not.

26
Graphics / Re: Glyph space inconsistency is killing me
« on: December 23, 2018, 10:15:42 am »
Easier to read example with white font in the attachment.

As you can see (especially if you zoom in), some glyphs have the same spacing as photoshop while some have more (hence why I call it inconsistent)

(sorry for double post, meant to edit)

27
Graphics / Glyph space inconsistency is killing me
« on: December 23, 2018, 10:01:25 am »
See attached picture please.

sf::Text::setLetterSpacing isn't helping because the overall space sizes between glyphs is inconsistent.

Is there a way to fix this?

28
General / Re: SFML cicrle movement
« on: December 22, 2018, 06:27:07 pm »
body.move( -sin(body.getRotation()*3.14159265 / 180)*-3, -cos(body.getRotation()*3.14159265 / 180) * 3);

I don't know what that is but my advice is to read the official tutorials such as:

https://www.sfml-dev.org/tutorials/2.5/graphics-transform.php

29
Graphics / Re: The RectangleShape outline is always red
« on: December 22, 2018, 06:23:17 pm »
If StackOverflow has taught me anything, it's this:

The code in your question MUST meet the following criteria

1. The code must compile and run when you copy/paste it to an empty (sfml-linked) project.
2. The code must reproduce the problem.

When both criteria are met, you will usually be able to see the solution before even finishing your post.

Even if you can't, you increase your chances of getting a solution from someone else by a zillion percent.

30
General / Re: How do I make a text box which only accepts numbers?
« on: December 14, 2018, 08:59:32 am »


This may shock you but pollEvents() polls events  [emoji14]

Yeah of course, and it is also encapsulated for a reason.

Sent from my SM-G950F using Tapatalk

I don't get your point.

ps I'm not too smart.

Pages: 1 [2] 3 4 ... 11
anything