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

Pages: [1] 2 3 4
1
Window / Collision Detection 2.0
« on: February 06, 2012, 07:19:14 pm »
I wouldn't throw away the bounding box approach either.  Since collision detection is such a CPU intensive action it works well to use a mult-tier approach.  Check for a collision with the bounding boxes first; if it returns a hit then run the check for a pixel collision on those objects to see if they are actually intersecting.  This way you're not wasting processing time on checking for pixel perfect collisions when the objects aren't even near each other.

2
Window / odd error
« on: February 01, 2012, 08:11:17 pm »
Two things stick out to me looking at your example.  

1) Your program doesn't really do much; there isn't a loop it keep it running.  It's just going to exit right after it starts.

2) I don't think you can use those WinAPI functions, SetCursorPos and mouse_event, like that inside a SFML window.  SFML has a built-in mouse class for that purpose.

3
System / Linker error at sf::Time
« on: January 21, 2012, 02:07:18 am »
I just updated my copy from git and I get that same error from sfml-network and this one from sfml-audio:

Code: [Select]
SoundStream.obj : error LNK2019: unresolved external symbol "public: static class sf::Time const sf::Time::Zero" (?Zero@Time@sf@@2V12@B) referenced in function "private: bool __thiscall sf::SoundStream::FillAndPushBuffer(unsigned int)" (?FillAndPushBuffer@SoundStream@sf@@AAE_NI@Z)

4
Graphics / Depth information
« on: January 20, 2012, 06:13:46 am »
No, it doesn't have a depth buffer; however, you can control depth by the order in which you draw items.  If you need an object to appear under another object simply make sure you draw it first.

5
SFML projects / Mappy tilemap engine playback library port for SFML
« on: January 19, 2012, 10:52:07 pm »
That's strange.  It's just a simple static variable that is private to the SFMLMappy class.  I can't think of a reason why you would get an error like that; I've only seen that message when trying to write to a pointer that is out of bounds.

6
SFML projects / Mappy tilemap engine playback library port for SFML
« on: January 03, 2012, 11:32:08 pm »
Quote from: "Neomex"
And how does it handle drawing many sprites? Is it actually able to run over 60fps with 1024x768 screen fullof 16bit tiles? Does it use OpenGL to render it or SFML graphics?


That really depends on a lot of things such as the power of your video card and how many layers you are trying to draw at once.  The 1.6 version is using SFML sprites for rendering so there is some overhead there.  Also, mappy supports multi-frame animations for tiles so it needs to redraw every tile every frame for that.

7
SFML projects / Mappy tilemap engine playback library port for SFML
« on: December 13, 2011, 04:39:32 am »
Sorry, but I haven't upgraded the playback library for version 2 yet.  I've been waiting for the graphics API to stabilize before I dive in and see what has changed.  

It's possible someone else has already modified it to version 2 for their own use, but I haven't been notified.

8
Graphics / Incredibly slow colored tile rendering. optimization help?
« on: March 05, 2011, 07:30:33 pm »
I'd hate to say it, but it's probably the netbook graphics chip that's the problem; especially if it's Intel.  They have absolutely abysmal opengl support.

I have an Asus netbook model and all SFML programs are pretty much unusable on it running at the same 2~5 fps.

9
Graphics / Drawing thousands of sprites
« on: March 05, 2011, 07:07:54 am »
You can speed things up by putting all of your tiles into sprite sheets with one sprite for each sheet and another data structure to hold the subrect coordinates for each tile.  Then to draw you just load the subrect for that tile into the sprite for its sheet and draw it to the screen.  That should cut back some on the opengl call bottleneck that you are seeing.  

I'm actually working on a system to dynamically create sprite sheets based on the max texture size supported by a users video card for my own tile engine for this very same reason.

10
Graphics / Good way to make sprite sheets? (not really programming)
« on: February 28, 2011, 04:39:45 pm »
Or just download a program to do it for you.  Here's the first one I found from a simple google search.  

http://spritesheetpacker.codeplex.com/

11
Graphics / Draw seems to be not correct.(sprites)
« on: February 13, 2011, 05:49:55 pm »
In the example code you posted, you're not disabling the bilinear filtering on the image which adds the 1 pixel black line around it.  This is definitely something you have to set on every image loaded for use as a tile map.

In your example just change your image loading code to this and try it again:

Code: [Select]
sf::Image grass;
if(!grass.LoadFromFile("images/grass.png"))
    return EXIT_FAILURE;
grass.SetSmooth(false);
sf::Sprite spr_grass(grass);
sf::Sprite spr_grass2(grass);
sf::Sprite spr_grass3(grass);
sf::Sprite spr_grass4(grass);
sf::Sprite spr_grass5(grass);
sf::Sprite spr_grass6(grass);

12
Graphics / Dull Image
« on: January 14, 2011, 05:46:42 pm »
I believe you can do this with opengl shaders as well.  Take a look at the SFML PostFX class if using 1.6 or the Shaders class if using 2.0

13
General / SFML fps runs very low
« on: January 10, 2011, 10:23:02 pm »
Did you happen to compile it in debug mode?  It's usually that or outdated video drivers that cause slow frame rates.

14
General discussions / How to make an sprite go to correct direction
« on: December 18, 2010, 07:09:37 am »
You need to use trigonometric functions to determine the trajectory of your shots.

If you take the sine(angle) it gives you the ratio of change in the y-axis.
If you take the cosine(angle) it gives you the ratio of change in the x-axis.

So, you can update the position with something like this (pseudocode):

sprite.x += cos((double)angle*3.14159/180.0)*speed
sprite.y += sin((double)angle*3.14159/180.0)*speed

I think that's basically about right.   I can't remember if the results need to be converted to match the screen coordinate system or not.

15
Graphics / LoadFromFile Error
« on: December 16, 2010, 06:49:48 pm »
You can also check what the max texture size of your card is by running this bit of code and looking at the value of texSize:

Code: [Select]
GLint texSize; glGetIntegerv(GL_MAX_TEXTURE_SIZE, &texSize);


Also, SFML does throw an error to std::cerr when you try to create a texture that is too large.

Pages: [1] 2 3 4