1. RedyCode 0.9.3 graphics

Forked from Re: RedyCode 0.9.2 released

ryanj said...

I just created a 0.9.3 development branch, which has the graphics optimizations and a few other enhancements. Syntax highlighting has been improved. Multi-line comments and quotes work now. The "File Contents" list has been improved.

If you try it, i am curious what you think of the graphics performance. It should be much faster and smoother than 0.9.2!. (You will need to run bindredy.bat to build the exe.) I will continue to work on this branch and release it officially once a few other features are added.

I am looking at why redylib_0_9\oswin\win32\win32.e structures might fail on eu41 64 bit

        case WM_PAINT then 
            if widx > 0 then 
				 ptrPs = allocate( 
				     szUInt --HDC  hdc; 
				     + szByte --BOOL fErase; 
				     + szLong * 4 --RECT rcPaint; 
				     + szByte --BOOL fRestore; 
				     + szByte --BOOL fIncUpdate; 
				     + szByte * 32 --BYTE rgbReserved[32]; 
				 ) 
         
                hdc = c_func(xBeginPaint, {hwnd, ptrPs}) 
                if hdc = 0 then 
                    --puts(1, "error: BeginPaint\n") 
                end if 
                rect = peek4u({ptrPs + szUInt + szLong , 4}) --get update rect 
 

shouldn't BOOL be an INT not a BYTE?

this seems to be ignoring the first BOOL in the struct when calculating the offset.

                rect = peek4u({ptrPs + szUInt + szLong , 4}) --get update rect 

using a structure lib should help with allocation and calculating the offsets. the only 64 bit compatible structure lib in the rds archive doesn't seem to offer any help with the offsets. not sure how much work it would take to modify struct14 from the rds archive for 64 bits. I don't have a 64 bit OS to test it.

I wonder if allocating and freeing the structure could be lifted out of the PAINT loop entirely? maybe assign a local pointer variable to a global structure that would be allocated once and free when the main window was closed.

I have a pretty weak computer and the graphic don't seem too sluggish interpreted or translated and compiled so far.

new topic     » topic index » view message » categorize

2. Re: RedyCode 0.9.3 graphics

ne1uno said...

using a structure lib should help with allocation and calculating the offsets. the only 64 bit compatible structure lib in the rds archive doesn't seem to offer any help with the offsets. not sure how much work it would take to modify struct14 from the rds archive for 64 bits.

The builtins/cffi.e component as shipped with Phix ought to cope on 32/64 bit out of the box. The current version is Eu4.1+ compatible, there's even a 2.4 compatible version, and both can be found at https://bitbucket.org/petelomax/phix.

The following snippet displays the internal diagnostics, because define_struct is passed a 0 in the add parameter, and uses the S32/S64 overrides so you can see the difference:

include builtins/cffi.e 
 
constant tRECT = """ 

                    typedef struct _RECT { 
                      LONG left; 
                      LONG top; 
                      LONG right; 
                      LONG bottom; 
                    } RECT, *PRECT;""", 
         tPS = """ 

                    typedef struct tagPAINTSTRUCT { 
                      HDC  hdc; 
                      BOOL fErase; 
                      RECT rcPaint; 
                      BOOL fRestore; 
                      BOOL fIncUpdate; 
                      BYTE rgbReserved[32]; 
                    } PAINTSTRUCT, *PPAINTSTRUCT;""" 
constant idRECT = define_struct(tRECT) 
 
pp(define_struct(tPS,S32,0)) 
pp(define_struct(tPS,S64,0)) 
 
==> 
 
{"PAINTSTRUCT", 64'@',16, 
 {{"hdc", "fErase", "rcPaint.left", "rcPaint.top", "rcPaint.right", 
   "rcPaint.bottom", "fRestore", "fIncUpdate", "rgbReserved"}, 
  {{"HDC", 4,0,0}, {"BOOL", 4,4,1}, {"LONG", 4,8,1}, {"LONG", 4,12,1}, 
   {"LONG", 4,16,1}, {"LONG", 4,20,1}, {"BOOL", 4,24,1}, {"BOOL", 4,28,1}, 
   {"BYTE", 1,32' ',1}}}, {"PPAINTSTRUCT"}} 
{"PAINTSTRUCT", 80'P',16, 
 {{"hdc", "fErase", "rcPaint.left", "rcPaint.top", "rcPaint.right", 
   "rcPaint.bottom", "fRestore", "fIncUpdate", "rgbReserved"}, 
  {{"HDC", 8,0,0}, {"BOOL", 4,8,1}, {"LONG", 4,12,1}, {"LONG", 4,16,1}, 
   {"LONG", 4,20,1}, {"LONG", 4,24,1}, {"BOOL", 4,28,1}, 
   {"BOOL", 4,32' ',1}, {"BYTE", 1,36'$',1}}}, {"PPAINTSTRUCT"}} 

Pete

new topic     » goto parent     » topic index » view message » categorize

3. Re: RedyCode 0.9.3 graphics

petelomax said...
ne1uno said...

using a structure lib should help with allocation and calculating the offsets. the only 64 bit compatible structure lib in the rds archive doesn't seem to offer any help with the offsets. not sure how much work it would take to modify struct14 from the rds archive for 64 bits.

The builtins/cffi.e component as shipped with Phix ought to cope on 32/64 bit out of the box. The current version is Eu4.1+ compatible, there's even a 2.4 compatible version, and both can be found at https://bitbucket.org/petelomax/phix.

The following snippet [...]

very nice. cffi as you've show is useful as a tool to check the offset math for 32/64 too.

with less than a dozen structs in the win32 wrap in redylib, and not much dynamic code, maybe a struct lib is overkill? I've always used Matt's structs branch of eu41 and I forgot what else was out there. thanks.

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu