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

Pages: [1]
1
Graphics / Redrawing Sprites in a Multi - Threaded Program
« on: January 14, 2012, 03:11:21 am »
I am working on my first game.  I have been stuck for the last few hours and I just cannot figure out how to redraw my sprite in a separate thread.   First I created a struct with a bunch of pointers.  Then I set up a new thread and passed the struct in.  Everything worked great until I tried to redraw the sprite.

Whenever I try to access the sf::RenderWindow.Draw Function, I don't have the right Object type to pass in.  It needs a reference to a Sprite Object, and I only have a pointer.
I tried converting it with a line like the one below but the compiler rejected it with this message: error C2440: 'initializing' : cannot convert from 'sf::Sprite *' to 'sf::Sprite &'
Code: [Select]
Sprite& rPlayer (pSprite);

I tried not using a pointer and just including a Sprite Object in the Struct.  It compiled but when the thread launched, the program froze up for a few seconds, and gave me a bunch of OpenGL error messages in the console window.  I can't figure out what to do with my Pointer so I can pass my sprite in to the sf::RenderWindow.Draw function a separate thread.

Any Help would be greatly appreciated!

My Code looks something like this.

Code: [Select]

struct UserData{
int* pMap;
RenderWindow* pApp;
Sprite* pSprite;
AnimationClass* pAnimator;
};

void ThreadFunction(void* UserData)
{

    for (int i = 0; i < 10; ++i)
{
Data->pAnimator->myAnimation(pSprite);
Data->pApp->Draw(???????What can I pass in here???????);
}
}


int main()
{

    UserData Data = { pMap, pApp, pSprite, pAnimator };
    sf::Thread myThread(&ThreadFunction, &Data);
    myThread.Launch();

    return EXIT_SUCCESS;

}

2
General / Packaging my open source game with SFML questions
« on: January 02, 2012, 07:52:26 pm »
Hello,

    I have an almost finished game that I plan to publish shortly as open source.   It is my first game.   The project has been a lot of fun and I have really enjoyed working with the SFML library.  It is a great way to learn C++.  

    I am not looking for anyone to help me complete the game.  My reason for going open is that I want it to be available so that other programmers working on their first game can see how I did mine.  And it would be great to show it to some experienced programmers that can look at what I did and possibly help me improve my programming.

    My question is about including the SFML library in the source.  I would love it if anyone could download the source and as long as they are running visual studio it would just compile and run automatically.  But of course they wouldn't be able to unless they had SFML installed, and their linker set up the right way.  (SFML is the only library I have used for this game).  

     It took me two days and a few forum posts to figure out just how to set up my linker the right way, and to get all of the files in the right place.  Maybe I am just slow, but I imagine other beginners who downloaded my source would come across similar problems.

So my questions are:

Is it possible / and permissible to include the entire SFML library in the source along with my program in order to make it easier for me to share my program with others?  

If so, can someone give me a zipped folder of a Visual Studio project/solution that includes all of the SFML library, and all of the files automatically configured in the linker, and all of the .dll files placed in the runtime folder?

Thanks! 8)

3
Graphics / Questions on My First Tile Map
« on: December 08, 2011, 02:05:33 am »
I am having fun plugging away at my first game using SFML, when I get it a little further along, I will post it up here, and on sourceforge.   I am working on the tile map now.  

I have 2 questions, I will probably have more later, but these  should get me through the map.


1. Is using a normal Multi-Dimensional array of sprites OK?
    Something like this

Code: [Select]

sf::Sprite tileArray [11] [9];


    In the examples I saw here everybody was using Vectors
    am I better off using a Vector, if so why?


2. I am using 96 x 96 tiles some go the full 96 pixels
    but many of them have smaller images inside and some
    empty background space.  I haven't started on my collision
    detection yet, but I am a little worried this can cause a problem
    down the road. Specifically:
    Is there any thing other than specifying the exact boundaries
    of each image inside the 96x96 tile that I could use to tell if there
    is an actual collision with the pixels of the image, and not just a    
    collision of empty background space?

Thanks,

4
Window / LNK2001: unresolved external symbol
« on: October 08, 2011, 11:39:10 pm »
Hello,

    I am new here.  Just installed your SDK and am trying to work my way through the tutorials.  I got up to the http://www.sfml-dev.org/tutorials/1.6/window-window.php section and then I started getting these error messages.  It couldn't be the code, because it is a direct copy (download) from the tutorials.  Here is the message I got:

Code: [Select]
1>------ Build started: Project: SFML-tutorials, Configuration: Debug Win32 ------
1>Compiling...
1>main.cpp
1>Linking...
1>main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall sf::Window::~Window(void)" (__imp_??1Window@sf@@UAE@XZ)
1>main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: void __thiscall sf::Window::Display(void)" (__imp_?Display@Window@sf@@QAEXXZ)
1>main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::Window::Window(class sf::VideoMode,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,unsigned long,struct sf::WindowSettings const &)" (__imp_??0Window@sf@@QAE@VVideoMode@1@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@KABUWindowSettings@1@@Z)
1>main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::VideoMode::VideoMode(unsigned int,unsigned int,unsigned int)" (__imp_??0VideoMode@sf@@QAE@III@Z)
1>C:\Users\colorado\Documents\Visual Studio 2008\Projects\SFML-tutorials\Debug\SFML-tutorials.exe : fatal error LNK1120: 4 unresolved externals
1>Build log was saved at "file://c:\Users\colorado\Documents\Visual Studio 2008\Projects\SFML-tutorials\SFML-tutorials\Debug\BuildLog.htm"
1>SFML-tutorials - 5 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


    I had posted the same problem on GameDev but this forum is probably a much better place for question.  

    Does anybody know what I did wrong?


Thanks,
Colorado

Pages: [1]
anything