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

Pages: [1]
1
General / SFML Game Book (github code) Run-time error & LNK2019 error.
« on: January 26, 2014, 03:04:56 pm »
So I got the github code from Laurent, ran it through CMake for VS12 and everything seems to have worked out, I went to chapter 2 (where I'm at on the book right now) and fitted in the additional SFML compiler includes and linker libraries + resources.

Now I had to place the debug dlls here:


And running the thing in release slapped me in the face with a ton of LNK2019 errors which I'm not even gonna bother with right this moment.

In debug, the execution dies out right were the breakpoint is set:


I'm assuming this is a directory issue, however I have no clue where I should be putting the stuff.  I used CMake to generate everything in the same folder (source and target are the same) but it clearly didn't pick them up...

Any clue about this, and whether or not the CMake caused an error or if this is something normal that should be taken care of prior to compilation?

Cheers.

Lupo :)

2
General / LNK1181: VS12
« on: January 24, 2014, 12:36:00 pm »
Followed the tutorial, went through all the other LNK1181 errors in the forums and I feel like I'm skipping something simple.  And I had this working before too, but now that I formatted and decided to get VS12, I'm stuck with:

1>------ Build started: Project: Project1, Configuration: Release Win32 ------
1>LINK : fatal error LNK1181: cannot open input file 'sfml-graphics.lib'
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

So what did I do?

Downloaded CMake, generated for Visual Studio 12 (2013) in the same directory "D:/Programming/SFML/SFML-2.1"

Went through the following tutorial: http://www.sfml-dev.org/tutorials/2.1/start-vc.php

And despite feeling like the error is something on my end (poor configuration) I just can't figure out what's wrong...

I also feel as if the folder structure has changed somewhat.  In the guide linked above it says:

Quote
Now compile the project, and if you linked to the dynamic version of SFML, don't forget to copy the SFML DLLs (they are in <sfml-install-path/bin>) to the directory where your compiled executable is. Then run it

And yet my SFML has no bin folder, I find my DLLs in <sfml-install-path>/lib/Release or <sfml-install-path>/lib/Debug

I placed my dll files in the <Projects>\Project1\Project1\Release folder and built as release, but that error typed out above happened.

3
Graphics / Tile Engine - Image/Texture? What's best to use for sprites
« on: April 27, 2013, 02:44:05 am »
I'm currently building the foundations for a working tile engine, prior to getting to develop more content to test with, and I'm stuck between 2 choices, Images and Textures.  Can someone explain what would be most appropriate.

Also I noticed sprites don't have a setImage anymore, or it was moved somehow, and setTexture has no intention of taking an Image since I see no overload to do that, how are we supposed to treat images, what are they there for?

Thanks =]

4
Graphics / Making object draw itself issue.
« on: April 25, 2013, 11:30:30 pm »
Allright I'm trying to draw a character sprite from a sprite sheet (3 wide, 4 deep), only drawing IntRect(32,0,32,32) specifically for now, just want some valid output.  To quickly describe my current setup this is what I have...

main.cpp  Supposed to do the standard stuff.  Build a render window, basic initialization and some simple event checking, then just clearing to grey and drawing the object's sprite.
#include <SFML/Graphics.hpp>
#include <iostream>
#include "creature.hpp"

#define screenWidth 800
#define screenHeight 600

int main ( void )
{
        // ############################### VARIABLE DECLARATION ############################### //
       
        // Window creation
        sf::VideoMode vMode(screenWidth, screenHeight, 32);
        sf::RenderWindow App (vMode,"Test");
        App.setFramerateLimit(60);
        App.setVerticalSyncEnabled(true);
        std::cout << "App Initialized" << std::endl;

        // Texture loading / Sprite Creation
        sf::Texture playerSheet;
        if (!playerSheet.loadFromFile("player.png"))
                return EXIT_FAILURE;
       
        // Create creature object
        creature player(playerSheet,sf::IntRect(32,0,32,32));

        // ############################### GAME LOOP ############################### //
        while (App.isOpen())
        {
                // ############################### EVENTS ############################### //
                sf::Event event;
                while (App.pollEvent(event))
                {
                        switch (event.type)
                        {
                        case sf::Event::Closed:
                                App.close();
                                break;

                        case sf::Event::KeyPressed:
                                switch (event.key.code)
                                {
                                case sf::Keyboard::Escape:
                                        App.close();
                                        break;
                                }
                        break;
                        }
                }


                // ############################### DRAW ############################### //#
                App.clear(sf::Color(125,125,125));

                player.draw(App);

                App.display();
        }      
}

creature.hpp Now as for the object's draw function:
#pragma once // Avoid multiple includes

#include <SFML/Graphics.hpp>

class creature
{
public:
        creature(sf::Texture tex, sf::IntRect zone);            // Constructor
        ~creature(void);                                                                        // Destructor
        void draw (sf::RenderWindow& App);

private:
        // Visual
        sf::Sprite creatureSpr;
};

creature.cpp  I've cropped away unecessary crap from both these files since they're not even implemented yet, just a bunch of declared variables which are set to default values and not really used for now.  But as you can see it's designed to be constructed with a texture and a specified zone, which is applied in the constructor, and then displayed by reference using the draw function of the app passed by reference.
#include "creature.hpp"

creature::creature(sf::Texture tex, sf::IntRect zone)
{
        // Set texture and zone
        creatureSpr.setTexture(tex);
        creatureSpr.setTextureRect(zone);
}

void creature::draw (sf::RenderWindow& App)
{
        App.draw(creatureSpr);
}

creature::~creature(void)
{
}
 

Output results in an empty 32*32 white opaque rectangle.  Leads me to believe the creatureSpr.setTexture() is failing for some reason, however the setTextureRect appears to work... what's going on? :O

5
General / Small RPG design layout.
« on: April 23, 2013, 07:39:03 pm »
Hi there, I've spent the past few days just reading up on various kinds of things to attempt to expand my knowledge before I even bother trying anything interesting and I've always been asking the same question and hunting for a specific answer of it, so I figured I'd open a topic to discuss it.

My current goal, once I can wrap my head around game design concepts well enough is to make a small rpg, oldskool like with a set of stats and some variance in equipment and such.  This of course means the enemies as well as friendly npcs would have the same amount of detail, possibly with the exception of the player due to swappable equipment and such.

Now the reason I made the thread is because I am curious as to how most coders out there would organize this, and what would you inherit from?

I'm still unfamiliar with SFML however I've attached a simple class structure which i kinda got off the top of my head.  Obviously this would not be correct since I've never done this and therefore never had to sit down and tackle the problems specifically, but how would one organize this?

With that in mind I might be able to take a more focused direction in learning.  My guess however, is the simpler the better, a single creature class which contains global stuff would probably be ideal, initiated once for the player, and then multiple more times with different details for the NPCs as well as enemies.

How would the sprites, animations and such be handled for these kind of situations?  Btw I'm mainly seeking just discussion, although code examples would be nice and welcome.

[attachment deleted by admin]

6
General / Organizing DLL Files from SFML?
« on: April 21, 2013, 02:45:14 pm »
Hi there, very simple question...

Is it possible to store the dll files such as sfml-audio-2.dll etc into their own folder called "bin", and still successfully refer to it from your program?  How would you go on about doing that?

Thanks =]

Pages: [1]
anything