Today, the entire play interface has been updated to learn how to load images in two-dimensional textures.
The final interface is as follows:
The following 10 boxes, the left five is the skill bar, the right five is a prop. These two need to wait until the integration to reflect.
Implementation method:
Load an interface diagram drawn by our artwork into the program and draw it with OpenGL.
The two-dimensional texture loading from OpenGL is drawn.
To load a picture in init:
// loading the user interface P1.LOAD_UI (Atlloadtexture ("res/hp.png"));
This is the LOAD_UI () function:
void PLAYER::LOAD_UI (int i) { = i;}
is to pass an ID into the player.
The Drawing UI interface function in player adds a new piece:
Glenable (Gl_blend);//set the background to be transparentGlenable (gl_texture_2d);//enable two-dimensional texturesGlbindtexture (gl_texture_2d, UIID);//Binding TexturesGlbegin (gl_quads); GLTEXCOORD2F (0,0); GLVERTEX2F (X-1, Y-1); GLTEXCOORD2F (0,1); GLVERTEX2F (X-1, Y +1); GLTEXCOORD2F (1,1); GLVERTEX2F (x +1, Y +1); GLTEXCOORD2F (1,0); GLVERTEX2F (x +1, Y-1); Glend (); gldisable (gl_texture_2d); gldisable (gl_blend) ;
Then, according to the position of the box, change the position parameters such as head, Blood bar and experience bar.
The sixth chapter of software engineering iterative development