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

Pages: [1]
1
General / g++ Linking Error on 64bit Linux Box
« on: April 02, 2017, 06:52:02 pm »
I'm following the linux tutorial, and i've run into a "file not recognized" error with my project.

I'm using Linux GCC 64bit SFML-2.4.2 downloaded from https://www.sfml-dev.org/download/sfml/2.4.2/

I've built my project using the following commands.
g++ -c main.cpp -ISFML-2.4.2/include
g++ main.o -LSFML-2.4.2/lib -lsfml-graphics -lsfml-window -lsfml-system

For some reason when I execute the linking command I get this error:
SFML-2.4.2/lib/libsfml-graphics.so: file not recognized: File truncated
collect2: error: ld returned 1 exit status

If I remove the -lsfml-graphics flag I get the same error with the window module.

I've downloaded SFML three times, so it cant be due to corruption of the files.
Am I missing some completely obvious?


2
General / Re: Change hardware cursor?
« on: July 24, 2015, 12:22:08 am »
You can do what I did and implement a sprite as the cursor.

call
<window name>.setMouseCursorVisible(false);
to turn off cursor while inside the window.

Then within your window make a sprite with the cursor texture you would like.

Now all you have to do is set the sprite origin to the cursors location
sf::vector2i mouse = sf::Mouse::getPosition(<window name>);
<cursor sprite>.setOrigin(mouse.x, mouse.y);

For me personally I had to change the coordinates to negatives before I saw the cursor flying around my window. I'm not that knowledgeable in SFML so I don't know if that's how its supposed to be.

3
General / Accessing Sprites within a vector
« on: July 24, 2015, 12:12:40 am »
I'm have a bit of trouble as the title suggests. I've got three sprites inside of a vector. I'm building a button system for an application. The code detects which sprite is being selected, but does not  show the changes. Wierd thing is-is if I change the vector component target to a specific sprite the color change works. Does anyone know whats going on here?

        unsigned int selected = -1;

        // Load Sprite Vector
        vect.push_back(S1);
        vect.push_back(S2);
        vect.push_back(S3);

        // Application Loop
        while (Running){

                //--EVENTS--
                while (App.pollEvent(Event)){

                        ... Event handler

                        else if (Event.type == Event.MouseButtonPressed && Event.mouseButton.button == sf::Mouse::Left){
                                for (unsigned int i = 0; i < vect.size(); i++){
                                        if (ifspritecollision(vect[i], mouse.x, mouse.y)){
                                                vect[i].setColor(sf::Color(120, 120, 120));
                                                selected = i;
                                                break;
                                        }
                                }
                        }
                        else if (Event.type == Event.MouseButtonReleased && Event.mouseButton.button == sf::Mouse::Left){
                                // There are only three sprites on the screen
                                if (!(selected < 0 || 2 < selected))
                                        vect[selected].setColor(sf::Color(255, 255, 255));
                        }
       
                //... clear screen
                //... draw to screen
                //... display screen
               
        }
 

This will work for a single sprite
                        else if (Event.type == Event.MouseButtonPressed && Event.mouseButton.button == sf::Mouse::Left){
                                for (unsigned int i = 0; i < vect.size(); i++){
                                        if (ifspritecollision(vect[i], mouse.x, mouse.y)){
                                                // target for color change set to a specific sprite
                                                S1.setColor(sf::Color(120, 120, 120));
                                                selected = i;
                                                break;
                                        }
                                }
                        }
                        else if (Event.type == Event.MouseButtonReleased && Event.mouseButton.button == sf::Mouse::Left){
                                // There are only three sprites on the screen
                                if (!(selected < 0 || 2 < selected))
                                        // target for color change set to a specific sprite
                                        S1.setColor(sf::Color(255, 255, 255));
                        }
 

P.S The code has been changed for simplicity.

4
Ahh gotcha that makes sense, Thank you! I'm only using the names that were given in the tutorial at the link. I'm planning on changing it.

5
The post posted before I finished.

ERRORS
Error   1   error C2011: 'cScreen' : 'class' type redefinition    File: cScreen.hpp    Line: 4
Error   2   error C2504: 'cScreen' : base class undefined       File:screen_0.hpp   Line: 7

6
I'm having an odd error pop up, and cant seem to figure out why its happening. I'm using code to help me manage screens within my application. The code I am using is found here https://github.com/SFML/SFML/wiki/Tutorial:-Manage-different-Screens. My problem is that within my cscreen.hpp and screen_0.hpp I am getting a class undefined and redefinition error. Has anyone encountered this before or could it be an IDE(VS2013) setting I've messed up.

Minimal Code

cScreen.hpp
#include "SFML\Graphics.hpp"

class cScreen
{
public:
        virtual int Run(sf::RenderWindow &App) = 0;
};

screens.hpp
#ifndef SCREENS_HPP_INCLUDED
#define SCREENS_HPP_INCLUDED

//Basic Screen Class
#include "cScreen.hpp"

//Including each screen of application
#include "screen_0.hpp"

#endif // SCREENS_HPP_INCLUDED

Screen_0.hpp
#include <iostream>
#include "cScreen.hpp"

#include <SFML/Graphics.hpp>

class screen_0 : public cScreen
{
private:
        ...
public:
        screen_0(void);
        virtual int Run(sf::RenderWindow &App);
};

screen_0::screen_0(void)
{
    ...
}

int screen_0::Run(sf::RenderWindow &App)
{
        ...
}
 

main.cpp
#include <iostream>
#include <SFML/Graphics.hpp>
#include "screens.hpp"

int main(int argc, char** argv)
{
        ...
        return EXIT_SUCCESS;
}
 

ERRORS
Error   1   error C2011: 'cScreen' : 'class' type redefinition

7
General / Re: Implementing a storyline.
« on: December 17, 2014, 08:53:57 pm »
I think I have an idea of how to start. I appreciate your reply!

8
General / Re: Implementing a storyline.
« on: December 17, 2014, 08:17:08 am »
Sorry for the late reply, and vague question. I just really didn't know how to word the situation of implementing a storyline. I don't want to hard code missions into the game, so I guess my question would be what is an easy way of creating missions(main and sub) so that they are not coded into the game.

9
General / Implementing a storyline.
« on: December 16, 2014, 10:23:08 pm »
I've been working on a small project with c++, and I've run into a confusing situation. I am creating a "hacking" game, but I don't know how to implement the story. I have completed so called game engine, and will implement more as I go along, but the story is where I run into a brick wall.

The story will be linear. I need a way to create missions and sub missions. I have thought about creating a separate cpp file for each mission, but that seems like it would be a bit messy. What are some ways you have dealt with this situation?

10
General / Re: Starting on my first project!
« on: September 23, 2014, 02:00:05 am »
I still have to get used to the lingo (statemanager, resourceManager, etc). Im big on planning, but I don't want to spend too much time designing something just to figure out that it won't work.

11
General / Re: Looking for tips to improve my code
« on: September 23, 2014, 01:20:59 am »
What I personally like to do is make comments above each block of code explaining what it does. This not only helps you and/or others later understand what is going on but forces you to fully understand what and how you are coding. You will catch many errors you put into code if you go back and explain the process in english. Of course this takes time and space, so you have to be willing to live with the small amount of clutter.

12
General / Starting on my first project!
« on: September 23, 2014, 12:23:31 am »
So I am going to start my first project in hopes of learning how to use SFML better with C++. The problem I have run into is where to start. I know that planning is of the utmost importance, but how and what do I plan? What are some ways you get around the initial hump of game development?

btw. I'm planning on making a simple dungeon crawler type RPG.

13
General / Re: Setting up SFML 2.1 on XCode 5.1.1
« on: September 21, 2014, 12:32:51 am »
Well I don't know exactly how I got it to work.

For anyone else who is in my position.

1) download "Clang - universal 32+64 bits (OS X 10.8+, compatible with C++11 and libc++)" from the SFML do
downloads page

