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

Pages: 1 [2]
16
General / Can´t run sfml games on a certain machine
« on: November 26, 2010, 04:27:38 pm »
For me using codeblocks w/ mingw I had to buld sfml's static libs then in linker options change "lsfml-graphics" to "lsfml-graphics-s" and so on down the list. I also remove SFML_DYNAMIC from my #defines and put in SFML_STATIC but im not sure if that was necessary.

17
General / Can´t run sfml games on a certain machine
« on: November 26, 2010, 01:50:37 am »
Its a bug between sfml and new ati drivers, use the static libs instead of the dynamic. I just had the same problem as you.

18
General / Can't run sfml applications
« on: November 26, 2010, 01:44:53 am »
I found that it is the ATI bug, I updated my graphics drivers in that time. I compiled the static libraries and applications run fine now.

19
General / Can't run sfml applications
« on: November 25, 2010, 12:44:01 am »
I find myself almost out of idiot hill getting sfml2 to work only to find that some way in the last few days I broke sfml. Not only do applications I compile not run, some of the others I downloaded from the projects section wont run either. I copied a simple open window program that I made onto my laptop and it ran fine but on my development desktop it just opens a blank console window which has no text or cpu usage, the same for others. Any ideas?

20
General / Setting up sfml 2 and cmake with codeblocks
« on: November 24, 2010, 11:29:37 pm »
Ah I got it, I had to use MinGW makefiles instead of the codeblocks ones, thanks :)

21
General / Setting up sfml 2 and cmake with codeblocks
« on: November 24, 2010, 09:47:21 pm »
I have decided to move to sfml 2 but am stuck and getting cmake to work. With a new normal codeblocks install and new cmake 2.8 install can anyone explain how to get cmake to make the projects for mingw properly (i get a lot of errors trying to follow the guid in the tutorial section)

22
Graphics / Best Way To Translate (move) A Sprite?
« on: November 21, 2010, 04:22:04 pm »
So you need to move a sprite between 2 points on a euclidian plane, simply and fast, and the person helping you hates working with vectors ;).

First we need to find the total length it will travel (x2-x1) on each axis (y2-y1). then we need to find out what percentage of time has passed (currentTime/totalTime) and then multiply the two to find how far it is on its path on each axis then add it to the starting points.

Use floats for all variables.

Sprite.SetPosition(x1+(x2-x1)*(currentTime/totalTime),y1+(y2-y1)*(currentTime/totalTime));

you can get total time from Refreshrate*seconds and current time be ticking up once per frame

