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

Pages: 1 ... 199 200 [201] 202 203 ... 224
3001
Graphics / Re: Int to string
« on: August 28, 2014, 04:36:45 am »
uses namespaces
using namespace sf;
using namespace std;

then...
sf::RenderWindow window(sf::VideoMode(400, 200), "SFML text test");
sf::Font font;
sf::Text Ttext;
std::string score, score2;
std::srand(static_cast<unsigned int>(std::time(NULL)));
Ttext.setColor(sf::Color::Black);
Pscore = std::rand() % 6;
sf::Event event;

Best suggestion is to remove the "using namespace" lines. It'll still work fine since you're correctly fully qualifying everything already.

3002
Graphics / Re: New renderWindow makes main renderWindow white
« on: August 28, 2014, 04:28:24 am »
My first "solution" should have been:
Sometimes, just adding a renderWindow.clear(sf::Color::Black); immediately after window creation seemed to removed the flash. If not, it can reduce the duration that it is white for.
It's not the ideal solution by any means.

Are you creating a RenderWindow to draw to it and then capture those drawings as an image? Why not use a RenderTexture instead? It does things the same way that a RenderWindow does but doesn't display a window.

3003
General / Re: Smaller window = better performance
« on: August 28, 2014, 12:11:43 am »
Guess no.
*waits 22 hours*
*gets annoyed that people don't solve his problems for him within his allocated time period of less than a day*

3004
General discussions / Re: Randomizer.hpp
« on: August 28, 2014, 12:08:31 am »
what's wrong with std::rand() ?
rand() Considered harmful - http://channel9.msdn.com/Events/GoingNative/2013/rand-Considered-Harmful

std::rand() is okay if you need to populate some data for testing rather than just sequential numbering, but other than that, why not use the STL stuff?

3005
Graphics / Re: New renderWindow makes main renderWindow white
« on: August 28, 2014, 12:05:56 am »
I've noticed this too and my "solutions" were just to make it easier for me to look at, nothing solid really.
1) Sometimes, just adding a renderWindow.clear(sf::Color::Black); seemed to removed the flash. If not, it can reduce the duration that it is white for
2) Bit more work but I end up using this if it annoys me: create a quick fade animation that transitions from white to black (or whichever colour). Looks better than that strobe thing.

3006
Graphics / Re: Does SFML delete sprites that are drawn over?
« on: August 28, 2014, 12:02:14 am »
Vertex arrays are good because they allow you to display multiple things with just one draw() call. They're obviously useful for other reasons too  :P

thats alright i found a solution to my sprite based tile editor.
Are you going to share this solution?

3007
Good to know that you fixed it  :)

I'm not sure I understand what you found as the problem. Is it because you were using pointers to elements in a vector and they were moving when allocating more size?

3008
Graphics / Re: Does SFML delete sprites that are drawn over?
« on: August 27, 2014, 11:55:48 pm »
    Square[0].position = sf::Vector2f(0, 0);
    Square[1].position = sf::Vector2f(32, 0);
    Square[2].position = sf::Vector2f(32, 32);
    Square[3].position = sf::Vector2f(0, 32);

    Square[0].texCoords = sf::Vector2f(0, 0);
    Square[0].texCoords = sf::Vector2f(32, 0);
    Square[0].texCoords = sf::Vector2f(32, 32);
    Square[0].texCoords = sf::Vector2f(0, 32);
 
I assume the second set of Square[] assignments should also be 0, 1, 2, and 3.

3009
General / Re: Drawing a maze from a text file on sfml 2.1
« on: August 27, 2014, 06:38:14 pm »
In the SFML tutorials, there is an example for displaying mapped tiles. As for parsing the text file, you may have to customise your own loader if it's in your own custom format.

3010
Graphics / Re: Does SFML delete sprites that are drawn over?
« on: August 27, 2014, 06:27:41 pm »
What is the list for? The vertex array can display all the tiles, whatever they are (just make sure that all the different tile types are in the same texture/tilesheet), so you just need one vertex array. Have a look at the TileMap example in the tutorial. You can see that every group of four vertices in a vertex array will display a textured quad (assuming you've still set the vertex array's primitive type to sf::Quads).

3011
General / Re: setFrameRateLimit & setVirtualSyncEnabled
« on: August 27, 2014, 01:17:31 am »
Vsync is handed by the graphics card and SFML just informs it that it thinks that it should use it. I'm not aware of a way to find out if the graphics card listened and obeyed though, other than accessing drivers or something. My final suggestion of testing the framerate yourself is a possible way to find out to some degree but some displays can run at a pretty high frequency.

@Ixrec This is a guess but Chrome could be displaying perfectly while the update of the video itself could be tearing. It made sense it my head but seems much sillier now I've written it down.  ???

3012
I think he was suggesting those links be put into the tutorials themselves.
Yeah, I did think that (it probably should be there) but I thought it should be here until then in case someone in the future searches the forum for this information.

3013
Graphics / Re: Does SFML delete sprites that are drawn over?
« on: August 27, 2014, 01:06:32 am »
For a grid, you could use a single vertex array.
Set its type to sf::Lines and then each pair of vertices form the end points of a line. You can then just draw lines from one side to the other and not need to do each tile individually, all in a single vertex array.

3014
sf::Texture texture = renderTexture.getTexture();
doesn't copy the texture?

If i fail even then, i will probably quit sfml, it is probably not for for me.
This is a terrible attitude to have. I have many other words to describe it but I will refrain from doing so.

3015
Image, Texture
Quote
The supported image formats are bmp, png, tga, jpg, gif, psd, hdr and pic.
Some format options are not supported, like progressive jpeg.
https://github.com/SFML/SFML/blob/master/include/SFML/Graphics/Image.hpp

Music, SoundBuffer
Quote
Here is a complete list of all the supported audio formats:
ogg, wav, flac, aiff, au, raw, paf, svx, nist, voc, ircam, w64, mat4, mat5 pvf, htk, sds, avr, sd2, caf, wve, mpc2k, rf64.
https://github.com/SFML/SFML/blob/master/include/SFML/Audio/Music.hpp
https://github.com/SFML/SFML/blob/master/include/SFML/Audio/SoundBuffer.hpp

(as of 26 August 2014)

Pages: 1 ... 199 200 [201] 202 203 ... 224
anything