GSDP:GAM100/CProcessing/screenToWorld()

From Inside
Jump to: navigation, search

screenToWorld()

Description

Takes an input coordinate in screen space and transforms it to world coordinates.

Parameters

screenToWorld(float xIn, float yIn, float* xOut, float* yOut)

  • xIn - (float) The x coordinate to convert.
  • yIn - (float) The y coordinate to convert.
  • xOut - (float*) The place to store the converted x coordinate.
  • yOut - (float*) The place to store the converted y coordinate.

Example

void init()
{
    // Variables to pass into the conversion functions
    float x = PI;
    float y = PI;

    // Run back and forth 100 times
    for (int i = 0; i < 100; ++i)
    {
        screenToWorld(x, y, &x, &y);
        worldToScreen(x, y, &x, &y);
    }

    // Should still be PI
    printf(" %9f\n(%9f,%9f)\n", PI, x, y);
}

Related

Personal tools
Namespaces

Variants
Actions
Navigation
NameSpaces:>
Tools
Dynamic:>