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

Pages: 1 ... 3 4 [5]
61
Graphics / Variables in App.Draw
« on: June 10, 2010, 05:49:49 pm »
When I finally defined the variable properly it works great,
Thanks for your help.

62
SFML projects / Tic Tac Toe
« on: June 09, 2010, 05:36:03 pm »
Could someone point me toward an example of coding for such a game or one like it.
I have googled till I am blue in the face with no luck.
Much appreciate
Warren

63
Graphics / Problem with circles coordinates
« on: June 08, 2010, 10:25:53 pm »
Revised code
Code: [Select]
#include <SFML/Graphics.hpp>

int main()
{
int x, y, radius = 20;

    // Create the main rendering window
    sf::RenderWindow App(sf::VideoMode(1400, 900, 32), "Warren Graphics");

// Clear screen
App.Clear(sf::Color(128, 128, 128));

for(x = 0; x < 1400; x = x + 25);
{
for(y = 0; y < 900; y = y + 25)
{
App.Draw(sf::Shape::Circle(x, y,radius,sf::Color(255,0,0)));

// Display window contents on screen
App.Display();

}
}

    // Start game loop
    while (App.IsOpened())
{
// Process events
        sf::Event Event;

        while (App.GetEvent(Event))
{
// Close window : exit
if (Event.Type == sf::Event::Closed)
App.Close();

//Escape key exit
if((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::Escape))
App.Close();


}
    }
    return EXIT_SUCCESS;
}

64
Graphics / Problem with circles coordinates
« on: June 08, 2010, 10:23:53 pm »
Mr Gomila
I moved the do loop out of the event loop as I understood you to mean but The results are the same.
Warren

65
Graphics / Problem with circles coordinates
« on: June 08, 2010, 03:29:56 pm »
Why does the following code place circles at only one value of X?
Thanks
Warren

Code: [Select]
#include <SFML/Graphics.hpp>

int main()
    {
int x, y, radius = 20;
 
    // Create the main rendering window
    sf::RenderWindow App(sf::VideoMode(1400, 900, 32), "Warren Graphics");

// Clear screen
App.Clear(sf::Color(128, 128, 128));

    // Start game loop
    while (App.IsOpened())
        {
// Process events
        sf::Event Event;

        while (App.GetEvent(Event))
            {
for(x = 0; x < 1400; x = x + 25);
   {
for(y = 0; y < 900; y = y + 25)
        {
App.Draw(sf::Shape::Circle(x, y,radius,sf::Color(255,0,0)));

        // Display window contents on screen
    App.Display();

    // Close window : exit
    if (Event.Type == sf::Event::Closed)
App.Close();

    //Escape key exit
    if((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::Escape))
App.Close();
        }
    }
}
    }
    return EXIT_SUCCESS;
}

66
SFML projects / first project
« on: June 07, 2010, 09:41:27 pm »
This code compiles and executes as is.
However I wish to allow the user to select the color in the function.
Using either cin or scanf compiles but does not execute.
Help please?
Warren


Code: [Select]
#include <SFML/Graphics.hpp>
#include <iostream>
using namespace std;

void NameColor();
int rd, gr, bl;

int main()
{
int j, radius = 25;
 
    // Create the main rendering window
    sf::RenderWindow App(sf::VideoMode(1400, 900, 32), "Warren Graphics");

// Clear screen
App.Clear(sf::Color(128, 128, 128));

for(j = 1; j < 5; j++)
{
NameColor();

// Draw circle
App.Draw(sf::Shape::Circle(250,j*100+5,radius,sf::Color(rd,gr,bl)));

// Display window contents on screen
App.Display();

}

    // Start game loop
    while (App.IsOpened())
    {
// Process events
        sf::Event Event;

        while (App.GetEvent(Event))
        {
            // Close window : exit
            if (Event.Type == sf::Event::Closed)
App.Close();

//Escape key exit
if((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::Escape))
App.Close();

        }
    }
    return EXIT_SUCCESS;
}

void NameColor()
{
int value;

// Get color from Random
value = sf::Randomizer::Random(1,6);

// Get color from key press
// scanf("%d",&value);
// cin >> value;

// Define color
if(value == 1)
{
rd = 0;
gr = 0;
bl = 255;
}
if(value == 2)
{
rd = 255;
gr = 0;
bl = 0;
}
    if(value == 3)
{
rd = 255;
gr = 255;
bl = 255;
}
    if(value == 4)
{
rd = 0;
gr = 255;
bl = 0;
}
if(value == 5)
{
rd = 255;
gr = 255;
bl = 0;
}
if(value == 6)
{
rd = 0;
gr = 0;
bl = 0;
}
}

67
Graphics / Variables in App.Draw
« on: June 06, 2010, 10:22:36 pm »
Thanks for your advice. I guess I did not program correctly for I get an error saying "red is not a recognized color.  
Apparently I am not defining the variable name I am using correctly?
Waarren

68
Graphics / Variables in App.Draw
« on: June 05, 2010, 05:30:16 pm »
May I use a variablet o define the color instead of the actual Color in the App.Draw Circle command?
Warren

69
SFML projects / graphic.hpp vs window.hpp
« on: June 04, 2010, 05:32:29 pm »
Thanks
Warren

70
SFML projects / graphic.hpp vs window.hpp
« on: June 04, 2010, 04:19:06 pm »
I wish to write some code in C++ where it draws 4 circles on the screen with the program defining the location and color of each.
Then I want to draw an additional four circles with the user defining the location and color of each.
Do I need to use graphic.hpp or window.hpp?
Thanks
Warren

Pages: 1 ... 3 4 [5]