Widget Handler Implementation

Widget Handler Implementation

Discuss the source code and development of Spring Engine in general from a technical point of view. Patches go here too.

Moderator: Moderators

Post Reply
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Widget Handler Implementation

Post by AF »

I'm looking at the widget handler and trying to figure out how it works so that I can implement something similar in other projects

As I understand it so far widget loading goes along the following lines, please correct em if Im wrong or miss out a vital step

A new table is created that holds the widget, it's filled in with some functions that act as default callbacks, and a reference to the widget handler is inserted

This widget is then set in it's own environment using setfenv, and then the widget file loaded into a variable is then passed to pcall, filling in Widget with all the methods and variables, as well as executing any lines of code.

The widget table is then added to the main list and sorted into the right order.

Is that correct? Am I missing any important steps? Is there a better ideal way that we don't use because we already have this setup? I assume the gadget handler works the same way?
User avatar
jK
Spring Developer
Posts: 2299
Joined: 28 Jun 2007, 07:30

Re: Widget Handler Implementation

Post by jK »

don't try to learn from the current widgetHandler, it's very very bad code.

First the way widgets are managed is very inefficient, and then the way callins are handled is very very very inefficient. It needs a totally new implementation, trepan already did parts of such a recode for bzFlag, but I didn't checked it yet.
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Re: Widget Handler Implementation

Post by AF »

hmmm so what exactly would you suggest?
Post Reply

Return to “Engine”