comparison src/video/nds/SDL_ndsrender.c @ 2694:c1c7cb1b5a47 gsoc2008_nds

More sprite-work in the render driver, and some updates to the nds-test-progs.
author Darren Alton <dalton@stevens.edu>
date Sat, 16 Aug 2008 12:58:36 +0000
parents bae97b6ac32b
children c04a266c277a
comparison
equal deleted inserted replaced
2693:bae97b6ac32b 2694:c1c7cb1b5a47
339 } 339 }
340 340
341 sprent->objMode = OBJMODE_BITMAP; 341 sprent->objMode = OBJMODE_BITMAP;
342 sprent->posX = 0; sprent->posY = 0; 342 sprent->posX = 0; sprent->posY = 0;
343 sprent->colMode = OBJCOLOR_16; /* OBJCOLOR_256 for INDEX8 */ 343 sprent->colMode = OBJCOLOR_16; /* OBJCOLOR_256 for INDEX8 */
344
345 /* the first 32 sprites get transformation matrices.
346 first come, first served */
344 if(whichspr < MATRIX_COUNT) { 347 if(whichspr < MATRIX_COUNT) {
345 sprent->isRotoscale = 1; 348 sprent->isRotoscale = 1;
346 sprent->rsMatrixIdx = whichspr; 349 sprent->rsMatrixIdx = whichspr;
347 } 350 }
351
352 sprent->objShape = OBJSHAPE_SQUARE;
353 if(texture->w/2 >= texture->h) {
354 sprent->objShape = OBJSHAPE_WIDE;
355 } else if(texture->h/2 >= texture->w) {
356 sprent->objShape = OBJSHAPE_TALL;
357 }
358 } else {
359 SDL_SetError("Out of NDS sprites.");
348 } 360 }
349 } else if(texture->w <= 256 && texture->h <= 256) { 361 } else if(texture->w <= 256 && texture->h <= 256) {
350 int whichbg = -1, base = 0; 362 int whichbg = -1, base = 0;
351 if(!data->bg_taken[2]) { 363 if(!data->bg_taken[2]) {
352 whichbg = 2; 364 whichbg = 2;
383 BG_BMP_RAM_SUB(base) : BG_BMP_RAM(base)); 395 BG_BMP_RAM_SUB(base) : BG_BMP_RAM(base));
384 396
385 /*txdat->size = txdat->dim.pitch * texture->h;*/ 397 /*txdat->size = txdat->dim.pitch * texture->h;*/
386 } else { 398 } else {
387 SDL_SetError("Out of NDS backgrounds."); 399 SDL_SetError("Out of NDS backgrounds.");
388 printf("ran out.\n");
389 } 400 }
390 } else { 401 } else {
391 SDL_SetError("Texture too big for NDS hardware."); 402 SDL_SetError("Texture too big for NDS hardware.");
392 } 403 }
393 404
394 TRACE("-NDS_CreateTexture\n"); 405 TRACE("-NDS_CreateTexture\n");
395 if (!texture->driverdata) { 406 if (!texture->driverdata) {
396 SDL_SetError("Couldn't create NDS render driver data.");
397 return -1; 407 return -1;
398 } 408 }
399 409
400 return 0; 410 return 0;
401 } 411 }