openarras/main.cpp
2023-05-30 21:03:04 +08:00

33 lines
698 B
C++

#include "2d.h"
#include "render.h"
#include <chrono>
#include <thread>
#include <cmath>
int main() {
arras::RenderWindow w(2360, 1240);
arras::RenderTexture t(w, SDL_RWFromFile("assets/basic.png", "rb"));
std::printf("%d %d\n", t.width(), t.height());
const float PI = acos(-1);
arras::Vec2 d{1, 0}, v{std::cos(PI / 300), std::sin(PI / 300)};
SDL_Event evt;
while (true) {
while (SDL_PollEvent(&evt)) {
if (evt.type == SDL_QUIT) {
break;
}
}
w.clear();
w.renderTextureAt(t, {200, 200}, d);
w.present();
d *= v;
// pos += v;
// if (pos.real() > 1000 || pos.real() < 200) {
// v *= -1;
// }
std::this_thread::sleep_for(std::chrono::milliseconds(16));
}
}