Changeset 33174 in project
 Timestamp:
 02/08/16 05:12:45 (4 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

wiki/eggref/4/sdl2
r33147 r33174 15 15 ; Project / Source Code Repository : [[https://gitlab.com/chickensdl2/chickensdl2]] 16 16 ; Issue Tracker : [[https://gitlab.com/chickensdl2/chickensdl2/issues]] 17 ; Maintainer : John Croisant (john+chicken at croisant dot net)17 ; Maintainer : [[/users/johncroisantJohn Croisant]] 18 18 ; License: [[https://gitlab.com/chickensdl2/chickensdl2/blob/master/LICENSEBSD.txtBSD 2Clause]] 19 19 … … 144 144 == Version History 145 145 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. 147 147 ; 0.1.1 (20151222) : Fixed a compile error when compiling with GCC 4. 148 148 ; 0.1.0 (20151219) : Initial release. … … 447 447 ==== sdl2:color Operations 448 448 449 These are operations for efficiently and conveniently working with sdl2:colors. 450 Many of them are implemented in C for efficiency. 451 452 449 453 <setter>(colorset! color #!optional r g b a) â color</setter> 450 454 <setter>(colourset! color #!optional r g b a) â color</setter> … … 600 604 E.g. 255 means full strength, 127 means half strength, 601 605 0 means no effect (the result will have the same values as {{color1}}). 606 607 608 <procedure>(colorlerp color1 color2 t) â sdl2:color</procedure> 609 <procedure>(colorlerp! color1 color2 t #!optional dest) â dest</procedure> 610 611 Efficient linear interpolation (or extrapolation) between {{color1}} and {{color2}}. 612 sdl2:color can only hold integer values, so the results will be truncated to integers. 613 The results will be clamped to the range 0 to 255. 614 615 {{t}} is the interpolation factor (a float). 616 Values of {{t}} between 0 and 1 will interpolate between {{color1}} and {{color2}}. 617 Values of {{t}} less that 0 will extrapolate beyond {{color1}} (moving away from {{color2}}). 618 Values greater that 1 will extrapolate beyond {{color2}} (moving away from {{color1}}). 619 620 * {{colorlerp}} returns a new managed sdl2:color. 621 * {{colorlerp!}} modifies and returns {{dest}}. 622 If {{dest}} is omitted, {{color1}} is modified and returned. 623 624 These procedures are available in '''sdl2 egg version 0.2.0 and higher'''. 602 625 603 626 … … 3260 3283 ==== sdl2:rect Operations 3261 3284 3285 These are operations for efficiently and conveniently working with sdl2:rects. 3286 Many of them are implemented in C for efficiency. 3287 3288 3262 3289 <procedure>(rectset! rect #!optional x y w h) â rect</procedure> 3263 3290 … … 3320 3347 E.g. {{scale}} 0.5 halves the values, {{scale}} 2.0 doubles the values. 3321 3348 sdl2:rect can only hold integer values, so the results will be truncated to integers. 3349 The results will be clamped to the range 2147483648 to 2147483647. 3322 3350 3323 3351 * {{rectscale}} returns a new managed sdl2:rect. … … 3327 3355 These procedures are available in '''sdl2 egg version 0.2.0 and higher'''. 3328 3356 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 3332 3357 3333 3358 <procedure>(rectmove rect dx dy) â sdl2:rect</procedure> … … 3336 3361 Efficiently move {{rect}} by adding the given amounts to its X and Y values. 3337 3362 {{dx}} and {{dy}} must be integers. 3363 The results will be clamped to the range 2147483648 to 2147483647. 3338 3364 3339 3365 If {{dx}} and {{dy}} are already stored in an sdl2:point, … … 3347 3373 These procedures are available in '''sdl2 egg version 0.2.0 and higher'''. 3348 3374 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 3352 3375 3353 3376 <procedure>(rectaddpoint rect point) â sdl2:rect</procedure> … … 3355 3378 3356 3379 Efficiently move {{rect}} by adding {{point}} to {{rect}}'s X and Y values. 3380 The results will be clamped to the range 2147483648 to 2147483647. 3357 3381 3358 3382 If the dx and dy values are already held as separate variables, … … 3366 3390 These procedures are available in '''sdl2 egg version 0.2.0 and higher'''. 3367 3391 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 3371 3392 3372 3393 <procedure>(rectsubpoint rect point) â sdl2:rect</procedure> … … 3374 3395 3375 3396 Efficiently move {{rect}} by subtracting {{point}} from {{rect}}'s X and Y values. 3397 The results will be clamped to the range 2147483648 to 2147483647. 3376 3398 3377 3399 If the dx and dy values are already held as separate variables, … … 3385 3407 These procedures are available in '''sdl2 egg version 0.2.0 and higher'''. 3386 3408 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 3390 3409 3391 3410 <procedure>(rectgrow rect dw dh) â sdl2:rect</procedure> … … 3395 3414 The rect's top left corner will stay the same. 3396 3415 See also {{rectgrow/center!}}, which keeps the rect's center point the same. 3416 The results will be clamped to the range 2147483648 to 2147483647. 3397 3417 3398 3418 {{dw}} and {{dh}} must be integers. … … 3405 3425 These procedures are available in '''sdl2 egg version 0.2.0 and higher'''. 3406 3426 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 3410 3427 3411 3428 <procedure>(rectgrow/center rect dw dh) â sdl2:rect</procedure> … … 3414 3431 Efficiently increase {{rect}}'s size while trying to keep the same center point. 3415 3432 See also {{rectgrow!}}, which keeps the rect's top left corner the same. 3433 The results will be clamped to the range 2147483648 to 2147483647. 3416 3434 3417 3435 {{dw}} and {{dh}} must be integers. … … 3427 3445 These procedures are available in '''sdl2 egg version 0.2.0 and higher'''. 3428 3446 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>(rectlerp rect1 rect2 t) â sdl2:rect</procedure> 3449 <procedure>(rectlerp! rect1 rect2 t #!optional dest) â dest</procedure> 3450 3451 Efficient linear interpolation (or extrapolation) between {{rect1}} and {{rect2}}. 3452 sdl2:rect can only hold integer values, so the results will be truncated to integers. 3453 The results will be clamped to the range 2147483648 to 2147483647. 3454 3455 These procedures affect all values of the rect: X, Y, W, and H. 3456 If you only want to interpolate the rect's position (X and Y), use {{rectlerpxy}} instead. 3457 3458 {{t}} is the interpolation factor (a float). 3459 Values of {{t}} between 0 and 1 will interpolate between {{rect1}} and {{rect2}}. 3460 Values of {{t}} less that 0 will extrapolate beyond {{rect1}} (moving away from {{rect2}}). 3461 Values greater that 1 will extrapolate beyond {{rect2}} (moving away from {{rect1}}). 3462 3463 * {{rectlerp}} returns a new managed sdl2:rect. 3464 * {{rectlerp!}} modifies and returns {{dest}}. 3465 If {{dest}} is omitted, {{rect1}} is modified and returned. 3466 3467 These procedures are available in '''sdl2 egg version 0.2.0 and higher'''. 3468 3469 3470 <procedure>(rectlerpxy rect1 rect2 t) â sdl2:rect</procedure> 3471 <procedure>(rectlerpxy! rect1 rect2 t #!optional dest) â dest</procedure> 3472 3473 Efficient linear interpolation (or extrapolation) between {{rect1}} and {{rect2}}. 3474 sdl2:rect can only hold integer values, so the results will be truncated to integers. 3475 The results will be clamped to the range 2147483648 to 2147483647. 3476 3477 These procedures only affect the X and Y values of the rect. 3478 The result will have the same W and H as {{rect1}}. 3479 If you want interpolate all values (X, Y, W, and H), use {{rectlerp}} instead. 3480 3481 {{t}} is the interpolation factor (a float). 3482 Values of {{t}} between 0 and 1 will interpolate between {{rect1}} and {{rect2}}. 3483 Values of {{t}} less that 0 will extrapolate beyond {{rect1}} (moving away from {{rect2}}). 3484 Values greater that 1 will extrapolate beyond {{rect2}} (moving away from {{rect1}}). 3485 3486 * {{rectlerpxy}} returns a new managed sdl2:rect. 3487 * {{rectlerpxy!}} modifies and returns {{dest}}. 3488 If {{dest}} is omitted, {{rect1}} is modified and returned. 3489 3490 These procedures are available in '''sdl2 egg version 0.2.0 and higher'''. 3431 3491 3432 3492 … … 3480 3540 ==== sdl2:point Operations 3481 3541 3542 These are operations for efficiently and conveniently working with sdl2:points. 3543 Many of them are implemented in C for efficiency. 3544 3545 3482 3546 <procedure>(pointset! point #!optional x y) â point</procedure> 3483 3547 … … 3539 3603 E.g. {{scale}} 0.5 halves the values, {{scale}} 2.0 doubles the values. 3540 3604 sdl2:point can only hold integer values, so the results will be truncated to integers. 3605 The results will be clamped to the range 2147483648 to 2147483647. 3541 3606 3542 3607 These procedures are available in '''sdl2 egg version 0.2.0 and higher'''. … … 3546 3611 If {{dest}} is omitted, {{point}} is modified and returned. 3547 3612 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 3551 3613 3552 3614 <procedure>(pointmove point dx dy) â sdl2:point</procedure> … … 3555 3617 Efficiently move {{point}} by adding the given amounts to its X and Y values. 3556 3618 {{dx}} and {{dy}} must be integers. 3619 The results will be clamped to the range 2147483648 to 2147483647. 3557 3620 3558 3621 If {{dx}} and {{dy}} are already stored in an sdl2:point, … … 3566 3629 These procedures are available in '''sdl2 egg version 0.2.0 and higher'''. 3567 3630 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 3571 3631 3572 3632 <procedure>(pointadd point1 point2) â sdl2:point</procedure> … … 3574 3634 3575 3635 Efficiently add {{point1}} and {{point2}} (vector addition). 3636 The results will be clamped to the range 2147483648 to 2147483647. 3576 3637 3577 3638 If the dx and dy values are already held as separate variables, … … 3585 3646 These procedures are available in '''sdl2 egg version 0.2.0 and higher'''. 3586 3647 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 3590 3648 3591 3649 <procedure>(pointsub point1 point2) â sdl2:point</procedure> … … 3593 3651 3594 3652 Efficiently subtract {{point2}} from {{point1}} (vector subtraction). 3653 The results will be clamped to the range 2147483648 to 2147483647. 3595 3654 3596 3655 If the dx and dy values are already held as separate variables instead, … … 3604 3663 These procedures are available in '''sdl2 egg version 0.2.0 and higher'''. 3605 3664 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>(pointlerp point1 point2 t) â sdl2:point</procedure> 3667 <procedure>(pointlerp! point1 point2 t #!optional dest) â dest</procedure> 3668 3669 Efficient linear interpolation (or extrapolation) between {{point1}} and {{point2}}. 3670 sdl2:point can only hold integer values, so the results will be truncated to integers. 3671 The results will be clamped to the range 2147483648 to 2147483647. 3672 3673 {{t}} is the interpolation factor (a float). 3674 Values of {{t}} between 0 and 1 will interpolate between {{point1}} and {{point2}}. 3675 Values of {{t}} less that 0 will extrapolate beyond {{point1}} (moving away from {{point2}}). 3676 Values greater that 1 will extrapolate beyond {{point2}} (moving away from {{point1}}). 3677 3678 * {{pointlerp}} returns a new managed sdl2:point. 3679 * {{pointlerp!}} modifies and returns {{dest}}. 3680 If {{dest}} is omitted, {{point1}} is modified and returned. 3681 3682 These procedures are available in '''sdl2 egg version 0.2.0 and higher'''. 3608 3683 3609 3684
Note: See TracChangeset
for help on using the changeset viewer.