試しに書いてみたら動いちゃったけど悪ノリしすぎなので良い子は真似すんなバージョン。
#include <piece.h> // #define vWidth 128 #define vHeight 88 #define ayakaWidth 48 #define ayakaHeight 72 #define ayakaPtn(n) (ayakaHeight * (n)) #define speed 3 #define pceLCDDraw(pBmp, dstX, dstY, srcX, srcY, w, h, param){\ DRAW_OBJECT obj ;\ pceLCDSetObject(&obj, (pBmp), (dstX), (dstY), (srcX), (srcY), (w), (h), (param)) ;\ pceLCDDrawObject(obj) ;\ } // typedef struct tag_piece_bmp* PpieceBmp ; typedef void (*IpceBmpInit)(PpieceBmp this, unsigned char* pDat) ; typedef void (*Idraw)(PpieceBmp this) ; typedef struct tag_piece_bmp { PIECE_BMP m_bmp ; IpceBmpInit init ; Idraw draw ; } TpieceBmp ; // static void pceBmpInit( // IpceBmpInit PpieceBmp this, unsigned char* pDat ){ this->m_bmp.header = *(PBMP_FILEHEADER*)(pDat) ; this->m_bmp.buf = pDat + sizeof(PBMP_FILEHEADER) ; this->m_bmp.mask = this->m_bmp.buf + (this->m_bmp.header.h * this->m_bmp.header.w)/4 ; } static void drawAyaka(PpieceBmp this){ // Idraw static int ptn[] = { ayakaPtn(0), ayakaPtn(1), ayakaPtn(2), ayakaPtn(0), ayakaPtn(3), ayakaPtn(4) } ; static int* EOP = ptn + sizeof(ptn)/sizeof(ptn[0]) ; static int* pPtn = ptn ; pceLCDDraw(&this->m_bmp, 40, 0, 0, *pPtn, ayakaWidth, ayakaHeight, DRW_NOMAL) ; pPtn++ ; if (EOP <= pPtn) { pPtn = ptn ; } } static void drawBackG(PpieceBmp this){ // Idraw static unsigned int x = 0 ; pceLCDDraw(&this->m_bmp, 0, 0, x, 0, vWidth-x, vHeight, DRW_NOMAL) ; pceLCDDraw(&this->m_bmp, vWidth-x, 0, 0, 0, x, vHeight, DRW_NOMAL) ; x += speed ; x %= vWidth ; } // static unsigned char vbuff[vWidth * vHeight]; extern unsigned char A[] ; extern unsigned char B[] ; static TpieceBmp pbmpAyaka = {{0}, pceBmpInit, drawAyaka} ; static TpieceBmp pbmpBackG = {{0}, pceBmpInit, drawBackG} ; static unsigned char seq[] = { #include "sample.c" } ; // void pceAppInit( void ){ pceLCDDispStop(); pceAppSetProcPeriod(160) ; InitMusic() ; PlayMusic(seq) ; pceLCDSetBuffer( vbuff ); pbmpBackG.init(&pbmpBackG, B) ; pbmpAyaka.init(&pbmpAyaka, A) ; pbmpBackG.draw(&pbmpBackG) ; pbmpAyaka.draw(&pbmpAyaka) ; pceLCDTrans() ; pceLCDDispStart(); } void pceAppProc( int cnt ){ pbmpBackG.draw(&pbmpBackG) ; pbmpAyaka.draw(&pbmpAyaka) ; pceLCDTrans() ; } void pceAppExit( void ){ pceWaveStop(0) ; }