[Ohrrpgce] SVN: teeemcee/8705 Add Slice.{Pos, ScreenPos, Size}, Frame.size, Surface.size, MouseInfo.pos,
Ralph Versteegen
teeemcee at gmail.com
Wed May 3 08:42:30 PDT 2017
- Previous message: [Ohrrpgce] SVN: teeemcee/8705 Add Slice.{Pos, ScreenPos, Size}, Frame.size, Surface.size, MouseInfo.pos,
- Next message: [Ohrrpgce] SVN: teeemcee/8705 Add Slice.{Pos, ScreenPos, Size}, Frame.size, Surface.size, MouseInfo.pos,
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
I wish I had thought of it earlier! However there are heaps of separate x
and y variables everywhere which still makes XYPairs difficult to use.
BTW, I was surprised to learn that FB has destructuring assignment, which
would be useful for converting back and forth between separate variables
and XYPairs:
dim as integer x, y
let (x, y) = get_resolution().xy
(The .xy, which I just added, is unfortunately necessary because XYPair is
a union, which can't be destructured directly)
Another thing worth mention, because it's already bitten me twice: FB's
parser won't let you write the following
DIM pos as XYPair = (a + b) * 2
because brackets are assumed to be object initialisation (like {} in C),
Finally! I learnt yesterday that FB lets you return objects byref, which I
find very useful in C++. Silly examples:
function battlemode() byref as integer
return gen(genBattleMode)
end function
function genmax(ty as SpriteType) byref as integer
return gen(genMaxHeroPic + ty)
end function
battlemode() = 1
(genmax(1)) = 14 'Exception: if exactly one argument, need extra brackets
You can return UDTs and strings too
On 3 May 2017 at 02:46, James Paige <Bob at hamsterrepublic.com> wrote:
> These are wonderful unions. As long as I can remember they exist, they are
> going to make for some cleaner code :)
>
> On Mon, May 1, 2017 at 9:29 AM, <subversion at hamsterrepublic.com> wrote:
>
>> teeemcee
>> 2017-05-01 09:29:43 -0700 (Mon, 01 May 2017)
>> 165
>> Add Slice.{Pos,ScreenPos,Size}, Frame.size, Surface.size, MouseInfo.pos,
>> which are in union with the existing members
>>
>> Start to use these aliases around the codebase
>> ---
>> U wip/allmodex.bas
>> U wip/allmodex.bi
>> U wip/common.rbas
>> U wip/scriptcommands.bas
>> U wip/slices.bas
>> U wip/slices.bi
>> U wip/surface.bi
>> _______________________________________________
>> Ohrrpgce mailing list
>> ohrrpgce at lists.motherhamster.org
>> http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org
>>
>
>
> _______________________________________________
> Ohrrpgce mailing list
> ohrrpgce at lists.motherhamster.org
> http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.motherhamster.org/pipermail/ohrrpgce-motherhamster.org/attachments/20170504/dea82866/attachment.htm>
- Previous message: [Ohrrpgce] SVN: teeemcee/8705 Add Slice.{Pos, ScreenPos, Size}, Frame.size, Surface.size, MouseInfo.pos,
- Next message: [Ohrrpgce] SVN: teeemcee/8705 Add Slice.{Pos, ScreenPos, Size}, Frame.size, Surface.size, MouseInfo.pos,
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Ohrrpgce
mailing list