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.


Topics - Wander

Pages: 1 2 [3]
31
Window / Getting Integer Input
« on: August 15, 2010, 11:21:55 am »
I have a program that displays a map and I need it to allow the user to input coordinates for that map. I'm trying to do the text input, but I've run into problems.
    1) The text doesn't display on the screen as you input
    2) It doesn't display on the screen after you input it either
    3) I doubt it's even working


Code: [Select]
           bool PressA = false;
            std::string XCoord;
            sf::String text;


            // Press A : Add coords
            if ((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::A))
            {
                PressA = true;

                // In event loop...
                if (Event.Type == sf::Event::TextEntered)
                {
                    // Handle ASCII characters only
                    if (Event.Text.Unicode < 128)
                    {
                        XCoord += static_cast<int>(Event.Text.Unicode);
                        text.SetText(XCoord);
                    }
                }
            }


            if (PressA == true)
               App.Draw(text);

32
Window / Toggling Between Video Modes
« on: August 15, 2010, 08:47:59 am »
I'm trying to make my program have the ability to toggle between two video modes: Desktop Mode and Windowed Mode.

Code: [Select]
           if (DONT KNOW WHAT TO PUT HERE && (Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::W))
                App.Create(DesktopMode, sf::Style::Fullscreen);
           
            if (DONT KNOW WHAT TO PUT HERE && (Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::W))
                App.Create(sf::VideoMode::GetMode(0), sf::Style::Resize | sf::Style::Close);


I'm not sure what to put in the if statement for checking the video modes. It seems like I've tried everything. Ugh.

33
Graphics / Center and Half Size
« on: August 15, 2010, 04:26:36 am »
I was looking at the tutorials and saw the views page.

Code: [Select]
   sf::Vector2f Center(1000, 1000);
    sf::Vector2f HalfSize(400, 300);
    sf::View View(Center, HalfSize);

    View.SetCenter(500, 300);
    View.SetHalfSize(200, 100);


The page didn't actually tell me what these mean.

Also, what does the 'f' mean that we usually have to put after number parameters? ie. 4.0f

34
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;
}

35
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 2 [3]
anything