zoom speed

This commit is contained in:
2025-12-28 17:13:38 +01:00
parent a82295ee6b
commit d474c0e670
2 changed files with 6 additions and 5 deletions

11
main.c
View File

@ -271,7 +271,7 @@ void DrawControlPanel(Michelson *mic) {
DrawRectangleLinesEx(spectrumRect, 1, GRAY);
Vector2 mousePos = GetMousePosition();
float stepLambda = speedMode ? 10.0f : 1.0f;
float stepLambda = speedMode ? 0.7f : 0.03f;
if (CheckCollisionPointRec(mousePos, spectrumRect)) {
float mouseRatio = (mousePos.x - spectrumRect.x) / spectrumRect.width;
@ -378,7 +378,7 @@ void DrawControlPanel(Michelson *mic) {
DrawText(TextFormat("Position M1 : %.2f um", mic->d1), startX, startY, 20, ORANGE);
// Pas des + et -
float stepD1 = speedMode ? 0.5f : 0.005f;
float stepD1 = speedMode ? 0.05f : 0.0006f;
if (GuiButtonRepeat((Rectangle){startX, startY + 30, btnSize, 25}, "-", shouldRepeat)) mic->d1 -= stepD1;
GuiSlider((Rectangle){startX + btnSize + 5, startY + 30, sliderWidth - 75, 25}, NULL, NULL, &mic->d1, 100, 600);
@ -389,7 +389,7 @@ void DrawControlPanel(Michelson *mic) {
// Angle M1 X
startY += 90;
DrawText(TextFormat("Inclinaison M1: %.3f deg", mic->angleM1), startX, startY, 20, ORANGE);
float stepAngle = speedMode ? 0.05f : 0.001f;
float stepAngle = speedMode ? 0.05f : 0.00006f;
if (GuiButtonRepeat((Rectangle){startX, startY + 30, btnSize, 25}, "-", shouldRepeat)) mic->angleM1 -= stepAngle;
GuiSlider((Rectangle){startX + btnSize + 5, startY + 30, sliderWidth - 75, 25}, 0, 0, &mic->angleM1, -1.0f, 1.0f);
if (GuiButtonRepeat((Rectangle){startX + btnSize + sliderWidth - 65, startY + 30, btnSize, 25}, "+", shouldRepeat)) mic->angleM1 += stepAngle;
@ -397,6 +397,7 @@ void DrawControlPanel(Michelson *mic) {
// Angles M1 Y
startY += 90;
stepAngle = speedMode ? 0.05f : 0.00006f;
DrawText(TextFormat("Inclinaison Y: %.3f deg", mic->angleM1_Y), startX, startY, 20, ORANGE);
if (GuiButtonRepeat((Rectangle){startX, startY + 30, btnSize, 25}, "-", shouldRepeat)) mic->angleM1_Y -= stepAngle;
GuiSlider((Rectangle){startX + btnSize + 5, startY + 30, sliderWidth - 75, 25}, 0, 0, &mic->angleM1_Y, -1.0f, 1.0f);
@ -420,7 +421,7 @@ void DrawControlPanel(Michelson *mic) {
GuiCheckBox((Rectangle){startX, startY + 30, 20, 20}, "Cuve", &mic->gaz);
if (mic->gaz) {
DrawText(TextFormat("n = %.4f", mic->nGaz), startX + 150, startY + 30, 20, WHITE);
float stepN = speedMode ? 0.001f : 0.0001f;
float stepN = speedMode ? 0.001f : 0.00005f;
if (GuiButtonRepeat((Rectangle){startX, startY + 55, btnSize, 25}, "-", shouldRepeat)) mic->nGaz -= stepN;
GuiSlider((Rectangle){startX + btnSize + 5, startY + 55, sliderWidth - 10, 25}, NULL, NULL, &mic->nGaz, 1.000f, 1.100f);
if (GuiButtonRepeat((Rectangle){startX + btnSize + sliderWidth, startY + 55, btnSize, 25}, "+", shouldRepeat)) mic->nGaz += stepN;
@ -452,7 +453,7 @@ void DrawControlPanel(Michelson *mic) {
int main () {
SetConfigFlags(FLAG_MSAA_4X_HINT);
InitWindow(1920, 1080, "Interferometre de Michelson");
SetTargetFPS(10044);
SetTargetFPS(144);
Shader shader = LoadShader(0, "michelson.frag");