Description:
More elaborate name input.
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
@@ -856,7 +856,7 | |||
|
856 | 856 | |
|
857 | 857 | Vector2 middle_dimensions = largeMonoFont.MeasureString("Isometric Park"); |
|
858 | 858 | float middle_start = (int)((FNAGame.width / 2) - (middle_dimensions.X / 2)); |
|
859 | ImGui.SetNextWindowPos(new Num.Vector2(((FNAGame.width/2) - 40), 200)); | |
|
859 | // ImGui.SetNextWindowPos(new Num.Vector2(((FNAGame.width/2) - 40), 200)); | |
|
860 | 860 | batch.DrawString(largeMonoFont, "Isometric Park", |
|
861 | 861 | new Vector2(middle_start, 50), |
|
862 | 862 | Color.Black, 0.0f, Vector2.Zero, |
@@ -32,7 +32,6 | |||
|
32 | 32 | |
|
33 | 33 | if (ImGui.Button("New Game", button_size)) |
|
34 | 34 | { |
|
35 | bridgeEngine.gameStateMessages.Add(new GameStateMessage { isPlaying = true}); | |
|
36 | 35 | bridgeEngine.typeMessages.Add(new ToggleWindowTypeMessage { Window = Window.NewGame }); |
|
37 | 36 | bridgeEngine.typeMessages.Add(new ToggleWindowTypeMessage { Window = Window.MainMenu }); |
|
38 | 37 | } |
@@ -34,8 +34,16 | |||
|
34 | 34 | |
|
35 | 35 | public static String selectedTitle; |
|
36 | 36 | |
|
37 | public static String playerName2Buffer; | |
|
38 | public static int playerName2Pos; | |
|
39 | ||
|
40 | public static byte[] customTitleBuffer; | |
|
41 | public static int customTitlePos; | |
|
42 | ||
|
37 | 43 | public static int choice; |
|
38 | 44 | |
|
45 | public static bool showModal; | |
|
46 | ||
|
39 | 47 | public static void Initialize() |
|
40 | 48 | { |
|
41 | 49 | parkNameBuffer = new byte[32]; |
@@ -46,6 +54,14 | |||
|
46 | 54 | |
|
47 | 55 | selectedTitle = ""; |
|
48 | 56 | |
|
57 | playerName2Buffer = ""; | |
|
58 | playerName2Pos = 0; | |
|
59 | ||
|
60 | customTitleBuffer = new byte[32]; | |
|
61 | customTitlePos = 0; | |
|
62 | ||
|
63 | showModal = true; | |
|
64 | ||
|
49 | 65 | } |
|
50 | 66 | |
|
51 | 67 | public static void Render(ImFontPtr font, ImFontPtr italicFont, ImGuiWindowBridgeEngine bridgeEngine) |
@@ -82,7 +98,7 | |||
|
82 | 98 | } |
|
83 | 99 | NewGameWindow.pos = newPos; |
|
84 | 100 | |
|
85 |
ImGui.Text(" |
|
|
101 | ImGui.Text("Formal Name: "); | |
|
86 | 102 | ImGui.SameLine(); |
|
87 | 103 | |
|
88 | 104 | |
@@ -100,7 +116,7 | |||
|
100 | 116 | } |
|
101 | 117 | ImGui.PopFont(); |
|
102 | 118 | |
|
103 | foreach (var title in new String[] {"Mr.", "Mrs.", "Ms.", "Mx.", "Dr."}) | |
|
119 | foreach (var title in new String[] {"Mr.", "Mrs.", "Ms.","Miss", "Mx.", "M", "Dr.", "Rev.", "Sir", "Madam", "Hon.", "Dishon.", "Director", "Comrade", "Brother", "Sister", "Friend"}) | |
|
104 | 120 | { |
|
105 | 121 | if (ImGui.Selectable(title)) |
|
106 | 122 | { |
@@ -108,6 +124,9 | |||
|
108 | 124 | } |
|
109 | 125 | } |
|
110 | 126 | |
|
127 | ImGui.PushFont(italicFont); | |
|
128 | ImGui.PopFont(); | |
|
129 | ||
|
111 | 130 | ImGui.EndCombo(); |
|
112 | 131 | } |
|
113 | 132 | |
@@ -116,11 +135,55 | |||
|
116 | 135 | |
|
117 | 136 | //God this sucks: |
|
118 | 137 | unsafe { |
|
119 |
|
|
|
138 | ImGui.InputText("##playerNameBuffer", playerNameBuffer, (uint)playerNameBuffer.Length, ImGuiInputTextFlags.AutoSelectAll, null, (IntPtr)(&newPlayerNamePos)); | |
|
120 | 139 | } |
|
121 | 140 | |
|
122 | 141 | NewGameWindow.playerNamePos = newPlayerNamePos; |
|
123 | 142 | |
|
143 | ImGui.SameLine(); | |
|
144 | ||
|
145 | if (ImGui.Button("<Custom>")) | |
|
146 | { | |
|
147 | NewGameWindow.showModal = true; | |
|
148 | ImGui.OpenPopup("XYZCustom"); | |
|
149 | ||
|
150 | } | |
|
151 | if (ImGui.BeginPopup("XYZCustom" /*, ref showModal*/)) | |
|
152 | { | |
|
153 | int newCustomTitlePos = NewGameWindow.customTitlePos; | |
|
154 | unsafe { | |
|
155 | ImGui.InputText("##customTitleBuffer", customTitleBuffer, (uint)customTitleBuffer.Length, ImGuiInputTextFlags.AutoSelectAll, null, (IntPtr)(&newCustomTitlePos)); | |
|
156 | } | |
|
157 | ||
|
158 | NewGameWindow.customTitlePos = newCustomTitlePos; | |
|
159 | ||
|
160 | ||
|
161 | if (ImGui.Button("Okay")) | |
|
162 | { | |
|
163 | selectedTitle = System.Text.Encoding.UTF8.GetString(customTitleBuffer); | |
|
164 | ImGui.CloseCurrentPopup(); | |
|
165 | } | |
|
166 | ImGui.SameLine(); | |
|
167 | if (ImGui.Button("Cancel")) | |
|
168 | { | |
|
169 | ImGui.CloseCurrentPopup(); | |
|
170 | } | |
|
171 | ImGui.EndPopup(); | |
|
172 | ||
|
173 | } | |
|
174 | ||
|
175 | ImGui.Text("Casual Name: "); | |
|
176 | ImGui.SameLine(); | |
|
177 | ||
|
178 | int newPlayerName2Pos = NewGameWindow.playerName2Pos; | |
|
179 | ||
|
180 | //God this sucks: | |
|
181 | unsafe { | |
|
182 | ImGui.InputTextWithHint("##playerName2", "Leave blank to use full name", playerName2Buffer, 32, ImGuiInputTextFlags.AutoSelectAll, null, (IntPtr)(&newPlayerNamePos)); | |
|
183 | } | |
|
184 | ||
|
185 | NewGameWindow.playerName2Pos = newPlayerName2Pos; | |
|
186 | ||
|
124 | 187 | ImGui.RadioButton("Easy: Full Funding", ref choice, ((int)DifficultyLevel.Easy)); |
|
125 | 188 | ImGui.RadioButton("Medium: Austerity", ref choice, ((int)DifficultyLevel.Medium)); |
|
126 | 189 | ImGui.RadioButton("Hard: Unfunded", ref choice, ((int)DifficultyLevel.Hard)); |
@@ -130,6 +193,7 | |||
|
130 | 193 | { |
|
131 | 194 | bridgeEngine.spawnGameMessages.Add(new SpawnGameMessage{}); |
|
132 | 195 | bridgeEngine.typeMessages.Add(new ToggleWindowTypeMessage {Window = Window.NewGame}); |
|
196 | bridgeEngine.gameStateMessages.Add(new GameStateMessage { isPlaying = true}); | |
|
133 | 197 | } |
|
134 | 198 | |
|
135 | 199 | ImGui.SameLine(); |
@@ -137,12 +201,13 | |||
|
137 | 201 | { |
|
138 | 202 | bridgeEngine.typeMessages.Add(new ToggleWindowTypeMessage {Window = Window.NewGame}); |
|
139 | 203 | |
|
140 | bridgeEngine.gameStateMessages.Add(new GameStateMessage { isPlaying = false}); | |
|
141 | 204 | bridgeEngine.typeMessages.Add(new ToggleWindowTypeMessage { Window = Window.MainMenu }); |
|
142 | 205 | } |
|
143 | 206 | |
|
207 | ||
|
144 | 208 | ImGui.End(); |
|
145 | 209 | |
|
210 | ||
|
146 | 211 | StyleSets.defaultSet.pop(); |
|
147 | 212 | ImGui.PopFont(); |
|
148 | 213 |
You need to be logged in to leave comments.
Login now