Update example slightly.
Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
This commit is contained in:
		
							parent
							
								
									0d6536b880
								
							
						
					
					
						commit
						2f2e57fd37
					
				
							
								
								
									
										
											BIN
										
									
								
								C++ProjectTemplate
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								C++ProjectTemplate
									
									
									
									
									
										Executable file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										15
									
								
								main.cpp
									
									
									
									
									
								
							
							
						
						
									
										15
									
								
								main.cpp
									
									
									
									
									
								
							| @ -1,6 +1,8 @@ | |||||||
| #define OLC_PGE_APPLICATION | #define OLC_PGE_APPLICATION | ||||||
| #include "pixelGameEngine.h" | #include "pixelGameEngine.h" | ||||||
| 
 | 
 | ||||||
|  | using namespace std; | ||||||
|  | 
 | ||||||
| class Example : public olc::PixelGameEngine | class Example : public olc::PixelGameEngine | ||||||
| { | { | ||||||
| public: | public: | ||||||
| @ -12,16 +14,23 @@ public: | |||||||
| public: | public: | ||||||
| 	bool OnUserCreate() override | 	bool OnUserCreate() override | ||||||
| 	{ | 	{ | ||||||
|  | 		SetPixelMode(olc::Pixel::ALPHA); | ||||||
|  | 		ConsoleCaptureStdOut(true); | ||||||
| 		// Called once at the start, so create things here
 | 		// Called once at the start, so create things here
 | ||||||
|  | 		for (int x = 0; x < ScreenWidth(); x++) | ||||||
|  | 			for (int y = 0; y < ScreenHeight(); y++) | ||||||
|  | 				Draw(x, y, olc::Pixel(rand() % 255, rand() % 255, rand()% 255));	 | ||||||
|  | 		for (int x=0;x<50;x++) { | ||||||
|  | 			for (int y=0;y<50;y++) { | ||||||
|  | 				Draw(x, y, olc::Pixel(255, 0, 0, 128));	 | ||||||
|  | 			} | ||||||
|  | 		} | ||||||
| 		return true; | 		return true; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	bool OnUserUpdate(float fElapsedTime) override | 	bool OnUserUpdate(float fElapsedTime) override | ||||||
| 	{ | 	{ | ||||||
| 		// called once per frame
 | 		// called once per frame
 | ||||||
| 		for (int x = 0; x < ScreenWidth(); x++) |  | ||||||
| 			for (int y = 0; y < ScreenHeight(); y++) |  | ||||||
| 				Draw(x, y, olc::Pixel(rand() % 255, rand() % 255, rand()% 255));	 |  | ||||||
| 		return true; | 		return true; | ||||||
| 	} | 	} | ||||||
| }; | }; | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user