|
@@ -172,10 +172,10 @@ void displayDialog(string[] pages, string[] choices, ref int selectedChoice,
|
|
|
|
|
|
// Draw text lines with shadow effect
|
|
|
immutable float lineHeight = MeasureTextEx(dialogFont, "A", fontSize, spacing).y * 1.4;
|
|
|
- foreach(i, line; lines) {
|
|
|
+ for (int i = 0; i < lines.length; i++) {
|
|
|
Vector2 pos = Vector2(dialogRect.x + textLeftMargin, dialogRect.y + textTopMargin + i*lineHeight);
|
|
|
- DrawTextEx(dialogFont, line.toStringz(), pos + Vector2(3*scale, 3*scale), fontSize, spacing, Colors.BLACK);
|
|
|
- DrawTextEx(dialogFont, line.toStringz(), pos, fontSize, spacing, Colors.WHITE);
|
|
|
+ DrawTextEx(dialogFont, lines[i].toStringz(), pos + Vector2(3*scale, 3*scale), fontSize, spacing, Colors.BLACK);
|
|
|
+ DrawTextEx(dialogFont, lines[i].toStringz(), pos, fontSize, spacing, Colors.WHITE);
|
|
|
}
|
|
|
|
|
|
// Draw continue indicator when text is fully displayed
|
|
@@ -217,7 +217,7 @@ void displayDialog(string[] pages, string[] choices, ref int selectedChoice,
|
|
|
Vector2 mousePos = GetMousePosition();
|
|
|
bool mouseClicked = IsMouseButtonPressed(MouseButton.MOUSE_BUTTON_LEFT);
|
|
|
|
|
|
- foreach(i, choice; choices) {
|
|
|
+ for (int i = 0; i < choices.length; i++) {
|
|
|
Rectangle choiceRect = Rectangle(
|
|
|
choiceWindow.x + 40,
|
|
|
choiceWindow.y + verticalPadding + i*(choiceHeight + choiceSpacing),
|
|
@@ -228,14 +228,14 @@ void displayDialog(string[] pages, string[] choices, ref int selectedChoice,
|
|
|
bool hovered = CheckCollisionPointRec(mousePos, choiceRect);
|
|
|
if (hovered) selectedChoice = cast(int)i;
|
|
|
|
|
|
- Vector2 textSize = MeasureTextEx(dialogFont, choice.toStringz(), fontSize, spacing);
|
|
|
+ Vector2 textSize = MeasureTextEx(dialogFont, choices[i].toStringz(), fontSize, spacing);
|
|
|
Vector2 textPos = Vector2(
|
|
|
choiceRect.x + (choiceRect.width - textSize.x)/2,
|
|
|
choiceRect.y + (choiceRect.height - textSize.y)/2
|
|
|
);
|
|
|
|
|
|
- DrawTextEx(dialogFont, choice.toStringz(), textPos + Vector2(3*scale, 3*scale), fontSize, spacing, Colors.BLACK);
|
|
|
- DrawTextEx(dialogFont, choice.toStringz(), textPos, fontSize, spacing,
|
|
|
+ DrawTextEx(dialogFont, choices[i].toStringz(), textPos + Vector2(3*scale, 3*scale), fontSize, spacing, Colors.BLACK);
|
|
|
+ DrawTextEx(dialogFont, choices[i].toStringz(), textPos, fontSize, spacing,
|
|
|
(i == selectedChoice) ? Colors.YELLOW : (hovered ? Colors.LIGHTGRAY : Colors.WHITE));
|
|
|
|
|
|
if (hovered && mouseClicked) {
|