SirMallard / Iris

Iris is an Immediate-Mode GUI Library for Roblox for creating debug and visualisation UI and tools, based on Dear ImGui,
https://sirmallard.github.io/Iris/
MIT License
164 stars 25 forks source link

Iris should throw an error if .Init() wasn't called before #19

Closed nakoyasha closed 1 year ago

nakoyasha commented 1 year ago

Iris should throw an error you tried to use it before calling .Init(). Removed the call by accident from my impl of it sometime ago, and only just now noticed it wasn't working :upside_down_face:

Michael-48 commented 1 year ago

I am weary to implement this change, I hadn't considered the confusion of Iris without calling .Init(), but I had considered the functionality of it; Not calling .Init() is the least intrusive way to enable or disable Iris from rendering. from the library docs:

TIP
Want to stop Iris from rendering and consuming performance, but keep all the Iris code? simply comment out the Iris.Init() line in your codebase.

the change might only create more confusion, by introducing errors where nothing fatally wrong occurs, and in the worst case might lead to errors being output in production, possibly every frame. Maybe emitting a warning instead of an error is the happy middle ground?

nakoyasha commented 1 year ago

I think a warning would be nicer! Not sure if the whole "Remove .Init() to disable Iris from rendering" thing should remain though... it feels more like a quirk rather than a feature.

Michael-48 commented 1 year ago

Agreed its definitely a quirk, calling Connect before Init now throws a warning, and Iris.Disabled allows you to control the Activity of iris https://github.com/Michael-48/Iris/commit/6722a96ee8feb41358e710830316bc17bafa8341