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

Pages: [1]
1
Graphics / Roll over images
« on: February 20, 2011, 08:50:11 pm »
Quote
I may be incorrect but I think you will have to offset the subrect with the sprites position for this to work. The sprite's subrect is only relative to itself, not the world/screen.


do you know how to do that?

2
General / code closes before i can use it
« on: February 19, 2011, 05:59:33 am »
You were right. I misplaced the image

3
Graphics / Roll over images
« on: February 19, 2011, 05:51:37 am »
Thanks for that idea. I had no clue GetSubReact even existed

4
General / code closes before i can use it
« on: February 18, 2011, 04:11:58 am »
the following code closes before i can even use it. i have no clue what is wrong because the debug does not report any errors when running.

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

////////////////////////////////////////////////////////////
// Control Center of Functions
////////////////////////////////////////////////////////////
int Mouse_Check(int M_Y,int M_X);

////////////////////////////////////////////////////////////
/// Entry point of application
///
/// \return Application exit code
///
////////////////////////////////////////////////////////////
int main()
{
    // Create the main rendering window
sf::Window App(sf::VideoMode(600, 650), "Spanish Game");

    // Load the sprite image from a file
    sf::Image Main_Box;
    if (!Main_Box.LoadFromFile("Main_Box.bmp"))
        return EXIT_FAILURE;

// Load the sprite image from a file
    sf::Image Answer_Box;
    if (!Answer_Box.LoadFromFile("Answer_Box.bmp"))
        return EXIT_FAILURE;

// Load the sprite image from a file
    sf::Image Roll_Over;
    if (!Roll_Over.LoadFromFile("Roll_Over.bmp"))
        return EXIT_FAILURE;

    // Create the sprite
    sf::Sprite Main(Main_Box);
sf::Sprite Answer_One(Answer_Box);
sf::Sprite Answer_Two(Answer_Box);
sf::Sprite Answer_Three(Answer_Box);
sf::Sprite Answer_Four(Answer_Box);

    // Change its properties
    Main.SetPosition(100.f, 0.f);
Answer_One.SetPosition(100.f, 200.f);
Answer_Two.SetPosition(300.f, 200.f);
Answer_Three.SetPosition(100.f, 350.f);
Answer_Four.SetPosition(300.f, 350.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();
        }
//Mouse Locations
const sf::Input& Input = App.GetInput();

int M_Y = App.GetInput().GetMouseY();
int M_X = App.GetInput().GetMouseX();

int Change = Mouse_Check(M_Y,M_X);
if(Change == 1)
{
sf::Sprite Answer_One(Roll_Over);
}
if(Change == 2)
{
sf::Sprite Answer_Two(Roll_Over);
}
if(Change == 3)
{
sf::Sprite Answer_Three(Roll_Over);
}
if(Change == 4)
{
sf::Sprite Answer_Three(Roll_Over);
}//replaces image for the roll over effect

// Clear the window
        //App.Clear();

// Display things on screen
        App.Display();

    }

    return EXIT_SUCCESS;
}



int Mouse_Check(int M_Y,int M_X)
{
int X = 0, Y = 0;
//used to check all positions to see if your mouse is over a location
for(X++; X<150;)
{
for(Y++; Y<200;)
{
Y += 200;
X += 100;
if((X == M_X)&&(Y==M_Y))
{
return 1;
}
X += 200;
if((X==M_X)&&(Y==M_Y))
{
return 2;
}
Y += 150;
X -= 200;
if((X==M_X)&&(Y==M_Y))
{
return 3;
}
X +=200;
if((X==M_X)&&(Y==M_Y))
{
return 4;
}

X-=300;
Y-=350;
}
}//end of X and Y checks
return 0;
}


does anyone know what is wrong?

5
Graphics / Roll over images
« on: February 17, 2011, 11:06:16 pm »
i want to create roll over images and i have found a way to do this with two "for" functions.  is there a built in way to compare the location of a sprite and a mouse?

i only ask because checking the majority of the screen every time the screen refreshes is a waste of ram.

6
Window / Window does not stay open
« on: February 07, 2011, 02:33:23 am »
i have been experimenting with SFML and my recent project compiles perfectly fine but it does not stay open.

Code: [Select]

#include <SFML/Graphics.hpp>
#include <SFML/System.hpp>
#include <SFML/Window.hpp>

sf::Window App(sf::VideoMode(800, 600, 32), "SFML Window");
sf::Event Event;
sf::Input Input;
sf::Input &rInput = Input;

int Start_Menu();

int main()
{
App.Create(sf::VideoMode(800, 600, 32), "SFML Window");

bool Running = true;
while (Running)
{
    App.Display();
while (App.IsOpened())
{

Start_Menu();
}

}

return EXIT_SUCCESS;

}

int Start_Menu()
{


const sf::Input& Input = App.GetInput();

unsigned int Start_X = Input.GetMouseX(), Start_Y = Input.GetMouseY();

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

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

return 0;
}


i put all the sf::(ect) up at the top so i do not have to call it in both functions.

i am running a 64bit vista if that is any help[/code]

7
General / Errors while linking
« on: January 26, 2011, 02:22:00 am »
thank you so much laurent, i am very new to libraries so thank you for helping me out. i appreciate it a lot.

