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

Pages: 1 [2] 3 4 ... 15
16
General / Re: Clamp to Screen
« on: April 27, 2011, 05:11:54 am »
To start, your function is done wrong. Decipher the commented code below for more info.
Secondly, you should always return something by default which fixes the problem referenced above anyways.
Code: [Select]
float Clamp(float value, float min, float max)
{
    if(value < min)
    {
        return min;
    }
    if(value > max)
    {
        return max;
    }
    // WRONG: (original)
    //if(min <= value || value >= max)
    //{
    //    return value;
    //}
    // CORRECT: (edited)
    //if(min <= value || max >= value)
    //{
    //    return value;
    //}

    return value; // default return
}


Unless you show more code, the only other potential problem I see is that your player variables have different names.
Code: [Select]
   playerPositionX = Clamp(playerPositionX, 0, windowWidth);
    playerBoundingBoxY = Clamp(playerPositionY, 0, windowHeight); // Intended to be playerPositionY?

17
General / Linking to libsfml-system on linux
« on: April 27, 2011, 04:54:06 am »
I think you need a "-o" and an application name in there if it's like MinGW.

g++ -I/home/wasalski/SFML-1.6/include first.cc -o first -L/home/wasalski/SFML-1.6/lib -lsfml-system

18
General / libgcc_s_dw2-1.dll missing ?
« on: April 26, 2011, 04:00:37 pm »
The reason I said "-static" needs to be used on newer versions is from personal experience.

I've had my SFML 1.6 projects compile without needing additional DLLs on Windows with my initial MinGW tool chain that came with my IDE;
but, after updating to the latest SFML 2 and MinGW version, the "-static-libgcc" option was not enough and "-static" was.

19
System / Overhead of sf::Thread::Launch
« on: April 26, 2011, 06:40:58 am »
Code: [Select]
void ThreadFunc()
{
    while (!ShouldRun)
        sf::Sleep(0);

    // Do stuff here!
}

20
General / libgcc_s_dw2-1.dll missing ?
« on: April 26, 2011, 06:33:46 am »
It's a linker option. You need to put "-static-libgcc" where CodeBlocks wants you to put additional linker options.
The command needs to be renamed to "-static" on newer GCC versions. I doubt you have a "newer" version though.

21
Quote from: "Laurent"
Wrong, the problem arises when trying to create the texture.

I was under the impression that the textures weren't created until they were first used. I read the source code and understand that I was wrong now.

Quote from: "Laurent"
This is impossible, because if you split a texture into several pieces then you need several sprites to draw it.

... or just one sprite that uses several different OpenGL textures to draw itself.

22
Quote from: "krisando"
[Possible bug]
When giving an image to the sprite constructor and then change to a smaller one. If the first image was a larger image than your video card can handle, it will crash on drawing. Seems to remember something from the constructor, maybe just size of image?

If you're using SFML 2.0, you might have to set the "adjustToNewSize" parameter to true when using SetImage with an image that is smaller than the previous image that the sprite's size was adjusted to. That's just a guess I have as to what your problem may be.

23
It's a good idea for SFML to handle this internally, splitting textures into multiple internal textures if their size is too big for the hardware.

24
There is an interesting read here on some new stuff coming to SFML to make this easier.

I think you can do it with the current SFML 2.0 and SFML 1.6 by loading the large image and then making smaller copies of the large image using the copy member function.
There is no problem with loading images with massive sizes in SFML 2.0; the problem lies with drawing them.

25
Graphics / Blurring effect when Mario is jumping
« on: April 22, 2011, 07:41:43 pm »
I don't think I can help you, but I downloaded your game just to check it out and there is no blurring effect for me.

Maybe, you just perceive a blurring effect because of the high velocity. Try limiting the FPS to 24 and, if that works, to 60 or use vertical synchronization.

Edit:
Theoretically, this shouldn't matter because the monitor cannot update more than the refresh rate set by your operating system. It's just an idea of something to try.

26
General / missing -l-lfsml-system?
« on: April 22, 2011, 01:14:30 pm »
Get rid of the dashes in the libraries, ex. "-sfml-system"->"sfml-system"

There is two possible ways to write out libraries to link depending on where you're writing it to, the command version and the plain version.
I think you're writing it in an area that doesn't want the command version.

The command version is "-lsfml-system"
The plain version is "sfml-system"

Quote from: "seerex"
-lfsml-system and -lfsml-graphics

Also, I didn't notice before, but you spelled "sfml" wrong...

Try both the command version and plain version to see what works.

27
General / missing -l-lfsml-system?
« on: April 22, 2011, 09:47:00 am »
Please read the official tutorial here if you have not already.

Quote from: "seerex"
Now when i try to compile and run this, it says it cannot find -l-lfsml-system?

This indicates that you didn't setup your linker setting(s) correctly.

Quote from: "seerex"
it says it cant find audio.hpp

This indicates that you didn't setup your compiler search directory correctly.

Quote from: "seerex"
in my build options added -lfsml-system and -lfsml-graphics

Try using "sfml-system" instead of "-lsfml-system" for both libraries and also add "sfml-window" since the graphics library depends on it. They need to be in the right order too because the graphics library depends on the window library and the window library depends on the system library. The graphics library should be the left-most (or top-most) library to achieve the correct order as per dependencies.

28
Network / Good idea for a network thread?
« on: April 21, 2011, 04:09:57 am »
Can a socket be ready more than once in the while loop?
Code: [Select]
while (socket.Receive(blah, blah, blah)) // or socket.Receive(blah)
    Blah();

29
Graphics / SFML 2.0 flickering textures
« on: April 21, 2011, 04:06:31 am »
Your math is wrong. I printed out the values each frame and sometimes the view is moving backwards when going forward in the same direction.

Note that SPEED * time can give a number less than 1.

This might have something to do with implicit conversions if you truly can't find anything wrong with your math.

30
Window / Fullscreen app sometimes does not start in focus
« on: April 21, 2011, 03:34:59 am »
Sometimes I feel like I have a similar problem without full screen enabled on Windows XP, but it has happened so rarely that I think I'm just tired when it happens.

My problem is that sometimes the application doesn't gain focus, but is visible and see-through (I can see the applications behind it) until I tab into it.

Pages: 1 [2] 3 4 ... 15