mirror of
https://github.com/Kapendev/parin.git
synced 2025-04-26 21:19:56 +03:00
Small UI changes and changed version.
This commit is contained in:
parent
900bf6513d
commit
b89bec38e1
11 changed files with 22 additions and 17 deletions
|
@ -10,7 +10,7 @@ enum header = "// ---
|
||||||
// SPDX-License-Identifier: MIT
|
// SPDX-License-Identifier: MIT
|
||||||
// Email: alexandroskapretsos@gmail.com
|
// Email: alexandroskapretsos@gmail.com
|
||||||
// Project: https://github.com/Kapendev/parin
|
// Project: https://github.com/Kapendev/parin
|
||||||
// Version: v0.0.31
|
// Version: v0.0.32
|
||||||
// ---";
|
// ---";
|
||||||
|
|
||||||
int main(string[] args) {
|
int main(string[] args) {
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
// SPDX-License-Identifier: MIT
|
// SPDX-License-Identifier: MIT
|
||||||
// Email: alexandroskapretsos@gmail.com
|
// Email: alexandroskapretsos@gmail.com
|
||||||
// Project: https://github.com/Kapendev/parin
|
// Project: https://github.com/Kapendev/parin
|
||||||
// Version: v0.0.31
|
// Version: v0.0.32
|
||||||
// ---
|
// ---
|
||||||
|
|
||||||
// TODO: The DialogueCommandRunner should work with gc functions too. Think about how to do it.
|
// TODO: The DialogueCommandRunner should work with gc functions too. Think about how to do it.
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
// SPDX-License-Identifier: MIT
|
// SPDX-License-Identifier: MIT
|
||||||
// Email: alexandroskapretsos@gmail.com
|
// Email: alexandroskapretsos@gmail.com
|
||||||
// Project: https://github.com/Kapendev/parin
|
// Project: https://github.com/Kapendev/parin
|
||||||
// Version: v0.0.31
|
// Version: v0.0.32
|
||||||
// ---
|
// ---
|
||||||
|
|
||||||
// TODO: Test the resource loading code.
|
// TODO: Test the resource loading code.
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
// SPDX-License-Identifier: MIT
|
// SPDX-License-Identifier: MIT
|
||||||
// Email: alexandroskapretsos@gmail.com
|
// Email: alexandroskapretsos@gmail.com
|
||||||
// Project: https://github.com/Kapendev/parin
|
// Project: https://github.com/Kapendev/parin
|
||||||
// Version: v0.0.31
|
// Version: v0.0.32
|
||||||
// ---
|
// ---
|
||||||
|
|
||||||
// TODO: Think about gaps in an atlas texture.
|
// TODO: Think about gaps in an atlas texture.
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
// SPDX-License-Identifier: MIT
|
// SPDX-License-Identifier: MIT
|
||||||
// Email: alexandroskapretsos@gmail.com
|
// Email: alexandroskapretsos@gmail.com
|
||||||
// Project: https://github.com/Kapendev/parin
|
// Project: https://github.com/Kapendev/parin
|
||||||
// Version: v0.0.31
|
// Version: v0.0.32
|
||||||
// ---
|
// ---
|
||||||
|
|
||||||
module parin;
|
module parin;
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
// SPDX-License-Identifier: MIT
|
// SPDX-License-Identifier: MIT
|
||||||
// Email: alexandroskapretsos@gmail.com
|
// Email: alexandroskapretsos@gmail.com
|
||||||
// Project: https://github.com/Kapendev/parin
|
// Project: https://github.com/Kapendev/parin
|
||||||
// Version: v0.0.31
|
// Version: v0.0.32
|
||||||
// ---
|
// ---
|
||||||
|
|
||||||
/// The `rl` module provides access to the raylib library.
|
/// The `rl` module provides access to the raylib library.
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
// SPDX-License-Identifier: MIT
|
// SPDX-License-Identifier: MIT
|
||||||
// Email: alexandroskapretsos@gmail.com
|
// Email: alexandroskapretsos@gmail.com
|
||||||
// Project: https://github.com/Kapendev/parin
|
// Project: https://github.com/Kapendev/parin
|
||||||
// Version: v0.0.31
|
// Version: v0.0.32
|
||||||
// ---
|
// ---
|
||||||
|
|
||||||
/// The `rayib` module provides access to the raylib.h functions.
|
/// The `rayib` module provides access to the raylib.h functions.
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
// SPDX-License-Identifier: MIT
|
// SPDX-License-Identifier: MIT
|
||||||
// Email: alexandroskapretsos@gmail.com
|
// Email: alexandroskapretsos@gmail.com
|
||||||
// Project: https://github.com/Kapendev/parin
|
// Project: https://github.com/Kapendev/parin
|
||||||
// Version: v0.0.31
|
// Version: v0.0.32
|
||||||
// ---
|
// ---
|
||||||
|
|
||||||
/// The `rlgl` module provides access to the rlgl.h functions.
|
/// The `rlgl` module provides access to the rlgl.h functions.
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
// SPDX-License-Identifier: MIT
|
// SPDX-License-Identifier: MIT
|
||||||
// Email: alexandroskapretsos@gmail.com
|
// Email: alexandroskapretsos@gmail.com
|
||||||
// Project: https://github.com/Kapendev/parin
|
// Project: https://github.com/Kapendev/parin
|
||||||
// Version: v0.0.31
|
// Version: v0.0.32
|
||||||
// ---
|
// ---
|
||||||
|
|
||||||
// TODO: Think about gaps in an atlas texture.
|
// TODO: Think about gaps in an atlas texture.
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
// SPDX-License-Identifier: MIT
|
// SPDX-License-Identifier: MIT
|
||||||
// Email: alexandroskapretsos@gmail.com
|
// Email: alexandroskapretsos@gmail.com
|
||||||
// Project: https://github.com/Kapendev/parin
|
// Project: https://github.com/Kapendev/parin
|
||||||
// Version: v0.0.31
|
// Version: v0.0.32
|
||||||
// ---
|
// ---
|
||||||
|
|
||||||
// TODO: Update all the doc comments here.
|
// TODO: Update all the doc comments here.
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
// SPDX-License-Identifier: MIT
|
// SPDX-License-Identifier: MIT
|
||||||
// Email: alexandroskapretsos@gmail.com
|
// Email: alexandroskapretsos@gmail.com
|
||||||
// Project: https://github.com/Kapendev/parin
|
// Project: https://github.com/Kapendev/parin
|
||||||
// Version: v0.0.31
|
// Version: v0.0.32
|
||||||
// ---
|
// ---
|
||||||
|
|
||||||
/// The `ui` module functions as a immediate mode UI library.
|
/// The `ui` module functions as a immediate mode UI library.
|
||||||
|
@ -13,12 +13,14 @@ import rl = parin.rl;
|
||||||
import joka.ascii;
|
import joka.ascii;
|
||||||
import parin.engine;
|
import parin.engine;
|
||||||
|
|
||||||
|
@safe @nogc nothrow:
|
||||||
|
|
||||||
UiState uiState;
|
UiState uiState;
|
||||||
UiState uiPreviousState;
|
UiState uiPreviousState;
|
||||||
|
|
||||||
enum defaultUiAlpha = 220;
|
enum defaultUiAlpha = 220;
|
||||||
enum defaultUiBorderThickness = 1;
|
|
||||||
enum defaultUiMargin = 1;
|
enum defaultUiMargin = 1;
|
||||||
|
enum defaultUiBorderThickness = 1;
|
||||||
enum defaultUiDisabledColor = 0x202020.toRgb();
|
enum defaultUiDisabledColor = 0x202020.toRgb();
|
||||||
enum defaultUiIdleColor = 0x414141.toRgb();
|
enum defaultUiIdleColor = 0x414141.toRgb();
|
||||||
enum defaultUiHotColor = 0x818181.toRgb();
|
enum defaultUiHotColor = 0x818181.toRgb();
|
||||||
|
@ -217,7 +219,11 @@ Vec2 uiLayoutStartPoint() {
|
||||||
}
|
}
|
||||||
|
|
||||||
Vec2 uiLayoutPoint() {
|
Vec2 uiLayoutPoint() {
|
||||||
return (uiState.layoutStartPoint + uiState.layoutStartPointOffest);
|
return uiState.layoutStartPoint + uiState.layoutStartPointOffest;
|
||||||
|
}
|
||||||
|
|
||||||
|
short uiItemId() {
|
||||||
|
return uiState.itemId;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vec2 uiItemPoint() {
|
Vec2 uiItemPoint() {
|
||||||
|
@ -416,7 +422,7 @@ void drawUiButton(Vec2 size, IStr text, Vec2 point, bool isHot, bool isActive, U
|
||||||
else if (isActive) drawRect(area, defaultUiActiveColor);
|
else if (isActive) drawRect(area, defaultUiActiveColor);
|
||||||
else if (isHot) drawRect(area, defaultUiHotColor);
|
else if (isHot) drawRect(area, defaultUiHotColor);
|
||||||
else drawRect(area, defaultUiIdleColor);
|
else drawRect(area, defaultUiIdleColor);
|
||||||
if (!options.isDisabled) drawHollowRect(area, defaultUiBorderThickness, defaultUiDisabledColor.alpha(defaultUiAlpha));
|
drawHollowRect(area, defaultUiBorderThickness, defaultUiDisabledColor.alpha(defaultUiAlpha));
|
||||||
drawUiText(size, text, point, options);
|
drawUiText(size, text, point, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -483,9 +489,7 @@ bool updateUiDragHandle(Vec2 size, ref Vec2 point, UiOptions options = UiOptions
|
||||||
|
|
||||||
void drawUiDragHandle(Vec2 size, Vec2 point, bool isHot, bool isActive, UiOptions options = UiOptions()) {
|
void drawUiDragHandle(Vec2 size, Vec2 point, bool isHot, bool isActive, UiOptions options = UiOptions()) {
|
||||||
drawUiButton(size, "", point, isHot, isActive, options);
|
drawUiButton(size, "", point, isHot, isActive, options);
|
||||||
if (!options.isDisabled) {
|
drawHollowRect(Rect(point, size), defaultUiBorderThickness, defaultUiDisabledColor.alpha(defaultUiAlpha));
|
||||||
drawHollowRect(Rect(point, size), defaultUiBorderThickness, defaultUiDisabledColor.alpha(defaultUiAlpha));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool uiDragHandle(Vec2 size, ref Vec2 point, UiOptions options = UiOptions()) {
|
bool uiDragHandle(Vec2 size, ref Vec2 point, UiOptions options = UiOptions()) {
|
||||||
|
@ -495,6 +499,7 @@ bool uiDragHandle(Vec2 size, ref Vec2 point, UiOptions options = UiOptions()) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Add support for right-to-left text.
|
// TODO: Add support for right-to-left text.
|
||||||
|
@trusted
|
||||||
bool updateUiTextField(Vec2 size, ref Str text, Str textBuffer, UiOptions options = UiOptions()) {
|
bool updateUiTextField(Vec2 size, ref Str text, Str textBuffer, UiOptions options = UiOptions()) {
|
||||||
auto point = uiLayoutPoint;
|
auto point = uiLayoutPoint;
|
||||||
if (options.isDisabled) {
|
if (options.isDisabled) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue