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] 2 3 ... 5
1
General discussions / Games
« on: January 17, 2014, 05:46:36 am »
Would it be practical to use SFML to write a board game such as chess or checkers for two people to play??????
Thanks
WVT

2
Window / Re: TextEntered Event does weird stuff
« on: January 16, 2014, 04:25:51 am »
Thanks
That fixed it.

3
Window / Re: TextEntered Event does weird stuff
« on: January 15, 2014, 11:46:53 pm »
I typed the text entered event given in the vs 2.1 event tutorial and got a compile error " cout not recognized"  What gives please?
Thanks

4
General / Re: error message
« on: October 16, 2013, 12:40:28 am »
I just want to thank everyone for their helpful suggestions!
I accidentally tripped over the answer so now I do not need your help with this problem.
Warren

5
General / error message
« on: October 11, 2013, 07:33:25 pm »
OSX 10.8.5 and xcode 5
I downloaded and installed version 2.1 and the xcode templates.
When I run the sample program it compiles but gives me an error message at the window.clear line.
Thread 1 EXC_BAD_ACCESS (code = 1, address = 0X25800000338.
What did I do wrong please?
Thanks
Warren

6
General / Xcode
« on: October 08, 2013, 09:49:25 pm »
Installed latest version of Xcode.  Compile sample code results in 31 error messages.
Worked great before installation.
Help please?
Warren

7
Graphics / Re: event
« on: August 28, 2013, 09:45:48 pm »
What I am asking, is why the instructions are executed when no event is properly called????
Warren

8
Graphics / event
« on: August 23, 2013, 11:34:47 pm »
As I understand the event tutorial, the following code should not move the shape when the mouse is moved or a key pressed, but the shape does move?????
 

#include <SFML/Graphics.hpp>

int main()
{
    int x = 50, y = 50;
   
    sf::RenderWindow window(sf::VideoMode(800, 600), "Input data test" );
   
    sf::CircleShape shape(20);
    shape.setFillColor(sf::Color::Color(255,0,0));
   
    while (window.isOpen())
    {
        sf::Event event;
        while (window.pollEvent(event))
        {
            window.clear(sf::Color(128,128,128));
            shape.setPosition(x, y);
            window.draw(shape);
            window.display();
            if(x < 750) x = x + 25;
            else
            {
                x = 50;
                y = y + 25;
            }
        }
    }
    return EXIT_SUCCESS;
}
 

9
General discussions / Frustrations
« on: June 27, 2013, 05:43:32 pm »
 

   I wrote  my first program on a yellow pad just over 61 years ago.  If I remember correctly it was called Fortran 4.  A key punch operator took the sheets and returned shortly with a deck of cards with holes punched in them.  She called the deck a source deck.  I fed them into a card reader connected to an IBM mainframe.  It responded by punching me a new deck called an object deck.  I combined this deck with a bunch of other decks called library decks  and fed them into the same card reader.  This time I received a deck called an executable deck.  Using my yellow pad again I listed all the input data and received another deck called input deck.  Placing this on the front of my executable deck I once again approached the card reader.  After entering this deck, I received a printout of  rows and columns of digits representing the flight performance of the engine and airplane our company was developing for the military, 
   A couple of years ago, I decided to try my hand at programming again.  I purchased a couple of books on C++ and downloaded some stuff called Allegro.
With the list of reserved words (as they were called) and the description of what they did and the examples, I was able to get a program up and running that filled the screen with random colored pixels and then set back and watch as it did a bubble sort, bubbling the lighter colors to the left upper corner and the darker to the lower right corner.  My great grandchildren loved watching this program,  But my computer died of old age  so I replaced it.  The new one had an Intel processor and a new OS so my bubble program would no longer function.
Then I saw on the internet  Simple and Fast Multimedia Library.  The kids liked the Hanoi's Tower game so I decided to give it a shot.   
   I read the tutorials, the documentation, and the forum pages but could not find any indication of reserved words or their function.  So after many weeks of frustrated try and fail I finally arrived at the enclosed.  Not good but is appears to work.

// tower of hanoi
// June 21st, 2013
// Yours truly

#include <SFML/Graphics.hpp>


int main()
{
    // Create the main window
    sf::RenderWindow window(sf::VideoMode(2200, 1300), "SFML window");
   
    window.clear(sf::Color(128,128,128));
   
    sf::RectangleShape rect1(sf::Vector2f(300,150));
    rect1.setFillColor(sf::Color(255,0,0));
    rect1.setPosition(200,550);
    window.draw(rect1);
    sf::RectangleShape rect2(sf::Vector2f(400,150));
    rect2.setFillColor(sf::Color(255,255,255));
    rect2.setPosition(150,700);
    window.draw(rect2);
    sf::RectangleShape rect3(sf::Vector2f(500,150));
    rect3.setFillColor(sf::Color(0,0,255));
    rect3.setPosition(100,850);
    sf::RectangleShape rect4(sf::Vector2f(50,600));
    rect4.setFillColor(sf::Color(0,0,0));
    rect4.setPosition(325,400);
    sf::RectangleShape rect5(sf::Vector2f(50,600));
    rect5.setFillColor(sf::Color(0,0,0));
    rect5.setPosition(1075,400);
    sf::RectangleShape rect6(sf::Vector2f(50,600));
    rect6.setFillColor(sf::Color(0,0,0));
    rect6.setPosition(1825,400);
    sf::RectangleShape rect7(sf::Vector2f(2200,300));
    rect7.setFillColor(sf::Color(139,68,19));
    rect7.setPosition(0,1000);
   
    window.draw(rect1);
    window.draw(rect2);
    window.draw(rect3);
    window.draw(rect4);
    window.draw(rect5);
    window.draw(rect6);
    window.draw(rect7);
    window.display();
   
    // Start the game loop
    while (window.isOpen())
    {
        // Process events
        sf::Event event;
        while (window.pollEvent(event))
        {
            // Close window : exit
            if (event.type == sf::Event::Closed)
            {
                window.close();
            }
           
            // Escape pressed : exit
            if (event.type == sf::Event::KeyPressed && event.key.code == sf::Keyboard::Escape)
            {
                window.close();
            }
         
            if ((event.type == sf::Event::MouseMoved) &&  (sf::Mouse::isButtonPressed(sf::Mouse::Button::Left))
                && (sf::Mouse::getPosition(window).x > rect1.getPosition().x - 50)
                && (sf::Mouse::getPosition(window).x < rect1.getPosition().x + 50)
                && (sf::Mouse::getPosition(window).y > rect1.getPosition().y - 50)
                && (sf::Mouse::getPosition(window).y < rect1.getPosition().y + 50))
               
            {
                rect1.setPosition(event.mouseMove.x,event.mouseMove.y);
            }
           
            if ((event.type == sf::Event::MouseMoved) &&  (sf::Mouse::isButtonPressed(sf::Mouse::Button::Left))
                && (sf::Mouse::getPosition(window).x > rect2.getPosition().x - 50)
                && (sf::Mouse::getPosition(window).x < rect2.getPosition().x + 50)
                && (sf::Mouse::getPosition(window).y > rect2.getPosition().y - 50)
                && (sf::Mouse::getPosition(window).y < rect2.getPosition().y + 50))
               
            {
                rect2.setPosition(event.mouseMove.x,event.mouseMove.y);
            }
           
            if ((event.type == sf::Event::MouseMoved) &&  (sf::Mouse::isButtonPressed(sf::Mouse::Button::Left))
                && (sf::Mouse::getPosition(window).x > rect3.getPosition().x - 50)
                && (sf::Mouse::getPosition(window).x < rect3.getPosition().x + 50)
                && (sf::Mouse::getPosition(window).y > rect3.getPosition().y - 50)
                && (sf::Mouse::getPosition(window).y < rect3.getPosition().y + 50))
               
            {
                rect3.setPosition(event.mouseMove.x,event.mouseMove.y);
            }
           
        }
     
        window.clear(sf::Color(128,128,128));
        window.draw(rect1);
        window.draw(rect2);
        window.draw(rect3);
        window.draw(rect4);
        window.draw(rect5);
        window.draw(rect6);
        window.draw(rect7);
        window.display();
   
       
       
    }
   
    return EXIT_SUCCESS;
   
}

10
Graphics / Re: Mouse movement
« on: June 24, 2013, 07:16:31 pm »
[/code

I thought it was inside?

#include <SFML/Graphics.hpp>

int main()
{
       // Create the main window
    sf::RenderWindow window(sf::VideoMode(2200, 1300), "SFML window");
 
    window.clear(sf::Color(128,128,128));
   
    sf::RectangleShape shape(sf::Vector2f(50,50));
    shape.setFillColor(sf::Color(255,0,0));
    shape.setPosition(100,650);
    window.draw(shape);
    window.display();

    // Start the game loop
    while (window.isOpen())
    {
        // Process events
        sf::Event event;
        while (window.pollEvent(event))
        {
             // Close window : exit
            if (event.type == sf::Event::Closed)
            {
                window.close();
            }

             if((sf::Mouse::isButtonPressed(sf::Mouse::Button::Left))
                && (sf::Event::MouseMoved))
            {
                shape.setPosition(sf::Event::MouseMoveEvent().x,sf::Event::MouseMoveEvent().y);
                window.clear(sf::Color(128,128,128));
                window.draw(shape);
                window.display();
            }
         }
     }
    return EXIT_SUCCESS;
}
 

11
Graphics / Re: Mouse movement
« on: June 24, 2013, 12:02:30 am »
I am looking for the expression for the x coordinate of the mouse after movement.  In the documentation I find sf::Event::MouseMoveEvent::x
I entered it into my source code but it does not compile. Needs a minor change sf::Event::MouseMoveEvent().x
Now it compiles but guess what I get after execution.
The x coordinate of the origin of the window, not the mouse movement.
Oh well back to the drawing board.
Please excuse the sarcasm, just had to get that off my chest!!!!

12
Graphics / Re: Mouse movement
« on: June 22, 2013, 09:14:42 pm »
When one is not an experienced programmer, tutorials  are not always the answer.  For instance to install SFML the tutorial states "copy the contents of lib to /usr/local/lib"  simple enough yes?.  But The MAC finder does not know that directory so how does one accomplish the task?  He must be familiar with Terminal and other such things.
Same thing applies with some of the other tutorials.
Warren 

13
Graphics / Re: Mouse movement
« on: June 21, 2013, 06:37:28 pm »
Perhaps some day some one will write a book "SFML for Idiots". When it happens, I will be the first purchaser and then perhaps I will be able to learn SFML programming as I am trying to learn C++.

14
Graphics / Re: Mouse movement
« on: June 21, 2013, 05:59:34 pm »
Thanks
 

15
Graphics / Re: Mouse movement
« on: June 21, 2013, 02:06:27 am »
If I could find and understand the answers to my questions in the tutorials or documentation or by reading the threads, I would not be bothering you nice people for help!!!!!

Pages: [1] 2 3 ... 5
anything