Mercurial > sdl-ios-xcode
comparison test/automated/render/render.c @ 3536:0267b8b1595c
Added interfaces for batch drawing of points, lines and rects:
SDL_DrawPoints()
SDL_BlendPoints()
SDL_BlendLines()
SDL_DrawLines()
SDL_FillRects()
SDL_BlendRects()
SDL_RenderPoints()
SDL_RenderLines()
SDL_RenderRects()
Renamed SDL_RenderFill() to SDL_RenderRect()
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Wed, 09 Dec 2009 15:56:56 +0000 |
parents | 61b7f5821576 |
children | 5f038ec1a1af |
comparison
equal
deleted
inserted
replaced
3535:b403f790df65 | 3536:0267b8b1595c |
---|---|
338 if (SDL_ATassert( "SDL_SetRenderDrawColor", ret == 0)) | 338 if (SDL_ATassert( "SDL_SetRenderDrawColor", ret == 0)) |
339 return -1; | 339 return -1; |
340 */ | 340 */ |
341 | 341 |
342 /* Clear screen. */ | 342 /* Clear screen. */ |
343 ret = SDL_RenderFill( NULL ); | 343 ret = SDL_RenderRect( NULL ); |
344 /* | 344 /* |
345 if (SDL_ATassert( "SDL_RenderFill", ret == 0)) | 345 if (SDL_ATassert( "SDL_RenderRect", ret == 0)) |
346 return -1; | 346 return -1; |
347 */ | 347 */ |
348 | 348 |
349 /* Set defaults. */ | 349 /* Set defaults. */ |
350 ret = SDL_SetRenderDrawBlendMode( SDL_BLENDMODE_NONE ); | 350 ret = SDL_SetRenderDrawBlendMode( SDL_BLENDMODE_NONE ); |
385 rect.w = 40; | 385 rect.w = 40; |
386 rect.h = 80; | 386 rect.h = 80; |
387 ret = SDL_SetRenderDrawColor( 13, 73, 200, SDL_ALPHA_OPAQUE ); | 387 ret = SDL_SetRenderDrawColor( 13, 73, 200, SDL_ALPHA_OPAQUE ); |
388 if (SDL_ATassert( "SDL_SetRenderDrawColor", ret == 0)) | 388 if (SDL_ATassert( "SDL_SetRenderDrawColor", ret == 0)) |
389 return -1; | 389 return -1; |
390 ret = SDL_RenderFill( &rect ); | 390 ret = SDL_RenderRect( &rect ); |
391 if (SDL_ATassert( "SDL_RenderRect", ret == 0)) | 391 if (SDL_ATassert( "SDL_RenderRect", ret == 0)) |
392 return -1; | 392 return -1; |
393 | 393 |
394 /* Draw a rectangle. */ | 394 /* Draw a rectangle. */ |
395 rect.x = 10; | 395 rect.x = 10; |
397 rect.w = 60; | 397 rect.w = 60; |
398 rect.h = 40; | 398 rect.h = 40; |
399 ret = SDL_SetRenderDrawColor( 200, 0, 100, SDL_ALPHA_OPAQUE ); | 399 ret = SDL_SetRenderDrawColor( 200, 0, 100, SDL_ALPHA_OPAQUE ); |
400 if (SDL_ATassert( "SDL_SetRenderDrawColor", ret == 0)) | 400 if (SDL_ATassert( "SDL_SetRenderDrawColor", ret == 0)) |
401 return -1; | 401 return -1; |
402 ret = SDL_RenderFill( &rect ); | 402 ret = SDL_RenderRect( &rect ); |
403 if (SDL_ATassert( "SDL_RenderRect", ret == 0)) | 403 if (SDL_ATassert( "SDL_RenderRect", ret == 0)) |
404 return -1; | 404 return -1; |
405 | 405 |
406 /* Draw some points like so: | 406 /* Draw some points like so: |
407 * X.X.X.X.. | 407 * X.X.X.X.. |
478 if (SDL_ATassert( "SDL_SetRenderDrawColor", ret == 0)) | 478 if (SDL_ATassert( "SDL_SetRenderDrawColor", ret == 0)) |
479 return -1; | 479 return -1; |
480 ret = SDL_SetRenderDrawBlendMode( SDL_BLENDMODE_NONE ); | 480 ret = SDL_SetRenderDrawBlendMode( SDL_BLENDMODE_NONE ); |
481 if (SDL_ATassert( "SDL_SetRenderDrawBlendMode", ret == 0)) | 481 if (SDL_ATassert( "SDL_SetRenderDrawBlendMode", ret == 0)) |
482 return -1; | 482 return -1; |
483 ret = SDL_RenderFill( NULL ); | 483 ret = SDL_RenderRect( NULL ); |
484 if (SDL_ATassert( "SDL_RenderFill", ret == 0)) | 484 if (SDL_ATassert( "SDL_RenderRect", ret == 0)) |
485 return -1; | 485 return -1; |
486 rect.x = 10; | 486 rect.x = 10; |
487 rect.y = 25; | 487 rect.y = 25; |
488 rect.w = 40; | 488 rect.w = 40; |
489 rect.h = 25; | 489 rect.h = 25; |
491 if (SDL_ATassert( "SDL_SetRenderDrawColor", ret == 0)) | 491 if (SDL_ATassert( "SDL_SetRenderDrawColor", ret == 0)) |
492 return -1; | 492 return -1; |
493 ret = SDL_SetRenderDrawBlendMode( SDL_BLENDMODE_ADD ); | 493 ret = SDL_SetRenderDrawBlendMode( SDL_BLENDMODE_ADD ); |
494 if (SDL_ATassert( "SDL_SetRenderDrawBlendMode", ret == 0)) | 494 if (SDL_ATassert( "SDL_SetRenderDrawBlendMode", ret == 0)) |
495 return -1; | 495 return -1; |
496 ret = SDL_RenderFill( &rect ); | 496 ret = SDL_RenderRect( &rect ); |
497 if (SDL_ATassert( "SDL_RenderFill", ret == 0)) | 497 if (SDL_ATassert( "SDL_RenderRect", ret == 0)) |
498 return -1; | 498 return -1; |
499 rect.x = 30; | 499 rect.x = 30; |
500 rect.y = 40; | 500 rect.y = 40; |
501 rect.w = 45; | 501 rect.w = 45; |
502 rect.h = 15; | 502 rect.h = 15; |
504 if (SDL_ATassert( "SDL_SetRenderDrawColor", ret == 0)) | 504 if (SDL_ATassert( "SDL_SetRenderDrawColor", ret == 0)) |
505 return -1; | 505 return -1; |
506 ret = SDL_SetRenderDrawBlendMode( SDL_BLENDMODE_BLEND ); | 506 ret = SDL_SetRenderDrawBlendMode( SDL_BLENDMODE_BLEND ); |
507 if (SDL_ATassert( "SDL_SetRenderDrawBlendMode", ret == 0)) | 507 if (SDL_ATassert( "SDL_SetRenderDrawBlendMode", ret == 0)) |
508 return -1; | 508 return -1; |
509 ret = SDL_RenderFill( &rect ); | 509 ret = SDL_RenderRect( &rect ); |
510 if (SDL_ATassert( "SDL_RenderFill", ret == 0)) | 510 if (SDL_ATassert( "SDL_RenderRect", ret == 0)) |
511 return -1; | 511 return -1; |
512 rect.x = 25; | 512 rect.x = 25; |
513 rect.y = 25; | 513 rect.y = 25; |
514 rect.w = 25; | 514 rect.w = 25; |
515 rect.h = 25; | 515 rect.h = 25; |
517 if (SDL_ATassert( "SDL_SetRenderDrawColor", ret == 0)) | 517 if (SDL_ATassert( "SDL_SetRenderDrawColor", ret == 0)) |
518 return -1; | 518 return -1; |
519 ret = SDL_SetRenderDrawBlendMode( SDL_BLENDMODE_MOD ); | 519 ret = SDL_SetRenderDrawBlendMode( SDL_BLENDMODE_MOD ); |
520 if (SDL_ATassert( "SDL_SetRenderDrawBlendMode", ret == 0)) | 520 if (SDL_ATassert( "SDL_SetRenderDrawBlendMode", ret == 0)) |
521 return -1; | 521 return -1; |
522 ret = SDL_RenderFill( &rect ); | 522 ret = SDL_RenderRect( &rect ); |
523 if (SDL_ATassert( "SDL_RenderFill", ret == 0)) | 523 if (SDL_ATassert( "SDL_RenderRect", ret == 0)) |
524 return -1; | 524 return -1; |
525 | 525 |
526 /* Draw blended lines, lines for everyone. */ | 526 /* Draw blended lines, lines for everyone. */ |
527 for (i=0; i<SCREEN_W; i+=2) { | 527 for (i=0; i<SCREEN_W; i+=2) { |
528 ret = SDL_SetRenderDrawColor( 60+2*i, 240-2*i, 50, 3*i ); | 528 ret = SDL_SetRenderDrawColor( 60+2*i, 240-2*i, 50, 3*i ); |