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 - The Illusionist Mirage

Pages: 1 ... 3 4 [5] 6 7 8
61
General / Unable to compile SFML program in Ubuntu 12.10
« on: September 15, 2013, 03:38:51 pm »
Hello

I can't compile the following code in Code::Blocks in Ubuntu 12.10:
#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;
}
 

When sing Code::Blocks, I've mentioned in the search directories where the includes and libs are under the compiler and debugger settings. I've also done the necessary steps in the project build options too. But still getting an error.

I've compiled SFML sources and have  built the libs from from make files at the path /home/user404/Libraries/SFML_2_1

Also, whenever I build my program in debug version, this error pops up:
libGLEW.so.1.7 needed by /home/user404/Libraries/SFML_2_1/lib/libsfml-graphics.so, not found

And when I try to install libGLEW.so.1.7 as sudo apt-get install libglew1.7-dev, this happens in the terminal:

Reading package lists... Done
uilding state information... Done
E: Unable to locate package libglew1.7-dev
E: Couldn't find any package by regex 'libglew1.7-dev'


Any suggestions where's the problem?

Thanks

EDIT:
Also, when I am trying to generate makefiles using cmake cmake -G "Unix Makefiles" -D CMAKE_BUILD_TYPE=Debug -D BUILD_SHARED_LIBS=FALSE, an error pops up :

CMake Error : The source directory "/home/user404/Downloads/SFML_2_1/BUILD_SHARED_LIBS=TRUE" does not exist.

But the part BUILD_SHARED_LIBS=TRUE has nothing to with the search directory

62
General / Re: AW: Unexpected semantic error
« on: September 14, 2013, 05:18:26 pm »
Yeah looks like the variables didn't get initialized. Where's the code e exactly from? If it's copied from the book you must know that the book doesn't always show the full code, thus such initialization might have been left out, but might still be implemented in the online source.
If it is from the Git repo then you should let Nexus/Groogy/Grimshaw know. ;)

Yes, I had some idea regarding this since in the beginning the authors have clearly stated they'll be only teaching game programming, not C++ and advised to have prior C++ knowledge or read a good C++ book in parallel. You made it more clear. An I

This is clearly not the original code, so you should have a look at GitHub ;)

I was just skimming through the first chapter in the book and there you(and your co-authors) have defined a basic Game class for moving a cyan circle. I got it from there. But in the git repo the variables are initialized using the default ctor.

Thanks ;)

63
General / Unexpected semantic error
« on: September 14, 2013, 07:38:48 am »
Hello

I was trying out the code given in The SFML Game Dev book in the first chapter:

Here are main.cpp, Game.h and Game.cpp

Game.h
#ifndef GAME_H
#define GAME_H


#include <SFML/Graphics.hpp>

class Game : private sf::NonCopyable
{
    public:
        Game();
        void run();
        ~Game();

    private:
        void processEvents();
        void update();
        void handlePlayerInput(sf::Keyboard::Key key, bool isPressed);
        void render();

    private:
        sf::RenderWindow mWindow;
        sf::CircleShape mPlayer;

        bool mIsMovingUp;
        bool mIsMovingDown;
        bool mIsMovingLeft;
        bool mIsMovingRight;
};

#endif // GAME_H
 

Game.cpp
#include "Game.h"


Game::Game() : mWindow(sf::VideoMode(640, 480), "SFML Application")
{
    mPlayer.setRadius(40.0f);
    mPlayer.setPosition(100.f, 100.f);
    mPlayer.setFillColor(sf::Color::Cyan);
}

void Game::run()
{
    while(mWindow.isOpen())
    {
        processEvents();
        update();
        render();
    }
}

void Game::processEvents()
{
    sf::Event event;
    while(mWindow.pollEvent((event)))
    {
        switch(event.type)
        {
            case sf::Event::KeyPressed:
                handlePlayerInput(event.key.code, true);
                break;
            case sf::Event::KeyReleased:
                handlePlayerInput(event.key.code, false);
                break;
            case sf::Event::Closed:
                mWindow.close();
                break;
        }
    }
}

void Game::handlePlayerInput(sf::Keyboard::Key key, bool isPressed)
{
    if(key == sf::Keyboard::W)
        mIsMovingUp = isPressed;
    else if(key == sf::Keyboard::S)
        mIsMovingDown = isPressed;
    else if(key == sf::Keyboard::A)
        mIsMovingLeft = isPressed;
    else if(key == sf::Keyboard::D)
        mIsMovingRight = isPressed;

}

void Game::update()
{
    sf::Vector2f movement(0.f, 0.f);

    if(mIsMovingUp)
       movement.y -= 1.f;
    if(mIsMovingDown)
        movement.y += 1.f;
    if(mIsMovingLeft)
        movement.x -= 1.f;
    if(mIsMovingRight)
        movement.x += 1.f;

    mPlayer.move(movement);

}

void Game::render()
{
    mWindow.clear();
    mWindow.draw(mPlayer);
    mWindow.display();
}

