Update Doppelspaltapp

This commit is contained in:
2024-06-11 17:28:28 +02:00
parent 683f7dd54b
commit 6ae0ef27c8
5 changed files with 53 additions and 11086 deletions
+4
View File
@@ -6,4 +6,8 @@ nob.old
Doppelspaltapp-Linux-x86-64 Doppelspaltapp-Linux-x86-64
main main
Makefile Makefile
*.exe
*.zip
include/
lib/
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
Binary file not shown.
+49 -6
View File
@@ -1,7 +1,8 @@
// DoppelspaltApp.c // DoppelspaltApp.c
#include <raylib.h> #include "raylib.h"
#include <raymath.h> #include "raymath.h"
#include <stdlib.h>
#include <assert.h> #include <assert.h>
typedef struct { typedef struct {
@@ -21,6 +22,9 @@ static int active_id = -1;
#define SLIDER_THICKNESS 20.0f #define SLIDER_THICKNESS 20.0f
#define SLIDER_GRIP_SIZE 10.0f #define SLIDER_GRIP_SIZE 10.0f
#define M_PI 3.14159
// Helper functions for clamping and interpolation // Helper functions for clamping and interpolation
static float clampf(float value, float min, float max) { static float clampf(float value, float min, float max) {
return (value < min) ? min : (value > max) ? max : value; return (value < min) ? min : (value > max) ? max : value;
@@ -75,7 +79,6 @@ static void slider(int id, Rectangle bounds, float *value, float min, float max,
void DrawKugelwelle(int x, int y, int breite, int hoehe, AppState* state, Color color) { void DrawKugelwelle(int x, int y, int breite, int hoehe, AppState* state, Color color) {
const int apertur = 90;
int s0; int s0;
double phi = (state->winkel - 90) * PI / 180.0; double phi = (state->winkel - 90) * PI / 180.0;
@@ -329,6 +332,8 @@ int main(void) {
//int windowBoxHeight = GetScreenWidth() / 8; //int windowBoxHeight = GetScreenWidth() / 8;
int windowBoxHeight = 150; int windowBoxHeight = 150;
// Define ratios based on the provided values // Define ratios based on the provided values
float ratioSpacing = 6.0f / windowBoxHeight; // Ratio for slider spacing float ratioSpacing = 6.0f / windowBoxHeight; // Ratio for slider spacing
float ratioHeight = 20.0f / windowBoxHeight; // Ratio for slider height float ratioHeight = 20.0f / windowBoxHeight; // Ratio for slider height
@@ -343,6 +348,39 @@ int main(void) {
int sliderBeginY = (int)(ratioBeginY * windowBoxHeight); int sliderBeginY = (int)(ratioBeginY * windowBoxHeight);
Rectangle windowBoxBounds = {0.0f, (float)(GetScreenHeight() - windowBoxHeight), (float)GetScreenWidth(), (float)windowBoxHeight};
Rectangle boundsLambda = { (float)sliderBeginY, windowBoxBounds.y, windowBoxBounds.width - (float)displayText - (float)sliderBeginY, (float)(sliderHeight - windowBoxHeight / 3)};
Rectangle boundsD = { (float)sliderBeginY, boundsLambda.y + (float)sliderHeight + (float)sliderSpacing, windowBoxBounds.width - (float)displayText - (float)sliderBeginY, (float)(sliderHeight - windowBoxHeight / 3)};
Rectangle boundsWinkel = { (float)sliderBeginY, boundsD.y + (float)sliderHeight + (float)sliderSpacing, windowBoxBounds.width - (float)displayText - (float)sliderBeginY, (float)(sliderHeight - windowBoxHeight / 3)};
/*
// Define bounds for the window box (bottom of the screen) // Define bounds for the window box (bottom of the screen)
Rectangle windowBoxBounds = {0, GetScreenHeight() - windowBoxHeight, GetScreenWidth(), windowBoxHeight}; Rectangle windowBoxBounds = {0, GetScreenHeight() - windowBoxHeight, GetScreenWidth(), windowBoxHeight};
@@ -351,7 +389,7 @@ int main(void) {
Rectangle boundsD = { sliderBeginY, boundsLambda.y + sliderHeight + sliderSpacing, windowBoxBounds.width - displayText - sliderBeginY, sliderHeight - windowBoxHeight / 3 }; Rectangle boundsD = { sliderBeginY, boundsLambda.y + sliderHeight + sliderSpacing, windowBoxBounds.width - displayText - sliderBeginY, sliderHeight - windowBoxHeight / 3 };
Rectangle boundsWinkel = { sliderBeginY, boundsD.y + sliderHeight + sliderSpacing, windowBoxBounds.width - displayText - sliderBeginY, sliderHeight - windowBoxHeight / 3 }; Rectangle boundsWinkel = { sliderBeginY, boundsD.y + sliderHeight + sliderSpacing, windowBoxBounds.width - displayText - sliderBeginY, sliderHeight - windowBoxHeight / 3 };
*/
// Werte in AppState aktualisieren // Werte in AppState aktualisieren
state.lambda = (int)valueLambda; state.lambda = (int)valueLambda;
@@ -364,6 +402,7 @@ int main(void) {
/*
Rectangle whiteRect = { Rectangle whiteRect = {
.x = 0, .x = 0,
.y = 0, .y = 0,
@@ -371,8 +410,12 @@ int main(void) {
.width = GetScreenWidth() / 3, .width = GetScreenWidth() / 3,
}; };
*/
Rectangle whiteRect;
whiteRect.x = 0;
whiteRect.y = 0;
whiteRect.height = GetScreenHeight();
whiteRect.width = GetScreenWidth() / 3;