| 
									
										
										
										
											2020-06-11 20:42:59 +01:00
										 |  |  | package atlas | 
					
						
							| 
									
										
										
										
											2020-06-07 18:08:34 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-06-07 18:33:44 +01:00
										 |  |  | import ( | 
					
						
							| 
									
										
										
										
											2020-07-10 18:22:59 +01:00
										 |  |  | 	"github.com/mdiluz/rove/pkg/maths" | 
					
						
							| 
									
										
										
										
											2020-06-07 18:33:44 +01:00
										 |  |  | ) | 
					
						
							| 
									
										
										
										
											2020-06-07 18:08:34 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-07-03 17:00:04 +01:00
										 |  |  | // Tile describes the type of terrain | 
					
						
							|  |  |  | type Tile byte | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | const ( | 
					
						
							|  |  |  | 	// TileNone is a keyword for nothing | 
					
						
							|  |  |  | 	TileNone = Tile(0) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	// TileRock is solid rock ground | 
					
						
							| 
									
										
										
										
											2020-07-08 23:45:52 +01:00
										 |  |  | 	TileRock = Tile('-') | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	// TileGravel is loose rocks | 
					
						
							|  |  |  | 	TileGravel = Tile(':') | 
					
						
							| 
									
										
										
										
											2020-07-03 17:00:04 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	// TileSand is sand | 
					
						
							| 
									
										
										
										
											2020-07-08 23:45:52 +01:00
										 |  |  | 	TileSand = Tile('~') | 
					
						
							| 
									
										
										
										
											2020-07-03 17:00:04 +01:00
										 |  |  | ) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-07-10 16:52:00 +01:00
										 |  |  | // Atlas represents a 2D world atlas of tiles and objects | 
					
						
							|  |  |  | type Atlas interface { | 
					
						
							|  |  |  | 	// SetTile sets a location on the Atlas to a type of tile | 
					
						
							| 
									
										
										
										
											2020-07-10 18:22:59 +01:00
										 |  |  | 	SetTile(v maths.Vector, tile Tile) | 
					
						
							| 
									
										
										
										
											2020-07-10 16:52:00 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	// SetObject will set a location on the Atlas to contain an object | 
					
						
							| 
									
										
										
										
											2020-07-10 18:39:33 +01:00
										 |  |  | 	SetObject(v maths.Vector, obj Object) | 
					
						
							| 
									
										
										
										
											2020-07-10 16:52:00 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	// QueryPosition queries a position on the atlas | 
					
						
							| 
									
										
										
										
											2020-07-10 18:39:33 +01:00
										 |  |  | 	QueryPosition(v maths.Vector) (byte, Object) | 
					
						
							| 
									
										
										
										
											2020-07-10 16:52:00 +01:00
										 |  |  | } |