Game::~Game()
{
    //dtor

 

main.cpp
#include "Game.h"

int main()
{
    Game game;
    game.run();
}
 

But whenever I am running my code, the circle starts moving upwards automatically and if I press the W key it stops moving and then everything works normal and as expected.

If I change Game.cpp as follows, everything is normal:
.
.
.
Game::Game() : mWindow(sf::VideoMode(640, 480), "SFML Application"), mIsMovingUp(false)
{
.
.
.
 

So what's exactly the problem in the code in the first case and why is the variable mIsMovingUp only initialized during runtime?

Thanks

64
General / Re: What does .inl stand for?
« on: September 12, 2013, 07:24:54 pm »
Now everything's working fine. Thanks sir! :)

65
General / Re: What does .inl stand for?
« on: September 12, 2013, 06:34:29 pm »
Thanks you Sir, I am doing exactly that. You were right that I should have read the README before doing anything.  :)

66
General / Re: What does .inl stand for?
« on: September 12, 2013, 06:29:01 pm »
I didn't rename or edit anything; I just copied all the files in another project and then tried to comile. It's possible I am missing something, so I'll recheck again.

67
General / [Solved]What does .inl stand for?
« on: September 12, 2013, 06:15:51 pm »
Hello friends

I stumbled upon the source for the SFML Game Dev book here. I downloaded it and then tried to run the very first program it contains(01_Intro). But when I tried to run it, an unexpected error pops up:

D:\CodeBlocks\SFML  2.0\Projects\sf-GameDev\Ch-1-Intro\main.cpp|5|fatal error: Book/StringHelpers.h: No such file or directory

What is that supposed to mean?

Thanks

(I've set up everything correctly and linked SFML statically, it's working for other projects if I change the code)

68
SFML projects / Re: A very nice Pong clone using SFML - 2.1
« on: September 10, 2013, 07:27:04 pm »
Hey. So I just tried your game and these are 2 things I saw:
I'd say the ball is going too fast. It could be slower.
Playing on easy computer never hits the ball. I can easily win.
Also, I'd be a great idea to choose a more simple font.

Thanks for your tips. :)

69
Hello

Your game is very nice. Loved it. :)

70
SFML projects / Re: A very nice Pong clone using SFML - 2.1
« on: September 10, 2013, 12:57:44 pm »
No dll errors!

I can score against the Easy and Intermediate AIs but not the Hard one, so the difficulty levels seem to work too.

I did find what might arguably be a bug: If the ball is directly above my paddle and I move the paddle up, the ball gets caught in it for several frames, making the bounce noise several times, then gets spit out at a sharp angle (so I usually scored when this happened).  Not sure how much of this is intended.

I'll try to fix that too. Actually, the problem is I don't have real life friends or people who can test or debug the program for me and nor does my school teacher help me, so every time I think that my program is error and bug free something new pops up. So, I sincerely beg pardon if I am pestering people too much with my simple and humble program.

I am really glad that I received so many feedbacks regarding my game. So I'd like to express my heartfelt gratitude to the community and of course SFML and its creator, Laurent sir.

Thanks again :D

71
SFML projects / Re: A very nice Pong clone using SFML - 2.1
« on: September 10, 2013, 07:38:59 am »
Hello

Fixed now. Game download link.
Link of repo is the same as before.

Hope it works.

CHEERS! :D

72
SFML projects / Re: A very nice Pong clone using SFML - 2.1
« on: September 10, 2013, 05:21:20 am »
Hello guys

I just discovered that I compiled it wrongly, will re-upload again in a few hours...I am very busy at the moment...Thanks.

73
SFML projects / Re: A very nice Pong clone using SFML - 2.1
« on: September 09, 2013, 02:17:47 pm »
Okay, I've fixed all the bugs reported by DarkYoung(except that wired collision part), updated the repo and also the exe download link. And now the game is good as ever. :D

And in my opinion the collision part is written that way so that the speed of the ball after collision is much faster after collsion with the end of the paddles than collision with the center.

Thanks!  ;)

74
SFML projects / Re: memoria
« on: September 09, 2013, 12:58:21 pm »
A very nice game. Awesome, superb. You have showed that a good game is not always about graphics and sounds only; content is the main factor. And I couldn't play it beyond a few levels! :)

75
SFML projects / Re: A very nice Pong clone using SFML - 2.1
« on: September 09, 2013, 12:38:23 pm »
Hi!

Game looks really good. Only font is a bit unreadable.

But i found some bugs :( :
-i can't start a new game with AI after finishing one. Looks like you don't reset level.
-when i choose play vs human, the humancontrols screen appear and it say "press any key to continue" but when i press any key, nothing happen. Only when i press enter im back to menu. This problem appear after i finish a game with AI so it could be connected with first problem
-not a bug but: ball is not center at the start.
-not a bug again but: ball always go in same direction after start
-collisions looks weird
-when point go to 10 number overlay on middle line


After all, game looks good, i like that GUI system. But you need to work more with it. Not much, but still a bit. Good work!

Actually, I've already fixed the following bugs you pointed out but have not yet updated the source on my repos and not re-uploaded the exe:
-> problem with resetting the level.
-> problem with play vs human option
-> ball going in same direction
-> overlaying of score with middle line

And regarding the collision, I'll try to reconsider my approach again.

Thank you very much DarkYoung! I am really encouraged by your corrections to make it more better. I'll fix them as soon as I can. :)

Pages: 1 ... 3 4 [5] 6 7 8
anything