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

Pages: 1 2 [3] 4 5
31
SFML projects / Re: OO Sprite Batch
« on: January 22, 2015, 10:08:03 am »
I think you missunderstood me.

SpriteBatch has a std::vector<sf::Vertex>

Sprite has Pointers to the vertices in SpriteBatch with std::vector<sf::Vertex *>.

So if SpriteBatch should reallocate its vertices, the Pointer in Sprite won't be valid anymore.

Please correct me if I got it wrong.

But I didn't see, that he won't add elements to his SpriteBatch-Vector if a certain size is reached (in which case he will just return an nullptr). So the Pointers in the return will stay valid.

std::array<sf::Vertex*, 4> SpriteBatch::addSprite()
{
if((spriteNum + 1) * 4 <= vertices.size())
{
unsigned int s = spriteNum * 4;
spriteNum++;
return {&vertices[s], &vertices[s + 1], &vertices[s + 2], &vertices[s + 3]};
}
else
return {nullptr};
}

32
SFML projects / Re: OO Sprite Batch
« on: January 21, 2015, 03:06:02 pm »
I think you might have a problem with invalid pointers in certain situations.

You use:
vertices = batch.addSprite();
where vertices ist a vector<sf::Vertex *>.

But if your Vertex-vector in SpriteBatch gets reallocated because it grows to big, your Pointers in the Sprite wont be valid anymore.

33
Nice video.

In my current project, I'm storing my entities in a heap (vector of unique_ptr).

Storing the entities cintiguously sounds interesting. but I'm wondering if sorting the atoms, marks etc. might turn out to be more inefficient than using a heap.

What if you don't delete the dead entities, but keep track of their index in a vector and just overwrite them, when you create new entities. That way each entity would keep its index.

34
General / Re: SFML 2.1 doesn't receive events
« on: November 20, 2014, 04:14:21 pm »
How do you check, if the program even gets to the "inputManager->Update()" line?

AFAIK yor renderWindows needs the Focus the get your Events.
So if you are debugging in your IDE, your renderWindow won't get any events.

35
If by "grid" you mean a map, you should take a look at the tilemap-example:

http://sfml-dev.org/tutorials/2.1/graphics-vertex-array.php#example-tile-map

(tough it will ne adjustments to handle changes)

36
Graphics / Re: RenderTarget - Multiply mode?
« on: August 20, 2014, 02:58:10 pm »
Yes,

RenderTexture.draw - draws to the RenderTexture
RenderWindow.draw - draws to the RenderWindow


Don't forget to call RenderTexture.display(), after you draw everything to your RenderTexture.

37
SFML website / Re: Youtube embedded videos not working
« on: July 30, 2014, 10:59:03 am »
As far as I know, not all videos on YouTube support HTML5.
Some of them still require Flash.

38
As far as I know. GLSL throws away unused variables.
So even if you have a variable in your shader-source, it might be missing at runtime, if it is not used.

39
Graphics / Re: Using View and TextureRect: pixel line glitch
« on: May 20, 2014, 04:41:42 pm »
Your texture is smoothed.

Disable it by using
tex.setSmooth(false);

40
Graphics / Re: Strange behavior when I draw a chequered design
« on: April 24, 2014, 01:13:45 pm »
So you don't handle that event in your code?

41
Graphics / Re: Strange behavior when I draw a chequered design
« on: April 24, 2014, 12:46:12 pm »
What do you do, when you resize your window?

42
General / Re: Flickering
« on: April 24, 2014, 09:46:09 am »
Change
world.Step(1.0f / 60.0f, 3, 3);
does not help.
I understand that the processing speed in Box2D and the problems SFML.
Here's what will happen if to do so
world.Step(0.5f / 60.0f, 3, 3);

I meant to use a clock, to get the exact time elapsed, not just to use another hardcoded timestep.

Something like this:
sf::Clock clock;
...
   world.Step(clock.restart().getElapsedTime().asSeconds(), 3, 3);

43
General / Re: Flickering
« on: April 23, 2014, 02:48:51 pm »
world.Step(1.0f / 60.0f, 3, 3);

You use 1/60 as your hardcoded timestep.


So when your step doesn't need exactly 1/60 seconds you might get your flickering.

Try to fix your timesteps and see if the flickering is gone.

44
SFML projects / Re: The 8-Bit Encounter
« on: April 15, 2014, 11:28:00 am »
Thanks. The art used in the game comes from various sources on the Internet (I did modify the colors a bit though), so kudos to the artists who decided to release their work under the CC license.

I don't want to be picky, but at least the caracters are part of the Liberated Pixel Cup at OpenGameArt.org
http://opengameart.org/content/lpc-medieval-fantasy-character-sprites
And the Creator marked them as CC-BY-SA license, so you should name the Author accordingly.

45
Graphics / Re: How to draw a single pixel?
« on: March 25, 2014, 04:21:37 pm »
You could use a VertexArray of Points.

Pages: 1 2 [3] 4 5
anything