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

Pages: [1]
1
General / Pong game doesn't work when i SetFramerateLimit
« on: September 16, 2011, 11:06:28 pm »
So i made a Pong game and it works fine (i know that the collision is really bad programmed and that it is bad programmed in general, but it works).

I use for movement sprite.Move(x, y*App.GetFrameTime()); and it works. I make the game "cout" the frame rate every loop and it runs at 300 at my computer.

The problem is that when i try to cap the framerate (i think it's the right term) using SetFrameRate the collision system doesn't work anymore. It works until the 100 fps but below that it desn't and i don't know why.

Here is the code:
Code: [Select]
///Headers///
#include <SFML/System.hpp>
#include <SFML/Window.hpp>
#include <SFML/Graphics.hpp>
#include <SFML/Audio.hpp>
#include <iostream>
#include <string>
#include <sstream>

///Namespaces///
using namespace std;
using namespace sf;

int main ()
{
///Variables///
float framerate;
float balltime;
int score1 = 0;
int score2 = 0;
bool isballonscreen = false;
bool player1up, player1down, player2up, player2down;
float speed;
float moveballx, movebally;
int random;
stringstream score;
Clock cballtime;

///Window and Input///
RenderWindow Janela (VideoMode(800,600,32), "Pong!");
const sf::Input& Input = Janela.GetInput();
Janela.SetFramerateLimit(0);

///Shapes///
Shape Line = Shape::Line(400, 0, 400, 600, 3, Color::White);
Shape Player1 = Shape::Rectangle(20, 265, 40, 335, Color::White);
Shape Player2 = Shape::Rectangle(760, 265, 780, 335, Color::White);
Shape Ball = Shape::Circle(400, 300, 10, Color::White);

///SoundBuffers///
SoundBuffer Blop, Ping, Yeah;

if(!Blop.LoadFromFile("Blop.wav"))
{
   return EXIT_FAILURE;
}
if(!Ping.LoadFromFile("Ping.wav"))
{
    return EXIT_FAILURE;
}
if(!Yeah.LoadFromFile("Yeah.wav"))
{
    return EXIT_FAILURE;
}

///Sounds///
Sound blop, ping, yeah;
blop.SetBuffer(Blop);
ping.SetBuffer(Ping);
yeah.SetBuffer(Yeah);

///Strings///
String PressReturn ("            PONG!\nPress Return to Start", Font::GetDefaultFont(), 50);
PressReturn.Move (160.f, 130.f);

String Keys ("Player 1:                   Player 2:\n\nUp                             W\nDown                         S", Font::GetDefaultFont(), 35);
Keys.Move (160.f, 300.f);

String player1score ("0", Font::GetDefaultFont(), 45);
String player2score ("0", Font::GetDefaultFont(), 45);
player1score.Move (250.f, 30.f);
player2score.Move (550.f, 30.f);

///Start Loop///
while(1)
{
        Janela.Clear();
        Janela.Draw(Keys);
        Janela.Draw(PressReturn);
        Janela.Display();

        Event start;
        Janela.GetEvent(start);

        if(start.Type == Event::KeyPressed && start.Key.Code == Key::Return)
        break;

        if(start.Type == Event::Closed)
        {
            Janela.Close();
            return EXIT_SUCCESS;
        }

        if(start.Type == Event::KeyPressed && start.Key.Code == Key::Escape)
        {
            Janela.Close();
            return EXIT_SUCCESS;
        }
}

///Main Loop///
    while(Janela.IsOpened())
    {
        framerate = 1.f / Janela.GetFrameTime();
        balltime = cballtime.GetElapsedTime();

        ///Puts ball on Screen///
            while(isballonscreen == false)
            {
                cballtime.Reset();
                speed = 300.f;
                moveballx = 0.f;
                movebally = 0.f;
                Ball.SetPosition(0.f,0.f);

                random = Randomizer::Random(1, 4);

                        switch(random)
                        {
                            case 1:
                            moveballx = speed;
                            movebally = speed;
                            isballonscreen = true;
                            break;

                            case 2:
                            moveballx = speed;
                            movebally = -speed;
                            isballonscreen = true;
                            break;

                            case 3:
                            moveballx = -speed;
                            movebally = speed;
                            isballonscreen = true;
                            break;

                            case 4:
                            moveballx = -speed;
                            movebally = -speed;
                            isballonscreen = true;
                            break;
                        }

                }

        ///Speeds up Ball///
        if(balltime > 3)
        speed += 0.03f;

        ///Events///
        Event quit;
        Janela.GetEvent(quit);

        if(quit.Type == Event::Closed)
        {
            Janela.Close();
            return EXIT_SUCCESS;
        }

        if(quit.Type == Event::KeyPressed && quit.Key.Code == Key::Escape)
        {
            Janela.Close();
            return EXIT_SUCCESS;
        }

        player1up = Input.IsKeyDown(Key::Up);
        player1down = Input.IsKeyDown(Key::Down);
        player2up = Input.IsKeyDown(Key::W);
        player2down = Input.IsKeyDown(Key::S);

        ///Ball///
        ////Collision with Walls
        if(Ball.GetPosition().x < 415 && Ball.GetPosition().x > -415 && Ball.GetPosition().y > 291)
        {
        blop.Play();
        movebally = -speed;
        }

        if(Ball.GetPosition().x < 415 && Ball.GetPosition().x > -415 && Ball.GetPosition().y < -291)
        {
        blop.Play();
        movebally = speed;
        }

        if(Ball.GetPosition().x > 600)
        {
            yeah.Play();
            score1++;
            score.str("");
            score << score1;
            player1score.SetText(score.str());
            isballonscreen = false;
        }

        if(Ball.GetPosition().x < -600)
        {
            yeah.Play();
            score2++;
            score.str("");
            score << score2;
            player2score.SetText(score.str());
            isballonscreen = false;
        }

        ////Collision with Player 1
        if(Ball.GetPosition().x < -349 && Ball.GetPosition().x > -391 && Ball.GetPosition().y > Player1.GetPosition().y-46 && Ball.GetPosition().y < Player1.GetPosition().y-44)
        {
        ping.Play();
        movebally = -speed;
        }

        if(Ball.GetPosition().x < -349 && Ball.GetPosition().x > -391 && Ball.GetPosition().y < Player1.GetPosition().y+46 && Ball.GetPosition().y > Player1.GetPosition().y+44)
        {
        ping.Play();
        movebally = speed;
        }

        if(Ball.GetPosition().x > -351 && Ball.GetPosition().x < -349 && Ball.GetPosition().y < Player1.GetPosition().y+40 && Ball.GetPosition().y > Player1.GetPosition().y-40)
        {
        ping.Play();
        moveballx = speed;
        }

        if(Ball.GetPosition().x < -349 && Ball.GetPosition().x > -351 && Ball.GetPosition().y-400 > Player1.GetPosition().y-446 && Ball.GetPosition().y-400 < Player1.GetPosition().y-444)
        {
        ping.Play();
        movebally = -speed;
        moveballx = speed;
        }

        if(Ball.GetPosition().x < -349 && Ball.GetPosition().x > -351 && Ball.GetPosition().y-400 < Player1.GetPosition().y-400+46 && Ball.GetPosition().y-400 > Player1.GetPosition().y-400+44)
        {
        ping.Play();
        movebally = speed;
        moveballx = speed;
        }

        ////Collision with Player 2
        if(Ball.GetPosition().x > 349 && Ball.GetPosition().x < 391 && Ball.GetPosition().y > Player2.GetPosition().y-46 && Ball.GetPosition().y < Player2.GetPosition().y-44)
        {
        ping.Play();
        movebally = -speed;
        }

        if(Ball.GetPosition().x > 349 && Ball.GetPosition().x < 391 && Ball.GetPosition().y < Player2.GetPosition().y+46 && Ball.GetPosition().y > Player2.GetPosition().y+44)
        {
        ping.Play();
        movebally = speed;
        }

        if(Ball.GetPosition().x < 351 && Ball.GetPosition().x > 349 && Ball.GetPosition().y < Player2.GetPosition().y+40 && Ball.GetPosition().y > Player2.GetPosition().y-40)
        {
        ping.Play();
        moveballx = -speed;
        }

        if(Ball.GetPosition().x > 349 && Ball.GetPosition().x < 351 && Ball.GetPosition().y-400 > Player2.GetPosition().y-446 && Ball.GetPosition().y-400 < Player2.GetPosition().y-444)
        {
        ping.Play();
        movebally = -speed;
        moveballx = -speed;
        }

        if(Ball.GetPosition().x > 349 && Ball.GetPosition().x < 351 && Ball.GetPosition().y-400 < Player2.GetPosition().y-400+46 && Ball.GetPosition().y-400 > Player2.GetPosition().y-400+44)
        {
        ping.Play();
        movebally = speed;
        moveballx = -speed;
        }

        ////Movement
        Ball.Move(moveballx*Janela.GetFrameTime(), movebally*Janela.GetFrameTime());

        ///Players///
        ////Player 1 Movement
        if(player1up && Player1.GetPosition().y > -255)
        Player1.Move(0,-500*Janela.GetFrameTime());

        if(player1down && Player1.GetPosition().y < 255)
        Player1.Move(0,500*Janela.GetFrameTime());

        ////Player 2 Movement
        if(player2up && Player2.GetPosition().y > -255)
        Player2.Move(0,-500*Janela.GetFrameTime());

        if(player2down && Player2.GetPosition().y < 255)
        Player2.Move(0,500*Janela.GetFrameTime());


        ///Rendering///
        Janela.Clear();
        Janela.Draw(player1score);
        Janela.Draw(player2score);
        Janela.Draw(Line);
        Janela.Draw(Ball);
        Janela.Draw(Player1);
        Janela.Draw(Player2);
        Janela.Display();
        cout << framerate << endl;
    }

return EXIT_SUCCESS;
}


First question why it is that the collision system doesn't work? Is it because the ball is not colliding in one frame and in another it's already past collision zone (the ball is inside the paddle)?

Second question is it really worth to cap the frame rate? If you use (for example) sprite.Move(0, 500*App.GetFrameTime()) then there's no point in capping the frame rate (except for animation, but you can use clocks for that). You could cap the frame rate and don't use App.GetFrameTime but then heavier games on slower pcs wouldn't run properly right?

Help please.
Cheers

2
General discussions / State machines or Screens?
« on: September 16, 2011, 09:04:06 pm »
Isn't Lazy Foo's example a generic State Machine? I though so.

Do you know any good tutorial on State Machines?

3
General discussions / State machines or Screens?
« on: September 16, 2011, 01:25:55 am »
So i'm kind of new to SFML, i've done some stuff but only in one screen/state and not oop.

I was going to make a game with various levels and menus (for learning porposes) and i was wondering which mettod should i use? State Machines or the cScreen class?

State Machines on SDL: http://lazyfoo.net/articles/article06/index.php
cScreens: https://github.com/SFML/SFML/wiki/TutorialScreens

I've never used one neither the other, so which one should i learn? cScreen can only be used in SFML so maybe it's better to learn State Machines? Also State Machines seems more oop-drive i think, while cScreens seems more like an easy and fast solution (kind of transforming non-oop code into a kind-of-oop code).

What do you think? Should i go for State machines or cScreens class?
Cheers

4
Graphics / Debug version works fine, release desn't (Tic Tac Toe)
« on: September 09, 2011, 05:16:04 pm »
Quote from: "Haikarainen"
Are you linking the debugtarget with debuglibraries, and release with releaselibs?

Also, debug will always be bigger since they contain debugging symbols, to help with stuff like trace stack etc.

Yes i am.

I managed to correct the error. I added in the "if" sections  event.Type == Event::MouseButtonPressed and now it works.

Cheers

5
Graphics / Debug version works fine, release desn't (Tic Tac Toe)
« on: September 07, 2011, 03:50:56 pm »
"One can expect to see funny errors in release builds due to compiler optimizations or differences in memory layout or initialization. These are ususally referred to as Release - Only bugs :)"

Does this means that the code is fine (it is doing everything it is supposed to do in debug)? Released games (sold) come in debug or release version?

6
Graphics / Debug version works fine, release desn't (Tic Tac Toe)
« on: September 06, 2011, 11:43:00 pm »
Hello.

I Programmed a Tic Tac Toe game using C++ and SFML. It's very simples, 2 players, no menu no sound. And i didn't use oop.

The game on Debug runs fine, but on Release doesn't. As soon as the mouse cursor runs over the game window a wild "X" appears. After that, it works fine. Why is that happening? I'm using Code::Blocks.

The game uses 4 800x800 images (win, loose, tie and the board) and 2 200x200 (circle and cross). Here is the code (i'm sorry for the mess, it's my first "project", also sorry for the variable names, i'm portuguese).

Code: [Select]
///Headers///
#include <SFML/System.hpp>
#include <SFML/Window.hpp>
#include <SFML/Graphics.hpp>
#include <iostream>

///Namespaces///
using namespace std;
using namespace sf;

int main ()
{

///Variables///

char tabuleirodejogo [3][3];
for (int i=0; i<3; i++)
    {
        for (int u=0; u<3; u++)
            {
                tabuleirodejogo[i][u] = 'n';
            }
    }

///Window///
RenderWindow Janela (VideoMode(800,800,32), "Tic Tac Toe");

///Images///
Image Tabuleiro, Jogador_X, Jogador_O, Ganhou_X, Ganhou_O, Empate;

if (!Tabuleiro.LoadFromFile("tabuleiro.jpg"))
        return EXIT_FAILURE;

if (!Jogador_X.LoadFromFile("Jogador X.png"))
        return EXIT_FAILURE;

if (!Jogador_O.LoadFromFile("Jogador O.png"))
        return EXIT_FAILURE;

if (!Ganhou_X.LoadFromFile("Ganhou X.png"))
        return EXIT_FAILURE;

if (!Ganhou_O.LoadFromFile("Ganhou O.png"))
        return EXIT_FAILURE;

if (!Empate.LoadFromFile("Empate.png"))
        return EXIT_FAILURE;

Jogador_X.SetSmooth(false);
Jogador_O.SetSmooth(false);

///Sprites///
Sprite tabuleiro;
tabuleiro.SetImage(Tabuleiro);
Janela.Draw(tabuleiro);

Sprite jx;
jx.SetImage(Jogador_X);

Sprite jo;
jo.SetImage(Jogador_O);

Sprite go(Ganhou_O);
Sprite gx(Ganhou_X);
Sprite empate(Empate);

///Loop///
    while (Janela.IsOpened())
        {
            ///Player X///
            while (1)
            {
                Event jogarx;
                (Janela.GetEvent(jogarx));

                if (jogarx.Type == Event::Closed)
                    Janela.Close();

                if ((tabuleirodejogo[0][0] == 'n') && (jogarx.Key.Code == Mouse::Left) && (jogarx.MouseButton.X < 250) && (jogarx.MouseButton.Y < 245))
                    {
                    tabuleirodejogo[0][0] = 'x';
                    jx.SetPosition(35.f,28.f);
                    Janela.Draw(jx);
                    break;
                    }

                if ((tabuleirodejogo[0][1] == 'n') && (jogarx.Key.Code == Mouse::Left) && (jogarx.MouseButton.X > 265) && (jogarx.MouseButton.Y < 250) && (jogarx.MouseButton.X < 520))
                    {
                    tabuleirodejogo[0][1] = 'x';
                    jx.SetPosition(301.f,28.f);
                    Janela.Draw(jx);
                    break;
                    }

                if ((tabuleirodejogo[0][2] == 'n') && (jogarx.Key.Code == Mouse::Left) && (jogarx.MouseButton.Y < 250) && (jogarx.MouseButton.X > 536))
                    {
                    tabuleirodejogo[0][2] = 'x';
                    jx.SetPosition(562.f,28.f);
                    Janela.Draw(jx);
                    break;
                    }

                if ((tabuleirodejogo[1][0] == 'n') && (jogarx.Key.Code == Mouse::Left) && (jogarx.MouseButton.X < 250) && (jogarx.MouseButton.Y < 505) && (jogarx.MouseButton.Y > 260))
                    {
                    tabuleirodejogo[1][0] = 'x';
                    jx.SetPosition(35.f,290.f);
                    Janela.Draw(jx);
                    break;
                    }

                if ((tabuleirodejogo[1][1] == 'n') && (jogarx.Key.Code == Mouse::Left) && (jogarx.MouseButton.X > 265) && (jogarx.MouseButton.X < 520) && (jogarx.MouseButton.Y < 505) && (jogarx.MouseButton.Y > 260))
                    {
                    tabuleirodejogo[1][1] = 'x';
                    jx.SetPosition(301.f,290.f);
                    Janela.Draw(jx);
                    break;
                    }

                if ((tabuleirodejogo[1][2] == 'n') && (jogarx.Key.Code == Mouse::Left) && (jogarx.MouseButton.X > 536) && (jogarx.MouseButton.Y < 505) && (jogarx.MouseButton.Y > 260))
                    {
                    tabuleirodejogo[1][2] = 'x';
                    jx.SetPosition(562.f,290.f);
                    Janela.Draw(jx);
                    break;
                    }

                if ((tabuleirodejogo[2][0] == 'n') && (jogarx.Key.Code == Mouse::Left) && (jogarx.MouseButton.X < 250) && (jogarx.MouseButton.Y > 520))
                    {
                    tabuleirodejogo[2][0] = 'x';
                    jx.SetPosition(35.f,555.f);
                    Janela.Draw(jx);
                    break;
                    }

                if ((tabuleirodejogo[2][1] == 'n') && (jogarx.Key.Code == Mouse::Left) && (jogarx.MouseButton.X > 270) && (jogarx.MouseButton.X < 520) && (jogarx.MouseButton.Y > 520))
                    {
                    tabuleirodejogo[2][1] = 'x';
                    jx.SetPosition(301.f,555.f);
                    Janela.Draw(jx);
                    break;
                    }

                if ((tabuleirodejogo[2][2] == 'n') && (jogarx.Key.Code == Mouse::Left) && (jogarx.MouseButton.X > 535) && (jogarx.MouseButton.Y > 520))
                    {
                    tabuleirodejogo[2][2] = 'x';
                    jx.SetPosition(562.f,555.f);
                    Janela.Draw(jx);
                    break;
                    }

                Janela.Display();
            }

            ///Player X won///
            if (tabuleirodejogo[0][0] == 'x' && tabuleirodejogo[0][1] == 'x' && tabuleirodejogo[0][2] == 'x')
            {
                Janela.Draw(gx);
                Janela.Display();
                Sleep(3.f);
                break;

            }
            else if (tabuleirodejogo[1][0] == 'x' && tabuleirodejogo[1][1] == 'x' && tabuleirodejogo[1][2] == 'x')
            {
                Janela.Draw(gx);
                Janela.Display();
                Sleep(3.f);
                break;
            }
            else if (tabuleirodejogo[2][0] == 'x' && tabuleirodejogo[2][1] == 'x' && tabuleirodejogo[2][2] == 'x')
            {
                Janela.Draw(gx);
                Janela.Display();
                Sleep(3.f);
                break;
            }
            else if (tabuleirodejogo[0][0] == 'x' && tabuleirodejogo[1][0] == 'x' && tabuleirodejogo[2][0] == 'x')
            {
                Janela.Draw(gx);
                Janela.Display();
                Sleep(3.f);
                break;
            }
            else if (tabuleirodejogo[0][1] == 'x' && tabuleirodejogo[1][1] == 'x' && tabuleirodejogo[2][1] == 'x')
            {
                Janela.Draw(gx);
                Janela.Display();
                Sleep(3.f);
                break;
            }
            else if (tabuleirodejogo[0][2] == 'x' && tabuleirodejogo[1][2] == 'x' && tabuleirodejogo[2][2] == 'x')
            {
                Janela.Draw(gx);
                Janela.Display();
                Sleep(3.f);
                break;
            }
            else if (tabuleirodejogo[0][0] == 'x' && tabuleirodejogo[1][1] == 'x' && tabuleirodejogo[2][2] == 'x')
            {
                Janela.Draw(gx);
                Janela.Display();
                Sleep(3.f);
                break;
            }
            else if (tabuleirodejogo[2][0] == 'x' && tabuleirodejogo[1][1] == 'x' && tabuleirodejogo[0][2] == 'x')
            {
                Janela.Draw(gx);
                Janela.Display();
                Sleep(3.f);
                break;
            }

            ///Tie///
            else if(tabuleirodejogo[0][0] != 'n' && tabuleirodejogo[0][1] != 'n' && tabuleirodejogo[0][2] != 'n' && tabuleirodejogo[1][0] != 'n' && tabuleirodejogo[1][1] != 'n' && tabuleirodejogo[1][2] != 'n' && tabuleirodejogo[2][0] != 'n' && tabuleirodejogo[2][1] != 'n' && tabuleirodejogo[2][2] != 'n')
            {
                Janela.Draw(empate);
                Janela.Display();
                Sleep(3.f);
                break;
            }

            ///Player O///
            while (1)
            {
                Event jogaro;
                (Janela.GetEvent(jogaro));

                if (jogaro.Type == Event::Closed)
                    Janela.Close();

                if ((tabuleirodejogo[0][0] == 'n') && (jogaro.Key.Code == Mouse::Left) && (jogaro.MouseButton.X < 250) && (jogaro.MouseButton.Y < 245))
                    {
                    tabuleirodejogo[0][0] = 'o';
                    jo.SetPosition(35.f,28.f);
                    Janela.Draw(jo);
                    break;
                    }

                if ((tabuleirodejogo[0][1] == 'n') && (jogaro.Key.Code == Mouse::Left) && (jogaro.MouseButton.X > 265) && (jogaro.MouseButton.Y < 250) && (jogaro.MouseButton.X < 520))
                    {
                    tabuleirodejogo[0][1] = 'o';
                    jo.SetPosition(301.f,28.f);
                    Janela.Draw(jo);
                    break;
                    }

                if ((tabuleirodejogo[0][2] == 'n') && (jogaro.Key.Code == Mouse::Left) && (jogaro.MouseButton.Y < 250) && (jogaro.MouseButton.X > 536))
                    {
                    tabuleirodejogo[0][2] = 'o';
                    jo.SetPosition(562.f,28.f);
                    Janela.Draw(jo);
                    break;
                    }

                if ((tabuleirodejogo[1][0] == 'n') && (jogaro.Key.Code == Mouse::Left) && (jogaro.MouseButton.X < 250) && (jogaro.MouseButton.Y < 505) && (jogaro.MouseButton.Y > 260))
                    {
                    tabuleirodejogo[1][0] = 'o';
                    jo.SetPosition(35.f,290.f);
                    Janela.Draw(jo);
                    break;
                    }

                if ((tabuleirodejogo[1][1] == 'n') && (jogaro.Key.Code == Mouse::Left) && (jogaro.MouseButton.X > 265) && (jogaro.MouseButton.X < 520) && (jogaro.MouseButton.Y < 505) && (jogaro.MouseButton.Y > 260))
                    {
                    tabuleirodejogo[1][1] = 'o';
                    jo.SetPosition(301.f,290.f);
                    Janela.Draw(jo);
                    break;
                    }

                if ((tabuleirodejogo[1][2] == 'n') && (jogaro.Key.Code == Mouse::Left) && (jogaro.MouseButton.X > 536) && (jogaro.MouseButton.Y < 505) && (jogaro.MouseButton.Y > 260))
                    {
                    tabuleirodejogo[1][2] = 'o';
                    jo.SetPosition(562.f,290.f);
                    Janela.Draw(jo);
                    break;
                    }

                if ((tabuleirodejogo[2][0] == 'n') && (jogaro.Key.Code == Mouse::Left) && (jogaro.MouseButton.X < 250) && (jogaro.MouseButton.Y > 520))
                    {
                    tabuleirodejogo[2][0] = 'o';
                    jo.SetPosition(35.f,555.f);
                    Janela.Draw(jo);
                    break;
                    }

                if ((tabuleirodejogo[2][1] == 'n') && (jogaro.Key.Code == Mouse::Left) && (jogaro.MouseButton.X > 270) && (jogaro.MouseButton.X < 520) && (jogaro.MouseButton.Y > 520))
                    {
                    tabuleirodejogo[2][1] = 'o';
                    jo.SetPosition(301.f,555.f);
                    Janela.Draw(jo);
                    break;
                    }

                if ((tabuleirodejogo[2][2] == 'n') && (jogaro.Key.Code == Mouse::Left) && (jogaro.MouseButton.X > 535) && (jogaro.MouseButton.Y > 520))
                    {
                    tabuleirodejogo[2][2] = 'o';
                    jo.SetPosition(562.f,555.f);
                    Janela.Draw(jo);
                    break;
                    }

                Janela.Display();
            }

            ///Player O Won///
            if (tabuleirodejogo[0][0] == 'o' && tabuleirodejogo[0][1] == 'o' && tabuleirodejogo[0][2] == 'o')
            {
                Janela.Draw(go);
                Janela.Display();
                Sleep(3.f);
                break;
            }
            else if (tabuleirodejogo[1][0] == 'o' && tabuleirodejogo[1][1] == 'o' && tabuleirodejogo[1][2] == 'o')
            {
                Janela.Draw(go);
                Janela.Display();
                Sleep(3.f);
                break;
            }
            else if (tabuleirodejogo[2][0] == 'o' && tabuleirodejogo[2][1] == 'o' && tabuleirodejogo[2][2] == 'o')
            {
                Janela.Draw(go);
                Janela.Display();
                Sleep(3.f);
                break;
            }
            else if (tabuleirodejogo[0][0] == 'o' && tabuleirodejogo[1][0] == 'o' && tabuleirodejogo[2][0] == 'o')
            {
                Janela.Draw(go);
                Janela.Display();
                Sleep(3.f);
                break;
            }
            else if (tabuleirodejogo[0][1] == 'o' && tabuleirodejogo[1][1] == 'o' && tabuleirodejogo[2][1] == 'o')
            {
                Janela.Draw(go);
                Janela.Display();
                Sleep(3.f);
                break;
            }
            else if (tabuleirodejogo[0][2] == 'o' && tabuleirodejogo[1][2] == 'o' && tabuleirodejogo[2][2] == 'o')
            {
                Janela.Draw(go);
                Janela.Display();
                Sleep(3.f);
                break;
            }
            else if (tabuleirodejogo[0][0] == 'o' && tabuleirodejogo[1][1] == 'o' && tabuleirodejogo[2][2] == 'o')
            {
                Janela.Draw(go);
                Janela.Display();
                Sleep(3.f);
                break;
            }
            else if (tabuleirodejogo[2][0] == 'o' && tabuleirodejogo[1][1] == 'o' && tabuleirodejogo[0][2] == 'o')
            {
                Janela.Draw(go);
                Janela.Display();
                Sleep(3.f);
                break;
            }

            ///Tie///
            else if(tabuleirodejogo[0][0] != 'n' && tabuleirodejogo[0][1] != 'n' && tabuleirodejogo[0][2] != 'n' && tabuleirodejogo[1][0] != 'n' && tabuleirodejogo[1][1] != 'n' && tabuleirodejogo[1][2] != 'n' && tabuleirodejogo[2][0] != 'n' && tabuleirodejogo[2][1] != 'n' && tabuleirodejogo[2][2] != 'n')
            {
                Janela.Draw(empate);
                Janela.Display();
                Sleep(3.f);
                break;
            }
        }



    return EXIT_SUCCESS;
}


Translation:
tabuleirodojogo = boardofthegame
Jogador_X = Player_X
Ganhou_X = Win_X
Empate = Tie
Janela = Window

Do you people know why it runs fine on Debug but on Release don't?
Also why is it that the debug exe. has 5 megabytes and the release version only 1?

Cheers

Pages: [1]
anything