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

Pages: 1 2 [3] 4
31
General / Re: Undefined references with CodeBlocks and MinGW
« on: December 20, 2013, 04:10:29 am »
I found this list in the linked thread:

Using MinGW I did the following setup:

Defines
GLEW_STATIC
SFML_STATIC
UNICODE

Libraries
sfml-audio-s
sfml-graphics-s
sfml-network-s
sfml-window-s
sfml-system-s
sndfile
openal32
jpeg
glew
freetype
ws2_32
gdi32
opengl32
winmm

I've added all these and the SFML libs I compiled the other other day work great now.

Thanks for pointing me in the right direction!

32
General / Re: Undefined references with CodeBlocks and MinGW
« on: December 19, 2013, 06:21:47 pm »
Right on. I'll check that out this evening. Should I post any further questions to that thread or this one?

33
General / Undefined references with CodeBlocks and MinGW
« on: December 19, 2013, 08:37:21 am »
I'm compiling the lastest SFML (commit 4a30054) from source with MinGW which goes fine (I guess -- I get .a files) for use in CodeBlocks (CB). When I attempt to build the project in CB I get several hundred "undefined reference" errors. For example:

Code: [Select]
..\..\libs\SFML-master-build\lib/libsfml-graphics-s-d.a(RenderWindow.cpp.obj): In function `ZNK2sf12RenderWindow7captureEv':
E:/Dev/libs/SFML-master/src/SFML/Graphics/RenderWindow.cpp:92: undefined reference to `glReadPixels@28'
..\..\libs\SFML-master-build\lib/libsfml-graphics-s-d.a(RenderTarget.cpp.obj): In function `ZN2sf12RenderTarget5clearERKNS_5ColorE':
E:/Dev/libs/SFML-master/src/SFML/Graphics/RenderTarget.cpp:61: undefined reference to `glClearColor@16'
E:/Dev/libs/SFML-master/src/SFML/Graphics/RenderTarget.cpp:62: undefined reference to `glClear@4'


I'm following the CMake tutorial when compiling SFML. When I hit the configure button this is my output:

Code: [Select]
The C compiler identification is GNU 4.7.2
The CXX compiler identification is GNU 4.7.2
Check for working C compiler: C:/MinGW/bin/gcc.exe
Check for working C compiler: C:/MinGW/bin/gcc.exe -- works
Detecting C compiler ABI info
Detecting C compiler ABI info - done
Check for working CXX compiler: C:/MinGW/bin/g++.exe
Check for working CXX compiler: C:/MinGW/bin/g++.exe -- works
Detecting CXX compiler ABI info
Detecting CXX compiler ABI info - done
Looking for sys/types.h
Looking for sys/types.h - found
Looking for stdint.h
Looking for stdint.h - found
Looking for stddef.h
Looking for stddef.h - found
Check size of void*
Check size of void* - done
Found OpenGL: opengl32 
Found Freetype: E:/Dev/libs/SFML-master/extlibs/libs-mingw/x86/libfreetype.a (found version "2.4.4")
Found GLEW: E:/Dev/libs/SFML-master/extlibs/libs-mingw/x86/libglew.a 
Found JPEG: E:/Dev/libs/SFML-master/extlibs/libs-mingw/x86/libjpeg.a 
Found OpenAL: E:/Dev/libs/SFML-master/extlibs/libs-mingw/x86/libopenal32.a 
Found SNDFILE: E:/Dev/libs/SFML-master/extlibs/libs-mingw/x86/libsndfile.a 
Configuring done
Generating done

I generate the makefiles and then build SFML with MinGW Make via the command line. I've also tried compiling with GCC 4.6.2 with the same result.

Once I have SFML compiled I'm using the CodeBlocks tutorial to set up a project and build it. When I try to build I get the errors mentioned above. For completeness this the code I have in main.cpp (straight from the tutorial):

Code: [Select]
#include <SFML/Graphics.hpp>

int main()
{
    sf::RenderWindow window(sf::VideoMode(200, 200), "SFML works!");
    sf::CircleShape shape(100.f);
    shape.setFillColor(sf::Color::Green);

    while (window.isOpen())
    {
        sf::Event event;
        while (window.pollEvent(event))
        {
            if (event.type == sf::Event::Closed)
                window.close();
        }

        window.clear();
        window.draw(shape);
        window.display();
    }

    return 0;
}

Based on the error it seems to me that the extlibs shipped with SFML are not getting compiled into the .a files. I've downloaded the MinGW version of SFML 2.1 from the site and the libsfml-graphics-s-d.a file is 3915KB on my computer while the one I compiled from source is 2526KB which would indicate that the official one has something I'm missing.

When I update my project to point to the official libs downloaded from the SFML site my project builds and runs as expected.

I'm not an expert in CMake/C++ but I was able to successfully compile SFML from source around the time 2.0 was released so I know my system can compile SFML correctly.

Does anyone have any idea what I'm doing wrong?

34
Window / Re: Joystick PoV Axes Flipped
« on: November 24, 2013, 09:34:02 pm »
So SFML's orientation is correct and it's obviously not hardware dependent (as long as the hardware follows these guidelines). So question is which orientation should SFML use? How's the orientation on other platforms?

My feeling is that it should be left as-is for a couple reasons.

First, legacy support: this is (probably) how SFML has always worked and it hasn't been an issue til now. While not the best reason this is certainly worth considering.

Second: sf::Joystick is a thin wrapper over each platform's joystick API, as such it shouldn't interpret or normalize data returned by a platform's API. For example, on Windows the 360 pad's triggers report a value of 0 when not pressed but they report a value of -100 when not pressed on Mac. Likewise, button indexes are inconsistent across joysticks and platforms. I feel that sf::Joystick should just report what the system gives it and leave it to the developer to properly interpret that information.

Regardless, making a note of this in the docs is definitely a good idea as this feels like a bug.

35
General / Re: How to load rotated and/or trimmed images from an atlas?
« on: November 23, 2013, 06:30:41 pm »
Use setOrigin on your sprite with a negative value of what the bound box width/height should be.

Here's what I ended up doing. I'm using TexturePacker to create my texture atlas and like the OP I'm using its "trim" feature which removes transparent pixels from source images so that more images can be packed into the atlas while also storing information like "sourceSize" (original size) and "spriteSourceSize" (essentially the offset for the trimmed sprite relative to the original).

In this instance I'm also using a modified version of the AnimatedSprite class from the wiki as I'm working on my game's animations at the moment.

For my AnimatedSprite I'm setting the origin at the center of the sprite as I need to be able to scale the sprite on the x-axis to get left/right versions of the sprite. I set the origin for the AnimatedSprite based on "sourceSize", or the original size of the graphic (i.e., setOrigin(sourceSize.w / 2, sourceSize.h / 2)). For this to work it's important that all graphics in the atlas have the same sourceSize (I suppose it could be made to work otherwise but using the same sourceSize for everything greatly simplifies my life).

Next I added a new class, AnimationFrame, that has three properties an sf::IntRect and two floats, "offsetX", and "offsetY". AnimationFrame replaces the sf::IntRect that is used to define frame sizes in the above-linked AnimatedSprite. AnimationFrame's sf::IntRect defines the bounds of the frame. The offset values are the x/y distances of the top left of the trimmed sprite from the top left of sourceSize. They allow me to properly position the trimmed sprite in the AnimatedSprite.

Finally, in AnimatedSprite::setFrame() the bounds of the frame are used to set the sf::Vertex positions that will later be used for drawing. I've updated this to add the offsetX and offsetY values from my AnimationFrame class to each vertex's position.

I've only had this up and running for a day or so but so far all seems well.

36
General / Re: How to load rotated and/or trimmed images from an atlas?
« on: November 21, 2013, 08:37:57 pm »
I will post more information later, along with the source, once I get all this up and running smoothly, which might take a while, but for now, suffice it to say that it required a Transformable and four points transformed using getTransform().transformPoint(), which is exactly what Sprite uses.

Did you ever post about this? If you did can you provide a link? If not could you provide more details? I'm looking into doing exactly the same thing and I'd love to have a look at how you accomplished this. Thanks!

37
Window / Re: Joystick PoV Axes Flipped
« on: November 21, 2013, 08:35:05 pm »
I can confirm I also have this issue on Windows 8 with SFML 2.0. I compiled from source using mingw.

38
SFML projects / Re: SFML Gamepad Test Utility Application
« on: September 26, 2013, 05:15:36 am »
I've added some buttons mappings to the repo here. Windows only for the moment, but ultimately I'd like to expand the list to include a variety of different gamepads on Windows, Mac and Linux. I only have 360, PS3 and Wii controllers so I'd appreciate any contributions for other controllers.

39
Window / Re: Xbox 360 Controller button/stick mapping
« on: September 18, 2013, 05:17:00 am »
well, for testing I have to write and app

No you don't. I wrote one :)

I started a thread about it here as I figured it'd probably be useful to other folks.

Maybe we should start another thread that is a listing of button mappings for OS-controller combos (the 360 buttons are not all the same on Mac and Windows for example).

40
SFML projects / SFML Gamepad Test Utility Application
« on: September 18, 2013, 05:11:09 am »
SFML Gamepad Test, as the name suggests, is a simple SFML app I wrote to test out gamepad functionality in SFML. Recently a question about mapping Xbox 360 gamepad buttons was asked in the Window subforum so I thought I'd post my code here so others would have an app for quickly testing out which button was mapped to which index in SFML.

The code is up on Github. I'm using the app with Xcode (clang) on Mac OSX Lion and CodeBlocks (gcc 4.6) on Windows 8. I don't have a ton of C++ experience so your mileage will almost certainly vary if you're using anything else ;)

41
General / Re: Problem Loading External Files - CodeBlocks
« on: August 21, 2013, 07:58:45 pm »
Could you recommend some commonly used methods and/or tutorials on how to package external resources?

Here's a quick rundown of how I do this on Windows using CodeBlocks and OSX using Xcode. I'm far from an experienced expert, my current project being my first C++ project but this system is working well for me so far.

On OSX applications are typically distributed in an app bundle. An app bundle is actually just a folder with the extension "app" that OSX recognizes and effectively treats as a file (though you can easily dig into it). I mention this because app bundles have an expected layout described here and my game is currently targeting Windows and OSX (and Linux when I get around to installing it).

As OSX has an expected layout and Windows doesn't I go with the OSX layout so everything lives in the same place regardless of platform. Also the OSX layout happens to be quite logical and nice. So all my audio, graphics and other external resources live in a folder called "Resources" in the final binary.

On Windows I use a tool called exe-packager to package my exe, dlls and resources into a single exe file. You can set the working directory with exe-packager but I haven't quite worked out exactly how I want to do that. You'll probably want to write a batch script to automate packing everything up with exe-packager.

When setting up a project I use premake which allows me to describe my project with a single configuration file and then generate specific IDE projects from that. On Windows I generate a CodeBlocks project, on Mac an Xcode one. Premake uses Lua as a scripting language and provides a script API to do things like detect which OS you are generating from and do OS-specific things.

In my premake script I make sure to include my Resources folder in the project and CodeBlocks automatically picks it up and my resources load just fine. Xcode works a tad differently (of course) so I ended up writing a script that gets run after a successful build that copies all my resources into the app bundle.

42
General / Re: GUI solutions for GUI-intensive games
« on: July 09, 2013, 01:40:31 am »
Two I'm aware of that are SFML-specific are SFGUI and TGUI.

43
Just curious, how is it with PS3 controller? Anybody tested that?

I've done some testing with the PS3 pad on Windows (specifically Windows 8 ) and Mac OS (specifically 10.7). Haven't had a chance to do anything on Linux yet.

Windows

On Windows the PS3 pad won't "just work". To get the pad to work you need the MotionInJoy driver. The driver allows you to use the PS3 controller as a DX (assuming this is DirectInput) device and emulate the 360 controller (XInput).

Using the DX the triggers (L2 and R2) share a single axis but they also report digital button presses the same as pressing the X button. I noticed that the right analog stick only reports the correct values along its x-axis in this configuration. I'm getting values along y but they are not what I would expect.

In XInput mode the PS3 pads functions identically to the 360 pad -- everything works great except L2 and R2 share an axis.

All of the above is using the default configurations provided by MotionInJoy. In DX mode there are quite a few configuration options (you can customize the tilt controls offered by the SixAxis for example) and I was able to get L2 and R2 to report on different axes and resolve the issue with the right analog stick.

If you're determined I think you can make the PS3 pad fully functional with SFML on Windows in DX mode but it would hardly be "plug and play": you have to use a third-party driver that has annoying ads and you have to root around in said driver's unintuitive interface changing a bunch of settings.

To be clear this is a driver issue so I don't think there is much that can be done on the SFML end to remedy it.

Mac OS

Mac OS (since 10.6 I think) supports the PS3 pad out of the box via Bluetooth. This video explains how to pair the pad with OSX:



By default all the buttons work but L2 and R2 report as digital button presses not analog axes. I haven't spent much time playing around with the PS3 pad on the Mac so I'm not sure if you can configure it or not.

44
To make it clear for other readers: XBox controllers are supported, it's just that triggers are merged into a single axis instead of being two separate axes.

You are right of course. Aside from the triggers 360 pads work just fine. I should have written:

Quote
it would be nice to have full 360 gamepad support.

45
That sounds about right.

I realize adding support for one specific gamepad probably isn't the highest priority but it would be really nice to have 360 gamepad support. I suspect 360 pads are one of the more popular gamepads on Windows as they're readily available and they just work on Windows.

That said, lack of XInput support is far from a deal breaker for me though. It's more a "nice to have".

Pages: 1 2 [3] 4