tangstad/helds
Archived
1
0

Added moving sprite on top of logo, currently just for testing.

This commit is contained in:
Truls Alexander Tangstad 2005-11-08 09:00:31 +00:00
parent 6bb21b4e3a
commit 30c5a499da
4 changed files with 30 additions and 4 deletions

@ -72,6 +72,7 @@ CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
PCXFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.pcx)))
BINFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.bin)))
#---------------------------------------------------------------------------------
# use CXX for linking C++ projects, CC for standard C
@ -87,7 +88,7 @@ else
endif
#---------------------------------------------------------------------------------
export OFILES := $(PCXFILES:.pcx=.o) $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
export OFILES := $(BINFILES:.bin=.o) $(PCXFILES:.pcx=.o) $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
#---------------------------------------------------------------------------------
# build a list of include paths
@ -126,7 +127,11 @@ $(OUTPUT).gba : $(OUTPUT).elf
$(OUTPUT).elf : $(OFILES)
%.o : %.pcx
%.o : %.pcx
@echo $(notdir $<)
@$(bin2o)
%.o : %.bin
@echo $(notdir $<)
@$(bin2o)

Binary file not shown.

Binary file not shown.

@ -5,20 +5,25 @@
#include "gba_systemcalls.h"
#include "gba_input.h"
#include "gba_interrupt.h"
#include "gba_sprites.h"
#include "gba_dma.h"
#include "pcx.h"
#include "fade.h"
#include <stdlib.h>
#include <string.h>
//---------------------------------------------------------------------------------
// header for binary data generated by bin2o macro in makefile
//---------------------------------------------------------------------------------
#include "helds_logo_pcx.h"
#include "s_piece_bin.h"
//---------------------------------------------------------------------------------
// storage space for palette data
//---------------------------------------------------------------------------------
u16 PaletteBuffer[256];
OBJATTR sprite;
unsigned int frame;
@ -47,15 +52,31 @@ int main(void)
// Allow Interrupts
REG_IME = 1;
SetMode( MODE_4 | BG2_ON ); // screen mode & background to display
// screen mode, background and objects to display
SetMode( MODE_4 | BG2_ON | OBJ_ON );
DecodePCX(helds_logo_pcx, (u16*)VRAM , PaletteBuffer);
FadeToPalette( PaletteBuffer, 60);
CpuFastSet(s_piece_bin, BITMAP_OBJ_BASE_ADR, COPY32 | s_piece_bin_size/4);
CpuFastSet(PaletteBuffer, OBJ_COLORS, COPY32 | sizeof(PaletteBuffer)/4);
memset(&sprite, 0, sizeof(sprite));
sprite.attr0 = OBJ_256_COLOR | OBJ_Y(25);
sprite.attr1 = OBJ_X(120);
sprite.attr2 = OBJ_CHAR(512);
u16 i;
u16* dst, *src;
while (1)
{
VBlankIntrWait();
sprite.attr0 = OBJ_256_COLOR | OBJ_Y(frame);
dst = (u16*)OAM;
src = (u16*)&sprite;
CpuFastSet(&sprite, OAM, COPY32 | sizeof(sprite)/4);
}
}