DXライブラリPortable v0.5.7 UTF8版 サンプルプログラム UTAUスライドショウ(音無し版)
こちらのソースコードは、全角の空白文字も使用しています。
たくさん勉強したい方は、このページを お気に入りに登録しておくといいかもです
main.c
-
-
-
-
-
-
-
-
- #include <dxlibp.h>
- #include "COLORS.H"
-
- #define MAX_GRAPHIC 4
-
-
-
-
-
-
-
- int initton(void);
- void ScreenSettings(void);
- int GraphicChecker(void);
-
- int main(int argc, char *argp[]);
- void action(void);
- void games(void);
- void games_finish(void);
-
-
-
-
- int Graph_handle[MAX_GRAPHIC+1];
-
-
- const char *Graph_filename[]={
- "./0001.png",
- "./0002.png",
- "./0003.png",
- "./0004.png"
- };
-
-
-
-
- PSP_MODULE_INFO("SLIDESHOW", PSP_MODULE_USER, 1, 0);
- PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER | THREAD_ATTR_VFPU);
- PSP_HEAP_SIZE_KB(16*1024);
- PSP_MAIN_THREAD_STACK_SIZE_KB(512);
-
-
-
-
- int main(int argc, char *argp[])
- {
- int result;
-
- DxLib_Init();
-
- result = initton();
-
- if(result == 0) {
-
- action();
- }
- else {
-
- DrawBox(0,0,480,272,DXP_COLOR_RED,TRUE);
- DrawFormatString(0,100,DXP_COLOR_WHITE
- ,"画像を%d枚 読み込めなかったので終了します",result);
- DrawFormatString(0,140,DXP_COLOR_WHITE,"何かボタンを押して下さい");
- ScreenFlip();
-
- do {
- ProcessMessage();
- }while(CheckHitKeyAll() == 0);
- }
-
- DxLib_End();
- return(0);
- }
-
-
-
-
- void ScreenSettings()
- {
- SetDisplayFormat(DXP_FMT_8888);
- SetWaitVSyncFlag(TRUE);
- SetDrawArea(0,0,480,272);
- SetDrawMode(DX_DRAWMODE_NEAREST);
- SetDrawBlendMode(DX_BLENDMODE_NOBLEND, 0);
- SetDrawBright(255,255,255);
- SetGraphMode(480, 272, DXP_FMT_8888);
- ClearDrawScreen();
-
- ChangeFontType(DX_FONTTYPE_NORMAL);
- }
-
-
-
-
-
-
-
- int GraphicChecker()
- {
- int i;
- int errors;
-
- errors = 0;
- for(i=0; i<MAX_GRAPHIC; i++) {
- Graph_handle[i] = LoadGraph(Graph_filename[i]);
- DrawBox(0,0,480,272,DXP_COLOR_BLUE,TRUE);
- DrawFormatString(0,100,DXP_COLOR_WHITE,"%d 番目 %s",i,Graph_filename[i]);
- DrawFormatString(0,140,DXP_COLOR_WHITE,"LoadGraph の ハンドル=%d",Graph_handle[i]);
- if(Graph_handle[i] != -1)
- DrawFormatString(0,180,XVI_COLOR_YELLOW,"読み込み成功!");
- else {
- DrawFormatString(0,180,DXP_COLOR_RED,"読み込み失敗!");
- ++errors;
- }
- ScreenFlip();
- Sleep(800);
- }
-
- return( errors );
- }
-
-
-
-
-
-
- int initton(void)
- {
- ScreenSettings();
-
-
- ChangeFontType(DX_FONTTYPE_NORMAL);
-
-
-
-
- return( GraphicChecker() );
- }
-
-
-
-
- void action(void)
- {
- games();
- games_finish();
- }
-
-
-
-
-
-
-
-
- void games(void)
- {
- int num,waits;
-
-
-
- num=0;
- while(1) {
- for(waits=0; waits<60; ++waits) {
-
- DrawGraph( 0,0,Graph_handle[num],FALSE );
- DrawFormatString(300, 220,DXP_COLOR_BLACK,"Lトリガー押しで終了");
- ScreenFlip();
-
- ProcessMessage();
- if(GetInputState()==DXP_INPUT_LTRIGGER)
- return;
- }
- ++num;
- if(num==4) num=0;
- };
- }
-
-
-
-
-
-
-
- void games_finish(void)
- {
- int num;
-
-
- for(num=0; num<MAX_GRAPHIC; ++num) {
- DeleteGraph(Graph_handle[num]);
- }
- }
Makefile
- TARGET = SLIDESHOW
- OBJS = main.o
-
- PSPSDK=$(shell psp-config --pspsdk-path)
- INCS = $(PSPSDK)/include $(PSPSDK)/DXP_v0.5.7/include
- INCDIR = $(INCS)
-
- CFLAGS = -Wall -G0 -O3 -fomit-frame-pointer -mgp32 -mlong32
-
- CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
- ASFLAGS = $(CFLAGS)
-
- PSP_FW_VERSION=300
-
- BUILD_PRX = 1
- #ENCRYPT = 1
-
- LIBDIR = $(PSPSDK)/DXP_v0.5.7/lib
- LDFLAGS =
- LIBS = $(PSPSDK)/DXP_v0.5.7/lib/dxlibp_UTF8.a
- #LIBS = $(PSPSDK)/DXP_v0.5.7/lib/dxlibp.a
- LIBS += -lpspgu -lz -lm -lpsprtc -lpspaudio -lpspaudiocodec\
- -lpsputility -lpspvalloc -lpsppower
-
- EXTRA_TARGETS = EBOOT.PBP
- PSP_EBOOT_TITLE = UTAU SLIDESHOW DXP (NO SOUND Ver)
- PSP_EBOOT_ICON = ICON0.png
- PSP_EBOOT_ICON1 = NULL
- PSP_EBOOT_UNKPNG= NULL
- PSP_EBOOT_PIC1 = NULL
- PSP_EBOOT_SND0 = NULL
-
- PSPSDK=$(shell psp-config --pspsdk-path)
- include $(PSPSDK)/lib/build.mak
-
- # 以下、任意で(開発しているソースに依存)
- main.o : main.c
ぴよ:「音無し・・・ですか・・・・はぁ・・・・。」