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

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

View File

@@ -72,6 +72,7 @@ CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp))) CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s))) SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
PCXFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.pcx))) 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 # use CXX for linking C++ projects, CC for standard C
@@ -87,7 +88,7 @@ else
endif 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 # build a list of include paths
@@ -130,6 +131,10 @@ $(OUTPUT).elf : $(OFILES)
@echo $(notdir $<) @echo $(notdir $<)
@$(bin2o) @$(bin2o)
%.o : %.bin
@echo $(notdir $<)
@$(bin2o)
-include $(DEPENDS) -include $(DEPENDS)
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------

Binary file not shown.

Binary file not shown.

View File

@@ -5,20 +5,25 @@
#include "gba_systemcalls.h" #include "gba_systemcalls.h"
#include "gba_input.h" #include "gba_input.h"
#include "gba_interrupt.h" #include "gba_interrupt.h"
#include "gba_sprites.h"
#include "gba_dma.h"
#include "pcx.h" #include "pcx.h"
#include "fade.h" #include "fade.h"
#include <stdlib.h> #include <stdlib.h>
#include <string.h>
//--------------------------------------------------------------------------------- //---------------------------------------------------------------------------------
// header for binary data generated by bin2o macro in makefile // header for binary data generated by bin2o macro in makefile
//--------------------------------------------------------------------------------- //---------------------------------------------------------------------------------
#include "helds_logo_pcx.h" #include "helds_logo_pcx.h"
#include "s_piece_bin.h"
//--------------------------------------------------------------------------------- //---------------------------------------------------------------------------------
// storage space for palette data // storage space for palette data
//--------------------------------------------------------------------------------- //---------------------------------------------------------------------------------
u16 PaletteBuffer[256]; u16 PaletteBuffer[256];
OBJATTR sprite;
unsigned int frame; unsigned int frame;
@@ -47,15 +52,31 @@ int main(void)
// Allow Interrupts // Allow Interrupts
REG_IME = 1; 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); DecodePCX(helds_logo_pcx, (u16*)VRAM , PaletteBuffer);
FadeToPalette( PaletteBuffer, 60); 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) while (1)
{ {
VBlankIntrWait(); VBlankIntrWait();
sprite.attr0 = OBJ_256_COLOR | OBJ_Y(frame);
dst = (u16*)OAM;
src = (u16*)&sprite;
CpuFastSet(&sprite, OAM, COPY32 | sizeof(sprite)/4);
} }
} }