Re: RedyCode - new features

new topic     » goto parent     » topic index » view thread      » older message » newer message
elias_maluko said...

Nice work so far!

Did Redy renders direct to GDI?
Is it possible to make it render to bitmaps in memory?
If yes, it could be easy to integrate with OpenGL...

Redy creates a buffer bitmap for each window, draws on it, then copies it to the window as needed. Additional bitmaps can be created in memory or loaded from files, and drawn to or copied to other bitmaps.

Currently, Redy uses some basic win32api graphics functions, which are hidden by a graphics abstraction layer, which (for lack of a better term) i call a "drawing language". It should be possible to add more GDI functions or switch to a different platform like xlib or OpenGL. I plan to work on this for Redy 2.0.

Here's a stripped-down example of drawing a button. As you can see, you don't have to keep track of pen styles, font styles, device contexts, etc. Just build a sequence of drawing commands and pass it to the draw procedure. There are some other functions that need to be called in certain situations, such as creating bitmaps, selecting a font before getting "text extent", getting the window handle so you can draw to it, etc. I will write documentation soon, explaining how to use it.

sequence cmds = { 
    --fill: 
    {DR_PenColor, fillcolor}, 
    {DR_Rectangle, True} & wrect, 
    --border: 
    {DR_PenColor, hlcolor}, 
    {DR_Line, wrect[1] + 1, wrect[2], wrect[3] - 1, wrect[2]}, 
    {DR_Line, wrect[1], wrect[2] + 1, wrect[1], wrect[4] - 1}, 
    {DR_PenColor, shcolor}, 
    {DR_Line, wrect[3] - 1, wrect[2] + 1, wrect[3] - 1, wrect[4]}, 
    {DR_Line, wrect[1] + 1, wrect[4], wrect[3] - 1, wrect[4]}, 
    --label: 
    {DR_Font, "Arial", 9, Normal}, 
    {DR_TextColor, lblcolor}, 
    {DR_PenPos} & txpos, 
    {DR_Puts, wcprops[wcpLabel][idx]} 
} 
draw(winhandle, cmds) 
new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu