現在のプログラム↓です
まだいろいろ抜けたりしてますが。。
#include "OP.h" int optionImg; <per> int cursorPos; int White; int Key[256]; void SetColor(); void Start(); void Option(); void Exit(); void Select(); int GetHitKeyStateAll_2(int KeyStateBuf[/url]){ char GetHitKeyStateAll_Key[256]; GetHitKeyStateAll( GetHitKeyStateAll_Key ); for(int i=0;i<256;i++){ if(GetHitKeyStateAll_Key==1) KeyStateBuf++; else KeyStateBuf=0; } return 0; } enum StateID{ STATE_A, STATE_OPTION, STATE_EXIT, STATE_SELECT, STATE_END }; StateID state = STATE_SELECT; enum ColorID{ COLOR_RED, COLOR_BLUE, COLOR_YELLOW, COLOR_GREEN, COLOR_CYAN, COLOR_WHITE, COLOR_MAX }; int Color[COLOR_MAX]; typedef struct{ const int r; const int g; const int b; }COLOR; COLOR CList[COLOR_MAX] = { { 255, 0, 0}, { 0, 0, 255}, { 255, 255, 0}, { 0, 255, 0}, { 100, 255, 255}, { 255, 255, 255}}; typedef struct{ int PtX; int PtY; char* str; ColorID c; const StateID next; }CHOICES; CHOICES choices[/url] = { {60 , 60, "・?????", COLOR_WHITE, STATE_A}, {60 , 90, "・?????", COLOR_WHITE, STATE_OPTION}, {60 , 120, "・?????", COLOR_WHITE, STATE_OPTION}, {750 , 560, "EXIT", COLOR_WHITE, STATE_EXIT}}; int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,LPSTR lpCmdLine, int nCmdShow ){ ChangeWindowMode( TRUE ); SetGraphMode( 800 , 600 , 32 ) ; if(DxLib_Init() == -1 ) return -1; SetDrawScreen( DX_SCREEN_BACK ); SetColor(); typedef void(*Func)(); Func fc[/url] = {Start, Option, Exit, Select}; while(ProcessMessage()==0 && ClearDrawScreen()==0 && GetHitKeyStateAll_2(Key)==0 && Key[KEY_INPUT_ESCAPE]==0 && state != STATE_END){ fc[state](); ScreenFlip(); } DxLib_End(); return 0; } void Start(void) { } void Option(void) { } void Exit(void) { static int count = 150; if((--count) == 0) state = STATE_END; DrawString( 100, 100 , "Exit画面です。" , Color[COLOR_RED]); DrawString( 100, 120 , "※プログラムを終了します。" , Color[COLOR_WHITE]); } void Select(void) { int y; int image; static int NowPt = 0; static const int ChoiceNum = sizeof(choices)/sizeof(choices[0]); White = GetColor( 255, 255, 255 ); // 白色の値を取得 DrawBox( 720, 50, 410, 400, White, FALSE ); // 四角形を描画(左上x座標,左上y座標,右下x座標,右下y座標) DrawBox( 30, 50, 300, 200, White, FALSE ); // 四角形を描画(左上x座標,左上y座標,右下x座標,右下y座標) if(Key[KEY_INPUT_DOWN] == 1 || (Key[KEY_INPUT_DOWN] > 10 && Key[KEY_INPUT_DOWN] % 10 == 0)){ choices[NowPt].c = COLOR_WHITE; NowPt = (NowPt + 1) % ChoiceNum; }else if(Key[KEY_INPUT_UP] == 1 || (Key[KEY_INPUT_UP] > 10 && Key[KEY_INPUT_UP] % 10 == 0)){ choices[NowPt].c = COLOR_WHITE; NowPt = (NowPt + ChoiceNum - 1) % ChoiceNum; } for(int i = 0; i < ChoiceNum; i++){ if(i == NowPt) choices.c = COLOR_YELLOW; DrawString( choices.PtX , choices.PtY , choices.str , Color[choices.c]); } DrawString( choices[NowPt].PtX - 20, choices[NowPt].PtY , "◇" , Color[COLOR_CYAN]); if(Key[KEY_INPUT_RETURN] == 1){ state = choices[NowPt].next; choices[NowPt].c = COLOR_WHITE; NowPt = 0; } } void SetColor(void) { for(int i = 0, count = sizeof(CList) / sizeof(CList[0]); i < count; i++) Color = GetColor(CList.r, CList[i].g, CList[i].b); }