added compile for windows machines
This commit is contained in:
22
main.cpp
22
main.cpp
@@ -15,22 +15,23 @@ void handleRightClick(Camera3D camera, Vector3* target_position) {
|
||||
}
|
||||
|
||||
int main() {
|
||||
InitWindow(900, 600, "My First 3D Cube");
|
||||
InitWindow(1920, 1080, "My First 3D Cube");
|
||||
|
||||
Camera3D camera = {0};
|
||||
camera.position = (Vector3){10.0f, 10.0f, 10.0f};
|
||||
camera.target = (Vector3){0.0f, 0.0f, 0.0f};
|
||||
camera.position = (Vector3){0.0f, 20.0f, -15.0f};
|
||||
camera.target = (Vector3){0.0f, 0.0f, 5.0f};
|
||||
camera.up = (Vector3){0.0f, 2.0f, 0.0f};
|
||||
camera.fovy = 90.0f;
|
||||
camera.projection = CAMERA_PERSPECTIVE;
|
||||
//camera.projection = CAMERA_ORTHOGRAPHIC;
|
||||
|
||||
Vector3 cube_position = {0, 1.0, 0};
|
||||
Vector3 target_position = {0, 0, 0};
|
||||
float move_speed = 0.001f;
|
||||
float move_speed = 0.005f;
|
||||
|
||||
while (!WindowShouldClose()) {
|
||||
|
||||
if (IsMouseButtonPressed(MOUSE_BUTTON_RIGHT)) {
|
||||
if (IsMouseButtonDown(MOUSE_BUTTON_RIGHT)) {
|
||||
handleRightClick(camera, &target_position);
|
||||
}
|
||||
|
||||
@@ -44,20 +45,19 @@ int main() {
|
||||
if (distance < move_speed) {
|
||||
cube_position.x = target_position.x;
|
||||
cube_position.z = target_position.z;
|
||||
continue;
|
||||
} else {
|
||||
cube_position.x += (xdiff/distance) * move_speed;
|
||||
cube_position.z += (zdiff/distance) * move_speed;
|
||||
}
|
||||
|
||||
cube_position.x += (xdiff/distance) * move_speed;
|
||||
cube_position.z += (zdiff/distance) * move_speed;
|
||||
}
|
||||
|
||||
BeginDrawing();
|
||||
ClearBackground((Color){0, 0, 0, 0});
|
||||
|
||||
BeginMode3D(camera);
|
||||
DrawPlane((Vector3){0, 0, 0}, (Vector2) {500, 500}, BLUE);
|
||||
DrawPlane((Vector3){0, 0, 0}, (Vector2) {500, 500}, (Color){0, 20, 100, 100});
|
||||
DrawCube(cube_position, 2.0f, 2.0f, 2.0f, RED);
|
||||
//DrawGrid(100, 1.0f);
|
||||
//DrawGrid(400, 1.0f);
|
||||
EndMode3D();
|
||||
|
||||
EndDrawing();
|
||||
|
||||
Reference in New Issue
Block a user