void FontManager::Load(FontSet font) { if( m_FontData[font].handle != 0) return; switch(font) { case FontSet_MSGothic_Small: m_FontData[font].size = 14; m_FontData[font].handle = CreateFontToHandle("MSゴシック", m_FontData[font].size, 1); break; case FontSet_MSGothic_Middle: m_FontData[font].size = 24; m_FontData[font].handle = CreateFontToHandle("MSゴシック", m_FontData[font].size, 2); break; case FontSet_AZUKI_25: m_FontData[font].size = 25; m_FontData[font].handle = CreateFontToHandle("あずきフォント", m_FontData[font].size, 6); break; case FontSet_AZUKI_003: DXLibMath::ConvertPixcelY(0.03, &m_FontData[font].size); m_FontData[font].handle = CreateFontToHandle("あずきフォント", m_FontData[font].size, 2); break; case FontSet_AZUKI_W0025: DXLibMath::ConvertPixcelX(0.025, &m_FontData[font].size); m_FontData[font].handle = CreateFontToHandle("あずきフォント", m_FontData[font].size, 2); break; case FontSet_AZUKI_W001875: DXLibMath::ConvertPixcelX(0.01875, &m_FontData[font].size); m_FontData[font].handle = CreateFontToHandle("あずきフォント", m_FontData[font].size, 2); break; case FontSet_AZUKI_W00225: DXLibMath::ConvertPixcelX(0.0225, &m_FontData[font].size); m_FontData[font].handle = CreateFontToHandle("あずきフォント", m_FontData[font].size, 2); break; case FontSet_AZUKI_W001625: DXLibMath::ConvertPixcelX(0.01625, &m_FontData[font].size); m_FontData[font].handle = CreateFontToHandle("あずきフォント", m_FontData[font].size, 2); break; case FontSet_AZUKI_W00375: DXLibMath::ConvertPixcelX(0.0375, &m_FontData[font].size); m_FontData[font].handle = CreateFontToHandle("あずきフォント", m_FontData[font].size, 10); break; case FontSet_AZUKI_W004375: DXLibMath::ConvertPixcelX(0.04375, &m_FontData[font].size); m_FontData[font].handle = CreateFontToHandle("あずきフォント", m_FontData[font].size, 20); break; case FontSet_AZUKI_W005: DXLibMath::ConvertPixcelX(0.05, &m_FontData[font].size); m_FontData[font].handle = CreateFontToHandle("あずきフォント", m_FontData[font].size, 20); break; default: break; } m_FontData[font].halfStringWidth = GetDrawStringWidthToHandle("a", 1, m_FontData[font].handle); m_FontData[font].stringWidth = GetDrawStringWidthToHandle("あ", 2, m_FontData[font].handle); }
//ゲームオーバーの描画 void draw_GameOver() { int FontHandle = CreateFontToHandle("HGS創英角ポップ体", 64, 8, DX_FONTTYPE_ANTIALIASING_EDGE); char *str = "Game Over...."; int Strlen = strlen(str); int Width = GetDrawStringWidthToHandle(str, Strlen, FontHandle); DrawStringToHandle(320 - Width / 2, 208, str, GetColor(255, 255, 255), FontHandle); /*フェードイン、フェードアウト*/ SetDrawBlendMode(DX_BLENDMODE_ALPHA, charClearOver); str = "スペースキーを押せば、もう一度プレイできます"; Strlen = strlen(str); Width = GetDrawStringWidth(str, Strlen); DrawString(320 - Width / 2, 280, str, GetColor(255, 255, 255)); //ブレンドを元に戻す SetDrawBlendMode(DX_BLENDMODE_NOBLEND, 0); if (charClearOver > 255 || charClearOver < 0) { i *= -1; } charClearOver += i; //フォントを削除 DeleteFontToHandle(FontHandle); }
//タイトルの描画 void draw_Title() { int FontHandle = CreateFontToHandle("HGS創英角ポップ体", 64, 8, DX_FONTTYPE_ANTIALIASING_EDGE); char *str = "Space Shooting"; int Strlen = strlen(str); int Width = GetDrawStringWidthToHandle(str, Strlen, FontHandle); DrawStringToHandle(320 - Width / 2, 208, str, GetColor(255, 255, 255), FontHandle); /*フェードイン、フェードアウト*/ SetDrawBlendMode(DX_BLENDMODE_ALPHA, char_br); str = "スペースキーを押してください"; Strlen = strlen(str); Width = GetDrawStringWidth(str, Strlen); DrawString(320 - Width / 2, 280, str, GetColor(255, 255, 255)); //ブレンドを元に戻す SetDrawBlendMode(DX_BLENDMODE_NOBLEND, 0); if (char_br > 255 || char_br < 0) { i *= -1; } char_br += i; //フォントを削除 DeleteFontToHandle(FontHandle); }
bool Window_Selectable::ApplyContent(int _item_width){ // 選択肢のサイズを設定 UpdateSelectableSize(); // 項目間のマージンを指定(最初に省略した場合) if(item_marginx == -1){ item_marginx = fontBandle.fontSize*2; } // 項目の最大サイズを指定 item_width = _item_width==-1 ? (GetContentMaxDrawWidth()+fontBandle.fontSize) : _item_width; content_width = item_width*column+item_marginx*(column-1); // タイトルの幅を指定 int title_width = GetDrawStringWidthToHandle( title, strlen(title), titleFontSize.hFont); // 項目の幅とタイトルの幅のうち大きいほうを実際の幅に指定 contentArea.w = max(content_width, title_width); // タイトルも含めたコンテンツの大きさを指定 contentArea.h = fontBandle.lineHeight*(select.row-1) + fontBandle.fontSize; contentArea.h += (useTitle ? titleFontSize.lineHeight : 0); return true; }
void Window::DrawStringInWindow(int Input_x,int Input_y,int Input_Pos,string Input_String,int FontData,int Color) { vector<string> Strs = split(Input_String,"<>"); int Height; GetFontStateToHandle(NULL,&Height,NULL,FontData); Height *= 1.4; int Length = Strs.size(); int Draw_y = Input_y-Height; for(int i=0;i<Length;i++) { int Graph; int Draw_x = Input_x; Draw_y += Height; int DrawWidth = GetDrawStringWidthToHandle(Strs[i].c_str(),Strs[i].size(),FontData); int Size; float Ext = 1.0f; if(Input_Pos == DrawString_Center)Draw_x -= DrawWidth/2; else if(Input_Pos == DrawString_Right)Draw_x -= DrawWidth; GetFontStateToHandle(0,&Size,0,FontData); Graph = MakeScreen(DrawWidth,Size*2,true); SetDrawScreen(Graph); DrawStringToHandle(0,0,Strs[i].c_str(),Color,FontData); if(DrawWidth + Draw_x >= Width) { Ext = (float)Width / (float)(DrawWidth + Draw_x) - 0.01f; } SetDrawScreen(Screen); DrawRotaGraph2(Draw_x,Draw_y,0,0,Ext,0.f,Graph,true); DeleteGraph(Graph); } SetDrawScreen(DX_SCREEN_BACK); }
void Window_DollListBase::DrawPage() const{ // 「次のページへ」の描画。 TCHAR pageStr[64]; wsprintf(pageStr, _T("← %d/%dページ →"), page+1, maxPage); DrawStringByPresetColor( frameArea.x + frameArea.w/2 - GetDrawStringWidthToHandle(pageStr, strlen(pageStr), g_font.hInfo)/2, frameArea.y + contentArea.y + contentArea.h - FONTSIZE_INFO - 20, pageStr, g_font.hInfo, presetColorIndex, COLORSET_COLOR_NORMAL); }
void Game_UseSkillManager::DrawPage(int _x, int _y, int _color) const{ // 「次のページへ」の描画。 TCHAR pageStr[64]; wsprintf(pageStr, _T("← %d/%dページ →"), page+1, maxPage); DrawStringByPresetColor( _x - GetDrawStringWidthToHandle(pageStr, strlen(pageStr), g_font.hInfo)/2, _y, pageStr, g_font.hInfo, _color, COLORSET_COLOR_NORMAL); }
int Window_Selectable::GetContentMaxDrawWidth() const{ int result = 0; for(int n=0; n<WND_SELECTABLE_CONTENT; n++){ if(strlen(content.data[n]) > 0){ result = max(result, GetDrawStringWidthToHandle( content.data[n], strlen(content.data[n]), windowFont.hFont)); } } return result; }
void Input::Draw() { { int alpha = active() ? 255 : 150; if (reverse_color_) { SetDrawBlendMode(DX_BLENDMODE_INVSRC, alpha); } else { SetDrawBlendMode(DX_BLENDMODE_ALPHA, alpha); } DrawGraph(x_, y_, *input_bg_image_handle_[0], TRUE); DrawGraph(x_ + width_ - 12, y_, *input_bg_image_handle_[1], TRUE); DrawGraph(x_, y_ + height_ - 12, *input_bg_image_handle_[2], TRUE); DrawGraph(x_ + width_ - 12, y_ + height_ - 12, *input_bg_image_handle_[3], TRUE); DrawRectExtendGraphF(x_ + 12, y_, x_ + width_ - 12, y_ + 12, 0, 0, 1, 12, *input_bg_image_handle_[1], TRUE); DrawRectExtendGraphF(x_ + 12, y_ + height_ - 12, x_ + width_ - 12, y_ + height_, 0, 0, 1, 12, *input_bg_image_handle_[3], TRUE); DrawRectExtendGraphF(x_, y_ + 12, x_ + 12, y_ + height_ - 12, 0, 0, 12, 1, *input_bg_image_handle_[2], TRUE); DrawRectExtendGraphF(x_ + width_ - 12, y_ + 12, x_ + width_, y_ + height_ - 12, 0, 0, 12, 1, *input_bg_image_handle_[3], TRUE); DrawRectExtendGraphF(x_ + 12, y_ + 12, x_ + width_ - 12, y_ + height_ - 12, 0, 0, 1, 1, *input_bg_image_handle_[3], TRUE); SetDrawBlendMode(DX_BLENDMODE_NOBLEND, 0); } { int internal_x = x_ + INPUT_MARGIN_X; int internal_y = y_ + INPUT_MARGIN_Y; // int internal_width = width_ - INPUT_MARGIN * 2; // int internal_height = height_ - INPUT_MARGIN * 2; // 選択範囲の背景を描画 //int current_line = 0; //for (auto it = selecting_lines_.begin(); it != selecting_lines_.end(); ++it) { // auto line = *it; // if (line.first < line.second) { // SetDrawBlendMode(DX_BLENDMODE_ALPHA, 100); // DrawBox(internal_x + line.first, // internal_y + current_line * font_height_, // internal_x + line.second, // internal_y + (current_line + 1) * font_height_, // GetColor(255, 0, 255), TRUE); // SetDrawBlendMode(DX_BLENDMODE_NOBLEND, 0); // } // current_line++; //} int current_line = 0; for (auto it = clause_lines_.begin(); it != clause_lines_.end(); ++it) { auto line = *it; if (line.first < line.second) { SetDrawBlendMode(DX_BLENDMODE_ALPHA, 100); DrawBox(internal_x + line.first, internal_y + current_line * font_height_, internal_x + line.second, internal_y + (current_line + 1) * font_height_, GetColor(0, 255, 255), TRUE); SetDrawBlendMode(DX_BLENDMODE_NOBLEND, 0); } current_line++; } current_line = 0; candidate_x_ = -1, candidate_y_ = -1; for (auto it = selecting_clause_lines_.begin(); it != selecting_clause_lines_.end(); ++it) { auto line = *it; if (line.first < line.second) { SetDrawBlendMode(DX_BLENDMODE_ALPHA, 100); DrawBox(internal_x + line.first, internal_y + current_line * font_height_, internal_x + line.second, internal_y + (current_line + 1) * font_height_, GetColor(255, 0, 255), TRUE); SetDrawBlendMode(DX_BLENDMODE_NOBLEND, 0); if (candidate_x_ < 0) { candidate_x_ = line.first; candidate_y_ = (current_line + 1) * font_height_; } } current_line++; } int text_color = reverse_color_ ? GetColor(255, 255, 255) : GetColor(0, 0, 0); current_line = 0; if (message_lines_.size() > 0) { for (auto it = message_lines_.begin(); it != message_lines_.end(); ++it) { auto line = *it; SetDrawBlendMode(DX_BLENDMODE_ALPHA, 140); DrawStringToHandle(internal_x, internal_y + current_line * font_height_ - 3, line.c_str(), text_color, font_handle_); SetDrawBlendMode(DX_BLENDMODE_NOBLEND, 0); current_line++; } } for (auto it = lines_.begin(); it != lines_.end(); ++it) { auto line = *it; DrawStringToHandle(internal_x, internal_y + current_line * font_height_, line.c_str(), text_color, font_handle_); current_line++; } // カーソルを描画 if (clause_lines_.size() <= 0 && active() && blink_count_ < 30) { DrawBox(internal_x + cursor_x_, internal_y + cursor_y_, internal_x + cursor_x_ + 2, internal_y + cursor_y_ + font_height_, text_color, TRUE); } } { int internal_x = x_ + INPUT_MARGIN_X; int internal_y = y_ + INPUT_MARGIN_Y; if (selecting_candidate_ >= 0) { int start_index = (selecting_candidate_ / IME_MAX_PAGE_SIZE) * IME_MAX_PAGE_SIZE; int end_index = std::min(start_index + IME_MAX_PAGE_SIZE, static_cast<int>(candidates_.size() - 1)); int x = candidate_x_; int y; int width = IME_MIN_WIDTH; int height = (end_index - start_index) * font_height_; for (int i = start_index; i < end_index; i++) { auto candidate = candidates_[i]; width = std::max(width, GetDrawStringWidthToHandle(candidate.c_str(), candidate.size(), font_handle_)); } int screen_height; GetScreenState(nullptr, &screen_height, nullptr); if (internal_y + height + candidate_x_ >= screen_height - IME_MARGIN_Y * 2) { y = candidate_y_ - font_height_ - height - IME_MARGIN_Y; } else { y = candidate_y_ + IME_MARGIN_Y; } if (height > 0) { int base_x = internal_x + x - IME_MARGIN_BASE; int base_y = internal_y + y - IME_MARGIN_BASE; int base_width = width + IME_MARGIN_BASE * 2; int base_height = height + IME_MARGIN_BASE * 2; DrawGraph(base_x, base_y, *ime_image_handle_[0], TRUE); DrawGraph(base_x + base_width - 12, base_y, *ime_image_handle_[1], TRUE); DrawGraph(base_x, base_y + base_height - 12, *ime_image_handle_[2], TRUE); DrawGraph(base_x + base_width - 12, base_y + base_height - 12, *ime_image_handle_[3], TRUE); DrawRectExtendGraphF(base_x + 12, base_y, base_x + base_width - 12, base_y + 12, 0, 0, 1, 12, *ime_image_handle_[1], TRUE); DrawRectExtendGraphF(base_x + 12, base_y + base_height - 12, base_x + base_width - 12, base_y + base_height, 0, 0, 1, 12, *ime_image_handle_[3], TRUE); DrawRectExtendGraphF(base_x, base_y + 12, base_x + 12, base_y + base_height - 12, 0, 0, 12, 1, *ime_image_handle_[2], TRUE); DrawRectExtendGraphF(base_x + base_width - 12, base_y + 12, base_x + base_width, base_y + base_height - 12, 0, 0, 12, 1, *ime_image_handle_[3], TRUE); DrawRectExtendGraphF(base_x + 12, base_y + 12, base_x + base_width - 12, base_y + base_height - 12, 0, 0, 1, 1, *ime_image_handle_[3], TRUE); } int line_top = 0; for (int i = start_index; i < end_index; i++) { if (i == selecting_candidate_) { SetDrawBlendMode(DX_BLENDMODE_ALPHA, 100); DrawBox(internal_x + x - 2, internal_y + line_top + y, internal_x + x + width + 2, internal_y + line_top + y + font_height_, GetColor(255, 0, 255), TRUE); SetDrawBlendMode(DX_BLENDMODE_NOBLEND, 0); } DrawStringToHandle(internal_x + x, internal_y + line_top + y, candidates_[i].c_str(), GetColor(0, 0, 0), font_handle_); line_top += font_height_; } } } }
void Input::ProcessInput(InputManager* input) { if (!input) { return; } // bool push_mouse_left = (input->GetMouseLeftCount() > 0); // bool first_key_shift = (input->GetKeyCount(KEY_INPUT_RSHIFT) == 1 // || input->GetKeyCount(KEY_INPUT_LSHIFT) == 1); bool push_key_shift = (input->GetKeyCount(KEY_INPUT_RSHIFT) > 0 || input->GetKeyCount(KEY_INPUT_LSHIFT) > 0); bool push_key_v = (input->GetKeyCount(KEY_INPUT_V) > 0); bool push_key_ctrl = (input->GetKeyCount(KEY_INPUT_LCONTROL) > 0 || input->GetKeyCount(KEY_INPUT_RCONTROL) > 0); bool push_key_return = (input->GetKeyCount(KEY_INPUT_RETURN) > 0); bool first_key_return = (input->GetKeyCount(KEY_INPUT_RETURN) == 1); bool push_repeat_key_return = (input->GetKeyCount(KEY_INPUT_RETURN) + KEY_REPEAT_FRAME) % (KEY_REPEAT_FRAME + 1) == 0; bool push_repeat_key_up = (input->GetKeyCount(KEY_INPUT_UP) + KEY_REPEAT_FRAME) % (KEY_REPEAT_FRAME + 1) == 0; bool push_repeat_key_down = (input->GetKeyCount(KEY_INPUT_DOWN) + KEY_REPEAT_FRAME) % (KEY_REPEAT_FRAME + 1) == 0; // bool push_long_backspace = (input->GetKeyCount(KEY_INPUT_BACK) > 60 * 1.5); auto input_text = text(); if (!active() && push_key_v && push_key_ctrl) { set_active(true); } else { if (push_key_shift && push_key_return) { SetActiveKeyInput(input_handle_); } else if (first_key_return) { if (CheckKeyInput(input_handle_) == 1) { if (on_enter_) { if (on_enter_(unicode::ToString(input_text))) { SetKeyInputString(_T(""), input_handle_); } } SetActiveKeyInput(input_handle_); } } } if (push_repeat_key_up) { cursor_moveto_y_ = cursor_y_ - font_height_ / 2; cursor_moveto_x_ = cursor_x_ + 2; } else if (push_repeat_key_down) { cursor_moveto_y_ = cursor_y_ + font_height_ + font_height_ / 2; cursor_moveto_x_ = cursor_x_ + 2; } if (push_key_shift && push_repeat_key_return && multiline_) { auto buffer = text(); uint32_t pos = GetKeyInputCursorPosition(input_handle_); tstring cursor_front_str = buffer.substr(0, pos); // カーソル前の文字列 tstring cursor_back_str = buffer.substr(pos); // カーソル後の文字列 auto new_string = cursor_front_str + _T('\n') + cursor_back_str; SetKeyInputString(new_string.c_str(), input_handle_); SetKeyInputCursorPosition(pos + 1, input_handle_); CancelSelect(); cursor_drag_count_ = 0; } int cursor_byte_pos, cursor_dot_pos; int draw_dot_pos = 0; TCHAR String[TEXT_BUFFER_SIZE]; GetKeyInputString(String, input_handle_); // 単一行設定の時、最初の行だけを表示 if (!multiline_) { tstring buffer(String, _tcslen(String)); size_t pos; if ((pos = buffer.find(_T('\n'))) != std::string::npos) { SetKeyInputString(buffer.substr(0, pos).c_str(), input_handle_); } } int internal_width = width_ - INPUT_MARGIN_X * 2; // int internal_height = height_ - INPUT_MARGIN * 2; message_lines_.clear(); if (message_.size() > 0) { int current_line = 0; tstring line_buffer; int line_width = 0; int char_count = 0; for (auto it = message_.begin(); it != message_.end(); ++it) { #ifdef UNICODE TCHAR c = *it; int width = GetDrawStringWidthToHandle(&c, 1, font_handle_); line_buffer += c; char_count++; #else unsigned char c = *it; TCHAR string[2] = { 0, 0 }; int width = 0; if ((c >= 0x81 && c <= 0x9f) || (c >= 0xe0 && c <= 0xfc)) { string[0] = c; string[1] = *(it + 1); ++it; width = GetDrawStringWidthToHandle(string, 2, font_handle_); line_buffer += string[0]; line_buffer += string[1]; char_count += 2; } else if (c == '\n') { char_count++; } else { string[0] = c; width = GetDrawStringWidthToHandle(string, 1, font_handle_); line_buffer += string[0]; char_count++; } #endif line_width += width; if (c == _T('\n') || line_width > internal_width - font_height_ / 2) { if (!line_buffer.empty() && line_buffer.back() == _T('\n')) { line_buffer.pop_back(); } message_lines_.push_back(line_buffer); current_line++; line_buffer.clear(); line_width = 0; } } message_lines_.push_back(line_buffer); } if (active()) { // カーソル位置(byte)を取得 cursor_byte_pos = GetKeyInputCursorPosition(input_handle_); if (prev_cursor_pos_ != cursor_byte_pos) { ResetCursorCount(); } prev_cursor_pos_ = cursor_byte_pos; // カーソルのドット単位の位置を取得する cursor_dot_pos = GetDrawStringWidthToHandle(String, cursor_byte_pos, font_handle_); draw_dot_pos += cursor_dot_pos; tstring cursor_front_str(String, cursor_byte_pos); // カーソル前の文字列 tstring cursor_back_str(String + cursor_byte_pos); // カーソル後の文字列 std::vector<tstring> clauses; // 入力中の文節 std::vector<tstring> candidates; // 変換候補 lines_.clear(); selecting_lines_.clear(); clause_lines_.clear(); selecting_clause_lines_.clear(); candidates_.clear(); // 文節データを取得 // int selecting_clause = -1; selecting_candidate_ = -1; IMEINPUTDATA *ImeData = GetIMEInputData(); if (ImeData && active()) { for (int i = 0; i < ImeData->ClauseNum; i++) { clauses.push_back( tstring( ImeData->InputString + ImeData->ClauseData[i].Position, ImeData->ClauseData[i].Length)); } selecting_clause_ = ImeData->SelectClause; if (ImeData->CandidateNum > 0) { for (int i = 0; i < ImeData->CandidateNum; i++) { candidates_.push_back( tstring(ImeData->CandidateList[i], _tcslen(ImeData->CandidateList[i]))); } selecting_candidate_ = ImeData->SelectCandidate; } } // 選択範囲を取得 int select_start, select_end; GetKeyInputSelectArea(&select_start, &select_end, input_handle_); if (select_start > select_end) { std::swap(select_start, select_end); } tstring line_buffer; int line_width = 0; int char_count = 0; // カーソル前のデータを描画 for (auto it = cursor_front_str.begin(); it != cursor_front_str.end(); ++it) { int prev_char_count = char_count; #ifdef UNICODE TCHAR c = *it; int width = GetDrawStringWidthToHandle(&c, 1, font_handle_); line_buffer += c; char_count++; #else unsigned char c = *it; TCHAR string[2] = { 0, 0 }; int width = 0; if ((c >= 0x81 && c <= 0x9f) || (c >= 0xe0 && c <= 0xfc)) { string[0] = c; string[1] = *(it + 1); ++it; width = GetDrawStringWidthToHandle(string, 2, font_handle_); line_buffer += string[0]; line_buffer += string[1]; char_count += 2; } else if (c == '\n') { char_count++; } else { string[0] = c; width = GetDrawStringWidthToHandle(string, 1, font_handle_); line_buffer += string[0]; char_count++; } #endif // 選択範囲を記録 if (select_start < char_count && char_count <= select_end) { selecting_lines_.resize(static_cast<int>(lines_.size() + message_lines_.size()) + 1, std::pair<int, int>(99999, 0)); selecting_lines_[static_cast<int>(lines_.size() + message_lines_.size())].first = std::min( selecting_lines_[static_cast<int>(lines_.size() + message_lines_.size())].first, line_width); selecting_lines_[static_cast<int>(lines_.size() + message_lines_.size())].second = std::max( selecting_lines_[static_cast<int>(lines_.size() + message_lines_.size())].second, line_width + std::max(width, 3)); } if (line_width - width / 2 <= cursor_moveto_x_ && cursor_moveto_x_ <= line_width + width && static_cast<int>(lines_.size() + message_lines_.size()) * font_height_ <= cursor_moveto_y_ && cursor_moveto_y_ <= (static_cast<int>(lines_.size() + message_lines_.size()) + 1) * font_height_) { SetKeyInputCursorPosition(prev_char_count, input_handle_); cursor_moveto_x_ = -1; cursor_moveto_y_ = -1; } line_width += width; if (c == _T('\n') || line_width > internal_width - font_height_ / 2) { if (!line_buffer.empty() && line_buffer.back() == _T('\n')) { line_buffer.pop_back(); } lines_.push_back(line_buffer); if (cursor_moveto_x_ >= line_width && static_cast<int>(lines_.size() + message_lines_.size()) * font_height_ <= cursor_moveto_y_ && cursor_moveto_y_ <= (static_cast<int>(lines_.size() + message_lines_.size()) + 1) * font_height_) { if (c == _T('\n')) { SetKeyInputCursorPosition(char_count - 1, input_handle_); } else { SetKeyInputCursorPosition(char_count, input_handle_); } cursor_moveto_x_ = -1; cursor_moveto_y_ = -1; } line_buffer.clear(); line_width = 0; } } cursor_x_ = line_width; cursor_y_ = static_cast<int>(lines_.size() + message_lines_.size()) * font_height_; // 変換中データを描画 for (uint32_t index = 0; index < clauses.size(); index++) { for (auto it = clauses[index].begin(); it != clauses[index].end(); ++it) { #ifdef UNICODE TCHAR c = *it; int width = GetDrawStringWidthToHandle(&c, 1, font_handle_); line_buffer += tstring(&c, 1); char_count++; #else unsigned char c = *it; TCHAR string[2] = { 0, 0 }; int width = 0; if ((c >= 0x81 && c <= 0x9f) || (c >= 0xe0 && c <= 0xfc)) { string[0] = c; string[1] = *(it + 1); ++it; width = GetDrawStringWidthToHandle(string, 2, font_handle_); line_buffer += string[0]; line_buffer += string[1]; char_count += 2; } else if (c == '\n') { char_count++; } else { string[0] = c; width = GetDrawStringWidthToHandle(string, 1, font_handle_); line_buffer += string[0]; char_count++; } #endif clause_lines_.resize(static_cast<int>(lines_.size() + message_lines_.size()) + 1, std::pair<int, int>(99999, 0)); clause_lines_[static_cast<int>(lines_.size() + message_lines_.size())].first = std::min( clause_lines_[static_cast<int>(lines_.size() + message_lines_.size())].first, line_width); clause_lines_[static_cast<int>(lines_.size() + message_lines_.size())].second = std::max( clause_lines_[static_cast<int>(lines_.size() + message_lines_.size())].second, line_width + width); if (index == static_cast<uint32_t>(selecting_clause_)) { selecting_clause_lines_.resize(static_cast<int>(lines_.size() + message_lines_.size()) + 1, std::pair<int, int>(99999, 0)); selecting_clause_lines_[static_cast<int>(lines_.size() + message_lines_.size())].first = std::min( selecting_clause_lines_[static_cast<int>(lines_.size() + message_lines_.size())].first, line_width); selecting_clause_lines_[static_cast<int>(lines_.size() + message_lines_.size())].second = std::max( selecting_clause_lines_[static_cast<int>(lines_.size() + message_lines_.size())].second, line_width + width); } line_width += width; if (line_width > internal_width - font_height_ / 2) { lines_.push_back(line_buffer); line_buffer.clear(); line_width = 0; } } } // カーソル後のデータを描画 for (auto it = cursor_back_str.begin(); it != cursor_back_str.end(); ++it) { int prev_char_count = char_count; #ifdef UNICODE TCHAR c = *it; int width = GetDrawStringWidthToHandle(&c, 1, font_handle_); line_buffer += tstring(&c, 1); #else unsigned char c = *it; TCHAR string[2] = { 0, 0 }; int width = 0; if ((c >= 0x81 && c <= 0x9f) || (c >= 0xe0 && c <= 0xfc)) { string[0] = c; string[1] = *(it + 1); ++it; width = GetDrawStringWidthToHandle(string, 2, font_handle_); line_buffer += string[0]; line_buffer += string[1]; char_count += 2; } else if (c == '\n') { char_count++; } else { string[0] = c; width = GetDrawStringWidthToHandle(string, 1, font_handle_); line_buffer += string[0]; char_count++; } #endif // 選択範囲を記録 if (select_start < char_count && char_count <= select_end) { selecting_lines_.resize(static_cast<int>(lines_.size() + message_lines_.size()) + 1, std::pair<int, int>(99999, 0)); selecting_lines_[static_cast<int>(lines_.size() + message_lines_.size())].first = std::min( selecting_lines_[static_cast<int>(lines_.size() + message_lines_.size())].first, line_width); selecting_lines_[static_cast<int>(lines_.size() + message_lines_.size())].second = std::max( selecting_lines_[static_cast<int>(lines_.size() + message_lines_.size())].second, line_width + std::max(width, 3)); } if (line_width - width / 2 <= cursor_moveto_x_ && cursor_moveto_x_ <= line_width + width && static_cast<int>(lines_.size() + message_lines_.size()) * font_height_ <= cursor_moveto_y_ && cursor_moveto_y_ <= (static_cast<int>(lines_.size() + message_lines_.size()) + 1) * font_height_) { SetKeyInputCursorPosition(prev_char_count, input_handle_); cursor_moveto_x_ = -1; cursor_moveto_y_ = -1; } line_width += width; if (c == _T('\n') || line_width > internal_width - font_height_ / 2) { if (!line_buffer.empty() && line_buffer.back() == _T('\n')) { line_buffer.pop_back(); } lines_.push_back(line_buffer); if (cursor_moveto_x_ >= line_width && static_cast<int>(lines_.size() + message_lines_.size()) * font_height_ <= cursor_moveto_y_ && cursor_moveto_y_ <= (static_cast<int>(lines_.size() + message_lines_.size()) + 1) * font_height_) { if (c == _T('\n')) { SetKeyInputCursorPosition(char_count - 1, input_handle_); } else { SetKeyInputCursorPosition(char_count, input_handle_); } cursor_moveto_x_ = -1; cursor_moveto_y_ = -1; } line_buffer.clear(); line_width = 0; } } // バッファの残りを描画 lines_.push_back(line_buffer); if (cursor_moveto_x_ >= line_width && static_cast<int>(lines_.size() + message_lines_.size()) * font_height_ <= cursor_moveto_y_ && static_cast<int>(cursor_moveto_y_) <= static_cast<int>(lines_.size() + message_lines_.size()) * font_height_) { SetKeyInputCursorPosition(char_count, input_handle_); cursor_moveto_x_ = -1; cursor_moveto_y_ = -1; } height_ = static_cast<int>(lines_.size() + message_lines_.size()) * font_height_ + INPUT_MARGIN_Y * 2; // height_ = max(height_, min_height_); line_buffer.clear(); line_width = 0; //if (push_key_shift && (push_repeat_key_up || push_repeat_key_down)) { // SetKeyInputSelectArea(GetKeyInputCursorPosition(input_handle_), // prev_cursor_pos_, input_handle_); //} } if (active()) { input->CancelKeyCountAll(); } }
int ChoiceTask::getTextWidth(const std::string& text, int fontHandle) { int length = text.length(); return GetDrawStringWidthToHandle(text.c_str(), text.length(), fontHandle); }
// ボタンの描画 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(); }
void Scene_DollUnite::DrawBonusCell( int _x, int _y, DATA_UNITEBONUS_ATTR_EACH _bonus, int _alpha) const{ TCHAR buf[16]; TCHAR buf2[16]; int width=0; switch(_bonus.type){ case UNITEBONUS_TYPE_NONE: strcpy_s(buf, 16-1, _T("ハズレ")); strcpy_s(buf2, 16-1, _T("")); break; case UNITEBONUS_TYPE_HP: strcpy_s(buf, 16-1, _T("HPLv")); wsprintf(buf2, _T("+%d"), _bonus.value); break; case UNITEBONUS_TYPE_ATK: strcpy_s(buf, 16-1, _T("攻撃Lv")); wsprintf(buf2, _T("+%d"), _bonus.value); break; case UNITEBONUS_TYPE_SPD: strcpy_s(buf, 16-1, _T("敏捷Lv")); wsprintf(buf2, _T("+%d"), _bonus.value); break; case UNITEBONUS_TYPE_MGC: strcpy_s(buf, 16-1, _T("魔力Lv")); wsprintf(buf2, _T("+%d"), _bonus.value); break; case UNITEBONUS_TYPE_TEC: strcpy_s(buf, 16-1, _T("技巧Lv")); wsprintf(buf2, _T("+%d"), _bonus.value); break; case UNITEBONUS_TYPE_SKILLNUM: strcpy_s(buf, 16-1, _T("スキル数")); wsprintf(buf2, _T("+%d"), _bonus.value); break; case UNITEBONUS_TYPE_UNLOCK: strcpy_s(buf, 16-1, _T("制限解除")); wsprintf(buf2, _T("+%d"), _bonus.value); break; case UNITEBONUS_TYPE_SKILLKEY: strcpy_s(buf, 16-1, _T("")); strcpy_s(buf2, 16-1, _T("")); break; case UNITEBONUS_TYPE_SKILLLEVEL: strcpy_s(buf, 16-1, _T("スキルP")); wsprintf(buf2, _T("+%dP"), _bonus.value); break; } // 透明度の調整 SetDrawBlendMode(DX_BLENDMODE_ALPHA, _alpha); // ボックスの描画 DrawBox( _x, _y, _x + UNITEBONUS_CELL_WIDTH, _y + UNITEBONUS_CELL_HEIGHT, GetColor(96,96,96), 1); DrawBox( _x, _y, _x + UNITEBONUS_CELL_WIDTH, _y + UNITEBONUS_CELL_HEIGHT, GetColor(32,32,32), 0); // 文字の描画 if(_bonus.type != UNITEBONUS_TYPE_SKILLKEY){ width = GetDrawStringWidthToHandle(buf, strlen(buf), g_font.hTinyInfo); DrawStringToHandle( _x + UNITEBONUS_CELL_WIDTH/2 - width/2, _y + 4, buf, GetColor(255,255,255), g_font.hTinyInfo); width = GetDrawStringWidthToHandle(buf2, strlen(buf2), g_font.hTinyInfo); DrawStringToHandle( _x + UNITEBONUS_CELL_WIDTH/2 - width/2, _y + 21, buf2, GetColor(255,255,255), g_font.hTinyInfo); }else{ // 鍵の描画 DrawGraph( _x + 26, _y + 8, g_image.icon.skillKey[_bonus.value], 1); } // 透明度を戻す SetDrawBlendMode(DX_BLENDMODE_NOBLEND, 255); }
void Scene_TestDangeon::Draw() const{ TCHAR buf[64]; // 背景の描画 int tmpX = backX-BACKTILE_SIZE; int tmpY = backY-BACKTILE_SIZE; while(tmpY < WND_HEIGHT){ while(tmpX < WND_WIDTH){ DrawGraph(tmpX, tmpY, g_image.icon.tile, 0); tmpX += BACKTILE_SIZE; } tmpY += BACKTILE_SIZE; tmpX = backX - BACKTILE_SIZE; } TCHAR menuTitle[MAX_TESTDANGEON_MENU][128] = { _T("出発する"), _T("パーティの編成"), _T("ステータス・装備"), _T("アイテム"), _T("人形の合成"), _T("休憩する"), _T("セーブ"), _T("リセット"), _T("BGM音量"), _T("SE音量"), _T("オートセーブ"), _T("ゲームを終了する"), #ifdef MYGAME_USE_DEBUGTOOLS _T("デバッグメニュー"), #endif // MYGAME_USE_DEBUGTOOLS }; TCHAR debugMenuTitle[MAX_TESTDANGEON_DEBUGMENU][128] = { _T("全回復"), _T("チュートリアルクリア状態にする"), _T("ステージ1クリア状態にする"), _T("ステージ2クリア状態にする"), _T("ステージ3クリア状態にする"), _T("ステージ4クリア状態にする"), _T("ステージ5クリア状態にする"), _T("ステージ6クリア状態にする"), _T("人形の作成"), _T("戻る"), }; TCHAR menuAcc[MAX_TESTDANGEON_MENU][128] = { _T("ステージを選択して出発します。"), _T("パーティ編成をします。"), _T("メンバーのステータス確認・装備変更をします。"), _T("アイテムを確認・使用します。"), _T("2体の人形を合成して新しい人形を作成します。"), _T("少しの時間休んで、TPとMPを少し回復します。"), _T("セーブします。(ロードは自動で行われます)"), _T("ゲームデータをリセットします。"), _T("BGMの音量を変更します。(左右キー)"), _T("SEの音量を変更します。(左右キー)"), _T("オートセーブの設定をします。(左右キー)"), _T("ゲームを終了します。"), #ifdef MYGAME_USE_DEBUGTOOLS _T("デバッグメニューを開きます"), #endif // MYGAME_USE_DEBUGTOOLS }; TCHAR debugMenuAcc[MAX_TESTDANGEON_DEBUGMENU][128] = { _T("TPとMPを全回復します。"), _T("チュートリアルをクリアしたような感じにします。"), _T("ステージ1をクリアしたような感じにします。"), _T("ステージ2をクリアしたような感じにします。"), _T("ステージ3をクリアしたような感じにします。"), _T("ステージ4をクリアしたような感じにします。"), _T("ステージ5をクリアしたような感じにします。"), _T("ステージ6をクリアしたような感じにします。"), _T("新しい人形を生み出します。"), _T("メインメニューに戻ります。"), }; TCHAR menuAcc_noDoll[128] = _T("戦闘メンバーを設定して下さい。"); TCHAR stageTitle[MAX_TESTDANGEON_STAGE+1][128] = { _T("チュートリアル1 ダンジョンに行こう"), _T("チュートリアル2 仲間を増やそう"), _T("チュートリアル3 力を合わせよう"), _T("Stage1 はじまりの森"), _T("Stage2 木々を抜けて"), _T("Stage3 立ちふさがる者"), _T("Stage4 古き森の守護者"), _T("Stage5 迷いの森の中で"), _T("Stage6 妖精小戦争"), _T("やめる"), }; // 背景の枠の描画 DrawBox(90, 45, 580, 515, GetColor(127, 191, 159), 1); DrawBox(50, 30, 540, 500, GetColor(223, 239, 232), 1); // 人形の描画 WORD dollType=0, dollFace=0, dollAttr=0; int hDollImage = -1; int tmp = backDoll; if(state != SCNSTATE_TESTDANGEON_CHOOSEMAP){ if(tmp != -1){ dollType = tmp/(DOLL_FACE_NUM*DOLL_ATTR_NUM); tmp -= dollType*DOLL_FACE_NUM*DOLL_ATTR_NUM; dollFace = tmp/DOLL_ATTR_NUM; tmp -= dollFace*DOLL_ATTR_NUM; dollAttr = tmp; hDollImage = g_image.GetDollIconHandle( dollType*DOLL_TYPE_PER_GROUP, dollFace, dollAttr); } if(hDollImage != -1){ DrawRotaGraphF( 630, 400+20*sin(2.0*M_PI*(sceneTime-90)/720), 1.0, 0, hDollImage, 1); } }else{ DrawComment(); } // 文字の描画 int color; switch(state){ case SCNSTATE_TESTDANGEON_MAINMENU: case SCNSTATE_TESTDANGEON_BDOLLMANAGE: case SCNSTATE_TESTDANGEON_ITEMMANAGE: case SCNSTATE_TESTDANGEON_RESET_YESNO: case SCNSTATE_TESTDANGEON_CHECK_MAPRESULT: for(int n=0; n<MAX_TESTDANGEON_MENU; n++){ if(s_main.index == n){ color = TESTDANGEON_SELECTEDCOLOR; }else if(s_main.isActive[n]){ color = TESTDANGEON_UNSELECTEDCOLOR; }else{ color = TESTDANGEON_DISABLEDCOLOR; } DrawStringToHandle(80+3, 50+30*n+3, menuTitle[n], color, g_font.hInfo); } // BGMのボリューム表示 TCHAR buf[16]; wsprintf(buf, _T("%3d"), (int)g_cfg.BGM); DrawStringToHandle( 200+120+3, 50+30*TESTDANGEON_MENU_BGM+3, buf, TESTDANGEON_SELECTEDCOLOR, g_font.hInfo); // SEのボリューム表示 wsprintf(buf, _T("%3d"), (int)g_cfg.SE); DrawStringToHandle( 200+120+3, 50+30*TESTDANGEON_MENU_SE+3, buf, TESTDANGEON_SELECTEDCOLOR, g_font.hInfo); // SEのオートセーブのON/OFF表示 DrawStringToHandle( 200+120+3, 50+30*TESTDANGEON_MENU_AUTOSAVE+3, r_aliceInfo.GetAutoSave() ? _T("ON") : _T("OFF"), TESTDANGEON_SELECTEDCOLOR, g_font.hInfo); /* // 回復しました。の文字 if(healedCount > 0 && healedCount < TESTDANGEON_HEALED_TIME){ SetDrawBlendMode(DX_BLENDMODE_ALPHA, min(255, min(32*healedCount, 12*(TESTDANGEON_SAVED_TIME-healedCount)))); DrawStringToHandle( 200+100+3, 50+30*TESTDANGEON_MENU_HEALALL+3, _T("回復しました。"), TESTDANGEON_SELECTEDCOLOR, g_font.hInfo); }*/ // セーブしました。の文字 if(savedCount > 0 && savedCount < TESTDANGEON_SAVED_TIME){ SetDrawBlendMode(DX_BLENDMODE_ALPHA, min(255, min(32*savedCount, 12*(TESTDANGEON_SAVED_TIME-savedCount)))); DrawStringToHandle( 200+100+3, 50+30*TESTDANGEON_MENU_SAVE+3, _T("セーブしました。"), TESTDANGEON_SELECTEDCOLOR, g_font.hInfo); } SetDrawBlendMode(DX_BLENDMODE_ALPHA, 255); break; case SCNSTATE_TESTDANGEON_CHOOSEMAP: for(int n=0; n<MAX_TESTDANGEON_STAGE+1; n++){ if(s_sub.index == n){ color = TESTDANGEON_SELECTEDCOLOR; }else{ color = TESTDANGEON_UNSELECTEDCOLOR; } if(n >= MAX_TESTDANGEON_STAGE){ DrawStringToHandle(80+3, 50+30*n+3, stageTitle[n], color, g_font.hInfo); }else if(s_sub.isActive[n]){ DrawStringToHandle(80+3, 50+30*n+3, stageTitle[n], color, g_font.hInfo); } } break; case SCNSTATE_TESTDANGEON_CHOOSEDEBUG: for(int n=0; n<MAX_TESTDANGEON_DEBUGMENU; n++){ if(s_debug.index == n){ color = TESTDANGEON_SELECTEDCOLOR; }else{ color = TESTDANGEON_UNSELECTEDCOLOR; } if(n >= MAX_TESTDANGEON_STAGE){ DrawStringToHandle(80+3, 50+30*n+3, debugMenuTitle[n], color, g_font.hInfo); }else if(s_debug.isActive[n]){ DrawStringToHandle(80+3, 50+30*n+3, debugMenuTitle[n], color, g_font.hInfo); } } break; } // 説明の描画 int width = 0; switch(state){ case SCNSTATE_TESTDANGEON_MAINMENU: if(!s_main.isActive[TESTDANGEON_MENU_DANGEON] && s_main.index == 1){ // 例外的なメッセージ表示 width = GetDrawStringWidthToHandle(menuAcc_noDoll, strlen(menuAcc_noDoll), g_font.hInfo); DrawStringToHandle((WND_WIDTH-width)/2, WND_HEIGHT-FONTSIZE_INFO-10, menuAcc_noDoll, GetColor(0, 0, 0), g_font.hInfo); }else{ width = GetDrawStringWidthToHandle(menuAcc[s_main.index], strlen(menuAcc[s_main.index]), g_font.hInfo); DrawStringToHandle((WND_WIDTH-width)/2, WND_HEIGHT-FONTSIZE_INFO-10, menuAcc[s_main.index], GetColor(0, 0, 0), g_font.hInfo); } break; case SCNSTATE_TESTDANGEON_CHOOSEDEBUG: width = GetDrawStringWidthToHandle(debugMenuAcc[s_debug.index], strlen(debugMenuAcc[s_debug.index]), g_font.hInfo); DrawStringToHandle((WND_WIDTH-width)/2, WND_HEIGHT-FONTSIZE_INFO-10, debugMenuAcc[s_debug.index], GetColor(0, 0, 0), g_font.hInfo); break; } // アリスの挑戦回数 /* wsprintf(buf, _T("挑戦回数:%d回"), (int)r_aliceInfo.GetTryNum()); DrawStringToHandle( 10, 10, buf, GetColor(32, 32, 32), g_font.hInfo); */ /* // 説明ウィンドウ表示する/しないの表示 DrawStringToHandle(360-((s_main.index==11)?4:0)+3, 50+30*11+3, g_trialAliceFile.data.tutorialHint ? _T("毎回表示") : _T("初回のみ"), TESTDANGEON_SHADOWCOLOR, (s_main.index == 11) ? TESTDANGEON_SHADOWCOLOR2 : TESTDANGEON_SHADOWCOLOR, g_font.hInfo); DrawStringToHandle(360-((s_main.index==11)?4:0), 50+30*11, g_trialAliceFile.data.tutorialHint ? _T("毎回表示") : _T("初回のみ"), (s_main.index == 11) ? TESTDANGEON_SELECTEDCOLOR : TESTDANGEON_UNSELECTEDCOLOR, g_font.hInfo); */ // ウィンドウの描画 if(!w_hint.GetClosed()){ SetDrawBlendMode(DX_BLENDMODE_ALPHA, 128); DrawBox(0, 0, WND_WIDTH, WND_HEIGHT, GetColor(0, 0, 0), 1); SetDrawBlendMode(DX_BLENDMODE_NOBLEND, 255); } /* if(w_hint.GetState() == Window_Base::CLOSING){ g_trialAliceFile.data.firstHint = true; } */ w_bDollManage.Draw(); // アイテムウィンドウと小ウィンドウ w_itemManage.Draw(); (w_itemManage.GetNoticeWindowPtr())->Draw(); (w_itemManage.GetDollNoticeWindowPtr())->Draw(); w_hint.Draw(); w_yesno.Draw(); DrawTimeAndMP(r_aliceInfo.GetTime(), r_aliceInfo.GetMP(), 0, 0); // DrawGraph(0, 0, g_image.icon.skillKey[0], 1); // シーン切り替えのフェードの描画 DrawReserveFade(); }
void Game_List_Each::DrawRightContent(int hFont, int _color, int _x, int _y, int _w) const{ int w = GetDrawStringWidthToHandle(rightStr, strlen(rightStr), hFont); DrawStringToHandle(_x+_w-w, _y, rightStr, _color, hFont); }
void BWindow_ChooseFront::DrawContent() const{ if(!GetActive()) return; // 人形を選択して下さい。を描画する TCHAR title[64] = _T("戦闘に参加させる人形を選んで下さい。"); TCHAR info_big[64] = _T("情報キー:小さいウィンドウ"); TCHAR info_small[64] = _T("表示変更:人形の詳細表示"); TCHAR confirm[16] = _T("決定"); int width; width = GetDrawStringWidthToHandle(title, strlen(title), g_font.hStrS); DrawStringToHandle( frameArea.x + (frameArea.w - width)/2, frameArea.y + contentArea.y, title, GetPresetColor(presetColorIndex, COLORSET_COLOR_NORMAL), g_font.hStrS); // 情報の表示 width = GetDrawStringWidthToHandle((isFullWindow?info_big:info_small), strlen((isFullWindow?info_big:info_small)), g_font.hTinyInfo); DrawStringToHandle( frameArea.x + contentArea.x + contentArea.w - width, frameArea.y + contentArea.h - FONTSIZE_TINYINFO, (isFullWindow?info_big:info_small), GetPresetColor(presetColorIndex, COLORSET_COLOR_NORMAL), g_font.hTinyInfo); // 人形を描画する。 const Game_CampDoll* pDoll = NULL; for(int n=0; n<MAX_BATTLEDOLL; n++){ if(!pScene->GetDollIsUsed(n)) continue; pDoll = g_dollList.GetBattleDollPtrByIndex(n); if(pDoll == NULL) return; if(!pDoll->Enabled()) continue; pDoll->DrawAsIcon(GetDollDrawX(n), GetDollDrawY(n), GetPresetColor(presetColorIndex, COLORSET_COLOR_NORMAL), CAMPDOLL_GAUGE_TYPE_HP_AND_TP); } // カーソルを描画する。 WINDOWAREA area; if(!cursorIsConfirm){ pSkin->DrawFocusRect( GetDollDrawX(s_main.index)-60, GetDollDrawY(s_main.index)-48, 120, 108, activeCount); } // 既に選択されている人形を描画する。 int color=0; for(int n=0; n<NUM_BATTLEDOLL_FRONT; n++){ if(selectedIndex[n] != -1){ /* switch(n){ case 0: color = GetColor(255, 0, 0); break; case 1: color = GetColor(0, 255, 0); break; case 2: color = GetColor(0, 0, 255); break; } DrawBox( GetDollDrawX(selectedIndex[n])-60, GetDollDrawY(selectedIndex[n])-48, GetDollDrawX(selectedIndex[n])-50, GetDollDrawY(selectedIndex[n])-38, color, 1); */ DrawGraph( GetDollDrawX(selectedIndex[n])-60, GetDollDrawY(selectedIndex[n])-48, g_image.icon.state[9], 1); } } // 人形の情報を描画する if(!cursorIsConfirm && isFullWindow){ pDoll = g_dollList.GetBattleDollPtrByIndex(s_main.index); if(pDoll != NULL){ pDoll->DrawStatus( frameArea.x + 290, frameArea.y+contentArea.y + 28, 212, false, presetColorIndex); } } // 「決定」の描画 width = GetDrawStringWidthToHandle(confirm, strlen(confirm), g_font.hInfo); DrawStringToHandle( frameArea.x + (frameArea.w - width)/2 - (isFullWindow ? 130 : 0), frameArea.y + contentArea.h - FONTSIZE_INFO, confirm, GetPresetColor(presetColorIndex, canConfirm ? COLORSET_COLOR_NORMAL : COLORSET_COLOR_INACTIVE), g_font.hInfo); // 決定にカーソルを合わせる if(cursorIsConfirm){ pSkin->DrawFocusRect( frameArea.x + (frameArea.w - width)/2 - FONTSIZE_INFO - (isFullWindow ? 130 : 0), frameArea.y + contentArea.h - FONTSIZE_INFO, width+FONTSIZE_INFO*2, FONTSIZE_INFO, activeCount, false); } }
void Select::Draw(int t){ if (pad1.PadGet(B_1) == 1){ } SetDrawBlendMode(DX_BLENDMODE_ALPHA, 100); //DrawBox(SYOKI_X - 40, 80 - 50, PLAYER_X + 60, SYOKI_Y + SELECT_INTERVAL * 4, BLACK, TRUE); DrawBox(0,0, Sx, Sy, BLACK, TRUE); //DrawBox(PLAYER_X - 40, 80 - 50, , 80 + SELECT_INTERVAL * 4, BLACK, TRUE); if (t > 255)t = 255; SetDrawBlendMode(DX_BLENDMODE_ALPHA, t); //セレクト画面の文字の描画 int w = GetDrawStringWidthToHandle("GAME START", 10, Font2); DrawFormatStringFToHandle(SYOKI_X + 10, SYOKI_Y - 10, WHITE, Font2, "PLAYER: %d", player_n); DrawFormatStringFToHandle(SYOKI_X + 10, SYOKI_Y - 10 + SELECT_INTERVAL, WHITE, Font2, "COUNT: %d", count_max); DrawFormatStringFToHandle(SYOKI_X + 10, SYOKI_Y - 10 + SELECT_INTERVAL*2, WHITE, Font2, "ROUND: %d", round_n); DrawFormatStringFToHandle(320 - w /2, SYOKI_Y - 10 + SELECT_INTERVAL * 4 + 50, WHITE, Font2, "GAME START", round_n); //DrawFormatStringFToHandle(SYOKI_X + 180, SYOKI_Y - 10 + SELECT_INTERVAL * 4 + 50, WHITE, Font1, "BACK", round_n); switch (state) { case PLAYER_NUMBER: DrawBox(x - ICON_SIZE / 2 - 5, y - ICON_SIZE / 2 + 5, x + ICON_SIZE / 2 - 10 + 5, y + ICON_SIZE / 2 + 5, BLACK, TRUE); DrawBox(x - ICON_SIZE / 2 - 10, y - ICON_SIZE / 2, x + ICON_SIZE / 2 - 10, y + ICON_SIZE / 2, RED, TRUE); DrawFormatStringFToHandle(SETUMEI_X , SETUMEI_Y, WHITE, CountFont, "プレイヤー数を"); DrawFormatStringFToHandle(SETUMEI_X, SETUMEI_Y + 32, WHITE, CountFont, "設定します。2"); DrawFormatStringFToHandle(SETUMEI_X, SETUMEI_Y + 32*2, WHITE, CountFont, "〜4人まで選ぶ"); DrawFormatStringFToHandle(SETUMEI_X, SETUMEI_Y + 32*3, WHITE, CountFont, "ことができます"); break; case COUNT_MAX: DrawBox(x - ICON_SIZE / 2 - 5, y - ICON_SIZE / 2 + 5, x + ICON_SIZE / 2 - 10 + 5, y + ICON_SIZE / 2 + 5, BLACK, TRUE); DrawBox(x - ICON_SIZE / 2 - 10, y - ICON_SIZE / 2, x + ICON_SIZE / 2 - 10, y + ICON_SIZE / 2, RED, TRUE); DrawFormatStringFToHandle(SETUMEI_X, SETUMEI_Y, WHITE, CountFont, "パネルのカウン"); DrawFormatStringFToHandle(SETUMEI_X, SETUMEI_Y + 32, WHITE, CountFont, "ト数を設定しま"); DrawFormatStringFToHandle(SETUMEI_X, SETUMEI_Y + 32 * 2, WHITE, CountFont, "す。値が小さい"); DrawFormatStringFToHandle(SETUMEI_X, SETUMEI_Y + 32 * 3, WHITE, CountFont, "ほど短期決戦に"); DrawFormatStringFToHandle(SETUMEI_X, SETUMEI_Y + 32 * 4, WHITE, CountFont, "なりやすくなり"); DrawFormatStringFToHandle(SETUMEI_X, SETUMEI_Y + 32 * 5, WHITE, CountFont, "ます。"); break; case ROUND: DrawBox(x - ICON_SIZE / 2 - 5, y - ICON_SIZE / 2 + 5 , x + ICON_SIZE / 2 - 10 + 5, y + ICON_SIZE / 2 + 5, BLACK, TRUE); DrawBox(x - ICON_SIZE / 2 -10, y - ICON_SIZE / 2 , x + ICON_SIZE / 2 -10, y + ICON_SIZE / 2, RED, TRUE); DrawFormatStringFToHandle(SETUMEI_X, SETUMEI_Y, WHITE, CountFont, "ラウンド数を設"); DrawFormatStringFToHandle(SETUMEI_X, SETUMEI_Y + 32, WHITE, CountFont, "定します。値が"); DrawFormatStringFToHandle(SETUMEI_X, SETUMEI_Y + 32 * 2, WHITE, CountFont, "小さいほどすぐ"); DrawFormatStringFToHandle(SETUMEI_X, SETUMEI_Y + 32 * 3, WHITE, CountFont, "に終わります。"); break; case NEXT: DrawFormatStringFToHandle(320 - w / 2 - 2, SYOKI_Y - 10 + SELECT_INTERVAL * 4 - 1 + 50, BLACK, Font2, "GAME START", round_n); DrawFormatStringFToHandle(SETUMEI_X, SETUMEI_Y, WHITE, CountFont, "ゲームを始めま"); DrawFormatStringFToHandle(SETUMEI_X, SETUMEI_Y + 32, WHITE, CountFont, "す。ボタンを押"); DrawFormatStringFToHandle(SETUMEI_X, SETUMEI_Y + 32 * 2, WHITE, CountFont, "してください。"); break; case BACK: DrawFormatStringFToHandle(SYOKI_X + 180 - 2, SYOKI_Y - 10 + SELECT_INTERVAL * 4 - 1 + 50, BLACK, Font1, "BACK", round_n); break; default: break; } switch (player_n) { case 0: case 1: DrawFormatStringFToHandle(PLAYER_X - PLAYER_SIZE_SELECT / 2, PLAYER_Y - PLAYER_SIZE_SELECT * 2, WHITE, CountFont, "1P"); DrawBox(PLAYER_X - PLAYER_SIZE_SELECT / 2, PLAYER_Y- PLAYER_SIZE_SELECT / 2, PLAYER_X+ PLAYER_SIZE_SELECT / 2, PLAYER_Y+ PLAYER_SIZE_SELECT / 2, RED, TRUE); break; case 2: DrawFormatStringFToHandle(PLAYER_X - PLAYER_SIZE_SELECT / 2, PLAYER_Y - PLAYER_SIZE_SELECT * 2, WHITE, CountFont, "1P"); DrawBox(PLAYER_X - PLAYER_SIZE_SELECT / 2, PLAYER_Y - PLAYER_SIZE_SELECT / 2 , PLAYER_X + PLAYER_SIZE_SELECT / 2, PLAYER_Y + PLAYER_SIZE_SELECT / 2 , RED, TRUE); DrawFormatStringFToHandle(PLAYER_X - PLAYER_SIZE_SELECT / 2, PLAYER_Y - PLAYER_SIZE_SELECT * 2 + 60, WHITE, CountFont, "2P"); DrawBox(PLAYER_X - PLAYER_SIZE_SELECT / 2, PLAYER_Y - PLAYER_SIZE_SELECT / 2 + 60, PLAYER_X + PLAYER_SIZE_SELECT / 2, PLAYER_Y + PLAYER_SIZE_SELECT / 2 + 60, BLUE, TRUE); break; case 3: DrawFormatStringFToHandle(PLAYER_X - PLAYER_SIZE_SELECT / 2, PLAYER_Y - PLAYER_SIZE_SELECT * 2, WHITE, CountFont, "1P"); DrawBox(PLAYER_X - PLAYER_SIZE_SELECT / 2, PLAYER_Y - PLAYER_SIZE_SELECT / 2, PLAYER_X + PLAYER_SIZE_SELECT / 2, PLAYER_Y + PLAYER_SIZE_SELECT / 2, RED, TRUE); DrawFormatStringFToHandle(PLAYER_X - PLAYER_SIZE_SELECT / 2, PLAYER_Y - PLAYER_SIZE_SELECT * 2 + 60, WHITE, CountFont, "2P"); DrawBox(PLAYER_X - PLAYER_SIZE_SELECT / 2, PLAYER_Y - PLAYER_SIZE_SELECT / 2 + 60, PLAYER_X + PLAYER_SIZE_SELECT / 2, PLAYER_Y + PLAYER_SIZE_SELECT / 2 + 60, BLUE, TRUE); DrawFormatStringFToHandle(PLAYER_X - PLAYER_SIZE_SELECT / 2, PLAYER_Y - PLAYER_SIZE_SELECT * 2 + 60 * 2, WHITE, CountFont, "3P"); DrawBox(PLAYER_X - PLAYER_SIZE_SELECT / 2, PLAYER_Y - PLAYER_SIZE_SELECT / 2 + 60 * 2, PLAYER_X + PLAYER_SIZE_SELECT / 2, PLAYER_Y + PLAYER_SIZE_SELECT / 2 + 60 * 2, GREEN, TRUE); break; case 4: DrawFormatStringFToHandle(PLAYER_X - PLAYER_SIZE_SELECT / 2, PLAYER_Y - PLAYER_SIZE_SELECT * 2, WHITE, CountFont, "1P"); DrawBox(PLAYER_X - PLAYER_SIZE_SELECT / 2, PLAYER_Y - PLAYER_SIZE_SELECT / 2, PLAYER_X + PLAYER_SIZE_SELECT / 2, PLAYER_Y + PLAYER_SIZE_SELECT / 2, RED, TRUE); DrawFormatStringFToHandle(PLAYER_X - PLAYER_SIZE_SELECT / 2, PLAYER_Y - PLAYER_SIZE_SELECT * 2 + 60, WHITE, CountFont, "2P"); DrawBox(PLAYER_X - PLAYER_SIZE_SELECT / 2, PLAYER_Y - PLAYER_SIZE_SELECT / 2 + 60, PLAYER_X + PLAYER_SIZE_SELECT / 2, PLAYER_Y + PLAYER_SIZE_SELECT / 2 + 60, BLUE, TRUE); DrawFormatStringFToHandle(PLAYER_X - PLAYER_SIZE_SELECT / 2, PLAYER_Y - PLAYER_SIZE_SELECT * 2 + 60 * 2, WHITE, CountFont, "3P"); DrawBox(PLAYER_X - PLAYER_SIZE_SELECT / 2, PLAYER_Y - PLAYER_SIZE_SELECT / 2 + 60 * 2, PLAYER_X + PLAYER_SIZE_SELECT / 2, PLAYER_Y + PLAYER_SIZE_SELECT / 2 + 60 * 2, GREEN, TRUE); DrawFormatStringFToHandle(PLAYER_X - PLAYER_SIZE_SELECT / 2, PLAYER_Y - PLAYER_SIZE_SELECT * 2 + 60 * 3, WHITE, CountFont, "4P"); DrawBox(PLAYER_X- PLAYER_SIZE_SELECT / 2, PLAYER_Y- PLAYER_SIZE_SELECT / 2 + 60 * 3, PLAYER_X+ PLAYER_SIZE_SELECT / 2, PLAYER_Y+ PLAYER_SIZE_SELECT / 2 + 60 * 3, PURPLE, TRUE); break; default: break; } }