Also, in aim to paint on the screen, we are going to use a fonts library. Painting fonts or text in video games can be something easy or something very complicated, in this case we are going to use a library called FW1FontWrapper which you can find on the web, which will allow us to paint text through DirectD2d from DirectX 11. This way we will be able to load fonts we have inside our computer and using the fonts to paint the text with them. To do so, we are going to use this library. Let's go back to the code, we've created a class called D3D11Font, which will encapsulate this library. We have, on one side, the library's include, the static library visualization and destruction media, so if we go to the CPP we can see how it works. We have the font builder, to which we give the device and the name of the font we want to load or create. Then we use Fontwrapper's FW1 factory class method Create in line 7, and in case everything is working fine, we go on. If it isn't working, we will get an on-screen message. Then we see the destroyer, which is going to delete the dynamic memory it has created when it has built this font. That is line 17, and then we get init and release static methods. Init will initialize the fonts library, which calls FW1create_factory, and this is the code which explains this library's SDK, and then we have the release, which will close the library, and what we are interested in is the drawtext which will allow us painting on-screen text where we give it the value, which is the text we want to write in double strings format, which means 2 bytes per character, the screen's XY position and the size of the font we want to use, and the color of the text we want to write, so we will use the double string method from FontWrapper, giving it the parameters we see here. So if you want more information on the web page, on the font, on the library, you can go to the website where you can download both the font code and the whole library, which is a very easily integrated library and which works pretty fine. What we are going to do next is implementing a small GUI screen where we will see the number of deaths and kills both the player and the bots have achieved. To do so, if we go to the bot class, we can see we have created 2 full-type variables which are M_deads and M_kills, M_deads is how many times you have died and M_kills is how many times you have killed. And in the player class we have done exactly the same, M_deads and M_kills. So, in each of these classes' builders e have initialized them at 0, and we have 4 new methods: GetDeads, GetKills, which gives us back the deaths and kills, how many times we killed and died, GetStats method, which gives us back to a string's number with a text, this is the state, and the kills it adds increase by one the number of times we killed, so let's go to the player's CP and see what GetStats does. GetStats simply creates a W string string, a text flow, and this is what we will present on the screen, which is the player, hyphen, number of deaths, hyphen, and number of times he died, number of kills and number of deaths, so what we are going to do is, when the player presses 0, on the screen appears a small GUI which says how many times he died and how many times he killed. This one we have here, bots.cpp, is the same thing but for the other bot. The bot, number of deaths, number of times he killed and number of times he died. For them, we are going to implement different TO DOs. If we go to ApplicationDx, if we search TO DO, we see that if we use the Render method, if we hit the key DIK_0, we paint the states calling the game's Render_Stats methods. This means that if in InputManager I say IsKeyPressed DIK_0, that is, if the user is pressing key 0, we paint the stats calling the render method of the mGUI object, mGUI and Render_Stats and we give it, in our case, the device with text. OK? Let's go on, we go to the GUI. Here we have a lot more code. We have to build the M_Font type object, which CD3d11Font has to be the same as new, CD3D11Font. We check the device and the font name, we can get the device from the application and we use the static mode, the singleton method from the singleton square and we have the GetDevice. Then we call the GetDevice and we give it the font's name, which is Courier New, and we use it because all the letters and signs are the same size, so it will be easier to align the texts. The next to do, is deleting the GFont object we previously built, we make a checking delete, font. Next to do, we are in Render_Stats, and what we do here is painting the text, which is in next with the method DragonText from the Font object in the 40,40 position. Let's do it. M_Font, DragonText, we give it the device which has some parameters, and in the values in there we use the X position which is 40,40, as we previously said, font size, which we get from Font Size, the local variable, and the color. Using the color, which color, we use color number 1 and we have used two colors which are a white one and a darker white one, most like a really clear gray, to distinguish the lines. Then, with the same code, we paint the lines and the mouse, which will separate the header and the data, and we give it an offset so that it paints the bottom line, and we use the color to paint the player states, so we have to ask for the player in application, which is the one the player has, and we ask the player the stats, in this case offset Y per 2, using the color number 2. Now we have to paint the stats of each bot, so I'm gonna come here and save the bots whole, the bots lists bot manager has, that is, the bots variable. So I'm gonna ask bots manager for bots. OK. I'm going to change the method because here it is called GetBotManager but it should be called GetBots as it's the correct name for it. We must change it for GetBots, so I have the bots here and I check them. And what I'm going to do is, as we have previously done, painting each bot's info. The C bot class has a GetStats method which gives us back the number of times bot killed, etc. So the position won't be 40+12x2, but 40+12x3+Y, in which Y is the bot's identifier. And then the color I want to paint with, if the bot's identifier is even, we will paint color 1, if it's odd, we will use 2. To do so, I'm going to make a ternary if 1, 102, a square 0, that is, if the module resulting from the division by 2 of the bot's identifier is even, we paint with color 1, otherwise, we use color 2. Well, let's go to the bot class. There are a couple of TO DOs we have to implement, when we recovery or lose HP. If our life is less than 0, we increase death, m_Dead, ++m_Dead. And we increase the player's kills using the player's Addkill method. So we must get to the player's GetApplicationDX, getPlayer and we tell the player 'Hey, you killed a bot!. OK, so this would be a part of the bot. If we go to the player class we have something similar. In this case the player gives back true or false if he dies due to this shot. So we are going to create a KillByShoot variable which will be false by default, but in case our life is less than 0, this variable's value will be true and we will increase the player's deaths in the counter of times he has died. m_Deads, increased by 1. And finally, tell us if the player died due to this shot. We give back the KillByShoot variable's value. And here end our fonts. If we did it well. We execute. The sound function we have inserted in the video game has started playing. So we see on one side the player's life. The bullets, we've picked up bullets. Then we see two fires there. Two infinite fire particles systems which never end. If we change our weapon and shoot, we can see how when we hit the scene, we fill the plane with smoke. It's also a particles system. So now I'm going to go find the bots. Here we can see how we've been hurt, we're being shot and we lose life. I killed a bot and I died once. I killed another bot. OK, now I'm dying a lot, I'm going to leave. And now, if I hit the 0 Key, I get the game stats, in which I killed 2 and I died 3. The first bot died twice and killed me twice as well. The second bot hasn't killed me, and neither I have killed him. And the third bot killed me once, but I haven't killed him. If I stop pressing the key the stats disappear. So, in this session we have learned how to integrate sound in our engine. The billboard concept and its use in video games. And what is the GUI of a video game. Here you can see the different sources I have used in this Power Point's slides. And here ends this course. I hope you liked it.