ajoute struc michelson + test draw michelson
This commit is contained in:
33
main.c
33
main.c
@ -1,11 +1,44 @@
|
|||||||
#include "raylib.h"
|
#include "raylib.h"
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
float d1;
|
||||||
|
float d2;
|
||||||
|
float lambda;
|
||||||
|
float angleM2;
|
||||||
|
Vector2 center;
|
||||||
|
} Michelson;
|
||||||
|
|
||||||
|
void DrawMichelsonSchema (Michelson *michelson) {
|
||||||
|
Vector2 center = { 400.0f, 300.0f };
|
||||||
|
Vector2 originM2 = { 5.0f, 30.0f };
|
||||||
|
Rectangle recM2 = {center.x + michelson->d2, center.y, 7.0f, 100.0f};
|
||||||
|
DrawRectanglePro(recM2, originM2, michelson->angleM2, WHITE);
|
||||||
|
}
|
||||||
|
|
||||||
int main () {
|
int main () {
|
||||||
InitWindow(1200, 800, "Interféromètre de Michelson");
|
InitWindow(1200, 800, "Interféromètre de Michelson");
|
||||||
SetTextLineSpacing(144);
|
SetTextLineSpacing(144);
|
||||||
|
|
||||||
|
Michelson *michelson = (Michelson*)malloc(sizeof(Michelson));
|
||||||
|
michelson->d1 = 100;
|
||||||
|
michelson->d2 = 100;
|
||||||
|
michelson->lambda = 450;
|
||||||
|
michelson->angleM2 = 45;
|
||||||
|
|
||||||
while (!WindowShouldClose()) {
|
while (!WindowShouldClose()) {
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
ClearBackground(BLACK);
|
ClearBackground(BLACK);
|
||||||
|
DrawText("Interféromètre de Michelson", 100, 10, 25, WHITE);
|
||||||
|
|
||||||
|
DrawMichelsonSchema(michelson);
|
||||||
|
|
||||||
|
/*
|
||||||
|
DrawLine(0, 0, 120 , 120, WHITE);
|
||||||
|
Vector2 start = {120.0f, 120.0f};
|
||||||
|
Vector2 end = {500.0f, 500.0f};
|
||||||
|
DrawLineEx(start, end, 6.0f, WHITE);
|
||||||
|
*/
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
}
|
}
|
||||||
CloseWindow();
|
CloseWindow();
|
||||||
|
|||||||
Reference in New Issue
Block a user