Texture2D and Variables

Why doesn’t the DrawText function work as intended here? Just to be clear, the actual location and game mechanics work as intended. It’s just the displayed DrawText variables aren’t showing correctly.

    // Player Variables
    Texture2D tPlayer = LoadTexture("textures/scarfy.png");
    Rectangle rPlayer;
        rPlayer.width = tPlayer.width/6;
        rPlayer.height = tPlayer.height;
        rPlayer.x = 0;
        rPlayer.y = 0;
    Vector2 vPlayerPos;
        vPlayerPos.x = (iWindowResX/2) - (rPlayer.width/2);
        vPlayerPos.y = iWindowResY - rPlayer.height - iBoundsDepth; 

Above is a snippet from the player variables.

        // Debugging Overlay
        ("iWindowResX(%i) iWindowResY(%i) iMainFPS(%i)\niPrevDelta(%i) iCurDelta(%i) iDelta(%i)\nvPlayerPos.x(%i) vPlayerPos.y(%i)", 
        iWindowResX, iWindowResY, iMainFPS, iPrevDelta, iCurDelta, iDelta, vPlayerPos.x, vPlayerPos.y), 
                            10, 10, 20, LIGHTGRAY);

When I DrawText() the vPlayerPos.x and vPlayerPos.y on screen, X always returns as 0 and Y returns some number over 1 trillion. Why doesn’t it return the apropriate position the character is actually located (within the iWindowResX and iWindowResY) at?

Try switching the %i to %f

Ahh. I didn’t even think it could be a float. I just added int (vPlayerPos.x) so that I can get a shorter HUD number and it works well.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms