To create a reference that facilitates converting between YAML-style pseudocode and AGK code, we need to map each YAML element directly to its corresponding AGK function or statement. This will allow you to see how each part of the configuration in YAML translates into AGK BASIC code.

Here’s how you can structure this conversion reference:

YAML to AGK Code Conversion Reference

YAML Representation

 
yaml

Copy code

camera:
  id: 1
  position:
    x: 10
    y: 10
    z: 10
  look_at:
    x: 0
    y: 0
    z: 0
  rotation:
    x: 35.264
    y: 45.0
    z: 0
 

Corresponding AGK BASIC Code

 
basic

Copy code

// Initialize the 3D camera
SetCameraPosition(1, 10, 10, 10) // Position the camera at (10, 10, 10)
SetCameraLookAt(1, 0, 0, 0, 0)   // Look at the origin (0, 0, 0)

// Adjust the camera angles
SetCameraRotation(1, 35.264, 45.0, 0) // Rotate to achieve isometric view
 

Conversion Details

  1. Camera ID:

    • YAML: camera: id: 1
    • AGK: The camera ID is specified as the first argument in AGK camera functions: SetCameraPosition(1, ...)SetCameraLookAt(1, ...), and SetCameraRotation(1, ...).
  2. Camera Position:

    • YAML: position: x: 10, y: 10, z: 10
    • AGK: Use the SetCameraPosition function with the camera ID followed by the position coordinates: SetCameraPosition(1, 10, 10, 10).
  3. Camera Look-at Point:

    • YAML: look_at: x: 0, y: 0, z: 0
    • AGK: Use the SetCameraLookAt function with the camera ID followed by the coordinates of the look-at point: SetCameraLookAt(1, 0, 0, 0, 0).
  4. Camera Rotation:

    • YAML: rotation: x: 35.264, y: 45.0, z: 0
    • AGK: Use the SetCameraRotation function with the camera ID followed by the rotation angles: SetCameraRotation(1, 35.264, 45.0, 0).

Usage

This reference provides a clear mapping between YAML-style configuration and AGK BASIC code, making it easier to transition from a structured configuration format to executable code. When using this conversion in practice, ensure that the AGK functions are called in the correct order to properly initialize and configure the camera settings.

Last modified: Tuesday, 10 December 2024, 6:13 AM