MCPcopy Create free account
hub / github.com/EasyRPG/Player / Start

Method Start

src/scene_name.cpp:33–92  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31}
32
33void Scene_Name::Start() {
34 // Create the windows
35 int margin_x = 32;
36 int margin_y = 8;
37 int window_face_width = 64;
38 int window_face_height = 64;
39 int window_name_width = 192;
40 int window_name_height = 32;
41 int window_keyboard_width = 256;
42 int window_keyboard_height = 160;
43
44 face_window.reset(new Window_Face(Player::menu_offset_x + margin_x, Player::menu_offset_y + margin_y, window_face_width, window_face_height));
45 face_window->Set(actor);
46 face_window->Refresh();
47
48 name_window.reset(new Window_Name(Player::menu_offset_x + window_face_width + margin_x, Player::menu_offset_y + margin_y + 32, window_name_width, window_name_height));
49 name_window->Set(use_default_name ? ToString(actor.GetName()) : "");
50 name_window->Refresh();
51
52 const char* done = Window_Keyboard::DONE;
53 // Japanese pages
54 if (Player::IsCP932()) {
55 layouts.push_back(Window_Keyboard::Hiragana);
56 layouts.push_back(Window_Keyboard::Katakana);
57 done = Window_Keyboard::DONE_JP;
58 // Korean pages
59 } else if (Player::IsCP949()) {
60 layouts.push_back(Window_Keyboard::Hangul1);
61 layouts.push_back(Window_Keyboard::Hangul2);
62 done = Window_Keyboard::DONE_KO;
63 // Simp. Chinese pages
64 } else if (Player::IsCP936()) {
65 layouts.push_back(Window_Keyboard::ZhCn1);
66 layouts.push_back(Window_Keyboard::ZhCn2);
67 done = Window_Keyboard::DONE_ZH_CN;
68 // Trad. Chinese pages
69 } else if (Player::IsBig5()) {
70 layouts.push_back(Window_Keyboard::ZhTw1);
71 layouts.push_back(Window_Keyboard::ZhTw2);
72 done = Window_Keyboard::DONE_ZH_TW;
73 // Cyrillic page (we assume it's Russian since we have no way to detect Serbian etc.)
74 } else if (Player::IsCP1251()) {
75 layouts.push_back(Window_Keyboard::RuCyrl);
76 done = Window_Keyboard::DONE_RU;
77 }
78
79 // Letter and symbol pages are used everywhere
80 layouts.push_back(Window_Keyboard::Letter);
81 layouts.push_back(Window_Keyboard::Symbol);
82 kbd_window.reset(new Window_Keyboard(Player::menu_offset_x + margin_x, Player::menu_offset_y + window_face_height + margin_y, window_keyboard_width, window_keyboard_height, done));
83
84 auto next_index = layout_index + 1;
85 if (next_index >= static_cast<int>(layouts.size())) {
86 next_index = 0;
87 }
88 kbd_window->SetMode(layouts[layout_index], layouts[next_index]);
89
90 kbd_window->Refresh();

Callers

nothing calls this directly

Calls 7

resetMethod · 0.45
SetMethod · 0.45
RefreshMethod · 0.45
GetNameMethod · 0.45
sizeMethod · 0.45
SetModeMethod · 0.45
UpdateCursorRectMethod · 0.45

Tested by

no test coverage detected