23
Graphics / Post Effects question
« on: November 21, 2010, 03:58:46 pm »
So the simplest/fastest way I can do this is to pass 4 floats per pixel (vec4's) of a texture and use sfml to read the pixel data of the texture?

24
Graphics / Post Effects question
« on: November 21, 2010, 12:50:02 am »
Is it possible to have a post effect return a variable (other than pixel data) back to the program directly?

25
C / Strings giving exit error
« on: October 20, 2010, 04:38:51 am »
Code: [Select]
#include <SFML/Audio.h>
#include <SFML/Graphics.h>
#include <SFML/Config.h>
#include <SFML/Network/IPAddress.h>
#include <SFML/Network/SocketStatus.h>
#include <SFML/Network/Types.h>

 int main()
 {
    char Running = 1; // Hold boolean that says if we need to process a close
    int BackgroundRed = 55, BackgroundGreen = 238, BackgroundBlue = 0, mnMnuLoc = 1, gameState = 1; // Set initial color values, will likely be tiled image in future
    sfWindowSettings Settings = {32, 8, 2}; // Window settings
    sfVideoMode Mode = {800, 600, 32}; // Set render area and color depth

    // Prepare the SFML packages
    sfRenderWindow* App;
    sfImage* mnuLoadImage;
    sfSprite* mnuLoadSprite;
    sfFont* mnuFont;
    sfString* mnuText1;
    sfString* mnuText2;
    sfString* mnuText3;
    sfString* mnuText4;
    sfMusic* mnuMusic;
    sfEvent Event;

    // Create the main window
    App = sfRenderWindow_Create(Mode, "Fast Track Racers", sfResize | sfClose, Settings);
    sfWindow_UseVerticalSync(App, 1);

    // Load and play the menu music
    mnuMusic = sfMusic_CreateFromFile("Audio/Menu.ogg");
    sfMusic_SetLoop(mnuMusic, sfTrue);
    sfMusic_Play(mnuMusic);

    // Load a sprite to display
    mnuLoadImage = sfImage_CreateFromFile("Images/menu_Car.jpg");
    mnuLoadSprite = sfSprite_Create();
    sfSprite_SetImage(mnuLoadSprite, mnuLoadImage);
    sfSprite_SetPosition(mnuLoadSprite, 60, 100);

    // Load Main Menu Text
    mnuFont = sfFont_CreateFromFile("Fonts/arial.ttf", 50, NULL);
    mnuText1 = sfString_Create();
    mnuText2 = sfString_Create();
    mnuText3 = sfString_Create();
    mnuText4 = sfString_Create();
    sfString_SetPosition(mnuText1, 100, 100);
    sfString_SetPosition(mnuText2, 100, 150);
    sfString_SetPosition(mnuText3, 100, 200);
    sfString_SetPosition(mnuText4, 100, 250);
    sfString_SetText(mnuText1, "Single Player");
    sfString_SetText(mnuText2, "Multiplayer");
    sfString_SetText(mnuText3, "Options");
    sfString_SetText(mnuText4, "Exit");
    sfString_SetFont(mnuText1, mnuFont);
    sfString_SetFont(mnuText2, mnuFont);
    sfString_SetFont(mnuText3, mnuFont);
    sfString_SetFont(mnuText4, mnuFont);
    sfString_SetSize(mnuText1, 32);
    sfString_SetSize(mnuText2, 32);
    sfString_SetSize(mnuText3, 32);
    sfString_SetSize(mnuText4, 32);


    // Start the game loop
    while (sfRenderWindow_IsOpened(App))
    {
        // Process events
        while (sfRenderWindow_GetEvent(App, &Event))
        {
            switch(gameState)
            {
                case(0):
                    Running = 0;
                    break;
                case(1): // Main menu
                    if (Event.Type == sfEvtKeyPressed)
                    {
                            if(Event.Key.Code == sfKeyReturn && mnMnuLoc == 4)
                                gameState = 0;
                            if (Event.Key.Code == sfKeyUp)
                                mnMnuLoc--;
                            if (Event.Key.Code == sfKeyDown)
                                mnMnuLoc++;
                            if (Event.Key.Code == sfKeyEscape)
                                sfRenderWindow_Close(App);
                    }
            }

        }
        // Clear the screen
        sfRenderWindow_Clear(App, sfColor_FromRGB(BackgroundRed,BackgroundGreen,BackgroundBlue));
        switch(gameState)
        {
            case(0): // End the game
                sfRenderWindow_Close(App);
                break;
            case(1): // Main menu
                // Draw mnuString
                sfRenderWindow_DrawString(App, mnuText1);
                sfRenderWindow_DrawString(App, mnuText2);
                sfRenderWindow_DrawString(App, mnuText3);
                sfRenderWindow_DrawString(App, mnuText4);
                // Main Menu Handling
                if(mnMnuLoc<1)
                    mnMnuLoc = 4;
                if(mnMnuLoc>4)
                    mnMnuLoc = 1;
                switch(mnMnuLoc)
                {
                    case(1):
                        sfSprite_SetPosition(mnuLoadSprite, 60, 100);
                        break;
                    case(2):
                        sfSprite_SetPosition(mnuLoadSprite, 60, 150);
                        break;
                    case(3):
                        sfSprite_SetPosition(mnuLoadSprite, 60, 200);
                        break;
                    case(4):
                        sfSprite_SetPosition(mnuLoadSprite, 60, 250);
                        break;
                }
                // Draw the sprite
                sfRenderWindow_DrawSprite(App, mnuLoadSprite);
                break;
        }
        // Update the window
        sfRenderWindow_Display(App);
    }
    sfMusic_Destroy(mnuMusic);
    sfString_Destroy(mnuText1);
    sfString_Destroy(mnuText2);
    sfString_Destroy(mnuText3);
    sfString_Destroy(mnuText4);
    sfFont_Destroy(mnuFont);
    sfFont_Destroy(mnuFont);
    sfFont_Destroy(mnuFont);
    sfFont_Destroy(mnuFont);
    sfSprite_Destroy(mnuLoadSprite);
    sfImage_Destroy(mnuLoadImage);
    sfRenderWindow_Destroy(App);

    return EXIT_SUCCESS;
 }


can anyone explain why the text freezes the program on exit?

26
Window / How to use sf::Window::ShowMouseCursor(); properly?
« on: August 27, 2010, 11:08:33 pm »
Quote from: "Laurent"
Code: [Select]
App.ShowMouseCursor(false)


Thanks Laurent... I know realize how stupid that mistake was lol.

27
Window / How to use sf::Window::ShowMouseCursor(); properly?
« on: August 27, 2010, 10:55:32 pm »
I'm trying to find out where/how to use sf::Window::ShowMouseCursor(false) in my program to hide the mouse cursor but I keep getting an error:

Code: [Select]
error: cannot call member function 'void sf::Window::ShowMouseCursor(bool)' without object|

I've tried putting it everwhere in this section (this seems like the logical place but it gives the above error):
Code: [Select]

sf::RenderWindow App(sf::VideoMode::GetMode(0), "SFML", sf::Style::Fullscreen, sf::WindowSettings::WindowSettings ( 24, 8, 16));
    sf::Window::ShowMouseCursor(false);

Pages: 1 [2]
anything