The third chapter of software engineering iterative development

Source: Internet
Author: User

Today, the contents of the previous user interface display are assembled into a function, and the status bar of the role in the upper left corner of the screen is added, and the state of magic is added. Interface with the following:

Because there is no skill, magic is not reduced. This is also to prepare for the ability to join later. The gray box in the picture is the avatar frame, and the gray square is the default avatar.

The integration code is as follows:

/*drawing the UI interface*/voidPlayer::p aintui () {//calculate the x, Y value of the user interface    Doublex, y; X=WX; Y=WY; if(X <1) x=1; Else if(X > Mapmax-1) x= Mapmax-1; if(Y <1) y=1; Else if(Y > Mapmax-1) y= Mapmax-1; /*below is the show Experience bar module*/    //Show Experience BoxGLCOLOR3F (0.8,0.8,0.8);    Glbegin (Gl_polygon); GLVERTEX2F (x-1, Y-0.982); GLVERTEX2F (x+1, Y-0.982); GLVERTEX2F (x+1, Y-1); GLVERTEX2F (x-1, Y-1);    Glend (); glcolor3f (0.6,0.2,1); //Show Experience BarGLRECTF (X-1, Y-0.985, X-1+ ((Double) Exp/(Double) maxexp) *2, Y-0.998); /*show the XP strip module ends here.*/    /*below is the top left corner of the screen showing the Avatar and the Blood volume box*/    //Draw the Avatar frameGLCOLOR3F (1,1,1);    Glbegin (Gl_line_loop); GLVERTEX2F (x-0.96, Y +0.925); GLVERTEX2F (x-0.83, Y +0.925); GLVERTEX2F (x-0.83, Y +0.73); GLVERTEX2F (x-0.96, Y +0.73);    Glend (); //Picture Status box (blood bars, etc.)//Blood StripsGLCOLOR3F (1,1,1);    Glbegin (Gl_line_loop); GLVERTEX2F (x-0.83, Y +0.925); GLVERTEX2F (x-0.5, Y +0.925); GLVERTEX2F (x-0.5, Y +0.85); GLVERTEX2F (x-0.83, Y +0.85);    Glend (); //Magic BarGLCOLOR3F (1,1,1);    Glbegin (Gl_line_loop); GLVERTEX2F (x-0.83, Y +0.85); GLVERTEX2F (x-0.5, Y +0.85); GLVERTEX2F (x-0.5, Y +0.78); GLVERTEX2F (x-0.83, Y +0.78);    Glend (); //status bar (add)    /*Top left corner avatar Frame module display complete*/    /*below is the top left corner of the screen showing the avatar and the amount of blood*/    //Picture PortraitGLCOLOR3F (0.7,0.7,0.7);    Glbegin (Gl_polygon); GLVERTEX2F (x-0.959, Y +0.924); GLVERTEX2F (x-0.8305, Y +0.924); GLVERTEX2F (x-0.8305, Y +0.731); GLVERTEX2F (x-0.959, Y +0.731);    Glend (); //draw the actual blood barGLCOLOR3F (1,0,0);    Glbegin (Gl_polygon); GLVERTEX2F (x-0.829, Y +0.924); GLVERTEX2F (x-0.829+ (HP/MAXHP) *0.3285, Y +0.924); GLVERTEX2F (x-0.829+ (HP/MAXHP) *0.3285, Y +0.851); GLVERTEX2F (x-0.829, Y +0.851);    Glend (); //draw the actual magic barGLCOLOR3F (0,0,1);    Glbegin (Gl_polygon); GLVERTEX2F (x-0.829, Y +0.849); GLVERTEX2F (x-0.829+ (MP/MAXMP) *0.3285, Y +0.849); GLVERTEX2F (x-0.829+ (MP/MAXMP) *0.3285, Y +0.781); GLVERTEX2F (x-0.829, Y +0.781);    Glend (); /*Portrait and blood volume display complete*/    /*displays the amount of blood and mana value*/    //show the amount of blood    Charbuf[ -]; glcolor3f (1,1,1); sprintf (BUF,"%.0LF/%.0LF", HP, MAXHP); GLRASTERPOS2F (x-0.69, Y +0.877);    DrawString (BUF); //Show MagicGLCOLOR3F (1,1,1); sprintf (BUF,"%.0LF/%.0LF", MP, MAXMP); GLRASTERPOS2F (x-0.69, Y +0.805);    DrawString (BUF); //Display LevelGLCOLOR3F (1,1,1); sprintf (BUF,"lv:%d", LV); GLRASTERPOS2F (x-0.915, Y +0.68);    DrawString (BUF); /*Show status Values complete*/}

Since all the user interfaces follow the camera, it's easy to figure out what's left of the picture, just by calculating the angle of view at the beginning. It takes time just to try out the position and size.

As for the MP and MAXMP two how to add only to see the final version, because the changes are too many places.

Of course, today also fixed a bug, that is, when the user killed the blame only after the client gained experience, the server did not calculate the added experience. There's no way to show this. Here's the code:

// Query the user who killed this monster list<client>:: iterator it3;  for (it3 = Cl1.begin (); It3! = Cl1.end (); it3++)     {if (id = = it3->p.id         ) {break;     }} It3->p.exp + = Getexp;            // Plus Experience

This is implemented in the Monster.cpp of the server. Service side when the monster is killed will regenerate a new monster, that is, at this time to kill this strange player plus corresponding experience. We find the corresponding player in the player list by the ID of the player who killed the monster, adding his experience.

In addition to the characters of the character offline record (we are now writing to TXT), due to the addition of an MP attribute, need to modify a little more places, I have not completely changed, so in the re-login when the user's MP will have some problems. Tomorrow will focus on solving this problem.

The third chapter of software engineering iterative development

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.