ecs attempt
This commit is contained in:
33
engine/ecs/systems/mob_render_system.go
Normal file
33
engine/ecs/systems/mob_render_system.go
Normal file
@ -0,0 +1,33 @@
|
||||
package systems
|
||||
|
||||
import (
|
||||
"lab.zaar.be/thefish/alchemyst-go/engine/ecs"
|
||||
"lab.zaar.be/thefish/alchemyst-go/engine/types"
|
||||
"lab.zaar.be/thefish/alchemyst-go/ui/mainwindow"
|
||||
)
|
||||
|
||||
type MobRenderSystem struct {
|
||||
EntityController *ecs.Controller
|
||||
Layer *mainwindow.Layer
|
||||
}
|
||||
|
||||
func (mrs MobRenderSystem) Process(){
|
||||
for e := range mrs.EntityController.GetEntities() {
|
||||
if mrs.EntityController.HasComponent(e, types.Coords{}.TypeOf()) &&
|
||||
mrs.EntityController.HasComponent(e, types.Appearance{}.TypeOf()) {
|
||||
|
||||
pos := mrs.EntityController.GetComponent(e, types.Coords{}.TypeOf()).(types.Coords)
|
||||
appearance := mrs.EntityController.GetComponent(e, types.Appearance{}.TypeOf()).(types.Appearance)
|
||||
|
||||
//fixme
|
||||
// Clear the cell this entity occupies, so it is the only glyph drawn there
|
||||
for i := 0; i <= 2; i++ {
|
||||
mrs.Layer.ClearArea(pos.X, pos.Y,1,1)
|
||||
//gogue.ClearArea(pos.X, pos.Y, 1, 1, i)
|
||||
}
|
||||
//fixme
|
||||
mrs.Layer.WithRawColor(appearance.ColorSet.Fg.GetColor()).Put(pos.X, pos.Y, appearance.Glyph)
|
||||
//gogue.PrintGlyph(pos.X, pos.Y, appearance.Glyph, "", appearance.Layer)
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user