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

Pages: [1]
1
Graphics / Multiple sprites with static image
« on: July 14, 2009, 04:23:57 pm »
Thanks guys, I appreciate the info! I have made a few 2 dimensional games with allegro, and now SFML. I have never had a solid method for managing images though. Maybe this is a topic better suited for a new thread, but does anyone have an example I could see that would illustrate a good way to manage a large amount of images to be used efficiently in a game? Thanks again.

2
Graphics / Multiple sprites with static image
« on: July 13, 2009, 11:36:09 pm »
I am trying to get this bit of example code I found to work, but i'm not exactly sure how to use it.

Code: [Select]
class Missile
{
public :

    static bool Init(const std::string& ImageFile)
    {
        return Image.LoadFromFile(ImageFile);
    }

    Missile()
    {
        Sprite.SetImage(Image); // every sprite uses the same unique image
    }

private :

    static sf::Image Image; // shared by every instance

    sf::Sprite Sprite; // one per instance
};



I have that included in my code, but how would I create an object of that type? Its constructor calls Sprite.SetImage(Image), but the Init function is what sets the Image. I'm not sure how to set the Image with the Init function before the constructor is called. Or is there some other way I should be going about setting the Image for the object?

3
General / A few issues getting SFML to work properly
« on: July 09, 2009, 04:34:36 am »
Scratch that about having another issue, I figured out what the problem was. I tried all of this on an XP machine tonight and got it all working, gonna hop back on my vista box tomorrow and see if I can get those original problems worked out now. Thanks again for the help!

4
General / A few issues getting SFML to work properly
« on: July 09, 2009, 04:24:22 am »
Ah, yeah I now that I have changed the code for the windowing segment, I have it working properly. It is no longer crashing. That was a stupid mistake on my part.

I have run into another issue with the pong demo now though, but I will repost as a new thread.

Thank you for the quick response!

5
General / A few issues getting SFML to work properly
« on: July 08, 2009, 04:00:10 am »
I have been reading through posts and trying to figure out how to get SFML to work properly on my machine.

I am running 32bit Windows Vista , and using Codeblocks.

The first problem that I'm having is getting the pong demo from the samples in the SDK to run.

I have added SFML_DYNAMIC to my #defines.

In my Other Linker Options I have:
-lsfml-graphics-d
-lsfml-window-d
-lsfml-audio-d
-lsfml-system-d

I have gone through the tutorial to set up SFML on codeblocks many times now and I cannot figure out why I keep getting this problem:


Code: [Select]
-------------- Build: Debug in pong ---------------

Linking console executable: bin\Debug\pong.exe
Info: resolving sf::Font::ourDefaultCharset      by linking to __imp___ZN2sf4Font17ourDefaultCharsetE (auto-import)
Info: resolving vtable for sf::Stringby linking to __imp___ZTVN2sf6StringE (auto-import)
Info: resolving vtable for sf::Spriteby linking to __imp___ZTVN2sf6SpriteE (auto-import)
obj\Debug\pong.o(.text$_ZN2sf6StringD1Ev[sf::String::~String()]+0x3a): In function `ZNSt8_Rb_treeIPN2sf11ResourcePtrINS0_5ImageEEES4_St9_IdentityIS4_ESt4lessIS4_ESaIS4_EE11_M_put_nodeEPSt13_Rb_tree_nodeIS4_E':
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/c++/3.4.2/bits/stl_construct.h: variable 'vtable for sf::String' can't be auto-imported. Please read the documentation for ld's --enable-auto-import for details.
obj\Debug\pong.o(.text$_ZN2sf6SpriteD1Ev[sf::Sprite::~Sprite()]+0x3a):C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/c++/3.4.2/bits/stl_construct.h: variable 'vtable for sf::Sprite' can't be auto-imported. Please read the documentation for ld's --enable-auto-import for details.
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 0 seconds)
0 errors, 0 warnings



The second problem that I am having is that every time I run part of the windowing tutorial, it builds and executes but the program hangs and then stops responding every time. The console window and the SFML window pop up, and the SFML window initially has a black background but after a few seconds it turns all white and thats when the not responding message pops up. Here is the code that I have:

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

int main()
{

    sf::Window App(sf::VideoMode(800, 600, 32), "SFML Window");


    bool Running = true;

    sf::Event Event;

    while (App.GetEvent(Event))
{
    // Window closed
    if (Event.Type == sf::Event::Closed)
        Running = false;

    // Escape key pressed
    if ((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::Escape))
        Running = false;
}


while (Running)
{
    App.Display();
}

return 0;
}


I started the project as a console application, using the GNU gcc compiler.

I have set SFML_DYNAMIC in my compiler defines.

In my Other Linker Options I have:
-lsfml-window-d
-lsfml-system-d

I copied all of the lib/mingw files and the /include files to the codeblocks directories.

I'm not sure what i'm doing wrong at this point. I am going to play with it some more when I get a chance. I am very interested in developing with SFML , and if anyone could lend me some advice it would be greatly appreciated!

Pages: [1]