TextureRegion.java
Go to the documentation of this file.
00001 package uk.co.blogspot.fractiousg.texample;
00002 
00003 class TextureRegion {
00004 
00005    //--Members--//
00006    public float u1, v1;                               // Top/Left U,V Coordinates
00007    public float u2, v2;                               // Bottom/Right U,V Coordinates
00008 
00009    //--Constructor--//
00010    // D: calculate U,V coordinates from specified texture coordinates
00011    // A: texWidth, texHeight - the width and height of the texture the region is for
00012    //    x, y - the top/left (x,y) of the region on the texture (in pixels)
00013    //    width, height - the width and height of the region on the texture (in pixels)
00014    public TextureRegion(float texWidth, float texHeight, float x, float y, float width, float height)  {
00015       this.u1 = x / texWidth;                         // Calculate U1
00016       this.v1 = y / texHeight;                        // Calculate V1
00017       this.u2 = this.u1 + ( width / texWidth );       // Calculate U2
00018       this.v2 = this.v1 + ( height / texHeight );     // Calculate V2
00019    }
00020 }


android_core
Author(s): Damon Kohler
autogenerated on Thu Jun 6 2019 21:20:07