2) download "Templates for Xcode 5" from the SFML downloads page.

3) Take all files inside of the frameworks folder in the Clang download and place them in your "library/Frameworks" folder

4) Take all files inside of the extlibs folder in the Clang download and place them in your "library/Frameworks" folder.

5) Take the SFML file from the Templates download and place them under library/Developer/Xcode/Templates/

Open a new xcode project of type sfml.app and run the template. It should work. I dont know if this way is transferable between mac's or PC's.

14
General / Setting up SFML 2.1 on XCode 5.1.1
« on: September 20, 2014, 09:00:49 pm »
I have purchased my first mac, and I'm having trouble setting up SFML with XCode as the title suggests.

I have chosen to download and install the files that came with the Clang - universal 32+64 bits (OS X 10.8+, compatible with C++11 and libc++) package.

In this package there is a readme.txt that sends you to the tutorial page on SFML.

I have followed this tutorial and installed SFML about 5 times due to this error that appears.

XCode recognized the SFML templates, but for some reason I get an error stating

Lexcial or Preprocessor Issue
'SFML/Audio.hpp' file not found with <angled> include; use "quotes" instead

and

Lexical or Preprocessor Issue
'SFML/System.hpp' file not found

Ive swiched the angled to quotes on all of the .hpp files, but xcode tells me that the files do not exit.

Ive removed the Audio.hpp include line, but the compiler spits out the same error for the next file include which is the Graphics.hpp file.

Ive also placed a copy of the SFML file that holds all of these files inside of the project folder with my main.cpp.

Has anyone run into this problem before, or have any ideas on how to fix this?

Pages: [1]