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

Pages: 1 [2] 3 4
16
General / Re: Having trouble solving SFML linker errors
« on: November 23, 2013, 07:50:23 am »
Quote
I've managed to set it up successfully already on my PC running Arch Linux
that is easy, as SFML 2.1 and SFML 1.6 are both in the AUR.
metulburr@arch ~/$ pacaur -Ss sfml
community/sfml 2.1-1 [installed]
    A simple, fast, cross-platform, and object-oriented multimedia API
aur/sfml1.6 1.6-6 (15)
    A simple, fast, cross-platform, and object-oriented multimedia API

In ubuntu the method i use is just coping from the extracted sfml file to /usr
metulburr@ubuntu ~/Downloads/SFML-2.1 $ sudo cp -r include/SFML /usr/include
[sudo] password for metulburr:
metulburr@ubuntu ~/Downloads/SFML-2.1 $ sudo cp -r lib/* /usr/lib    
metulburr@ubuntu ~/Downloads/SFML-2.1 $ sudo cp -r share/SFML /usr/share  
metulburr@ubuntu ~/Downloads/SFML-2.1 $

and in my IDE's i execute:
g++ -std=c++11 -Wall -o "%e" "%f" -lsfml-audio -lsfml-graphics -lsfml-window -lsfml-system &&"./%e"
or via terminal:
metulburr@arch ~/Downloads $ g++ -std=c++11 test.cpp -o test -lsfml-audio -lsfml-graphics -lsfml-window -lsfml-system
metulburr@arch ~/Downloads $ ./test
 

It is in Windows, i have a hell of a time and have yet to compile a successful SFML example.


17
General / Re: missing sfml-graphics-2.dll
« on: November 16, 2013, 01:26:52 am »
i dont really want to dynamically link the libs while learning SFML.

18
General / Re: missing sfml-graphics-2.dll
« on: November 15, 2013, 10:07:58 pm »
I dont know where else to go as you point me to the tutorial in which in my perspective (at this point now) follows the tutorials to a T.  I've reread the tutorial again this time, but i dont see a difference in my setup as opposed to the tutorials.

It took me less than 60 seconds to install via linux, and in windows i have been messing around with it all day.

19
General / Re: missing sfml-graphics-2.dll
« on: November 15, 2013, 08:24:14 pm »
I thought the dynamic linking was just coping the dll's over to the directory with the executable, and that the -d suffix was for debug? How am i doing both?

20
General / Re: missing sfml-graphics-2.dll
« on: November 15, 2013, 06:12:57 pm »
EDIT:
sorry.... i didnt see the build target drop down box option to change from debug to release. Changing that stopped the original error.

However now i get 50 errors with the example code given:
#include <SFML/Window.hpp>
#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;
}
 

compiling:
mingw32-g++.exe -LC:\SFML-2.1\lib -LC:\SFML-2.1\lib -LC:\SFML-2.1\lib  -o bin\Release\test.exe obj\Release\main.o   -s  -lsfml-graphics -lsfml-window -lsfml-system -lsfml-audio -lsfml-network -lsfml-graphics-s -lsfml-window-s -lsfml-system-s -lsfml-audio-s -lsfml-network-s

I am not sure if this is related to the changes i made to the projects links etc. i nthis thread or someething completely different at this point now.

21
General / Re: missing sfml-graphics-2.dll
« on: November 15, 2013, 05:52:07 pm »
ok so now in the tree:
project -> build options - > project_name has OP settings with no suffix
project -> build options - > project_name -> Debug has OP settings with -d suffix
project -> build options - > project_name -> Release has OP settings with -s suffix

but i still get the same error

22
General / Re: missing sfml-graphics-2.dll
« on: November 15, 2013, 05:34:28 pm »
ok

Well the projects build options for both the Debug and Release are the same as the OP, with the addition of the -s suffixes

23
General / Re: missing sfml-graphics-2.dll
« on: November 15, 2013, 05:17:48 pm »
the projects build settings are identical to the compilers build settings

24
General / Re: missing sfml-graphics-2.dll
« on: November 15, 2013, 05:02:36 pm »
changing to this however changed no results.
sfml-graphics-s
sfml-window-s
sfml-system-s
sfml-network-s

25
General / missing sfml-graphics-2.dll
« on: November 15, 2013, 04:08:25 pm »
I get the error:
missing sfml-graphics-2.dll
when i try to compile SFML under windows. I walked through the tutorial.

Path to SFML
C:\SFML-2.1\

to confirm... in compiler settings for code blocks i changed:
compiler
C:\SFML-2.1\include

linker
C:\SFML-2.1\lib

settings->#defines
SFML_STATIC

linker settings:
sfml-graphics
sfml-window
sfml-system
sfml-network

enabled flag for c++11



windows 8
code blocks mingw
SFML 2.1


I think that was it. I don't really see a problem?

26
General / Re: Making 2D Physics based game
« on: November 14, 2013, 11:32:58 pm »
i dont know about the others, but:

Quote
1. What if I spend a ton of time using/learning SFML it, then they don't support it anymore am I basically screwed? I guess I'm basically concerned about the future of it.
Then you would learn basic game programming at least in which you can use else where. People still use pygame for example, and their website is essentially halted for new users, and their last official update was in 2009, but yet people still use it. Seriously though, I doubt SFML is going anywhere. It is essentially the first 3rd party gaming library people are referred to in some forums. Its been around for a bit at this point. As long as someone is working on it, what is there to worry about?


Quote
2. I don't see how they make revenue from SFML as it appears free? What's keeping it from collapsing or not being maintained
What is wrong with free? Just because it is free does not mean it would stop being maintained. For example, Ubuntu (as well with every other linux distro) is free/open-sourced, but yet they obtain money. And that is not going anywhere. One method i know they obtian money is from personal tech support.

27
General / Re: random speed in movement
« on: November 13, 2013, 06:28:43 am »
ok i figured it out. I updated with the time and not frame time
                obj.update(time);

                obj.update(frame_time);

28
General / random speed in movement
« on: November 13, 2013, 06:13:21 am »
When moving the object, the obj will jump from slow to fast, vice versa if held down long enough. I had it at what seemed a steady speed, but that was before i read that section in the SFML book. In which that said to add a second while loop in for logic updates as opposed to rendering. The theory sounds good, but i cannot figure out why i cannot get it to work. This process is new to me as in Pygame i just used clock.tick(60), but i am assuming that it used an internal sleep method for 60 FPS.

well anyway, this is the code. It is not exactly like the book, as i was trying to implement into my style. The problem lies in Control::update()
#include <SFML/Window.hpp>
#include <SFML/Graphics.hpp>
#include <iostream>

class Rect{
    public:
        int speed = 100;
        sf::Vector2f position;
        sf::RectangleShape rect;
        bool moving_up = false,
            moving_down = false,
            moving_right = false,
            moving_left = false;
           
        Rect(){
            position = {100,100};
            rect.setSize(sf::Vector2f(100,100));
            rect.setPosition(position);
            rect.setFillColor(sf::Color::Red);
        }
       
        void update(sf::Time delta){
           
            sf::Vector2f movement(0,0);
            if (moving_up)
                movement.y -= speed;
            if (moving_down)
                movement.y += speed;
            if (moving_left)
                movement.x -= speed;
            if (moving_right)
                movement.x += speed;
            move(movement * delta.asSeconds());
            rect.setPosition(position);
        }
       
        void move(sf::Vector2f movement){
            position += movement;
        }
};

class Control{
    public:
        sf::RenderWindow window;
        sf::Clock clock;
        sf::Time frame_time = sf::seconds(1.f/60.f);
        sf::Time time = sf::Time::Zero, update_time = sf::Time::Zero;
        Rect obj;
       
        Control(){
            window.create(sf::VideoMode(600,400), "Title");
            //window.setKeyRepeatEnabled(false);
        }
       
        void update(sf::Event event){
            time = clock.restart();
            update_time += time;

            while(update_time > frame_time){
                update_time -= frame_time;
                obj.update(time);
            }
            render();
        }
       
        void render(){
            window.clear(sf::Color::Black);
            window.draw(obj.rect);
            window.display();
        }
       
        void input_handler(sf::Keyboard::Key key, bool is_pressed){
            if (key == sf::Keyboard::W)
                obj.moving_up = is_pressed;
            else if (key == sf::Keyboard::S)
                obj.moving_down = is_pressed;
            else if (key == sf::Keyboard::D)
                obj.moving_right = is_pressed;
            else if (key == sf::Keyboard::A)
                obj.moving_left = is_pressed;
        }
       
        void event_handler(sf::Event event){
            while(window.pollEvent(event)){
                if (event.type == sf::Event::Closed)
                    window.close();
                else if (event.type == sf::Event::KeyPressed)
                    input_handler(event.key.code, true);
                else if (event.type == sf::Event::KeyReleased)
                    input_handler(event.key.code, false);
            }
        }
       
        void run(){
            while (window.isOpen()){
                sf::Event event;
                event_handler(event);
                update(event);
            }
        }
};

int main(){
    Control app;
    app.run();
}

 

29
General / Re: checking for collision against an object
« on: November 12, 2013, 11:03:34 pm »
i have tried searchig the forums for such, however in the forums if is search i get a database error:
Please try again. If you come back to this error screen, report the error to an administrator.

and googling sfml collision does not return much. I think i found one thread which was unhelpful this method.

30
General / checking for collision against an object
« on: November 12, 2013, 10:48:48 pm »
I come from python/pygame where the methods are made for you. However looking through sfml, i dont see such methods as in pygame. such as rect.collidepoint() for mouse or rect.colliderect() for collision test against another rect. Do you have to make these yourself in sfml?

If so i am not quite sure on how to make these functions.
I set up the base classes, i am just not sure on how to check if the mouse is inside the rect or not?

#include <SFML/Window.hpp>
#include <SFML/Graphics.hpp>
#include <iostream>

class Rect{
    public:
        sf::RectangleShape rect;
       
        Rect(){
            rect.setSize(sf::Vector2f(100,100));
            rect.setPosition(sf::Vector2f(10,10));
            rect.setFillColor(sf::Color::Red);
        }
};

class Control{
    public:
        sf::RenderWindow window;
        Rect obj;
       
        Control(){
            window.create(sf::VideoMode(600,400), "Title");
            window.setKeyRepeatEnabled(false);
        }
       
        void update(sf::Event event){
            window.clear(sf::Color::Black);
            window.draw(obj.rect);
            window.display();
        }
       
        void event_handler(sf::Event event){
            while(window.pollEvent(event)){
                if (event.type == sf::Event::Closed){
                    window.close();
                }
            }
        }
       
        void run(){
            while (window.isOpen()){
                sf::Event event;
                event_handler(event);
                update(event);
            }
        }
};

int main(){
    Control app;
    app.run();
}

 

Pages: 1 [2] 3 4