8
General / Errors while linking
« on: January 25, 2011, 01:45:46 am »
ok, i did get the original error to fix. i continued with the tutorial on the main site and got a new set of errors as soon i got to gl- prefixes. i buil the rotating cube code and i get these errors.


1>------ Build started: Project: Test_SFML, Configuration: Debug Win32 ------
1>Compiling...
1>Main.cpp
1>Linking...
1>Main.obj : error LNK2019: unresolved external symbol __imp__glEnd@0 referenced in function _main
1>Main.obj : error LNK2019: unresolved external symbol __imp__glVertex3f@12 referenced in function _main
1>Main.obj : error LNK2019: unresolved external symbol __imp__glBegin@4 referenced in function _main
1>Main.obj : error LNK2019: unresolved external symbol __imp__glRotatef@16 referenced in function _main
1>Main.obj : error LNK2019: unresolved external symbol "public: float __thiscall sf::Clock::GetElapsedTime(void)const " (?GetElapsedTime@Clock@sf@@QBEMXZ) referenced in function _main
1>Main.obj : error LNK2019: unresolved external symbol __imp__glTranslatef@12 referenced in function _main
1>Main.obj : error LNK2019: unresolved external symbol __imp__glClear@4 referenced in function _main
1>Main.obj : error LNK2019: unresolved external symbol __imp__glViewport@16 referenced in function _main
1>Main.obj : error LNK2019: unresolved external symbol _gluPerspective@32 referenced in function _main
1>Main.obj : error LNK2019: unresolved external symbol __imp__glLoadIdentity@0 referenced in function _main
1>Main.obj : error LNK2019: unresolved external symbol __imp__glMatrixMode@4 referenced in function _main
1>Main.obj : error LNK2019: unresolved external symbol __imp__glDepthMask@4 referenced in function _main
1>Main.obj : error LNK2019: unresolved external symbol __imp__glEnable@4 referenced in function _main
1>Main.obj : error LNK2019: unresolved external symbol __imp__glClearColor@16 referenced in function _main
1>Main.obj : error LNK2019: unresolved external symbol __imp__glClearDepth@8 referenced in function _main
1>Main.obj : error LNK2019: unresolved external symbol "public: __thiscall sf::Clock::Clock(void)" (??0Clock@sf@@QAE@XZ) referenced in function _main
1>C:\Users\Reed\Documents\Visual Studio 2008\Projects\Test_SFML\Debug\Test_SFML.exe : fatal error LNK1120: 16 unresolved externals
1>Build log was saved at "file://c:\Users\Reed\Documents\Visual Studio 2008\Projects\Test_SFML\Test_SFML\Debug\BuildLog.htm"
1>Test_SFML - 17 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

will i have to download the opengl sdk and install that as well?

9
General / Errors while linking
« on: January 24, 2011, 12:57:48 am »
i am using SFML 1.6 and i did link something incorrectly. i fixed it and i got a new error. this is what came up.


------ Build started: Project: SFML_Test, Configuration: Debug Win32 ------
Compiling...
Main.cpp
Linking...
MSVCRTD.lib(crtexew.obj) : error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup
C:\Documents and Settings\Owner\My Documents\Visual Studio 2008\Projects\SFML_Test\Debug\SFML_Test.exe : fatal error LNK1120: 1 unresolved externals
Build log was saved at "file://c:\Documents and Settings\Owner\My Documents\Visual Studio 2008\Projects\SFML_Test\SFML_Test\Debug\BuildLog.htm"
SFML_Test - 2 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

10
General / Errors while linking
« on: January 23, 2011, 11:17:38 pm »
this is everything i got after compiling.


------ Build started: Project: SFML_Test, Configuration: Debug Win32 ------
Compiling...
Main.cpp
Linking...
Main.obj : error LNK2019: unresolved external symbol "void __cdecl sf::Sleep(float)" (?Sleep@sf@@YAXM@Z) referenced in function _main
Main.obj : error LNK2019: unresolved external symbol "public: float __thiscall sf::Clock::GetElapsedTime(void)const " (?GetElapsedTime@Clock@sf@@QBEMXZ) referenced in function _main
Main.obj : error LNK2019: unresolved external symbol "public: __thiscall sf::Clock::Clock(void)" (??0Clock@sf@@QAE@XZ) referenced in function _main
MSVCRTD.lib(crtexew.obj) : error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup
C:\Documents and Settings\Owner\My Documents\Visual Studio 2008\Projects\SFML_Test\Debug\SFML_Test.exe : fatal error LNK1120: 4 unresolved externals
Build log was saved at "file://c:\Documents and Settings\Owner\My Documents\Visual Studio 2008\Projects\SFML_Test\SFML_Test\Debug\BuildLog.htm"
SFML_Test - 5 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

11
General / Errors while linking
« on: January 23, 2011, 10:57:04 pm »
i am brand new to this SDK and i just tried compiling the test code from the tutorial that uses the clock.

when i compiled it i received 4 errors.  every single error was  LNK2019.

i followed the installation instructions perfectly.

i am using the Visual C++ 2008 to compile and i am running it on a windows XP, 32 bit.

any way to fix this?

Pages: [1]