Centered image
This commit is contained in:
		
							parent
							
								
									1cfb148453
								
							
						
					
					
						commit
						f2961a006b
					
				
					 1 changed files with 8 additions and 3 deletions
				
			
		
							
								
								
									
										11
									
								
								src/main.cpp
									
										
									
									
									
								
							
							
						
						
									
										11
									
								
								src/main.cpp
									
										
									
									
									
								
							|  | @ -259,11 +259,16 @@ int main(int argc, char *argv[]) { | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         BeginDrawing(); |         BeginDrawing(); | ||||||
|         ClearBackground(DARKGRAY); |         ClearBackground(BLACK); | ||||||
| 
 | 
 | ||||||
|         Vector2 winwidth = (Vector2) {(float) GetScreenWidth(), (float) GetScreenHeight()}; |         Vector2 winwidth = (Vector2) {(float) GetScreenWidth(), (float) GetScreenHeight()}; | ||||||
|         Vector2 imagesize = (Vector2) {(float) current_player.tex.tex.width, (float) current_player.tex.tex.height}; |         Vector2 imagesize = (Vector2) {(float) current_player.tex.tex.width, (float) current_player.tex.tex.height}; | ||||||
|         DrawTextureEx(current_player.tex.tex, (Vector2) {0,0}, 0,  ScaleToFit(imagesize, winwidth), WHITE); | 
 | ||||||
|  |         Vector2 scaledsize = Vector2Scale(imagesize, ScaleToFit(imagesize, winwidth)); | ||||||
|  |         Vector2 fpos; | ||||||
|  |         fpos.x = (winwidth.x *0.5) - (scaledsize.x * 0.5f); | ||||||
|  |         fpos.y = (winwidth.y *0.5) - (scaledsize.y * 0.5f); | ||||||
|  |         DrawTextureEx(current_player.tex.tex, fpos, 0,  ScaleToFit(imagesize, winwidth), WHITE); | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | @ -370,4 +375,4 @@ int main(int argc, char *argv[]) { | ||||||
|     //--------------------------------------------------------------------------------------
 |     //--------------------------------------------------------------------------------------
 | ||||||
|     curl_global_cleanup(); |     curl_global_cleanup(); | ||||||
|     return 0; |     return 0; | ||||||
| } | } | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue