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

Pages: 1 ... 639 640 [641] 642 643 ... 721
9601
General / Re: [linux] Dedicated server / run in Console
« on: September 23, 2012, 02:25:11 pm »
Well sfml-graphics depends on sfml-window, so I don't really see how you could've successfully build your application without linking against sfml-window.

You probably shouldn't create a second version, but refactor your original one and separate the logic fully from the graphic (e.g. by using the MVC pattern), so it would be very easy to drop the graphics part and just run the game as server... ;)

9602
Audio / Re: Best way to use Sound?
« on: September 23, 2012, 01:09:46 pm »
I will need shot sounds and maybe other little sounds too, but what's better, a single Sound instance which plays these little sounds when is needed -stopping the previous one if is necessary- or an instance for each type of sound: shot, attack, bird, ....
It depends on what you want to do. If there can be multiple sounds at once, then use multiple objects, otherwise one instance should be enough.

Ah btw, when I run my program, even if I dont declare any sound, any music or anything that relies to audio, I hear a continuous BEEE in my speakers :S
I guess that 'BEEE' is just a high pitched humming, right?
Some graphics card can produce such strange noises (somehow) when they are at their limits.
Try to use window.setFramerateLimit(60); or similar.

9603
Window / Re: How do I get the dimensions of a window?
« on: September 23, 2012, 01:06:32 pm »
Well if the function has no reference/handle to the window, how should it get information from it?
Global objects should not be used and calling OS specific APIs shouldn't be done either.
Easiest part is to either pass in the dimension of the window (e.g. sf::Vector2i) or pass the whole window as reference (e.g. foo(const sf::RenderWindow& wnd)).
If you only need the size then you should only pass the size, if you need more than you can pass a reference  to the whole window.

9604
General / Re: Top Down car movement help
« on: September 23, 2012, 11:57:08 am »
Movement is basic stuff and doesn't have that much to do directly with programming, but it's rather a logical part.
If you had Googled a bit on your own, I bet you would've found some sources in no time. ;)

9605
General / Re: Threads and Drawing
« on: September 23, 2012, 08:09:30 am »
There are quite a few boundaries you have to keep track un a mulithreaded enviroment, so it may not be the most trivial although it might seem to work you still can have race conditions etc.
If you should do it depends highly on what your game is all about and if it's worth it. You might get a boost in FPS but then again the FPS count probably is alright already without the seperat threads...

9606
General / Re: Top Down car movement help
« on: September 23, 2012, 07:53:11 am »
So you're asking how to program a game? ???
We can help you with that, but explaining how everything works is not really our task. There are many open source games for which you can look at the code and learn how to do things, then there are many, many books about game programming. Google will also reveal quite a lot of information.

As for SFML you can look at the official tutorials, the wiki section and the documentation to understand what you can do and how.

9607
Graphics / Re: Shapes problem
« on: September 23, 2012, 02:06:07 am »
Update CMake to the latest version and it will have that option. ;)

9608
Graphics / Re: is it possible to subtract a texture from an other
« on: September 22, 2012, 06:37:16 pm »
He meant that you don't call clear() and display() in ever iteration.

Lets take an easy analogy:
The window is a piece of paper with a drawing on it. The render texture is another piece of paper on top of the other one and it is just black.
Now to see what's underneath you go and cut out some parts of the black paper. After that you can look through that cutout part onto your window.

What you did in the code with the vector is. Everytime you've cut out a square, you threw away the black paper with the hole and took a new black paper and cut out the next hole. Obviously you'll always just see one hole (since you've thrown the other holes away).

What you actually want is to take the black paper, punch as many holes as you want into it and the overlay it  with the drawing paper.

Got it? ;)

9609
General / Re: Weird sf::Font problem
« on: September 22, 2012, 06:31:54 pm »
If you have use Visual Studio, then use the Visual Studio compiler, you attach it to the application and when the application crashes the debugger will tell exactly which functions call where made till the crash occurred (= call stack).
Are you using the SFML 2rc binaries?
If so try to initialize the sf::Text objects directly (i.e. in the initialization list of the constructor) with your own font, so that no default font can get loaded.

9610
General / Re: Weird sf::Font problem
« on: September 22, 2012, 06:17:59 pm »
It depends on what causes the error which one could find out with a debugger...

I guess it's something with cleaning up the context etc. Are you using global objects at some point?

Also do you both have either an ATI or a Nvidia graphics card?

9611
General / Re: Weird sf::Font problem
« on: September 22, 2012, 06:05:53 pm »
sf::Font is a resource and thus should not be copied around, when you pass with not as reference nor as pointer (nor with move sematics) you pass it by value, i.e. you get a copy of the original. This doesn't work with OpenGL, so you create one and pass references to that one object around.
Now why exactly it crashes, I can't really say... ;)

now i understand that a const will not be deleted...
This is wrong, const only means that 'it' can not change. The 'it' can either relate to pointers, values or functions. You may want to google a bit for const correctness.

9612
Graphics / Re: is it possible to subtract a texture from an other
« on: September 22, 2012, 05:58:40 pm »
Please make use of the code=cpp tag!! :)

You still don't understand how it works, don't you? Please at least try to understand it! ;)
You only have to clear and display the render texture once and not with every single light...

9613
General / Re: Weird sf::Font problem
« on: September 22, 2012, 05:46:03 pm »
Is there a way i can pass a sf::Font via parameters?
Yes as (const) reference or (smart) pointer.

void foo(const sf::Font& font)

9614
SFML projects / Re: Crazy Painter
« on: September 22, 2012, 05:31:35 pm »
Yes it works without crash. ;)

9615
General / Re: Weird sf::Font problem
« on: September 22, 2012, 05:20:53 pm »
I bet it's some problem in your state machine/manager, which we can't find out with the given code, also we don't really want to dig through your code, thus it's probably the easiest if you'd just go on it on your own, with a debugger and by minimizing the codebase. ;)
The debugger/call stack will tell you exactly where the problem originated from and by taking away all the parts that don't have anything to do with the error, you end up with a small/minimal example that reproduces the error.
If it's a problem with SFML itself then it's mostly possible to reproduce the problem with a simple main function. ;)

Are you making sure that the state doesn't get freed/deleted before the member variable aren't used anymore? Otherwise you'd end up with an invalid object, which can blow things up quite easily. ;)

Pages: 1 ... 639 640 [641] 642 643 ... 721
anything