comparison modules/sdl.tp @ 334:98534108b854

Add width and height accessors to texture objects in SDL module
author Michael Pavone <pavone@retrodev.com>
date Mon, 30 Mar 2015 19:12:40 -0700
parents 577406b25f89
children 6bbf12c203f7
comparison
equal deleted inserted replaced
333:577406b25f89 334:98534108b854
481 _makeTexture <- :rendptr texptr { 481 _makeTexture <- :rendptr texptr {
482 #{ 482 #{
483 includeSystemHeader: "SDL.h" 483 includeSystemHeader: "SDL.h"
484 llProperty: renderer withType: (SDL_Renderer ptr) 484 llProperty: renderer withType: (SDL_Renderer ptr)
485 llProperty: texture withType: (SDL_Texture ptr) 485 llProperty: texture withType: (SDL_Texture ptr)
486 llProperty: _width withType: int32_t
487 llProperty: _height withType: int32_t
488 llProperty: _format withType: uint32_t
489 llProperty: _access withType: int32_t
486 llMessage: opaque withVars: { 490 llMessage: opaque withVars: {
487 ptr <- cpointer ptr 491 ptr <- cpointer ptr
488 } andCode: { 492 } andCode: {
489 ptr <- make_object: (addr_of: cpointer_meta) NULL 0 493 ptr <- make_object: (addr_of: cpointer_meta) NULL 0
490 ptr val!: texture 494 ptr val!: texture
494 rendptr <- cpointer ptr 498 rendptr <- cpointer ptr
495 texptr <- cpointer ptr 499 texptr <- cpointer ptr
496 } andCode: :rendptr texptr{ 500 } andCode: :rendptr texptr{
497 renderer <- rendptr val 501 renderer <- rendptr val
498 texture <- texptr val 502 texture <- texptr val
503 SDL_QueryTexture: texture (addr_of: _format) (addr_of: _access) (addr_of: _width) (addr_of: _height)
499 self 504 self
500 } 505 }
501 506
502 llMessage: copy withVars: { 507 llMessage: copy withVars: {
503 intret <- obj_int32 ptr 508 intret <- obj_int32 ptr
628 mcall: none 1 option 633 mcall: none 1 option
629 } else: { 634 } else: {
630 mcall: value 2 option (mcall: r:g:b 4 sdl r g b) 635 mcall: value 2 option (mcall: r:g:b 4 sdl r g b)
631 } 636 }
632 } 637 }
638
639 llMessage: width withVars: {
640 intret <- obj_int32 ptr
641 } andCode: {
642 intret <- make_object: (addr_of: obj_int32_meta) NULL 0
643 intret num!: _width
644 intret
645 }
646
647 llMessage: height withVars: {
648 intret <- obj_int32 ptr
649 } andCode: {
650 intret <- make_object: (addr_of: obj_int32_meta) NULL 0
651 intret num!: _height
652 intret
653 }
633 654
634 llMessage: destroy withVars: {} andCode: { 655 llMessage: destroy withVars: {} andCode: {
635 SDL_DestroyTexture: texture 656 SDL_DestroyTexture: texture
636 true 657 true
637 } 658 }