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

Pages: 1 ... 11 12 [13] 14 15 ... 34
181
Graphics / Re: A question about VertexBuffer::update
« on: October 07, 2018, 10:23:28 pm »
The update method copies any new vertex data from the CPU to the buffer stored on the GPU - so unless you're copying all the data for the entire buffer (which is what VertexArray does each time you call draw) it's probably going to be better than sf::VertexArray - especially if you're not updating it every single frame.

182
General / Re: Accommodating different resolutions in 2D games
« on: October 07, 2018, 10:10:04 pm »
This is usually achieved with sf::View. Fix the view to the world size you want to draw (for example 1080p or whatever your assets are designed for) then set the view properties to map it to your window accordingly, including aspect ratio - there's an example on the wiki here. Using this method you can also render UI elements such as health bars separately, via their own view, to maintain things such as pixel sizes independently from the game rendering.

183
Sounds like an uninitialised variable somewhere - possibly a bool. When you're building in debug mode quite often values are all zeroed out, and an uninitialised value here can go unnoticed, particularly if the default value should be false. In release builds, however, you might get the value you expect, or you might not - which causes the odd behaviour. Moving other objects around in memory is going to change the values which are current at the time the uninitialised variable is created. Again this might give the value you want, 'fixing' the issue, but the chances are it won't. Make sure to set the flag for your compiler to warn for uninitialised variables, which might help pinpoint the problem.

184
General / Re: Syntax error with identifiers
« on: September 16, 2018, 04:04:58 pm »
Does Ball.h also include Blocks.h ? In which case you have a circular dependency. You can fix this with a Forward Declaration of Ball in Blocks.h

https://stackoverflow.com/a/4757718/6740859

185
Window / Re: Checking the position of the cursor in relation to buttons
« on: September 15, 2018, 05:35:42 pm »
Try using mapPixelToCoords() to convert your mouse coordinates to world coordinates:

https://www.sfml-dev.org/documentation/2.5.0/classsf_1_1RenderTarget.php#a0103ebebafa43a97e6e6414f8560d5e3

186
Graphics / Re: Drawing Inside Containers
« on: September 15, 2018, 10:03:17 am »
To move objects relative to each other you probably want a Scene Graph. There's an example of one on the tutorials page: https://www.sfml-dev.org/tutorials/2.5/graphics-transform.php#object-hierarchies-scene-graph

187
Window / Re: Window creation trouble on SMFL-Pi
« on: September 05, 2018, 10:49:21 am »
I used the pi version in a project a while back and I remember some similar problems (I can't check the project any more because it went to a client). I was running without an x session, that I do remember, and to stop the cropping I think I had to adjust the overscan settings for the pi itself, which can be done with config.txt

https://www.raspberrypi.org/documentation/configuration/config-txt/video.md

Window creation looked something like:

    const sf::Vector2f ScreenArea(1920.f, 1080.f);

    auto mode = sf::VideoMode::getDesktopMode();
    sf::RenderWindow window;
    window.create(mode, "Buns.");
    window.setVerticalSyncEnabled(true);

    //fix the view at 1080p
    auto vModeWidth = static_cast<float>(mode.width);
    auto vModeHeight = static_cast<float>(mode.height);

    if(mode.width == 720)
    {
        //we're using composite output so the display handles letterboxing
        //we just need to adjust the pixel aspect ratio
        sf::View view({0.f, 0.f, ScreenArea.x, ScreenArea.y});
        view.setCenter(ScreenArea / 2.f);
        window.setView(view);
    }
    else
    {
        float windowRatio = vModeWidth / vModeHeight;
        float viewRatio = 16.f / 9.f;
        float sizeY = windowRatio / viewRatio;
        float top = (1.f - sizeY) / 2.f;

        sf::View view({0.f, 0.f, ScreenArea.x, ScreenArea.y});
        view.setCenter(ScreenArea / 2.f);
        view.setViewport({ { 0.f, top }, { 1.f, sizeY } });
        window.setView(view);
    }
 

Hope this is some help

188
Graphics / Re: OpenGL on Yosemite produces flashing screen
« on: August 03, 2018, 08:44:52 am »
Compatibility contexts are not supported by macOS (see the red box at this link). Tldr; if you want to mix opengl with the graphics module you're restricted to opengl 2.1 core profile on macOS

189
General / Re: Problem with static linking SFML 2.5.0
« on: July 18, 2018, 10:26:54 am »
If I remember correctly this is due to a mismatch in visual studio versions. Most likely the binaries on the sfml site were built with a slightly different version to what you have installed (ie 17.4 vs 17.5). Make sure your version is fully up to date and if all else fails build sfml from source using your own copy of visual studio

190
General / Re: SFML Keybinds
« on: July 17, 2018, 11:08:21 am »
Have a look at chapter 6 of the SFML Game Development book

191
General / Re: SFML on Raspberry PI
« on: June 29, 2018, 10:44:48 am »
I've used this with success, which certainly supports hardware OpenGL

https://github.com/mickelson/sfml-pi

I don't recall if my particular project used shaders specifically however, so I couldn't say if they work.

192
Sounds like this problem:

https://en.sfml-dev.org/forums/index.php?topic=23895.0

My solution was to change  the order in which SteamAPI is initialised (as mentioned near the bottom of the thread)

193
SFML projects / [Steam Release] Castle Clamber - 1.1 update
« on: May 11, 2018, 03:39:16 pm »
The Steam version has been updated to 1.1 with the following new features:
  • 3 new enemies: Swoop the owl, Doris Poopsnail and proximity mines
  • New graphics and overhauled maps for the first tower (West Wing)
  • Brand new tutorial mode, available from the main menu
  • Two new achievements
  • Experimental linux support
  • Dead players can control their ethereal form in multiplayer mode while they wait for a continue



As well as a bunch of performance and bug fixes. Thanks to everyone who gave feedback!

Store page: http://store.steampowered.com/app/770050/Castle_Clamber/
Twitter updates: https://twitter.com/TrederiaGames

194
Unfortunately it makes no difference. I found this in the API docs for SteamAPI_Shutdown():

Quote
This will not unhook the Steam Overlay from your game as there's no guarantee that your rendering API is done using it.

So it seems the client handles the unhooking itself somewhere else :(

EDIT
OK so after digging around the Steam developer forums it appears that Steam uses DirectInput itself for a wrapper which makes all controllers appear as XInput devices in big picture mode. If I call SteamAPI_Init() *after* creating a window the problem goes away. Presumably it detects DirectInput is already being used somewhere (I've not looked into DirectInput myself to see how the API works so I'm making a few assumptions here) and makes sure it's initialised correctly, preventing the apparent double delete exception. So for me personally this is a fix for my current project (hooray!) but is this something SFML might want to handle - ie should it check if DirectInput is already being used (if it can even do that?)

195
General / Re: .cpp syntax for reference initialization
« on: April 13, 2018, 11:33:02 pm »
You're looking for member initialisation lists: http://en.cppreference.com/w/cpp/language/initializer_list

Pages: 1 ... 11 12 [13] 14 15 ... 34
anything