aboutsummaryrefslogtreecommitdiffstats
path: root/src/sldj.c
diff options
context:
space:
mode:
authornathansmith <nathansmith@posteo.com>2025-05-03 01:46:21 +0000
committernathansmith <nathansmith@posteo.com>2025-05-03 01:46:21 +0000
commit2d2f143d248ef9f173f711108feb770efdfe7d21 (patch)
treec82af5d97f4d4594f2630eabe9b31cec935ebf50 /src/sldj.c
parentffd314a245632a85ba5f310e8d86937091886d4d (diff)
downloadsldj-2d2f143d248ef9f173f711108feb770efdfe7d21.tar.gz
sldj-2d2f143d248ef9f173f711108feb770efdfe7d21.tar.bz2
sldj-2d2f143d248ef9f173f711108feb770efdfe7d21.zip
Shorter lines
Diffstat (limited to 'src/sldj.c')
-rw-r--r--src/sldj.c35
1 files changed, 23 insertions, 12 deletions
diff --git a/src/sldj.c b/src/sldj.c
index 08dd1b9..5f66c95 100644
--- a/src/sldj.c
+++ b/src/sldj.c
@@ -11,7 +11,8 @@ void initSldj(Sldj *sldj)
SetTargetFPS(DEFAULT_FRAME_RATE);
sldj->targetFps = DEFAULT_FRAME_RATE;
- sldj->viewport = LoadRenderTexture(DEFAULT_SCREEN_WIDTH, DEFAULT_SCREEN_HEIGHT);
+ sldj->viewport = LoadRenderTexture(DEFAULT_SCREEN_WIDTH,
+ DEFAULT_SCREEN_HEIGHT);
sldj->frameCounter = 0;
sldj->xCount = UINT16_MAX / DEFAULT_SCREEN_WIDTH;
sldj->yCount = UINT16_MAX / DEFAULT_SCREEN_HEIGHT;
@@ -55,20 +56,24 @@ void updateGui(Sldj* sldj)
if (sldj->gui.fpsSliderValue != oldFps)
{
sldj->targetFps = (uint32_t)sldj->gui.fpsSliderValue;
- sldj->targetFps = sldj->targetFps > FRAME_RATE_MAX ? 0 : sldj->targetFps;
+ sldj->targetFps =
+ sldj->targetFps > FRAME_RATE_MAX ? 0 : sldj->targetFps;
SetTargetFPS(sldj->targetFps);
}
// Width and height.
- GuiSlider(sldj->gui.widthSlider, "Width", TextFormat("%d", (int)sldj->gui.widthSliderValue),
- &sldj->gui.widthSliderValue, SCREEN_MIN, SCREEN_MAX);
- GuiSlider(sldj->gui.heightSlider, "Height", TextFormat("%d", (int)sldj->gui.heightSliderValue),
- &sldj->gui.heightSliderValue, SCREEN_MIN, SCREEN_MAX);
+ GuiSlider(sldj->gui.widthSlider, "Width",
+ TextFormat("%d",(int)sldj->gui.widthSliderValue),
+ &sldj->gui.widthSliderValue, SCREEN_MIN, SCREEN_MAX);
+ GuiSlider(sldj->gui.heightSlider, "Height",
+ TextFormat("%d", (int)sldj->gui.heightSliderValue),
+ &sldj->gui.heightSliderValue, SCREEN_MIN, SCREEN_MAX);
if (GuiButton(sldj->gui.viewportButton, "Reset view"))
{
- resetViewport(sldj, sldj->gui.widthSliderValue, sldj->gui.heightSliderValue);
+ resetViewport(sldj,
+ sldj->gui.widthSliderValue, sldj->gui.heightSliderValue);
resizeGui(sldj);
}
}
@@ -93,7 +98,9 @@ void updateSldj(Sldj* sldj)
for (int x = 0; x < sldj->viewport.texture.width; ++x)
{
- DrawPixel(x, y, sldj->scripting.lineScanner(xScan, yScan, sldj->frameCounter));
+ DrawPixel(x, y,
+ sldj->scripting.lineScanner(
+ xScan, yScan, sldj->frameCounter));
xScan += sldj->xCount;
}
@@ -147,15 +154,19 @@ void resizeGui(Sldj* sldj)
sldj->gui.fpsSlider = (Rectangle){startX, startY, sliderWidth, guiHeight};
- sldj->gui.widthSlider = (Rectangle){startX, startY + guiHeight, sliderWidth, guiHeight};
- sldj->gui.heightSlider = (Rectangle){startX, startY + guiHeight * 2.0, sliderWidth, guiHeight};
- sldj->gui.viewportButton = (Rectangle){startX, startY + guiHeight * 3.0, guiWidth * 2.0, guiHeight};
+ sldj->gui.widthSlider = (Rectangle){startX, startY + guiHeight,
+ sliderWidth, guiHeight};
+ sldj->gui.heightSlider = (Rectangle){startX, startY + guiHeight * 2.0,
+ sliderWidth, guiHeight};
+ sldj->gui.viewportButton = (Rectangle){startX, startY + guiHeight * 3.0,
+ guiWidth * 2.0, guiHeight};
}
void resetViewportRect(Sldj* sldj, float scale)
{
Texture texture = sldj->viewport.texture;
- sldj->viewPortRect = (Rectangle){0.0, 0.0, texture.width * scale, texture.height * scale};
+ sldj->viewPortRect = (Rectangle){0.0, 0.0, texture.width * scale,
+ texture.height * scale};
}
void resetViewport(Sldj* sldj, int width, int height)