mirror of
				https://github.com/yeslayla/golang-game-framework.git
				synced 2025-11-04 08:43:06 +01:00 
			
		
		
		
	Initial commit
This commit is contained in:
		
							
								
								
									
										14
									
								
								core/rect2d.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								core/rect2d.go
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,14 @@
 | 
			
		||||
package core
 | 
			
		||||
 | 
			
		||||
import "fmt"
 | 
			
		||||
 | 
			
		||||
type Rect2D struct {
 | 
			
		||||
	X float64
 | 
			
		||||
	Y float64
 | 
			
		||||
	W float64
 | 
			
		||||
	H float64
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (rect Rect2D) String() string {
 | 
			
		||||
	return fmt.Sprintf("X: %v, Y: %v, W: %v, H: %v", rect.X, rect.Y, rect.W, rect.H)
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										19
									
								
								core/vector2.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								core/vector2.go
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,19 @@
 | 
			
		||||
package core
 | 
			
		||||
 | 
			
		||||
import "fmt"
 | 
			
		||||
 | 
			
		||||
type Vector2 struct {
 | 
			
		||||
	X float64
 | 
			
		||||
	Y float64
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (p Vector2) String() string {
 | 
			
		||||
	return fmt.Sprintf("X: %v, Y: %v", p.X, p.Y)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (vector Vector2) Add(other Vector2) Vector2 {
 | 
			
		||||
	return Vector2{
 | 
			
		||||
		X: vector.X + other.X,
 | 
			
		||||
		Y: vector.Y + other.Y,
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user