models_geometric_shapes.bmx 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. SuperStrict
  2. Framework Ray.Lib
  3. ' Initialization
  4. '--------------------------------------------------------------------------------------
  5. Const screenWidth:Int = 800
  6. Const screenHeight:Int = 450
  7. InitWindow(screenWidth, screenHeight, "raylib [models] example - geometric shapes")
  8. ' Define the camera to look into our 3d world
  9. Local camera:RCamera
  10. camera.position = New RVector3(0.0, 10.0, 10.0)
  11. camera.target = New RVector3(0.0, 0.0, 0.0)
  12. camera.up = New RVector3(0.0, 1.0, 0.0)
  13. camera.fovy = 45.0
  14. camera.projection = CAMERA_PERSPECTIVE
  15. SetTargetFPS(60) ' Set our game to run at 60 frames-per-second
  16. '--------------------------------------------------------------------------------------
  17. ' Main game loop
  18. While Not WindowShouldClose() ' Detect window close button or ESC key
  19. ' Update
  20. '----------------------------------------------------------------------------------
  21. ' TODO: Update your variables here
  22. '----------------------------------------------------------------------------------
  23. ' Draw
  24. '----------------------------------------------------------------------------------
  25. BeginDrawing()
  26. ClearBackground(RAYWHITE)
  27. BeginMode3D(camera)
  28. DrawCube(New RVector3(-4.0, 0.0, 2.0), 2.0, 5.0, 2.0, RED)
  29. DrawCubeWires(New RVector3(-4.0, 0.0, 2.0), 2.0, 5.0, 2.0, GOLD)
  30. DrawCubeWires(New RVector3(-4.0, 0.0, -2.0), 3.0, 6.0, 2.0, MAROON)
  31. DrawSphere(New RVector3(-1.0, 0.0, -2.0), 1.0, GREEN)
  32. DrawSphereWires(New RVector3(1.0, 0.0, 2.0), 2.0, 16, 16, LIME)
  33. DrawCylinder(New RVector3(4.0, 0.0, -2.0), 1.0, 2.0, 3.0, 4, SKYBLUE)
  34. DrawCylinderWires(New RVector3(4.0, 0.0, -2.0), 1.0, 2.0, 3.0, 4, DARKBLUE)
  35. DrawCylinderWires(New RVector3(4.5, -1.0, 2.0), 1.0, 1.0, 2.0, 6, BROWN)
  36. DrawCylinder(New RVector3(1.0, 0.0, -4.0), 0.0, 1.5, 3.0, 8, GOLD)
  37. DrawCylinderWires(New RVector3(1.0, 0.0, -4.0), 0.0, 1.5, 3.0, 8, PINK)
  38. DrawCapsule(New RVector3(-3.0, 1.5, -4.0), New RVector3(-4.0, -1.0, -4.0), 1.2, 8, 8, VIOLET)
  39. DrawCapsuleWires(New RVector3(-3.0, 1.5, -4.0), New RVector3(-4.0, -1.0, -4.0), 1.2, 8, 8, PURPLE)
  40. DrawGrid(10, 1.0) ' Draw a grid
  41. EndMode3D()
  42. DrawFPS(10, 10)
  43. EndDrawing()
  44. '----------------------------------------------------------------------------------
  45. Wend
  46. ' De-Initialization
  47. '--------------------------------------------------------------------------------------
  48. CloseWindow() ' Close window and OpenGL context
  49. '--------------------------------------------------------------------------------------