Example #1
0
//文字を描画
void DrawImpl::textLine(const Vector2& pos, int color, int fontHandle, const std::string &str, int alpha, HorizontalPlace::en fh, VerticalPlace::en fv, int blendMode){
	Vector2 dPos(0, 0);
	if (fh == HorizontalPlace::en::center){
		dPos.x -= GetDrawFormatStringWidthToHandle(fontHandle, "%s", str.c_str()) / 2.0;
	}
	else if (fh == HorizontalPlace::en::right){
		dPos.x -= GetDrawFormatStringWidthToHandle(fontHandle, "%s", str.c_str());
	}
	if (fv == VerticalPlace::en::center){
		dPos.y -= GetFontSizeToHandle(fontHandle) / 2.0;
	}
	else if (fv == VerticalPlace::en::bottom){
		dPos.y -= GetFontSizeToHandle(fontHandle);
	}

	SetDrawBlendMode(blendMode, alpha);

	size_t preNum = 0;
	size_t num = 0;
	while (1){
		preNum = num;
		num = str.find('\n', num);
		DrawFormatStringToHandle(pos.x + dx + dPos.x, pos.y + dy + dPos.y, color, fontHandle, "%s", str.substr(preNum, num - preNum).c_str());
		if (num == std::string::npos){
			break;
		}
		else{
			dPos += Vector2(0, GetFontSizeToHandle(fontHandle));
			num++;
		}
	}
	textDrawLog.set(pos, color, fontHandle, alpha, blendMode);
}
Example #2
0
// ボタンの描画
void BaseButton::Draw() {
    // 描画をαブレンドに設定
    SetDrawBlendMode(DX_BLENDMODE_ALPHA, 128);
    // マウスカーソルがボタンの上にあるか
    if (IsMouseOver) {
        DrawBox(APosition_LT.x, APosition_LT.y, APosition_LT.x + Size.x, APosition_LT.y + Size.y, 0xFFFFFF - ButtonStringColor, TRUE);
    }
    // 描画をノーブレンドに戻す
    SetDrawBlendMode(DX_BLENDMODE_NOBLEND, 0);

    // ボタンの状態によって描画する画像を変える
    switch (ButtonState) {
    case CLICK_PRESS:
    case CLICK_PRESSED:
        DrawBox(APosition_LT.x, APosition_LT.y, APosition_LT.x + Size.x, APosition_LT.y + Size.y, 0xFFFFFF - ButtonStringColor, FALSE);
        DrawStringToHandle(APosition_LT.x + (Size.x - GetDrawFormatStringWidthToHandle(FontHandle, ShowString.c_str())) / 2, APosition_LT.y + (Size.y - GetDrawStringWidthToHandle(_T("あ"), 1, FontHandle)) / 2, ShowString.c_str(), 0xFFFFFF - ButtonStringColor, FontHandle);
        break;
    case CLICK_DEFAULT:
    case CLICK_RELEASE:
    default:
        DrawBox(APosition_LT.x, APosition_LT.y, APosition_LT.x + Size.x, APosition_LT.y + Size.y, ButtonStringColor, FALSE);
        DrawStringToHandle(APosition_LT.x + (Size.x - GetDrawFormatStringWidthToHandle(FontHandle, ShowString.c_str())) / 2, APosition_LT.y + (Size.y - GetDrawStringWidthToHandle(_T("あ"), 1, FontHandle)) / 2, ShowString.c_str(), ButtonStringColor, FontHandle);
        break;
    }

    BaseGUIObj::Draw();
}
Example #3
0
//テキストとその背景に
void DrawImpl::textBox(const Vector2& pos, int color, int fontHandle, const std::string &str, int alpha, HorizontalPlace::en fh, VerticalPlace::en fv, const Vector2 &boxMargeV2, int boxColor, int boxAlpha, int blendMode, int boxBlendMode){
	Vector2 dPos(0, 0);
	Vector2 fontSize = Vector2(
		GetDrawFormatStringWidthToHandle(fontHandle, "%s", str.c_str()),
		GetFontSizeToHandle(fontHandle)
		);
	if (fh == HorizontalPlace::en::center){
		dPos.x -= fontSize.x / 2.0;
	}
	else if (fh == HorizontalPlace::en::right){
		dPos.x -= fontSize.x;
	}
	if (fv == VerticalPlace::en::center){
		dPos.y -= fontSize.y / 2.0;
	}
	else if (fv == VerticalPlace::en::bottom){
		dPos.y -= fontSize.y;
	}
	Vector2 shift(-(int)fh * fontSize.x * 0.5, -(int)fv * fontSize.y * 0.5);
	Vector2 leftTop(pos.x + dx + dPos.x, pos.y + dy + dPos.y);
	Draw.box(leftTop - boxMargeV2 * 0.5, leftTop + fontSize + boxMargeV2 * 0.5, boxColor, boxAlpha);
	SetDrawBlendMode(blendMode, alpha);
	DrawFormatStringToHandle(leftTop.x, leftTop.y, color, fontHandle, "%s", str.c_str());
	textDrawLog.set(leftTop, color, fontHandle, alpha, blendMode);
}
Example #4
0
void result::draw(){
	SetDrawBlendMode( DX_BLENDMODE_ALPHA , 100 ) ;	SetDrawBright(255,255,255);
	DrawRotaGraph(400, 300, 1, 0, GHandle[11] , 1);

	SetDrawBlendMode( DX_BLENDMODE_ALPHA , 255 ) ;	SetDrawBright(255,255,255);
	int stry = 60;
	int wdx;
	wdx = (int)(0.5 *GetDrawFormatStringWidthToHandle(FontHandle[1],  "RESULT"));
	DrawFormatStringToHandle((int)400-wdx, (int)stry, 0xFFFFFF, FontHandle[1] , "RESULT") ;
	stry+= 80;
	wdx = (int)(0.5 *GetDrawFormatStringWidthToHandle(FontHandle[1],  "倒したゾンビ数: %d", ptr->menemy->dienum));
	DrawFormatStringToHandle((int)400-wdx, (int)stry, 0xFFFFFF, FontHandle[1] , "倒したゾンビ数: %d", ptr->menemy->dienum) ;
	stry+= 80;
	wdx = (int)(0.5 *GetDrawFormatStringWidthToHandle(FontHandle[1],  "累積経験値: %d", ptr->mplayer->expsum));
	DrawFormatStringToHandle((int)400-wdx, (int)stry, 0xFFFFFF, FontHandle[1] , "累積経験値: %d", ptr->mplayer->expsum) ;
	stry+= 80;
	wdx = (int)(0.5 *GetDrawFormatStringWidthToHandle(FontHandle[1],  "被ダメージ回数: %d", ptr->menemy->damagenum));
	DrawFormatStringToHandle((int)400-wdx, (int)stry, 0xFFFFFF, FontHandle[1] , "被ダメージ回数: %d", ptr->menemy->damagenum) ;
	stry+= 80;
	wdx = (int)(0.5 *GetDrawFormatStringWidthToHandle(FontHandle[1],  "総合スコア: %ld", ptr->menemy->dienum*1000 + ptr->mplayer->expsum*10 - ptr->menemy->damagenum*200));
	DrawFormatStringToHandle((int)400-wdx, (int)stry, 0xFFFFFF, FontHandle[1] , "総合スコア: %ld", ptr->menemy->dienum*1000 + ptr->mplayer->expsum*10 - ptr->menemy->damagenum*200) ;
	
	SetDrawBlendMode( DX_BLENDMODE_ALPHA , (int)(128+128*sin(keika*0.05) ) ) ;	
	wdx = (int)(0.5 *GetDrawFormatStringWidthToHandle(FontHandle[1],  "THANK YOU FOR PLAYING!!"));
	DrawFormatStringToHandle((int)400-wdx, (int)460, 0xFFFFFF, FontHandle[1] , "THANK YOU FOR PLAYING!!") ;
	
	SetDrawBlendMode( DX_BLENDMODE_ALPHA , 255 ) ;	SetDrawBright(255,255,255);
	wdx = (int)(0.5 *GetDrawFormatStringWidthToHandle(FontHandle[0],  "[スペースキーで終了]"));
	DrawFormatStringToHandle((int)400-wdx, (int)550, 0xFF8800, FontHandle[0] , "[スペースキーで終了]") ;

	ptr->meffect->draw();
}
Example #5
0
//文字を描画・位置指定
void DrawImpl::textPlace(const Vector2& pos, int color, int fontHandle, const std::string &str, int alpha, HorizontalPlace::en fh, VerticalPlace::en fv, int blendMode){
	SetDrawBlendMode(blendMode, alpha);
	Vector2 dPos(0, 0);
	if (fh == HorizontalPlace::en::center){
		dPos.x -= GetDrawFormatStringWidthToHandle(fontHandle, "%s", str.c_str()) / 2.0;
	}
	else if (fh == HorizontalPlace::en::right){
		dPos.x -= GetDrawFormatStringWidthToHandle(fontHandle, "%s", str.c_str());
	}
	if (fv == VerticalPlace::en::center){
		dPos.y -= GetFontSizeToHandle(fontHandle) / 2.0;
	}
	else if (fv == VerticalPlace::en::bottom){
		dPos.y -= GetFontSizeToHandle(fontHandle);
	}
	DrawFormatStringToHandle(pos.x + dx + dPos.x, pos.y + dy + dPos.y, color, fontHandle, "%s", str.c_str());
	textDrawLog.set(pos, color, fontHandle, alpha, blendMode);
}
Example #6
0
void MessageWindow::Draw() {
	BaseWindow::Draw();
	//DrawFormatStringToHandle(APosition_LT.x + CharShowWait, APosition_LT.y + CharShowWait, 0xFFFFFF, Font, (NowText + (ShowingIsFinish && !MessagesAreEmpty ? _T("▼") : _T(""))).c_str());
	// テキストが空なら何もしないでreturn
	if (NowText.empty()) {
		return;
	}
	// 文の先頭が何番目であるか
	int TopChar = 0;
	// 文の終了位置が何番目であるか
	int EndChar = 0;
	// 改行しながら表示
	for (int LineCount = 0; TopChar < NowText.size(); ++LineCount) {
		// 改行位置を探す
		EndChar = NowText.find_first_of(_T("\n"), TopChar);
		// 見つからなければ、終端を最後にする
		if (EndChar == mine::tstring::npos) {
			EndChar = NowText.size() - 1;
		}
		// 指定された範囲で描画
		DrawFormatStringToHandle(APosition_LT.x + Message_DefaultInterval, APosition_LT.y + Message_DefaultInterval + LineCount * (GetDrawFormatStringWidthToHandle(Font, _T("あ"))), 0xFFFFFF, Font, (NowText.substr(TopChar, EndChar - TopChar + 1) + (ShowingIsFinish && !MessagesAreEmpty && EndChar == NowText.size() - 1 ? _T("▼") : _T(""))).c_str());
		// 先頭を現在の終端の次に
		TopChar = EndChar + 1;
	}

	//DrawString(-1000, 100, Texts.front().c_str(), 0xFF0000);
}
Example #7
0
//文字の右上の座標を指定して文字を描画
void DrawImpl::rightText(const Vector2& pos, int color, int fontHandle, const std::string &str, int alpha, int blendMode){
	SetDrawBlendMode(blendMode, alpha);
	int wd = GetDrawFormatStringWidthToHandle(fontHandle, "%s", str.c_str());
	DrawFormatStringToHandle(pos.x + dx - wd, pos.y + dy, color, fontHandle, "%s", str.c_str());
}