Changeset 33174 in project


Ignore:
Timestamp:
02/08/16 05:12:45 (3 years ago)
Author:
jacius
Message:

sdl2: More 0.2.0 docs.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wiki/eggref/4/sdl2

    r33147 r33174  
    1515; Project / Source Code Repository : [[https://gitlab.com/chicken-sdl2/chicken-sdl2]]
    1616; Issue Tracker : [[https://gitlab.com/chicken-sdl2/chicken-sdl2/issues]]
    17 ; Maintainer : John Croisant (john+chicken at croisant dot net)
     17; Maintainer : [[/users/john-croisant|John Croisant]]
    1818; License: [[https://gitlab.com/chicken-sdl2/chicken-sdl2/blob/master/LICENSE-BSD.txt|BSD 2-Clause]]
    1919
     
    144144== Version History
    145145
    146 ; 0.2.0 (in development) : Improved integer type checking. Added 2D accelerated rendering (renderer and texture). Added hints. Performance improvements. Miscellaneous other changes.
     146; 0.2.0 (in development) : Added 2D accelerated rendering (renderer and texture). Added hints. Added color, point, and rect operations. Performance improvements. Improved integer type checking. Miscellaneous other changes.
    147147; 0.1.1 (2015-12-22) : Fixed a compile error when compiling with GCC 4.
    148148; 0.1.0 (2015-12-19) : Initial release.
     
    447447==== sdl2:color Operations
    448448
     449These are operations for efficiently and conveniently working with sdl2:colors.
     450Many of them are implemented in C for efficiency.
     451
     452
    449453<setter>(color-set! color #!optional r g b a) → color</setter>
    450454<setter>(colour-set! color #!optional r g b a) → color</setter>
     
    600604E.g. 255 means full strength, 127 means half strength,
    6016050 means no effect (the result will have the same values as {{color1}}).
     606
     607
     608<procedure>(color-lerp  color1 color2 t) → sdl2:color</procedure>
     609<procedure>(color-lerp! color1 color2 t #!optional dest) → dest</procedure>
     610
     611Efficient linear interpolation (or extrapolation) between {{color1}} and {{color2}}.
     612sdl2:color can only hold integer values, so the results will be truncated to integers.
     613The results will be clamped to the range 0 to 255.
     614
     615{{t}} is the interpolation factor (a float).
     616Values of {{t}} between 0 and 1 will interpolate between {{color1}} and {{color2}}.
     617Values of {{t}} less that 0 will extrapolate beyond {{color1}} (moving away from {{color2}}).
     618Values greater that 1 will extrapolate beyond {{color2}} (moving away from {{color1}}).
     619
     620* {{color-lerp}} returns a new managed sdl2:color.
     621* {{color-lerp!}} modifies and returns {{dest}}.
     622  If {{dest}} is omitted, {{color1}} is modified and returned.
     623
     624These procedures are available in '''sdl2 egg version 0.2.0 and higher'''.
    602625
    603626
     
    32603283==== sdl2:rect Operations
    32613284
     3285These are operations for efficiently and conveniently working with sdl2:rects.
     3286Many of them are implemented in C for efficiency.
     3287
     3288
    32623289<procedure>(rect-set! rect #!optional x y w h) → rect</procedure>
    32633290
     
    33203347E.g. {{scale}} 0.5 halves the values, {{scale}} 2.0 doubles the values.
    33213348sdl2:rect can only hold integer values, so the results will be truncated to integers.
     3349The results will be clamped to the range -2147483648 to 2147483647.
    33223350
    33233351* {{rect-scale}} returns a new managed sdl2:rect.
     
    33273355These procedures are available in '''sdl2 egg version 0.2.0 and higher'''.
    33283356
    3329 '''WARNING:''' sdl2:rect can only hold values in the range -2147483648 to 2147483647.
    3330 The behavior of these procedures is not specified if any result would be outside of that range.
    3331 
    33323357
    33333358<procedure>(rect-move  rect dx dy) → sdl2:rect</procedure>
     
    33363361Efficiently move {{rect}} by adding the given amounts to its X and Y values.
    33373362{{dx}} and {{dy}} must be integers.
     3363The results will be clamped to the range -2147483648 to 2147483647.
    33383364
    33393365If {{dx}} and {{dy}} are already stored in an sdl2:point,
     
    33473373These procedures are available in '''sdl2 egg version 0.2.0 and higher'''.
    33483374
    3349 '''WARNING:''' sdl2:rect can only hold values in the range -2147483648 to 2147483647.
    3350 The behavior of these procedures is not specified if any result would be outside of that range.
    3351 
    33523375
    33533376<procedure>(rect-add-point  rect point) → sdl2:rect</procedure>
     
    33553378
    33563379Efficiently move {{rect}} by adding {{point}} to {{rect}}'s X and Y values.
     3380The results will be clamped to the range -2147483648 to 2147483647.
    33573381
    33583382If the dx and dy values are already held as separate variables,
     
    33663390These procedures are available in '''sdl2 egg version 0.2.0 and higher'''.
    33673391
    3368 '''WARNING:''' sdl2:rect can only hold values in the range -2147483648 to 2147483647.
    3369 The behavior of these procedures is not specified if any result would be outside of that range.
    3370 
    33713392
    33723393<procedure>(rect-sub-point  rect point) → sdl2:rect</procedure>
     
    33743395
    33753396Efficiently move {{rect}} by subtracting {{point}} from {{rect}}'s X and Y values.
     3397The results will be clamped to the range -2147483648 to 2147483647.
    33763398
    33773399If the dx and dy values are already held as separate variables,
     
    33853407These procedures are available in '''sdl2 egg version 0.2.0 and higher'''.
    33863408
    3387 '''WARNING:''' sdl2:rect can only hold values in the range -2147483648 to 2147483647.
    3388 The behavior of these procedures is not specified if any result would be outside of that range.
    3389 
    33903409
    33913410<procedure>(rect-grow  rect dw dh) → sdl2:rect</procedure>
     
    33953414The rect's top left corner will stay the same.
    33963415See also {{rect-grow/center!}}, which keeps the rect's center point the same.
     3416The results will be clamped to the range -2147483648 to 2147483647.
    33973417
    33983418{{dw}} and {{dh}} must be integers.
     
    34053425These procedures are available in '''sdl2 egg version 0.2.0 and higher'''.
    34063426
    3407 '''WARNING:''' sdl2:rect can only hold values in the range -2147483648 to 2147483647.
    3408 The behavior of these procedures is not specified if any result would be outside of that range.
    3409 
    34103427
    34113428<procedure>(rect-grow/center  rect dw dh) → sdl2:rect</procedure>
     
    34143431Efficiently increase {{rect}}'s size while trying to keep the same center point.
    34153432See also {{rect-grow!}}, which keeps the rect's top left corner the same.
     3433The results will be clamped to the range -2147483648 to 2147483647.
    34163434
    34173435{{dw}} and {{dh}} must be integers.
     
    34273445These procedures are available in '''sdl2 egg version 0.2.0 and higher'''.
    34283446
    3429 '''WARNING:''' sdl2:rect can only hold values in the range -2147483648 to 2147483647.
    3430 The behavior of these procedures is not specified if any result would be outside of that range.
     3447
     3448<procedure>(rect-lerp  rect1 rect2 t) → sdl2:rect</procedure>
     3449<procedure>(rect-lerp! rect1 rect2 t #!optional dest) → dest</procedure>
     3450
     3451Efficient linear interpolation (or extrapolation) between {{rect1}} and {{rect2}}.
     3452sdl2:rect can only hold integer values, so the results will be truncated to integers.
     3453The results will be clamped to the range -2147483648 to 2147483647.
     3454
     3455These procedures affect all values of the rect: X, Y, W, and H.
     3456If you only want to interpolate the rect's position (X and Y), use {{rect-lerp-xy}} instead.
     3457
     3458{{t}} is the interpolation factor (a float).
     3459Values of {{t}} between 0 and 1 will interpolate between {{rect1}} and {{rect2}}.
     3460Values of {{t}} less that 0 will extrapolate beyond {{rect1}} (moving away from {{rect2}}).
     3461Values greater that 1 will extrapolate beyond {{rect2}} (moving away from {{rect1}}).
     3462
     3463* {{rect-lerp}} returns a new managed sdl2:rect.
     3464* {{rect-lerp!}} modifies and returns {{dest}}.
     3465  If {{dest}} is omitted, {{rect1}} is modified and returned.
     3466
     3467These procedures are available in '''sdl2 egg version 0.2.0 and higher'''.
     3468
     3469
     3470<procedure>(rect-lerp-xy  rect1 rect2 t) → sdl2:rect</procedure>
     3471<procedure>(rect-lerp-xy! rect1 rect2 t #!optional dest) → dest</procedure>
     3472
     3473Efficient linear interpolation (or extrapolation) between {{rect1}} and {{rect2}}.
     3474sdl2:rect can only hold integer values, so the results will be truncated to integers.
     3475The results will be clamped to the range -2147483648 to 2147483647.
     3476
     3477These procedures only affect the X and Y values of the rect.
     3478The result will have the same W and H as {{rect1}}.
     3479If you want interpolate all values (X, Y, W, and H), use {{rect-lerp}} instead.
     3480
     3481{{t}} is the interpolation factor (a float).
     3482Values of {{t}} between 0 and 1 will interpolate between {{rect1}} and {{rect2}}.
     3483Values of {{t}} less that 0 will extrapolate beyond {{rect1}} (moving away from {{rect2}}).
     3484Values greater that 1 will extrapolate beyond {{rect2}} (moving away from {{rect1}}).
     3485
     3486* {{rect-lerp-xy}} returns a new managed sdl2:rect.
     3487* {{rect-lerp-xy!}} modifies and returns {{dest}}.
     3488  If {{dest}} is omitted, {{rect1}} is modified and returned.
     3489
     3490These procedures are available in '''sdl2 egg version 0.2.0 and higher'''.
    34313491
    34323492
     
    34803540==== sdl2:point Operations
    34813541
     3542These are operations for efficiently and conveniently working with sdl2:points.
     3543Many of them are implemented in C for efficiency.
     3544
     3545
    34823546<procedure>(point-set! point #!optional x y) → point</procedure>
    34833547
     
    35393603E.g. {{scale}} 0.5 halves the values, {{scale}} 2.0 doubles the values.
    35403604sdl2:point can only hold integer values, so the results will be truncated to integers.
     3605The results will be clamped to the range -2147483648 to 2147483647.
    35413606
    35423607These procedures are available in '''sdl2 egg version 0.2.0 and higher'''.
     
    35463611  If {{dest}} is omitted, {{point}} is modified and returned.
    35473612
    3548 '''WARNING:''' sdl2:point can only hold values in the range -2147483648 to 2147483647.
    3549 The behavior of these procedures is not specified if any result would be outside of that range.
    3550 
    35513613
    35523614<procedure>(point-move  point dx dy) → sdl2:point</procedure>
     
    35553617Efficiently move {{point}} by adding the given amounts to its X and Y values.
    35563618{{dx}} and {{dy}} must be integers.
     3619The results will be clamped to the range -2147483648 to 2147483647.
    35573620
    35583621If {{dx}} and {{dy}} are already stored in an sdl2:point,
     
    35663629These procedures are available in '''sdl2 egg version 0.2.0 and higher'''.
    35673630
    3568 '''WARNING:''' sdl2:point can only hold values in the range -2147483648 to 2147483647.
    3569 The behavior of these procedures is not specified if any result would be outside of that range.
    3570 
    35713631
    35723632<procedure>(point-add  point1 point2) → sdl2:point</procedure>
     
    35743634
    35753635Efficiently add {{point1}} and {{point2}} (vector addition).
     3636The results will be clamped to the range -2147483648 to 2147483647.
    35763637
    35773638If the dx and dy values are already held as separate variables,
     
    35853646These procedures are available in '''sdl2 egg version 0.2.0 and higher'''.
    35863647
    3587 '''WARNING:''' sdl2:point can only hold values in the range -2147483648 to 2147483647.
    3588 The behavior of these procedures is not specified if any result would be outside of that range.
    3589 
    35903648
    35913649<procedure>(point-sub  point1 point2) → sdl2:point</procedure>
     
    35933651
    35943652Efficiently subtract {{point2}} from {{point1}} (vector subtraction).
     3653The results will be clamped to the range -2147483648 to 2147483647.
    35953654
    35963655If the dx and dy values are already held as separate variables instead,
     
    36043663These procedures are available in '''sdl2 egg version 0.2.0 and higher'''.
    36053664
    3606 '''WARNING:''' sdl2:point can only hold values in the range -2147483648 to 2147483647.
    3607 The behavior of these procedures is not specified if any result would be outside of that range.
     3665
     3666<procedure>(point-lerp  point1 point2 t) → sdl2:point</procedure>
     3667<procedure>(point-lerp! point1 point2 t #!optional dest) → dest</procedure>
     3668
     3669Efficient linear interpolation (or extrapolation) between {{point1}} and {{point2}}.
     3670sdl2:point can only hold integer values, so the results will be truncated to integers.
     3671The results will be clamped to the range -2147483648 to 2147483647.
     3672
     3673{{t}} is the interpolation factor (a float).
     3674Values of {{t}} between 0 and 1 will interpolate between {{point1}} and {{point2}}.
     3675Values of {{t}} less that 0 will extrapolate beyond {{point1}} (moving away from {{point2}}).
     3676Values greater that 1 will extrapolate beyond {{point2}} (moving away from {{point1}}).
     3677
     3678* {{point-lerp}} returns a new managed sdl2:point.
     3679* {{point-lerp!}} modifies and returns {{dest}}.
     3680  If {{dest}} is omitted, {{point1}} is modified and returned.
     3681
     3682These procedures are available in '''sdl2 egg version 0.2.0 and higher'''.
    36083683
    36093684
Note: See TracChangeset for help on using the changeset viewer.