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

Pages: [1]
1
General / [Sovled] Intergrating SFML into gtkmm
« on: February 21, 2011, 08:16:34 pm »
I know that this is a dead post, but instead of creating a new sf::RenderWindow on each resize, all he needs is a
Code: [Select]
sf::Event event;
while (App.GetEvent(event)) ;
loop and sfml will handle the size changes like it should(ie scaling everything correctly.

Just for future users like me who look at old posts on the forum.

2
General / Moving source code made in Windows to XCode on Mac Errors
« on: February 18, 2011, 06:41:52 am »
The errors indicate that you are trying to copy the non-copyable class of sf::Music, and then  fails to copy the classes sf::Music is derived from.

3
SFML website / A new tutorial on how to integrate with Gtk
« on: February 18, 2011, 06:28:04 am »
We do not have a tutorial on how to integrate with Gtk(we already have wxWidgets and Qt, the other major two gui frameworks), so I have created a guide based off Shy Guy's work.
I think we should add this next to the other tutorials.

I downloaded the Qt guide html page and changed the contents.
The guide can be found here: http://lalaland.github.com/gtkGuide.html

Hope you find it useful!

4
Feature requests / Thread management or the like in SFML2
« on: December 17, 2010, 03:25:37 pm »
I will assume here that you are using queue's of some sort to pass your instructions to the thread.

You might want to look into boost::thread for threading.
It is cross platform, commonly used,  has similar syntax to the coming c++0x standard, etc..

They also have lots of useful constructs, one of which, condition variables, seems to be the perfect thing you need.

A condition variable pauses a thread till another thread calls notify on it.

Here is an example use of a condition variable

Code: [Select]

{
   boost::scoped_lock lock(AMutexForAQueue); //locks a mutex

   while (ASharedQueue.empty()) //We cannot do work while the queue is empty
   {
       cond.wait(); //wait
   }

someData = ASharedQueue.pop();
}

//Do stuff with data here

 


While waiting the mutex will be released.

Here is how the code would look on the main thread side.

Code: [Select]


{
    boost::scoped_lock lock(AMutexForAQueue); //locks a mutex

    ASharedQueue.push(someTask); // push a task into the queue
}

cond.notify_one(); // start the thread

 


EDIT:  This method would also allow you to easily add more threads, as the condition variable is guaranteed to only notify one at a time.

Pages: [1]