Revisión | 2d4e5f0f6e9747322065178e3f63c18f37c50514 (tree) |
---|---|
Tiempo | 2012-10-30 12:52:19 |
Autor | h2so5 <h2so5@git....> |
Commiter | h2so5 |
マップ上でのワープポイント位置表示
ワープ先の座標指定機能
@@ -1,4 +1,4 @@ | ||
1 | -Miku Miku Online 0.4.0 | |
1 | +Miku Miku Online 0.4.1 | |
2 | 2 | |
3 | 3 | // ******************************** 警告 *********************************** // |
4 | 4 | // *** |
@@ -205,7 +205,7 @@ void MiniMap::DrawPosAndCalc() | ||
205 | 205 | if(current_channel){ |
206 | 206 | BOOST_FOREACH(auto it,current_channel->warp_points) |
207 | 207 | { |
208 | - direction = VSub(VGet(it.x,it.y,it.z),myself_pos); | |
208 | + direction = VSub(it.position, myself_pos); | |
209 | 209 | direction.y = 0; |
210 | 210 | theta = atan2( -direction.x, -direction.z); |
211 | 211 | tmp_pos_x = ( sin(mtheta + TORADIAN(180.0f) - theta) * VSize(direction) * ( 1.0f / world_manager->stage()->map_scale()) )/ 3.0f + absolute_x() + absolute_width()/2; |
@@ -8,7 +8,7 @@ | ||
8 | 8 | |
9 | 9 | const size_t Input::TEXT_BUFFER_SIZE = 1024; |
10 | 10 | const size_t Input::HISTORY_MAX_SIZE = 50; |
11 | -const int Input::KEY_REPEAT_FRAME = 8; | |
11 | +const int Input::KEY_REPEAT_FRAME = 6; | |
12 | 12 | |
13 | 13 | const int Input::INPUT_MARGIN_X = 8; |
14 | 14 | const int Input::INPUT_MARGIN_Y = 6; |
@@ -19,12 +19,9 @@ const int Input::IME_MARGIN_Y = 16; | ||
19 | 19 | const int Input::IME_MAX_PAGE_SIZE = 6; |
20 | 20 | const int Input::IME_MIN_WIDTH = 120; |
21 | 21 | |
22 | -Input::Input(ConfigManagerPtr config_manager) : | |
22 | +Input::Input() : | |
23 | 23 | multiline_(true), |
24 | - reverse_color_(false), | |
25 | - drag_flag_(false), | |
26 | - rightmenu_show_(false), | |
27 | - config_manager_(config_manager) | |
24 | + reverse_color_(false) | |
28 | 25 | { |
29 | 26 | input_bg_image_handle_ = ResourceManager::LoadCachedDivGraph<4>( |
30 | 27 | _T("system/images/gui/gui_inputbox_input_bg.png"), 2, 2, 12, 12); |
@@ -48,114 +45,6 @@ Input::Input(ConfigManagerPtr config_manager) : | ||
48 | 45 | y_ = 100; |
49 | 46 | width_ = 160; |
50 | 47 | height_ = font_height_ + 4; |
51 | - | |
52 | - click_cancel_count_ = 0; | |
53 | - | |
54 | -} | |
55 | - | |
56 | -void Input::Init() | |
57 | -{ | |
58 | - auto shd_right_click_list_ = std::make_shared<UIList>(right_click_list_); | |
59 | - right_click_list_.addItem(UIBasePtr(new UILabel([&]()->UILabel{ | |
60 | - UILabel label; | |
61 | - label.set_parent_c(shd_right_click_list_); | |
62 | - label.set_input_adaptor(this); | |
63 | - label.set_text(unicode::ToTString(unicode::sjis2utf8("切り取り"))); | |
64 | - label.set_width(120); | |
65 | - label.set_top(12); | |
66 | - label.set_left(0); | |
67 | - label.set_textcolor(UISuper::Color(0,0,0,255)); | |
68 | - label.set_bgcolor(UISuper::Color(255,255,255,180)); | |
69 | - label.set_on_click_function_([](UIBase* ptr)->void{ | |
70 | - auto input_ = ptr->input_adpator(); | |
71 | - auto sel_txt = input_->selecting_text(); | |
72 | - SetClipboardText(sel_txt.c_str()); | |
73 | - auto text = input_->text(); | |
74 | - auto pos = text.find(sel_txt); | |
75 | - tstring res; | |
76 | - if( pos != std::string::npos ) | |
77 | - { | |
78 | - res = text.substr(0,pos); | |
79 | - res += text.substr(pos + sel_txt.size(),text.size() - pos + sel_txt.size()); | |
80 | - } | |
81 | - input_->set_text(res); | |
82 | - input_->set_click_chancel_count(8); | |
83 | - }); | |
84 | - label.set_on_hover_function_([](UIBase* ptr)->void{ | |
85 | - auto label_ptr = (UILabel *)ptr; | |
86 | - label_ptr->set_bgcolor(UISuper::Color(0,0,0,180)); | |
87 | - label_ptr->set_textcolor(UISuper::Color(255,255,255)); | |
88 | - }); | |
89 | - label.set_on_out_function_([](UIBase* ptr)->void{ | |
90 | - auto label_ptr = (UILabel *)ptr; | |
91 | - label_ptr->set_bgcolor(UISuper::Color(255,255,255,180)); | |
92 | - label_ptr->set_textcolor(UISuper::Color(0,0,0)); | |
93 | - }); | |
94 | - return label; | |
95 | - }()))); | |
96 | - right_click_list_.addItem(UIBasePtr(new UILabel([&]()->UILabel{ | |
97 | - UILabel label; | |
98 | - label.set_parent_c(shd_right_click_list_); | |
99 | - label.set_input_adaptor(this); | |
100 | - label.set_text(unicode::ToTString(unicode::sjis2utf8("コピー"))); | |
101 | - label.set_width(120); | |
102 | - label.set_top(12); | |
103 | - label.set_left(0); | |
104 | - label.set_textcolor(UISuper::Color(0,0,0,255)); | |
105 | - label.set_bgcolor(UISuper::Color(255,255,255,180)); | |
106 | - label.set_on_click_function_([&](UIBase* ptr)->void{ | |
107 | - auto input_ = ptr->input_adpator(); | |
108 | - SetClipboardText(input_->selecting_text().c_str()); | |
109 | - input_->set_click_chancel_count(8); | |
110 | - }); | |
111 | - label.set_on_hover_function_([](UIBase* ptr)->void{ | |
112 | - auto label_ptr = (UILabel *)ptr; | |
113 | - label_ptr->set_bgcolor(UISuper::Color(0,0,0,180)); | |
114 | - label_ptr->set_textcolor(UISuper::Color(255,255,255)); | |
115 | - }); | |
116 | - label.set_on_out_function_([](UIBase* ptr)->void{ | |
117 | - auto label_ptr = (UILabel *)ptr; | |
118 | - label_ptr->set_bgcolor(UISuper::Color(255,255,255,180)); | |
119 | - label_ptr->set_textcolor(UISuper::Color(0,0,0)); | |
120 | - }); | |
121 | - return label; | |
122 | - }()))); | |
123 | - right_click_list_.addItem(UIBasePtr(new UILabel([&]()->UILabel{ | |
124 | - UILabel label; | |
125 | - label.set_parent_c(shd_right_click_list_); | |
126 | - label.set_input_adaptor(this); | |
127 | - label.set_text(unicode::ToTString(unicode::sjis2utf8("貼り付け"))); | |
128 | - label.set_width(120); | |
129 | - label.set_top(12); | |
130 | - label.set_left(0); | |
131 | - label.set_textcolor(UISuper::Color(0,0,0,255)); | |
132 | - label.set_bgcolor(UISuper::Color(255,255,255,180)); | |
133 | - label.set_on_click_function_([&](UIBase* ptr)->void{ | |
134 | - auto input_ = ptr->input_adpator(); | |
135 | - auto size = GetClipboardText(NULL); | |
136 | - if(size > 0){ | |
137 | - TCHAR *buf = new TCHAR[size]; | |
138 | - GetClipboardText(buf); | |
139 | - input_->paste_text(buf); | |
140 | - delete []buf; | |
141 | - } | |
142 | - input_->set_click_chancel_count(8); | |
143 | - }); | |
144 | - label.set_on_hover_function_([](UIBase* ptr)->void{ | |
145 | - auto label_ptr = (UILabel *)ptr; | |
146 | - label_ptr->set_bgcolor(UISuper::Color(0,0,0,180)); | |
147 | - label_ptr->set_textcolor(UISuper::Color(255,255,255)); | |
148 | - }); | |
149 | - label.set_on_out_function_([](UIBase* ptr)->void{ | |
150 | - auto label_ptr = (UILabel *)ptr; | |
151 | - label_ptr->set_bgcolor(UISuper::Color(255,255,255,180)); | |
152 | - label_ptr->set_textcolor(UISuper::Color(0,0,0)); | |
153 | - }); | |
154 | - return label; | |
155 | - }()))); | |
156 | - right_click_list_.set_height((font_height_ + 2)* 3); | |
157 | - right_click_list_.set_width(120); | |
158 | - right_click_list_.set_visible(false); | |
159 | 48 | } |
160 | 49 | |
161 | 50 | void Input::Draw() |
@@ -270,98 +159,12 @@ void Input::Draw() | ||
270 | 159 | } |
271 | 160 | } |
272 | 161 | |
273 | - int select_start = 0,select_end = 0; | |
274 | - GetKeyInputSelectArea(&select_start,&select_end,input_handle_); | |
275 | - if( select_start > select_end )std::swap(select_start,select_end); | |
276 | - | |
277 | - if( select_start > -1 && select_end != select_start ) { | |
278 | - if ( multiline_ ) { | |
279 | - BOOST_FOREACH(auto it,lines_){ | |
280 | - int width = 0; | |
281 | - TCHAR c[2] = {0}; | |
282 | - if( select_start >= it.size() && select_start != -1 ) { | |
283 | - DrawStringToHandle(internal_x, internal_y + current_line * font_height_, | |
284 | - it.c_str(), text_color, font_handle_); | |
285 | - if(select_start == it.size()){ | |
286 | - select_start -= it.size(); | |
287 | - }else{ | |
288 | - select_start -= it.size() + 1; | |
289 | - } | |
290 | - select_end -= it.size() + 1; | |
291 | - ++current_line; | |
292 | - }else if(select_start != -1){ | |
293 | - for(int i = 0;i < select_start;++i){ | |
294 | - c[0] = it[i]; | |
295 | - DrawStringToHandle(internal_x + width, internal_y + current_line * font_height_, | |
296 | - c, text_color, font_handle_); | |
297 | - width += GetDrawStringWidthToHandle(c,1,font_handle_); | |
298 | - } | |
299 | - for(int i = select_start;i < ((select_end > static_cast<int>(it.size())) ? it.size() : select_end); ++i){ | |
300 | - c[0] = it[i]; | |
301 | - SetDrawBlendMode(DX_BLENDMODE_ALPHA, 180); | |
302 | - DrawBox(internal_x + width,internal_y + current_line * font_height_, | |
303 | - internal_x + width + GetDrawStringWidthToHandle(c,1,font_handle_),internal_y + ( current_line + 1 ) * font_height_,text_color,1); | |
304 | - DrawStringToHandle(internal_x + width, internal_y + current_line * font_height_, | |
305 | - c, !reverse_color_ ? GetColor(255, 255, 255) : GetColor(0, 0, 0), font_handle_); | |
306 | - width += GetDrawStringWidthToHandle(c,1,font_handle_); | |
307 | - SetDrawBlendMode(DX_BLENDMODE_NOBLEND, 0); | |
308 | - } | |
309 | - for(int i = ((select_end > static_cast<int>(it.size())) ? it.size() : select_end);i < it.size(); ++i){ | |
310 | - c[0] = it[i]; | |
311 | - DrawStringToHandle(internal_x + width, internal_y + current_line * font_height_, | |
312 | - c, text_color, font_handle_); | |
313 | - width += GetDrawStringWidthToHandle(c,1,font_handle_); | |
314 | - } | |
315 | - if(select_end > it.size()){ | |
316 | - select_end -= it.size() + 1; | |
317 | - select_start = 0; | |
318 | - }else{ | |
319 | - select_start = -1; | |
320 | - } | |
321 | - ++current_line; | |
322 | - }else if(select_start == -1){ | |
323 | - DrawStringToHandle(internal_x + width, internal_y + current_line * font_height_, | |
324 | - it.c_str(), text_color, font_handle_); | |
325 | - ++current_line; | |
326 | - } | |
327 | - } | |
328 | - }else{ | |
329 | - BOOST_FOREACH(auto it,lines_){ | |
330 | - int width = 0; | |
331 | - TCHAR c[2] = {0}; | |
332 | - for(int i = 0;i < select_start;++i){ | |
333 | - c[0] = it[i]; | |
334 | - DrawStringToHandle(internal_x + width, internal_y + current_line * font_height_, | |
335 | - c, text_color, font_handle_); | |
336 | - width += GetDrawStringWidthToHandle(c,1,font_handle_); | |
337 | - } | |
338 | - for(int i = select_start;i < select_end; ++i){ | |
339 | - c[0] = it[i]; | |
340 | - SetDrawBlendMode(DX_BLENDMODE_ALPHA, 180); | |
341 | - DrawBox(internal_x + width,internal_y + current_line * font_height_, | |
342 | - internal_x + width + GetDrawStringWidthToHandle(c,1,font_handle_),internal_y + ( current_line + 1 ) * font_height_,text_color,1); | |
343 | - DrawStringToHandle(internal_x + width, internal_y + current_line * font_height_, | |
344 | - c, !reverse_color_ ? GetColor(255, 255, 255) : GetColor(0, 0, 0), font_handle_); | |
345 | - width += GetDrawStringWidthToHandle(c,1,font_handle_); | |
346 | - SetDrawBlendMode(DX_BLENDMODE_NOBLEND, 0); | |
347 | - } | |
348 | - for(unsigned int i = select_end;i < it.size(); ++i){ | |
349 | - c[0] = it[i]; | |
350 | - DrawStringToHandle(internal_x + width, internal_y + current_line * font_height_, | |
351 | - c, text_color, font_handle_); | |
352 | - width += GetDrawStringWidthToHandle(c,1,font_handle_); | |
353 | - } | |
354 | - } | |
355 | - } | |
356 | - }else{ | |
357 | - for (auto it = lines_.begin(); it != lines_.end(); ++it) { | |
358 | - auto line = *it; | |
359 | - DrawStringToHandle(internal_x, internal_y + current_line * font_height_, | |
360 | - line.c_str(), text_color, font_handle_); | |
361 | - current_line++; | |
362 | - } | |
363 | - } | |
364 | - | |
162 | + for (auto it = lines_.begin(); it != lines_.end(); ++it) { | |
163 | + auto line = *it; | |
164 | + DrawStringToHandle(internal_x, internal_y + current_line * font_height_, | |
165 | + line.c_str(), text_color, font_handle_); | |
166 | + current_line++; | |
167 | + } | |
365 | 168 | |
366 | 169 | // カーソルを描画 |
367 | 170 | if (clause_lines_.size() <= 0 && active() && blink_count_ < 30) { |
@@ -455,21 +258,11 @@ void Input::Draw() | ||
455 | 258 | } |
456 | 259 | } |
457 | 260 | } |
458 | - { | |
459 | - if ( right_click_list_.visible() ) { | |
460 | - right_click_list_.Draw(); | |
461 | - } | |
462 | - } | |
463 | 261 | } |
464 | 262 | |
465 | 263 | void Input::Update() |
466 | 264 | { |
467 | 265 | blink_count_ = (blink_count_ + 1) % 60; |
468 | - { | |
469 | - if ( right_click_list_.visible() ) { | |
470 | - right_click_list_.Update(); | |
471 | - } | |
472 | - } | |
473 | 266 | } |
474 | 267 | |
475 | 268 | void Input::ProcessInput(InputManager* input) |
@@ -478,18 +271,7 @@ void Input::ProcessInput(InputManager* input) | ||
478 | 271 | return; |
479 | 272 | } |
480 | 273 | |
481 | - if (click_cancel_count_ > 0) | |
482 | - { | |
483 | - input->CancelMouseLeft(); | |
484 | - input->CancelMouseRight(); | |
485 | - --click_cancel_count_; | |
486 | - } | |
487 | - | |
488 | - bool push_mouse_left = (input->GetMouseLeftCount() > 0); | |
489 | - bool prev_mouse_left = input->GetPrevMouseLeft(); | |
490 | - | |
491 | - bool push_mouse_right = (input->GetMouseRightCount() > 0); | |
492 | - bool prev_mouse_right = input->GetPrevMouseRight(); | |
274 | + // bool push_mouse_left = (input->GetMouseLeftCount() > 0); | |
493 | 275 | |
494 | 276 | // bool first_key_shift = (input->GetKeyCount(KEY_INPUT_RSHIFT) == 1 |
495 | 277 | // || input->GetKeyCount(KEY_INPUT_LSHIFT) == 1); |
@@ -510,7 +292,6 @@ void Input::ProcessInput(InputManager* input) | ||
510 | 292 | + KEY_REPEAT_FRAME) % (KEY_REPEAT_FRAME + 1) == 0; |
511 | 293 | bool push_repeat_key_down = (input->GetKeyCount(KEY_INPUT_DOWN) |
512 | 294 | + KEY_REPEAT_FRAME) % (KEY_REPEAT_FRAME + 1) == 0; |
513 | - | |
514 | 295 | // bool push_long_backspace = (input->GetKeyCount(KEY_INPUT_BACK) > 60 * 1.5); |
515 | 296 | |
516 | 297 | auto input_text = text(); |
@@ -531,13 +312,6 @@ void Input::ProcessInput(InputManager* input) | ||
531 | 312 | } |
532 | 313 | } |
533 | 314 | |
534 | - if ( right_click_list_.visible() ) { | |
535 | - right_click_list_.ProcessInput(input); | |
536 | - if( push_mouse_left ) { | |
537 | - //rightmenu_show_ = false; | |
538 | - right_click_list_.set_visible(false); | |
539 | - } | |
540 | - } | |
541 | 315 | if (push_repeat_key_up) { |
542 | 316 | cursor_moveto_y_ = cursor_y_ - font_height_ / 2; |
543 | 317 | cursor_moveto_x_ = cursor_x_ + 2; |
@@ -633,189 +407,7 @@ void Input::ProcessInput(InputManager* input) | ||
633 | 407 | } |
634 | 408 | |
635 | 409 | if (active()) { |
636 | - if ( !right_click_list_.visible() && | |
637 | - !( right_click_list_.visible() && right_click_list_.absolute_x()<= input->GetMouseX() && input->GetMouseX() <= right_click_list_.absolute_x()+ right_click_list_.absolute_width() | |
638 | - && right_click_list_.absolute_y() <= input->GetMouseY() && input->GetMouseY() <= right_click_list_.absolute_y() + right_click_list_.absolute_height())) { | |
639 | - // マウス左ボタンが押された時 | |
640 | - if (push_mouse_left && !prev_mouse_left) { | |
641 | - auto mpos = input->GetMousePos(); | |
642 | - auto offset_x = mpos.first - (x_ + INPUT_MARGIN_X); | |
643 | - auto offset_y = mpos.second - (y_ + INPUT_MARGIN_Y); | |
644 | - // カレット変更 | |
645 | - if( multiline_ ) { | |
646 | - auto line_num = offset_y / font_height_; | |
647 | - //if( ( offset_y % font_height_ ) != 0 )++line_num; | |
648 | - int tmp = 0,cnt = 0; | |
649 | - if( line_num < (int)lines_.size() && line_num >= 0 ){ | |
650 | - for(int i = 0;i < line_num; ++i){ | |
651 | - cnt += lines_[i].size(); | |
652 | - } | |
653 | - for(unsigned int i = 0;i < lines_[line_num].size(); ++i){ | |
654 | - auto tmp_x = GetDrawStringWidthToHandle(&lines_[line_num][i],1,font_handle_); | |
655 | - if( tmp + tmp_x < offset_x ){ | |
656 | - tmp += tmp_x; | |
657 | - ++cnt; | |
658 | - } | |
659 | - } | |
660 | - SetKeyInputCursorPosition(line_num + cnt,input_handle_); | |
661 | - } | |
662 | - }else{ | |
663 | - int tmp = 0,cnt = 0; | |
664 | - for(unsigned int i = 0;i < lines_[0].size(); ++i){ | |
665 | - auto tmp_x = GetDrawStringWidthToHandle(&lines_[0][i],1,font_handle_); | |
666 | - if( tmp + tmp_x < offset_x ){ | |
667 | - tmp += tmp_x; | |
668 | - ++cnt; | |
669 | - } | |
670 | - } | |
671 | - if( selecting_coursorpoint_.first = selecting_coursorpoint_.second ) { | |
672 | - SetKeyInputSelectArea( -1, -1, input_handle_ ); | |
673 | - }else{ | |
674 | - SetKeyInputSelectArea(selecting_coursorpoint_.first,selecting_coursorpoint_.second,input_handle_); | |
675 | - } | |
676 | - SetKeyInputCursorPosition(cnt,input_handle_); | |
677 | - } | |
678 | - } | |
679 | - // マウス左ボタンがドラッグされた時 | |
680 | - if (push_mouse_left && prev_mouse_left ) { | |
681 | - int prev_cursor_pos = 0; | |
682 | - if( !drag_flag_ ){ | |
683 | - prev_cursor_pos = GetKeyInputCursorPosition(input_handle_); | |
684 | - }else{ | |
685 | - prev_cursor_pos = selecting_coursorpoint_.first; | |
686 | - } | |
687 | - auto mpos = input->GetMousePos(); | |
688 | - auto offset_x = mpos.first - (x_ + INPUT_MARGIN_X); | |
689 | - auto offset_y = mpos.second - (y_ + INPUT_MARGIN_Y); | |
690 | - // カレット変更 | |
691 | - if( multiline_ ) { | |
692 | - auto line_num = offset_y / font_height_; | |
693 | - int tmp = 0,cnt = 0; | |
694 | - if( line_num < (int)lines_.size() && line_num >= 0){ | |
695 | - for(int i = 0;i < line_num; ++i,++cnt){ | |
696 | - cnt += lines_[i].size(); | |
697 | - } | |
698 | - for(unsigned int i = 0;i < lines_[line_num].size(); ++i){ | |
699 | - auto tmp_x = GetDrawStringWidthToHandle(&lines_[line_num][i],1,font_handle_); | |
700 | - if( tmp + tmp_x < offset_x ){ | |
701 | - tmp += tmp_x; | |
702 | - ++cnt; | |
703 | - } | |
704 | - } | |
705 | - } | |
706 | - selecting_coursorpoint_ = std::make_pair<int,int>(prev_cursor_pos,cnt); | |
707 | - }else{ | |
708 | - int tmp = 0,cnt = 0; | |
709 | - for(unsigned int i = 0;i < lines_[0].size(); ++i){ | |
710 | - auto tmp_x = GetDrawStringWidthToHandle(&lines_[0][i],1,font_handle_); | |
711 | - if( tmp + tmp_x < offset_x ){ | |
712 | - tmp += tmp_x; | |
713 | - ++cnt; | |
714 | - } | |
715 | - } | |
716 | - selecting_coursorpoint_ = std::make_pair<int,int>(prev_cursor_pos,cnt); | |
717 | - } | |
718 | - SetKeyInputSelectArea(selecting_coursorpoint_.first,selecting_coursorpoint_.second,input_handle_); | |
719 | - SetKeyInputCursorPosition(selecting_coursorpoint_.second,input_handle_); | |
720 | - drag_flag_ = true; | |
721 | - } | |
722 | - // マウス左ボタンが離され、且つ前回ドラッグされていた時 | |
723 | - if (!push_mouse_left && prev_mouse_left && drag_flag_ ) { | |
724 | - drag_flag_ = false; | |
725 | - if( selecting_coursorpoint_.first == selecting_coursorpoint_.second ) { | |
726 | - SetKeyInputSelectArea( -1, -1, input_handle_ ); | |
727 | - }else{ | |
728 | - if(selecting_coursorpoint_.first > selecting_coursorpoint_.second) | |
729 | - { | |
730 | - std::swap(selecting_coursorpoint_.first , selecting_coursorpoint_.second); | |
731 | - } | |
732 | - SetKeyInputSelectArea(selecting_coursorpoint_.first,selecting_coursorpoint_.second,input_handle_); | |
733 | - } | |
734 | - SetKeyInputCursorPosition(selecting_coursorpoint_.second,input_handle_); | |
735 | - } | |
736 | - }else{ | |
737 | - if( push_mouse_left ){ | |
738 | - auto mpos = input->GetMousePos(); | |
739 | - auto offset_x = mpos.first - (x_ + INPUT_MARGIN_X); | |
740 | - auto offset_y = mpos.second - (y_ + INPUT_MARGIN_Y); | |
741 | - // カレット変更 | |
742 | - if( multiline_ ) { | |
743 | - auto line_num = offset_y / font_height_; | |
744 | - //if( ( offset_y % font_height_ ) != 0 )++line_num; | |
745 | - int tmp = 0,cnt = 0; | |
746 | - if( line_num < (int)lines_.size() && line_num >= 0 ){ | |
747 | - for(int i = 0;i < line_num; ++i){ | |
748 | - cnt += lines_[i].size(); | |
749 | - } | |
750 | - for(unsigned int i = 0;i < lines_[line_num].size(); ++i){ | |
751 | - auto tmp_x = GetDrawStringWidthToHandle(&lines_[line_num][i],1,font_handle_); | |
752 | - if( tmp + tmp_x < offset_x ){ | |
753 | - tmp += tmp_x; | |
754 | - ++cnt; | |
755 | - } | |
756 | - } | |
757 | - SetKeyInputCursorPosition(line_num + cnt,input_handle_); | |
758 | - } | |
759 | - }else{ | |
760 | - int tmp = 0,cnt = 0; | |
761 | - for(unsigned int i = 0;i < lines_[0].size(); ++i){ | |
762 | - auto tmp_x = GetDrawStringWidthToHandle(&lines_[0][i],1,font_handle_); | |
763 | - if( tmp + tmp_x < offset_x ){ | |
764 | - tmp += tmp_x; | |
765 | - ++cnt; | |
766 | - } | |
767 | - } | |
768 | - if( selecting_coursorpoint_.first = selecting_coursorpoint_.second ) { | |
769 | - SetKeyInputSelectArea( -1, -1, input_handle_ ); | |
770 | - }else{ | |
771 | - SetKeyInputSelectArea(selecting_coursorpoint_.first,selecting_coursorpoint_.second,input_handle_); | |
772 | - } | |
773 | - SetKeyInputCursorPosition(cnt,input_handle_); | |
774 | - } | |
775 | - } | |
776 | - } | |
777 | - // マウス右ボタンが押されたとき | |
778 | - if ( push_mouse_right && !prev_mouse_right ) { | |
779 | - if( x() <= input->GetMouseX() && input->GetMouseX() <= x() + width() && | |
780 | - y() <= input->GetMouseY() && input->GetMouseY() <= y() + height()){ | |
781 | - auto mouse_pos_ = input->GetMousePos(); | |
782 | - if( mouse_pos_.second + right_click_list_.absolute_height() > config_manager_->screen_height()){ | |
783 | - right_click_list_.set_top(mouse_pos_.second - right_click_list_.absolute_height()); | |
784 | - if ( mouse_pos_.first + right_click_list_.absolute_width() > config_manager_->screen_width()){ | |
785 | - right_click_list_.set_left(mouse_pos_.first - right_click_list_.absolute_width()); | |
786 | - BOOST_FOREACH(auto it,right_click_list_.getItems()){ | |
787 | - it->set_left(mouse_pos_.first - right_click_list_.absolute_width()); | |
788 | - it->set_top(mouse_pos_.second - right_click_list_.absolute_height() + 12); | |
789 | - } | |
790 | - }else{ | |
791 | - right_click_list_.set_left(mouse_pos_.first); | |
792 | - BOOST_FOREACH(auto it,right_click_list_.getItems()){ | |
793 | - it->set_left(mouse_pos_.first); | |
794 | - it->set_top(mouse_pos_.second - right_click_list_.absolute_height() + 12); | |
795 | - } | |
796 | - } | |
797 | - }else{ | |
798 | - right_click_list_.set_top(mouse_pos_.second); | |
799 | - if ( mouse_pos_.first + right_click_list_.absolute_width() > config_manager_->screen_width()){ | |
800 | - right_click_list_.set_left(mouse_pos_.first - right_click_list_.absolute_width()); | |
801 | - BOOST_FOREACH(auto it,right_click_list_.getItems()){ | |
802 | - it->set_left(mouse_pos_.first - right_click_list_.absolute_width()); | |
803 | - it->set_top(mouse_pos_.second + 12); | |
804 | - } | |
805 | - }else{ | |
806 | - right_click_list_.set_left(mouse_pos_.first); | |
807 | - BOOST_FOREACH(auto it,right_click_list_.getItems()){ | |
808 | - it->set_left(mouse_pos_.first); | |
809 | - it->set_top(mouse_pos_.second + 12); | |
810 | - } | |
811 | - } | |
812 | - } | |
813 | - right_click_list_.set_visible(true); | |
814 | - //rightmenu_show_ = true; | |
815 | - } | |
816 | - } | |
817 | - | |
818 | - // カーソル位置(文字単位)を取得 | |
410 | + // カーソル位置(byte)を取得 | |
819 | 411 | cursor_byte_pos = GetKeyInputCursorPosition(input_handle_); |
820 | 412 | if (prev_cursor_pos_ != cursor_byte_pos) { |
821 | 413 | ResetCursorCount(); |
@@ -823,7 +415,6 @@ void Input::ProcessInput(InputManager* input) | ||
823 | 415 | |
824 | 416 | prev_cursor_pos_ = cursor_byte_pos; |
825 | 417 | |
826 | - | |
827 | 418 | // カーソルのドット単位の位置を取得する |
828 | 419 | cursor_dot_pos = GetDrawStringWidthToHandle(String, cursor_byte_pos, |
829 | 420 | font_handle_); |
@@ -1030,7 +621,6 @@ void Input::ProcessInput(InputManager* input) | ||
1030 | 621 | TCHAR c = *it; |
1031 | 622 | int width = GetDrawStringWidthToHandle(&c, 1, font_handle_); |
1032 | 623 | line_buffer += tstring(&c, 1); |
1033 | - char_count++; | |
1034 | 624 | #else |
1035 | 625 | unsigned char c = *it; |
1036 | 626 | TCHAR string[2] = { 0, 0 }; |
@@ -1069,7 +659,7 @@ void Input::ProcessInput(InputManager* input) | ||
1069 | 659 | && cursor_moveto_x_ <= line_width + width |
1070 | 660 | && static_cast<int>(lines_.size() + message_lines_.size()) * font_height_ <= cursor_moveto_y_ |
1071 | 661 | && cursor_moveto_y_ <= (static_cast<int>(lines_.size() + message_lines_.size()) + 1) * font_height_) { |
1072 | - SetKeyInputCursorPosition(char_count - 1, input_handle_); | |
662 | + SetKeyInputCursorPosition(prev_char_count, input_handle_); | |
1073 | 663 | cursor_moveto_x_ = -1; |
1074 | 664 | cursor_moveto_y_ = -1; |
1075 | 665 | } |
@@ -1126,7 +716,6 @@ void Input::ProcessInput(InputManager* input) | ||
1126 | 716 | if (active()) { |
1127 | 717 | input->CancelKeyCountAll(); |
1128 | 718 | } |
1129 | - | |
1130 | 719 | } |
1131 | 720 | |
1132 | 721 | bool Input::active() |
@@ -1226,51 +815,6 @@ void Input::set_on_enter(const CallbackFunc& func) | ||
1226 | 815 | on_enter_ = func; |
1227 | 816 | } |
1228 | 817 | |
1229 | -tstring Input::selecting_text() const | |
1230 | -{ | |
1231 | - int select_start = 0,select_end = 0; | |
1232 | - GetKeyInputSelectArea(&select_start,&select_end,input_handle_); | |
1233 | - if( select_start > select_end )std::swap(select_start,select_end); | |
1234 | - tstring selecting_text; | |
1235 | - | |
1236 | - if( select_start > -1 && select_end != select_start ) { | |
1237 | - if ( multiline_ ) { | |
1238 | - BOOST_FOREACH(auto it,lines_){ | |
1239 | - TCHAR c[2] = {0}; | |
1240 | - if( select_start > it.size() && select_start != -1 ) { | |
1241 | - select_start -= it.size(); | |
1242 | - select_end -= it.size(); | |
1243 | - }else{ | |
1244 | - for(int i = select_start;i < select_end; ++i){ | |
1245 | - c[0] = it[i]; | |
1246 | - selecting_text += c; | |
1247 | - } | |
1248 | - select_start = -1; | |
1249 | - } | |
1250 | - } | |
1251 | - }else{ | |
1252 | - BOOST_FOREACH(auto it,lines_){ | |
1253 | - TCHAR c[2] = {0}; | |
1254 | - for(int i = select_start;i < select_end; ++i){ | |
1255 | - c[0] = it[i]; | |
1256 | - selecting_text += c; | |
1257 | - } | |
1258 | - } | |
1259 | - } | |
1260 | - } | |
1261 | - return selecting_text; | |
1262 | -} | |
1263 | - | |
1264 | -void Input::paste_text(tstring text) | |
1265 | -{ | |
1266 | - auto pos = GetKeyInputCursorPosition(input_handle_); | |
1267 | - TCHAR String[TEXT_BUFFER_SIZE]; | |
1268 | - GetKeyInputString(String, input_handle_); | |
1269 | - tstring dat(String, _tcslen(String)); | |
1270 | - dat.insert(pos,text); | |
1271 | - SetKeyInputString(dat.c_str(), input_handle_); | |
1272 | -} | |
1273 | - | |
1274 | 818 | bool Input::reverse_color() const |
1275 | 819 | { |
1276 | 820 | return reverse_color_; |
@@ -1289,9 +833,4 @@ bool Input::multiline() const | ||
1289 | 833 | void Input::set_multiline(bool flag) |
1290 | 834 | { |
1291 | 835 | multiline_ = flag; |
1292 | -} | |
1293 | - | |
1294 | -void Input::set_click_chancel_count(int count) | |
1295 | -{ | |
1296 | - click_cancel_count_ = count; | |
1297 | 836 | } |
\ No newline at end of file |
@@ -8,20 +8,16 @@ | ||
8 | 8 | #include <functional> |
9 | 9 | #include "../ResourceManager.hpp" |
10 | 10 | #include "../InputManager.hpp" |
11 | -#include "../ConfigManager.hpp" | |
12 | -#include "include.hpp" | |
13 | -#include <boost/enable_shared_from_this.hpp> | |
14 | 11 | |
15 | -class Input{ | |
12 | +class Input { | |
16 | 13 | typedef std::function<bool(const std::string&)> CallbackFunc; |
17 | 14 | |
18 | 15 | public: |
19 | - Input(ConfigManagerPtr config_manager); | |
16 | + Input(); | |
20 | 17 | |
21 | 18 | void Draw(); |
22 | 19 | void Update(); |
23 | 20 | void ProcessInput(InputManager* input); |
24 | - void Init(); | |
25 | 21 | |
26 | 22 | bool active(); |
27 | 23 | void set_active(bool flag); |
@@ -49,11 +45,6 @@ class Input{ | ||
49 | 45 | |
50 | 46 | void set_on_enter(const CallbackFunc& func); |
51 | 47 | |
52 | - tstring selecting_text() const; | |
53 | - void paste_text(tstring text); | |
54 | - | |
55 | - void set_click_chancel_count(int count); | |
56 | - | |
57 | 48 | public: |
58 | 49 | void CancelSelect(); |
59 | 50 |
@@ -82,22 +73,12 @@ class Input{ | ||
82 | 73 | std::vector<std::pair<int, int>> selecting_lines_; |
83 | 74 | std::vector<std::pair<int, int>> clause_lines_; |
84 | 75 | std::vector<std::pair<int, int>> selecting_clause_lines_; |
85 | - std::pair<int, int> selecting_coursorpoint_; | |
86 | - bool drag_flag_; | |
87 | 76 | |
88 | 77 | CallbackFunc on_enter_; |
89 | 78 | tstring message_; |
90 | 79 | |
91 | 80 | bool reverse_color_; |
92 | 81 | int blink_count_; |
93 | - bool rightmenu_show_; | |
94 | - //std::pair<int, int> mouse_pos_; | |
95 | - | |
96 | - UIList right_click_list_; | |
97 | - | |
98 | - ConfigManagerPtr config_manager_; | |
99 | - | |
100 | - int click_cancel_count_; | |
101 | 82 | |
102 | 83 | private: |
103 | 84 | const static size_t TEXT_BUFFER_SIZE; |
@@ -43,8 +43,7 @@ InputBox::InputBox(const ManagerAccessorPtr& manager_accessor) : | ||
43 | 43 | selecting_tab_index_(0), |
44 | 44 | manager_accessor_(manager_accessor), |
45 | 45 | card_(std::make_shared<Card>(manager_accessor_, "", "immo", "", "", |
46 | - std::vector<std::string>())), | |
47 | - input_(manager_accessor->config_manager().lock()) | |
46 | + std::vector<std::string>())) | |
48 | 47 | |
49 | 48 | { |
50 | 49 | absolute_rect_ = Rect(100, 100, 800, 100); |
@@ -103,7 +102,6 @@ InputBox::InputBox(const ManagerAccessorPtr& manager_accessor) : | ||
103 | 102 | |
104 | 103 | return true; |
105 | 104 | }); |
106 | - input_.Init(); | |
107 | 105 | } |
108 | 106 | |
109 | 107 | InputBox::~InputBox() |
@@ -9,7 +9,7 @@ | ||
9 | 9 | |
10 | 10 | #define MMO_VERSION_MAJOR 0 |
11 | 11 | #define MMO_VERSION_MINOR 4 |
12 | -#define MMO_VERSION_REVISION 0 | |
12 | +#define MMO_VERSION_REVISION 1 | |
13 | 13 | |
14 | 14 | #define MMO_PROTOCOL_VERSION 3 |
15 | 15 |