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

Pages: 1 ... 10 11 [12]
166
Graphics / Won't Display Polygon
« on: August 14, 2010, 11:13:35 am »
I'm trying to draw a polygon here, but the points I put in won't display.


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


using namespace std;

int main()
{
    sf::RenderWindow App(sf::VideoMode::GetMode(0), "Laz's Interactive Map :: The Wrath... :: PvP Created");

    // Creates the PE map :: 7000x3000
    sf::Shape Map;
    Map.AddPoint(0,100,sf::Color(100,100,200));
    Map.AddPoint(100,100,sf::Color(100,100,200));
    Map.EnableFill(true);
    Map.EnableOutline(false);
    //Map.Rotate(45);
    //Map.Move(0,354);

    while (App.IsOpened())
    {
        sf::Event Event;
        while (App.GetEvent(Event))
        {
            if (Event.Type == sf::Event::Closed)
                App.Close();
        }

        float ElapsedTime = App.GetFrameTime();

        App.Clear();

        App.Draw(Map);

        App.Display();

    }



    return 0;
}

167
Graphics / Getting Sprites to Work
« on: August 14, 2010, 09:17:23 am »
Thank you very much! :D

I got the map to display and now I'm moving around the map to see different parts of it. I need to know how to split the screen in half to have the map draw on one half and text input on the other side.

Can you help me, or do I need to make a new topic?

168
Graphics / Getting Sprites to Work
« on: August 14, 2010, 08:46:28 am »
Code: [Select]
sf::Image Image;
            if (!Image.LoadFromFile("MapBMP.bmp"))
            {
                cout << "Error... Couldn't load file..." << endl;
            }

This is what is loading the image, correct?

Also, I never found a command in the tutorials that actually displays the picture. What command is it? How is it used?

169
Graphics / Getting Sprites to Work
« on: August 14, 2010, 12:46:27 am »
OOPS! I meant to paste the code.... :/ Got distracted.

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

using std::endl; // Ends the line
using std::cout; // Basic Output
using sf::Clock; // Measures time
using sf::Sleep; // Causes the program to sleep
using sf::Thread; // Lightweight process (multiples can run at the same time)
using sf::Mutex; // Locks and unlocks chunks of code
using sf::Window; // Creates a window

class MyPicture
{
public :

    MyPicture(const MyPicture& Copy) : Image(Copy.Image), Sprite(Copy.Sprite)
    {
        Sprite.SetImage(Image);
    }

private :

    sf::Image  Image;
    sf::Sprite Sprite;
};

int main()
{
    Window App(sf::VideoMode::GetMode(1), "SFML Window", sf::Style::Resize | sf::Style::Close);

    while (App.IsOpened())
    {
        sf::Event Event;
        while (App.GetEvent(Event))
        {
            const sf::Input& Input = App.GetInput();

            bool LeftButtonDown = Input.IsMouseButtonDown(sf::Mouse::Left);
            bool RightButtonDown = Input.IsMouseButtonDown(sf::Mouse::Right);
            unsigned int MouseX = Input.GetMouseX();
            unsigned int MouseY = Input.GetMouseY();

            cout << MouseX << " " << MouseY << endl;
            cout << LeftButtonDown << RightButtonDown << endl;

            sf::Image Image;
            if (!Image.LoadFromFile("MapBMP.bmp"))
            {
                cout << "Error... Couldn't load file..." << endl;
            }

            if (Event.Type == sf::Event::Closed)
            {
                App.Close();
            }

            if ((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::Escape))
            {
                App.Close();
            }

            App.Display();
        }

    }

    return EXIT_SUCCESS;
}

170
Graphics / Getting Sprites to Work
« on: August 14, 2010, 12:34:47 am »
I'm gonna sound like a total idiot, but I can't get my sprites to work on my SFML program.

I am trying to make a program that displays a map on the left side of the window and a text input/output on the right side of the window.
(I'm still a beginner and the program isn't complete yet, because I don't know how to go about it)
Anyhow, the sprite of my map won't display to the screen.

Please help.

tyler.is.number.one@gmail.com
-Wander

Pages: 1 ... 10 11 [12]
anything