Re: RedyCode 0.9.3 graphics
- Posted by petelomax Aug 01, 2016
- 1307 views
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