fast-nuclear-sim/src/main.cpp

53 lines
983 B
C++
Raw Normal View History

2024-01-13 15:21:17 +11:00
2024-01-24 22:01:33 +11:00
#include <sys/time.h>
2024-01-25 00:35:39 +11:00
#include <random>
#include <iostream>
#include <cmath>
#include "reactor/builder.hpp"
#include "reactor/control/control_rod.hpp"
#include "reactor/fuel/fuel_rod.hpp"
#include "reactor/coolant/pipe.hpp"
#include "reactor/coolant/heater.hpp"
#include "reactor/coolant/vessel.hpp"
#include "coolant/fluid_t.hpp"
#include "coolant/valve.hpp"
#include "coolant/pump.hpp"
2024-01-21 01:36:21 +11:00
#include "graphics/window.hpp"
2024-01-24 22:01:33 +11:00
#include "graphics/camera.hpp"
2024-01-13 15:21:17 +11:00
2024-01-21 01:36:21 +11:00
using namespace sim;
2024-01-13 21:54:21 +11:00
2024-01-24 22:01:33 +11:00
unsigned long get_now()
{
struct timeval tv;
gettimeofday(&tv, nullptr);
return (unsigned long)tv.tv_sec * 1000000 + tv.tv_usec;
}
2024-01-13 15:21:17 +11:00
int main()
{
2024-01-25 00:35:39 +11:00
std::random_device rd;
std::mt19937 rand(rd());
2024-01-21 01:36:21 +11:00
graphics::window::create();
2024-01-14 23:44:36 +11:00
2024-01-24 22:01:33 +11:00
long clock = get_now();
2024-01-21 01:36:21 +11:00
while(!graphics::window::should_close())
2024-01-13 15:21:17 +11:00
{
2024-01-24 22:01:33 +11:00
long now = get_now();
long passed = now - clock;
double dt = (double)passed / 1e6;
clock += passed;
graphics::camera::update(dt);
2024-01-21 01:36:21 +11:00
graphics::window::loop();
2024-01-13 15:21:17 +11:00
}
2024-01-21 01:36:21 +11:00
graphics::window::destroy();
2024-01-13 15:21:17 +11:00
}