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

Pages: [1]
1
Feature requests / Proposal: Coroutine support
« on: December 07, 2013, 08:59:12 am »
Many game engines (I realize SFML isn't one but this is for discussion) have support for coroutines. That is, for two routines to run alongside one another and communicate with each other on one thread. This occurs with user defined commands to switch contexts in the code.

For games, this is useful because I can write game behavior routines like:

void MeleeAttack(Target &target) {
    MoveToTarget(target);
    WaitForSeconds(1);
    AttackTarget(target);
}
 

Notice the 1 second cooldown between the time the unit moves to the target and when the unit actually attacks. This code is a bit easier to read than managing a number of state variables.

To do this, one could use boost.context or boost.coroutine but they are a bit heavy and will pull in several other boost libraries as well. Would it make sense to implement this support for SFML? It would require assembly unfortunately as one needs to store the copy the function context from the stack to the heap when execution is suspended and back to the stack again when execution resumes. This would need to be written for each target processor supported.

Coroutines are supposedly coming in C++17 but I'm not holding my breath. Meanwhile, C# and many other languages support this programming concept (straight from Knuth's 1st volume of AoCP).

Any thoughts on us working on something like this?

2
Feature requests / Re: Mouse capture/grab
« on: November 28, 2013, 08:59:21 am »
Hey Mario,

Thanks a million for the initial patch. I'd really like to get this in.

Basically, I think the initial approach is not a bad one and I think my suggestion is not strictly necessary. I was just considering a possible overhaul of the input system later on to be a bit lower level so the user has more control if desired. Looking into it recently, I think it'd be a significant change so it's worth discussing before any implementation is done.

3
Feature requests / Re: Mouse capture/grab
« on: November 20, 2013, 10:51:28 am »
I noticed the implementation uses a number of X methods to grab and ungrab the input.

Why doesn't SFML use evdev to capture input to give users more flexibility with this sort of thing? This is how SDL implements it so it can capture the pointer in addition to providing raw mouse input to the developer.

Pages: [1]
anything