61 lines
1.5 KiB
C#
61 lines
1.5 KiB
C#
using Raylib_cs;
|
|
|
|
namespace PhysicsEngine
|
|
{
|
|
class Program
|
|
{
|
|
static void Main(string[] args)
|
|
{
|
|
const int screenWidth = 1280;
|
|
const int screenHeight = 720;
|
|
|
|
Raylib.InitWindow(screenWidth, screenHeight, "Fysikmotor & Sandlåda");
|
|
Raylib.SetTargetFPS(144);
|
|
|
|
const float physicsTimeStep = 1.0f / 60.0f;
|
|
float accumulator = 0.0f;
|
|
|
|
// Main loop
|
|
while (!Raylib.WindowShouldClose())
|
|
{
|
|
float frameTime = Raylib.GetFrameTime();
|
|
|
|
if (frameTime > 0.25f)
|
|
{
|
|
frameTime = 0.25f;
|
|
}
|
|
|
|
accumulator += frameTime;
|
|
|
|
// Update loop
|
|
while (accumulator >= physicsTimeStep)
|
|
{
|
|
UpdatePhysics(physicsTimeStep);
|
|
accumulator -= physicsTimeStep;
|
|
}
|
|
|
|
// Render loop
|
|
Raylib.BeginDrawing();
|
|
Raylib.ClearBackground(Color.RayWhite);
|
|
|
|
// Draw
|
|
RenderScene();
|
|
|
|
Raylib.EndDrawing();
|
|
}
|
|
|
|
// Close
|
|
Raylib.CloseWindow();
|
|
}
|
|
|
|
private static void UpdatePhysics(float dt)
|
|
{
|
|
|
|
}
|
|
|
|
private static void RenderScene()
|
|
{
|
|
Raylib.DrawText("Physics Engine", 20, 20, 20, Color.DarkGray);
|
|
}
|
|
}
|
|
} |