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.


Topics - NoobsArePeople2

Pages: [1]
1
Graphics / Graphics or Icons in sf::Text
« on: May 02, 2014, 08:25:49 pm »
I'd like to display a label with the following text:

Quote
Press ENTER to start

But have "ENTER" be a graphic that looks like an enter key. I'd like to be able to do similar things with, say, a graphic of the left mouse button. The text in this graphic shows something similar to what I'd like to achieve:


I'm looking for some input on the best way to achieve this in SFML. What I've come up with so far is to either implement a bitmap font and use special characters that I wouldn't otherwise use in the text of my game (e.g., ~) as stand-ins for my graphics. In this case the actual text would be:

Quote
Press ~ to start

and in the bitmap font the ~ character would be the enter graphic. This is somewhat hacky but I can live with that, the real downside is that I'd have to implement a bitmap font myself.

Another possibility to is to expand on a TTF font, adding the icons similar to an icon font like Font Awesome. On the upside this doesn't require me to implement anything in SFML but now I'm mucking around editing fonts.

Either way, getting this to work is going to involve some work on my part. So I'd like to hear some critiques of my two ideas and some thoughts from others about how to approach this issue.

2
Window / Exposed Joystick Name, Product ID and Manufacturer ID
« on: January 04, 2014, 04:59:41 am »
I've made an update to expose the name, product ID and manufacturer ID for joysticks. This is ticket #152 on Github. The commit with these changes is on my fork of SFML.

I'm a C++ noob so I'd like to get a good code review of this change before doing a pull request. Also, I haven't been able to properly test this on Linux (it compiles in VM but by VM software doesn't allow me to connect USB devices) so I'm not certain it functions properly on that platform. If a pull request is preferrable to this forum post let me know and I can do that.

The Changes

JoystickCaps has been renamed JoystickInfo. In addition to the name change three properties have been added to it:

1. name: the name of the joystick.
2. manufacturerID: the joystick manufacturer's ID.
3. productID: the product ID of the joystick.

sf::Joystick has three new functions that correspond with these values:

1. getName(unsigned int index): return the name of the joystick at index as an sf::String.
2. getManufacturerID(unsigned int index): returns the manufacturer ID at index as an unsigned int.
3. getProductID(unsigned int index): returns the product ID at index as an unsigned int.

Testing

I've been using this update on Mac OS and Windows for awhile and all is well (for me anyway). The Linux implementation compiles but I'm running Ubuntu in a virtual machine and am unable to connect USB devices to it so I cannot put it to the test.

Platforms

On the Mac side of things I'm running 10.7 Lion with Xcode 4.6. I'm compiling with C++11 support using Clang.

On Windows I'm running Windows 8 x64 with Mingw 4.6.2.

On Ubuntu I'm running 13.10 x64 with GCC 4.8.x.

Controllers

I've tested with the following controllers (drivers listed in instances were the manufacturer does not provide one for the platform):

- Xbox 360, wired (Windows, Mac via Tattiebogle v0.08 Driver)
- Xbox 360, wireless (Windows)
- PS3 (Windows via Motioninjoy v0.7 Driver, Mac)
- Wiimote, no attachments, with nunchuck, with classic controller (Mac via WJoy v0.7.1 Driver)



I feel good about the Mac and Windows implementations. Can someone please give the Linux version a try and let me know how/if it works?

3
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?

4
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 ;)

Pages: [1]