HeladoDeBrownie / Nexus

creative sandbox game in early development
MIT License
3 stars 1 forks source link

factor out canvas backing logic for widgets #106

Closed HeladoDeBrownie closed 3 years ago

HeladoDeBrownie commented 3 years ago

create a new mixin called e.g. CanvasBacked that performs the canvas drawing logic for a widget. unexpose Widget.get_canvas, and instead expose:

note that there will be no CanvasBacked.get_canvas. this is because with CanvasBacked's implementation of draw, there will be no need to leak the canvas. for that matter the mixin can be called something more centered on its extrinsic properties instead, such as Buffered

the idea here is that widgets can be designed to be buffered or not depending on their needs. like it's probably not necessary for a simple button widget to have its own canvas

HeladoDeBrownie commented 3 years ago

resoloved by https://github.com/HeladoDeBrownie/Nexus/commit/7aabbd679d4e83e0a108eaaf2fd116cc06436823