2019-04-24 11:44:08 +03:00
|
|
|
#include <math.h>
|
|
|
|
#include "raylib.h"
|
|
|
|
|
|
|
|
int main() {
|
2019-08-03 12:07:41 +03:00
|
|
|
int screenWidth = 800;
|
|
|
|
int screenHeight = 450;
|
2019-04-24 11:44:08 +03:00
|
|
|
|
2019-08-03 12:07:41 +03:00
|
|
|
InitWindow(screenWidth, screenHeight, "raylib");
|
2019-04-24 11:44:08 +03:00
|
|
|
|
2019-08-03 12:07:41 +03:00
|
|
|
Camera cam;
|
2020-10-05 21:19:18 +03:00
|
|
|
cam.position = (Vector3){ 0.0f, 10.0f, 8.f };
|
|
|
|
cam.target = (Vector3){ 0.0f, 0.0f, 0.0f };
|
|
|
|
cam.up = (Vector3){ 0.0f, 1.f, 0.0f };
|
|
|
|
cam.fovy = 60.0f;
|
2019-04-24 11:44:08 +03:00
|
|
|
|
2020-10-05 21:19:18 +03:00
|
|
|
Vector3 cubePos = { 0.0f, 0.0f, 0.0f };
|
2019-04-24 11:44:08 +03:00
|
|
|
|
2019-08-03 12:07:41 +03:00
|
|
|
SetTargetFPS(60);
|
2019-04-24 11:44:08 +03:00
|
|
|
|
2019-08-03 12:07:41 +03:00
|
|
|
while (!WindowShouldClose()) {
|
2020-10-05 21:19:18 +03:00
|
|
|
cam.position.x = sin(GetTime()) * 10.0f;
|
|
|
|
cam.position.z = cos(GetTime()) * 10.0f;
|
2019-04-24 11:44:08 +03:00
|
|
|
|
2019-08-03 12:07:41 +03:00
|
|
|
BeginDrawing();
|
|
|
|
ClearBackground(RAYWHITE);
|
|
|
|
BeginMode3D(cam);
|
|
|
|
DrawCube(cubePos, 2.f, 2.f, 2.f, RED);
|
|
|
|
DrawCubeWires(cubePos, 2.f, 2.f, 2.f, MAROON);
|
|
|
|
DrawGrid(10, 1.f);
|
|
|
|
EndMode3D();
|
|
|
|
DrawText("This is a raylib example", 10, 40, 20, DARKGRAY);
|
|
|
|
DrawFPS(10, 10);
|
|
|
|
EndDrawing();
|
|
|
|
}
|
|
|
|
|
|
|
|
CloseWindow();
|
|
|
|
return 0;
|
2019-04-24 11:44:08 +03:00
|
|
|
}
|