comparison modules/sdl.tp @ 283:0ec4f1b68a38

Add copyTo method to texture that allows copying to a rectangular region on the renderer rather than stretching to fit the entire renderer
author Michael Pavone <pavone@retrodev.com>
date Mon, 21 Jul 2014 20:27:38 -0700
parents eb83863fd33e
children 99c18127da04
comparison
equal deleted inserted replaced
282:361a449a7235 283:0ec4f1b68a38
137 llMessage: copy withVars: { 137 llMessage: copy withVars: {
138 intret <- obj_int32 ptr 138 intret <- obj_int32 ptr
139 } andCode: { 139 } andCode: {
140 intret <- make_object: (addr_of: obj_int32_meta) NULL 0 140 intret <- make_object: (addr_of: obj_int32_meta) NULL 0
141 intret num!: (SDL_RenderCopy: renderer texture NULL NULL) 141 intret num!: (SDL_RenderCopy: renderer texture NULL NULL)
142 intret
143 }
144
145 llMessage: copyTo withVars: {
146 dst <- object ptr
147 dstOpaque <- cpointer ptr
148 intret <- obj_int32 ptr
149 } andCode: :dst {
150 dstOpaque <- (mcall: _rectPointer 1 dst) castTo: (cpointer ptr)
151 intret <- make_object: (addr_of: obj_int32_meta) NULL 0
152 intret num!: (SDL_RenderCopy: renderer texture NULL (dstOpaque val))
142 intret 153 intret
143 } 154 }
144 155
145 llMessage: destroy withVars: {} andCode: { 156 llMessage: destroy withVars: {} andCode: {
146 SDL_DestroyTexture: texture 157 SDL_DestroyTexture: texture
326 llMessage: clearError withVars: {} andCode: { 337 llMessage: clearError withVars: {} andCode: {
327 SDL_ClearError: 338 SDL_ClearError:
328 true 339 true
329 } 340 }
330 341
342 rect:size <- :x y :w h {
343 getter <- macro: :propName {
344 quote: (llMessage: propName withVars: {
345 intret <- obj_int32 ptr
346 } andCode: {
347 intret <- make_object: (addr_of: obj_int32_meta) NULL 0
348 intret num!: ((addr_of: rect) propName)
349 intret
350 })
351 }
352 setter <- macro: :propName {
353 quote: (llMessage: propName withVars: {
354 v <- obj_int32 ptr
355 } andCode: :v {
356 (addr_of: rect) propName: (v num)
357 self
358 })
359 }
360 (((#{
361 llProperty: rect withType: SDL_Rect
362 getter: x
363 setter: x!
364 getter: y
365 setter: y!
366 getter: w
367 setter: w!
368 getter: h
369 setter: h!
370 llMessage: _rectPointer withVars: {
371 retptr <- cpointer ptr
372 } andCode: {
373 retptr <- make_object: (addr_of: cpointer_meta) NULL 0
374 retptr val!: (addr_of: (self rect))
375 retptr
376 }
377 } x!: x) y!: y) w!: w) h!: h
378 }
379
331 llMessage: getError withVars: { 380 llMessage: getError withVars: {
332 str <- string ptr 381 str <- string ptr
333 rawstr <- char ptr 382 rawstr <- char ptr
334 } andCode: { 383 } andCode: {
335 rawstr <- SDL_GetError: 384 rawstr <- SDL_GetError: