Added a palette buffer should help with a multi-sprites.

This commit is contained in:
Stevie Frederick 2010-08-20 22:32:03 -04:00
parent 61a88acd6f
commit 5af38467fd
3 changed files with 32 additions and 5 deletions

View File

@ -2,6 +2,16 @@
#include <stdio.h>
#include "blu_impl.h"
//Implementation Specific Functions
void blu_impl::PushToPalBuffs(u16* palData, int chunks){
if(palBuff == NULL) return;
dmaCopy(palData, palBuff, chunks);
palBrk += chunks;
}
//this function initiates video ram for immediate use with sprites
//There are default settings in here for if you need to do video immediately
@ -29,7 +39,10 @@ bsp->init = 1;
}
dmaCopy(bsp->tiles, bsp->gfx, bsp->tlen);
dmaCopy(bsp->pal, SPRITE_PALETTE, bsp->plen);
//Only loading the sprtie pal works differents
//dmaCopy(bsp->pal, SPRITE_PALETTE, bsp->plen);
PushToPalBuffs(bsp->pal, bsp->plen);
}
void blu_impl::GFX_ULDSprite(bluSprite* bsp){
@ -44,6 +57,8 @@ bsp->init = 0;
//Blits sprite defined in bsp if it's been set up into OAM memory via ldsprite
//TODO: See above
void blu_impl::GFX_BltSpr(bluSprite* bsp){
//I think this is a good place to load a master pallette
dmaCopy(palBuff, SPRITE_PALETTE, palBrk);
if(bsp->init != 0)
oamSet(&oamMain,bsp->id,bsp->x,bsp->y,bsp->priority,0,bsp->sz,bsp->sfmt,bsp->gfx,0,false,false,false,false,false);
oamUpdate(&oamMain);

View File

@ -47,6 +47,7 @@ static blu_impl* InterfaceGet();
//System
void PrintLines(int x, int y);
void PushToPalBuffs(u16* palData, int chunks);
//Input
void StashQueue();
@ -68,6 +69,8 @@ bluVent* tailpV;
//resource wrapper
bluWrapper* bWrap;
u16* palBuf;
int palBrk;
//log control
int logSz;

View File

@ -39,7 +39,9 @@ blu_impl::blu_impl(){
//dummy
bluFrameFunc = 0;
bluRenderFunc = 0;
palBrk = 0;
bWrap = (bluWrapper*)malloc(sizeof(bluWrapper));
palBuff = (u16*)malloc(sizeof(u16)*1016);
}
//Destroys references until their are no more then completely destroys reference
@ -51,6 +53,7 @@ void blu_impl::Release(){
bref--;
if(!bref){
free(bWrap);
free(palBuff);
delete pblu;
pblu = 0;
}
@ -76,7 +79,7 @@ blog->logLine = "system start";
logTP = blog;
logSz = 1;
curLn = 1;
printf("0.%d %s",curLn,blog->logLine);
printf("0.%d %s\n",curLn,blog->logLine);
for(;;){
bluVent aVent = this->Input_PumpQueue();
//event based handling causes these to hit and get added to history to be dealt
@ -110,11 +113,9 @@ if(x > logSz || y > logSz){
printf("Segmentation Fault!\n");
return;
}
for(int i = 1; i <= x; i++){
for(int i = 1; i >= x; i++){
frstLn = frstLn->next;
}
curLn = x;
for(int i = x; i < y; i++){
@ -154,6 +155,14 @@ bluWrapper* blu_impl::System_GetWrapperHandle(void){
return bWrap;
}
//The resource list is a giant proc table with so many wrapper based slots
//available. This is the core of the resource manager. There are 2 queues, the
//first queue is for pipable resources. Such as log lines and
void blu_impl::System_QueueResource(bluWrapper rap){
}
void* blu_impl::System_ResourceFactory(void){
switch(bWrap->typW){