Qbasicnews.com

Full Version: Needed a trick for SDL in FB...
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi!

I needed a trick to get smooth GFX with SDL as my machine seemed to have better things to do than to run my game.
So, if anyone needs it, try this:
Code:
'$include: 'win\kernel32.bi'
.
.
.
.
win32return = SetPriorityClass(GetCurrentProcess(),&h00008000)

If win32return is 0 then do something that tells the error.

With this you will get a priority level one over normal, but dont try to burn a disc while you do this, you burning software will produce a puffer underrun. Everything else wont care Wink

So Long, The Werelion!
Thats nice!

What are the numbers for diff. priorities?
Quote:Thats nice!

What are the numbers for diff. priorities?

CnP from winbase.h from dev-cpp Wink

#define NORMAL_PRIORITY_CLASS 0x00000020
#define IDLE_PRIORITY_CLASS 0x00000040
#define HIGH_PRIORITY_CLASS 0x00000080
#define REALTIME_PRIORITY_CLASS 0x00000100
#define BELOW_NORMAL_PRIORITY_CLASS 0x00004000
#define ABOVE_NORMAL_PRIORITY_CLASS 0x00008000

kernel32.bi from FreeBASIC is missing the last two, so i just used the hexcode in my example.
If you don't have to update the screen all the time, just when a key/button is pressed or the window is moved, it's better to use SDL_WaitEvent(), to not waste CPU time.

The freeimage.bas examples uses that, it consumes no more than 2% here, on my 1.8Ghz.