タイトル作成でのエラー
Posted: 2010年11月29日(月) 13:38
#include "GV.h"
void title_disp(int x , int y , char title[] , const char **str , int &menu ){
int num=0;
int dx=0,len=0;
const char **str2 = str;
//タイトル表示
dx = x - GetDrawFormatStringWidthToHandle( font[1], title ) / 2;
DrawFormatStringToHandle( dx, y, color[0], font[1], "%s", title );
y += 30; //改行
//情報の取得
while ( strcmp( *str2, "NULL" ) != 0 )
{
if( len < GetDrawFormatStringWidthToHandle( font[0] , *str2 ) )
{
len = GetDrawFormatStringWidthToHandle( font[0] , *str2 );
}
++num;
*str2++;
}
dx = x - len / 2;
//選択制御
if( CheckStatePad(configpad.up) == 1 && menu > 0 )
--menu;
else if( CheckStatePad(configpad.up) == 1 )
menu = num-1;
if( CheckStatePad(configpad.down) == 1 && menu < num-1 )
++menu;
else if( CheckStatePad(configpad.down) == 1 )
menu = 0;
y += menu * 20;
SetDrawBlendMode( DX_BLENDMODE_ALPHA , 100 ) ;
DrawBox( dx-10 , y , dx+10 + len , y + 18 , color[5] , TRUE ) ; //選択位置の表示
SetDrawBlendMode( DX_BLENDMODE_NOBLEND , 0 ) ;
y -= menu * 20;
//項目の表示
while ( strcmp( *str, "NULL" ) != 0 )
{
dx = x - GetDrawFormatStringWidthToHandle( font[0] , *str ) / 2;
DrawFormatStringToHandle( dx, y, color[0], font[0], "%s", *str++);
y += 20;
}
}
void game_start(){
// constでデータが書き換わらないようにする
const char *str[] =
{
{"START"},
{"EXIT"},
{"NULL"} // NULL文字列で終了を示す(小文字不可)
};
static int menu;
title_disp( FIELD_X+FIELD_MAX_X/2 , FIELD_Y+FIELD_MAX_Y/3 , " " , str, menu );
if( CheckStatePad(configpad.shot) == 1 )
{
switch(menu)
{
case 0:
func_state = 99; //メインに戻る
break;
case 1:
printfDx("不明なメニューが選択されました ");
break;
}
}
}
void title_main(){
title_disp();
game_start();
}
上のプログラムを打ってタイトルを作ろうとしたところ
’title_disp’関数に 0 個の引数を指定できません。
とエラーが出ました。
どこを修正することで治せるでしょうか?
void title_disp(int x , int y , char title[] , const char **str , int &menu ){
int num=0;
int dx=0,len=0;
const char **str2 = str;
//タイトル表示
dx = x - GetDrawFormatStringWidthToHandle( font[1], title ) / 2;
DrawFormatStringToHandle( dx, y, color[0], font[1], "%s", title );
y += 30; //改行
//情報の取得
while ( strcmp( *str2, "NULL" ) != 0 )
{
if( len < GetDrawFormatStringWidthToHandle( font[0] , *str2 ) )
{
len = GetDrawFormatStringWidthToHandle( font[0] , *str2 );
}
++num;
*str2++;
}
dx = x - len / 2;
//選択制御
if( CheckStatePad(configpad.up) == 1 && menu > 0 )
--menu;
else if( CheckStatePad(configpad.up) == 1 )
menu = num-1;
if( CheckStatePad(configpad.down) == 1 && menu < num-1 )
++menu;
else if( CheckStatePad(configpad.down) == 1 )
menu = 0;
y += menu * 20;
SetDrawBlendMode( DX_BLENDMODE_ALPHA , 100 ) ;
DrawBox( dx-10 , y , dx+10 + len , y + 18 , color[5] , TRUE ) ; //選択位置の表示
SetDrawBlendMode( DX_BLENDMODE_NOBLEND , 0 ) ;
y -= menu * 20;
//項目の表示
while ( strcmp( *str, "NULL" ) != 0 )
{
dx = x - GetDrawFormatStringWidthToHandle( font[0] , *str ) / 2;
DrawFormatStringToHandle( dx, y, color[0], font[0], "%s", *str++);
y += 20;
}
}
void game_start(){
// constでデータが書き換わらないようにする
const char *str[] =
{
{"START"},
{"EXIT"},
{"NULL"} // NULL文字列で終了を示す(小文字不可)
};
static int menu;
title_disp( FIELD_X+FIELD_MAX_X/2 , FIELD_Y+FIELD_MAX_Y/3 , " " , str, menu );
if( CheckStatePad(configpad.shot) == 1 )
{
switch(menu)
{
case 0:
func_state = 99; //メインに戻る
break;
case 1:
printfDx("不明なメニューが選択されました ");
break;
}
}
}
void title_main(){
title_disp();
game_start();
}
上のプログラムを打ってタイトルを作ろうとしたところ
’title_disp’関数に 0 個の引数を指定できません。
とエラーが出ました。
どこを修正することで治せるでしょうか?