User Tools

Site Tools


hpl3:game:gui

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
hpl3:game:gui [2013/11/04 09:19]
ian.thomas Added Thomas's notes on image sizes.
hpl3:game:gui [2013/11/04 09:57]
thomas [Note on Graphics]
Line 122: Line 122:
 Then flowerGfx can be used where ever it is needed. No need to neither load or destroy the asset. Then flowerGfx can be used where ever it is needed. No need to neither load or destroy the asset.
  
-==== Note on Graphics ​====+It is also possible to load graphics as textures or animations, by using the types ''​eImGuiGfx_Texture''​ and ''​eImGuiGfx_ImageAnimated''​. 
 + 
 +For texture: 
 +<code c++> 
 +cImGuiGfx flowerGfx("​flower.dds",​ eImGuiGfx_Texture);​ 
 +cImGuiGfx flowerGfx("​flower.dds",​ eGuiMaterial_Additive,​ eImGuiGfx_Texture);​ 
 +</​code>​ 
 +Note that it is now possible to load DXT format files! 
 + 
 + 
 +For for animation:​ 
 +<code c++> 
 +cImGuiGfx flowerGfx("​flower.tga",​ eImGuiGfx_ImageAnimated);​ 
 +cImGuiGfx flowerGfx("​flower.tga",​ eGuiMaterial_Additive,​ eImGuiGfx_ImageAnimated);​ 
 +</​code>​ 
 +When loading an animation, an extension is required and the engine will load all the files named like "​flower00.tga",​ "​flower01.tga",​ etc for as long as it can find file names. These images will then be looped around in an animation loop. Control the animation speed by setting the member variable ''​mfAnimationTime''​ like this: 
 +<code c++> 
 +cImGuiGfx flowerGfx("​flower.tga",​ eImGuiGfx_ImageAnimated);​ 
 +flowerGfx.mfAnimationTime ​0.1; 
 +</​code>​ 
 +This will make each frame play for 0.1 seconds. (default setting is 1). 
 +**Note on Graphics**
  
   * The size limit is 510x510. (1 pixel borders need for images).   * The size limit is 510x510. (1 pixel borders need for images).
-  * You should NOT use the normal graphics for larger images though as it is in effective. It is meant to be for smaller images so that you can batch the graphics (eg draw must of the gui in 2-3 draw calls). ​Instead ​use textures. ​And with textures, the sky is the limit!+  * You should NOT use the normal graphics for larger images though as it is in effective. It is meant to be for smaller images so that you can batch the graphics (making it possible to draw most of the gui in 2-3 draw calls). ​If you need large images, ​use textures! Here you can easily go up to 1024x1024 (and beyond, should it be needed).
 ===== Custom Widgets ===== ===== Custom Widgets =====
  
hpl3/game/gui.txt · Last modified: 2015/09/17 10:14 by ian.thomas