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 ... 9 10 [11] 12 13 ... 34
151
Is that the only place you use getGlobalBounds() ? I can't see the line numbers in the image to see if you're looking at the line mentioned in the error. This error usually means you forgot to put the () at the end of a function call (and confuses it with a malformed function pointer).

152
General / Re: Problem with MSVCP140d.dll
« on: June 03, 2019, 08:46:21 am »
I'll also note that msvc140d.dll is the debug version (there's a d on the end). You can't redistribute these, you need to rebuild in release mode before putting it on your other computer. Then installing vc_redist.exe from the Microsoft website on your other computer should fix your problem.

153
There's now a DRM-free version for Windows available at itch.io

Find it here

154
SFML projects / OSGC - Open Source Game Collection
« on: May 11, 2019, 12:46:43 pm »
So I started this a little while ago as a place to put all my small game projects / prototypes. OSGC is a front-end browser application which allows games to be created as plugins (compiled as dlls/dylibs/SOs) and simply placed in a plugin directory for the browser to find them.

Right now there's only one game, Drone Drop, but I'm already working on prototyping a remake of one of my earliest projects, Space Racers. Here's a video of Drone Drop in action:



There are windows downloads available on itch.io here: https://fallahn.itch.io/osgc-open-source-game-collection but I also check to make sure OSGC can be built on linux and mac regularly. The source is available on github: https://github.com/fallahn/osgc

If anyone wants to make a game plugin (or contribute to Drone Drop - the maps are made with Tiled!) I'd love to see what they come up with :D

155
Player player;
 

You're not referencing the sprite, it should be:

Player player(playerSprite);
 

ie, there's no default constructor for Player

156
Graphics / Re: Exception when trying to draw text from a function
« on: May 04, 2019, 10:24:57 pm »
You're passing in a copy of the font (which will go out of scope when the function returns) instead of a reference. Resources such as fonts, textures and sound buffers need to make sure their lifetime exceeds that of anything which uses them. Usually this is done with some sort of resource manager, examples of which are on the wiki, or available in libraries like Thor.

157
OK, the latest patch should fix most of these issues - although I still don't have a high res monitor to try it on :( Thanks for the feedback everyone!

https://steamcommunity.com/games/1037140/announcements/detail/1608259124200224679

158
General / Re: SFML on iMac
« on: May 03, 2019, 10:45:17 pm »

159
General / Re: Run any computer.
« on: May 02, 2019, 11:17:01 pm »
vcruntime140d.dll and ucrtbased.dll are debug versions (there's a 'd' on the end of the file names). You want to build in Release mode before distributing.

160
Oops! Thanks for pointing that out :D

161
Oh! Thanks for letting me know. I don't actually have a monitor that goes that high to try it on... I guess it's a good excuse to buy one! :)

162
Yeah the steam leaderboards seem a bit lacking feature-wise. They don't appear to have any meta-data with which you can sub-sort entries such as a time stamp :(

The easter egg is designed to be found by not looking for it... although I have the feeling you may have already got it by now ;)

And yeah maybe 500 miles is a bit much, but it's a tribute to a quality song! :P Perhaps I'll increase the distance awarded per tile in a future patch

163
Graphics / Re: Creating simple 3D objects SFML
« on: April 21, 2019, 09:52:41 pm »
You're welcome, it's looking good! It sounds like an interesting technique, I'm sure I shall be experimenting with it myself sometime :D

164
Graphics / Re: Creating simple 3D objects SFML
« on: April 21, 2019, 10:09:09 am »
Technically no, although you can pre-transform vertices when you build your vertex array. In theory it could be done a bit like this (untested code):


struct BodyPart final : public sf::Transformable
{
    std::array<sf::Vector2f, 4u>  quadPoints = {}; //set these to the default positions of a quad used for a body part
};

enum PartID
{
    Legs, Body, Head, Count //start with legs because presumably you want to draw from the bottom up
};

class Robot final : public sf::Drawable, public sf::Transformable
{
public:
    Robot()
    {
        //for each body part set the initial quad point positions
        //eg {-10.f, -10.f} , {10.f, -10.f}, {10.f, 10.f}, {-10.f, 10.f} for a 20 unit quad that rotates around the centre
    }

    void update()
    {
        //update the transform for each body part
        m_bodyParts[PartID::Head].setRotation(20.f);
        m_bodyParts[PartID::Body].setScale(1.2f, 1.2f);
        //...etc

        //build the vertex array by creating a transformed quad for each part
        m_vertices.clear();
        for(const auto& part : m_bodyParts)
        {
            auto quadPoints = part.quadPoints; //make sure this is a copy so as not to modify the orignal part
            const auto& transform = part.getTransform();
            for(auto& point : quadPoints)
            {
                point = transform.transformPoint(point); //the point is now rotated/scaled by the bodypart transform
            }

            for(auto i = 0; i < SliceCount; ++i) //slice count is number of quads in this body part
            {
                //create a new slice by using the quadPoints array as positions
                //and adding any texture coordinates. Emplace the vertex into m_vertices
                //don't forget to decrement the Y value of the position by the thickness of a slice.
                for(auto& point : quadPoints)
                {
                    m_vertices.emplace_back(point, someTexCoord);
                    point.y -= sliceThickness;
                }
            }
    }
private:
    std::array<BodyPart, PartID::Count> m_bodyParts;
    std::vector<sf::Vertex> m_vertices;

    void draw(sf::RenderTarget& rt, sf::RenderStates) const override
    {
        states.transform *= getTransform(); //this now controls the world transform of the entire robot
        rt.draw(m_vertices.data(), m_vertices.size(), sf::Quads, states);
    }
};

 

To summarise:
Keep the positions for each part separate along with their own transform
When rebuilding the vertex array apply the transform of that part directly to *a copy* of the quad base position
Draw the vertex array using a transform which controls the position/rotation/scale of the robot in world coordinates.

165
Graphics / Re: Creating simple 3D objects SFML
« on: April 20, 2019, 10:49:00 pm »
I believe that, if you're using sf::Quads, a vertex array will draw them in the order in which they were added. I don't know if this is official OpenGL spec or just how it happens to work though (ie there might be some corner cases where it doesn't work). You'll also have to put all your images into a single texture.

Pages: 1 ... 9 10 [11] 12 13 ... 34
anything