{RESOLVED} Drag an object or GUI control

Started by Joacim Andersson, Sun 22/12/2024 18:12:36

Previous topic - Next topic

Crimson Wizard

#20
Quote from: Joacim Andersson on Tue 24/12/2024 08:02:33I understand that downcasting would require an explicit cast (unlike upcasting which can be done implicitly), but I still think it should be available.

This is not only a matter of supporting "explicit cast" syntax, it a matter of engine being able to distinguish types.
Because the downcast cannot be resolved at compile time, as compiler does not know which type exactly is pointed to by the base class pointer. so it must be resolved at runtime. And in order to do that engine has to know the type hierarchy, and know which type the pointer is.

Couple of years ago I had to implement RTTI (runtime type information) in the AGS engine from scratch, because it was not available originally.
Since then a number of new functionalities was based on rtti. Among other things, now it is theoretically possible to add a "dynamic pointer cast" operation. But it still has to be written by someone.

SMF spam blocked by CleanTalk