basic mapgen
This commit is contained in:
@ -12,7 +12,7 @@ func NewRect(x, y, w, h int) *Rect {
|
||||
return &Rect{x, y, w, h}
|
||||
}
|
||||
|
||||
func (r *Rect) RenderToLayer(fillage RectFill, layer Putable) {
|
||||
func (r *Rect) Blit(fillage RectFill, layer Putable) {
|
||||
|
||||
if fillage.Body != "" {
|
||||
for i := r.X + 1; i < r.X+r.W; i++ {
|
||||
@ -45,3 +45,17 @@ func (r *Rect) RenderToLayer(fillage RectFill, layer Putable) {
|
||||
//lii.Put(X+W, Y-1, "L");
|
||||
layer.Put(r.X+r.W, r.Y+r.H, fillage.BottomRight)
|
||||
}
|
||||
|
||||
func (self *Rect) Intersects(other *Rect) bool {
|
||||
if self.X <= (other.X+other.W) &&
|
||||
(self.X+self.W) >= other.X &&
|
||||
self.Y <= (other.Y+other.Y) &&
|
||||
(self.Y+self.H) >= other.Y {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (r *Rect) InBounds (x,y int) bool {
|
||||
return x >= r.X && x <= (r.X + r.W) && y >= r.Y && y <= (r.Y + r.H)
|
||||
}
|
Reference in New Issue
Block a user