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

Pages: 1 2 3 [4]
46
Window / Possibility of displaying Zoom/Rotate in increments
« on: September 08, 2010, 05:16:14 am »
I want to implement a function that gradually performs some functions and displays it in increments, instead of when I choose to zoom in, it instantaneously zooms to that setting.

I have tried using a for loop, that zooms and rotates on a certain degree each turn, but it is still instantaneous, and doesn't display in increments.

Is there a way I can implement this? To delay the loop each turn?

Thanks.

47
General / Need help used separate void functions
« on: September 07, 2010, 09:20:00 pm »
Thanks for the links, after messing with it a little bit more and looking at some examples I understand how to set it up now :D.

48
General / Need help used separate void functions
« on: September 07, 2010, 07:02:26 am »
Now that I've got to mess with it again, I've got another question.

I want to make different classes to manage different game functions and link all the separate classes to a primary class to manage the other classes.

Such as this:
I have the same code as posted before, but an added Sprite Manager Class, to load the images. Then I link it with the Application Class, and I load the image, but my Spr_Mgr is undeclared.

Code: [Select]

#include <SFML/Graphics.hpp

//////////////////////
//Declare Sprite Class
//////////////////////
class SpriteManager
{
private:
sf::Image Image1;
public:
void LoadPicture();
};

////////////////////////
//Sprite Class Functions
////////////////////////
void SpriteManager::LoadPicture()
{
if( !Image1.LoadFromFile("Image1.png") ){}
sf::Sprite Image_1(Image1);
Image_1.SetPosition(150,150);
}

////////////////////
//Declare Game Class
////////////////////
class Application
{
private:
   sf::RenderWindow Window;
   sf::String Hello;

   void DrawStuff();
public:
   Application();
   void Run();
   SpriteManager Spr_Mgr(); //Create Sprite Manager for Application
};

//////////////////////
//Game Class Functions
//////////////////////
Application::Application()
{
   Window.Create(sf::VideoMode(400, 600), "Title");

   Spr_Mgr.LoadPictures(); //Load Pictures with Sprite Manager - ERROR, Spr_Mgr not recognized!!
   Hello.SetText("Hello!");
   Hello.SetColor(sf::Color(0, 128, 128));
   Hello.SetPosition(100.f, 100.f);
   Hello.SetSize(30.f);
}

void Application::DrawStuff()
{
   Window.Draw(Image_1); //Display the Picture
   Window.Draw(Hello);
}

void Application::Run()
{
   while (Window.IsOpened())
    {
        sf::Event Event;
        while (Window.GetEvent(Event))
        {
            if (Event.Type == sf::Event::Closed)
                Window.Close();
        }
 
        DrawStuff();
        Window.Display();
    }
}
///////////
//Main Game
///////////
int main()
{
   Application Game;
   Game.Run();

   return 0;
}
///END///


Any help is appreciated  :D

49
General / Need help used separate void functions
« on: September 07, 2010, 02:57:35 am »
Sweet, I will take a look at it later. Thanks man!

I'm fairly familiar with classes, usually I just use structures.

50
General discussions / Your favorite?
« on: September 07, 2010, 12:45:37 am »
Out of those I prefer MW2 :D.

51
General / Need help used separate void functions
« on: September 07, 2010, 12:43:36 am »
I'm having problems with separating my programs into separate functions.

Such as having a function that display's text from a string stored earlier in the program:

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

void DisplayText();

int main()
{
    // Create main window
    sf::RenderWindow App(sf::VideoMode(326, 600), "Title");

    // Create a graphical string
    sf::String Hello;
    Hello.SetText("Hello!");
    Hello.SetColor(sf::Color(0, 128, 128));
    Hello.SetPosition(100.f, 100.f);
    Hello.SetSize(30.f);

    // 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();
        }
DisplayText();
        App.Display();
    }
std::cout << "DONE" << std::endl;
std::cin.get();
return 0;
}

void DisplayText()
{
App.Draw(Hello);
}


What would I need to include so that the function includes the variables that I need to read?

Thanks.

52
Graphics / Registering Single Mouse Click
« on: September 04, 2010, 11:05:55 pm »
Ah ok thanks I got it to work! So for other readers that have had this problem, here's the code:

Code: [Select]
while( App.GetEvent(Event))
{
if (Event.Type == sf::Event::Closed)
App.Close();
else if( Event.Type == Event.MouseButtonReleased && Event.MouseButton.Button == sf::Mouse::Left )
std::cout << "LEFT" << std::endl;
}

53
Graphics / Registering Single Mouse Click
« on: September 04, 2010, 10:19:39 pm »
I guess I must be doing something wrong, I have tried that, but I still get infinite output if the mouse is held down.

What is wrong with this sample?

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

int main()
{
sf::RenderWindow App(sf::VideoMode(600,600),"Test");
App.EnableKeyRepeat(false);

    while( App.IsOpened() )
    {
const sf::Input& Input = App.GetInput();
App.GetInput().GetMouseX(), App.GetInput().GetMouseY();
sf::Event Event;
while( App.GetEvent(Event))
{
if (Event.Type == sf::Event::Closed)
App.Close();
}
if( Input.IsMouseButtonDown(sf::Mouse::Left) )
std::cout << "left" << std::endl;
App.Display();
}
std::cout << "DONE" << std::endl;
}

54
Graphics / Registering Single Mouse Click
« on: September 04, 2010, 09:33:46 pm »
Hello, I've lurked here for a while to help solve some problems here and there and I have searched for the answer to the problem I have now, but I haven't found much solid info.

I am trying to use the mouse to select buttons in a program, but holding the mouse down for longer than half a second will output the button multiple times.

How can I fix it so that the button won't be initiated until I release the mouse click on the button?

Thanks.

Pages: 1 2 3 [4]