UI-System Design

Posted By: Rei_Ayanami

UI-System Design - 03/03/12 16:50

Heyo Guys,

I am stuck with LiteGUI again because I am not sure how to design the user solution for it. My main problem is, that every element has an ridiculous amount of members.

Example: A button consists of an metric struct (x,y,width,height,scaleX,scaleY,alignX,alignY,angle,alpha,layer) and a system struct (events,flags) and the "specific" struct, which consists of 4 BMAPs, 4 label structs and a disabled-bool.
The label struct again consists of a string, fontString, color, italic/bold bools and a size.

And if I leave out more things, it will make the whole thing less usable for more people smirk



Ideas?


(Btw, the user does not have to apply all settings, as the struct will always be filled with standard-values from a user/default configuration file in json.)

Regards,
Marian
Posted By: Damocles_

Re: UI-System Design - 03/03/12 18:21

Just make differnt Contructors, with different amounts of parameters passed. (filling in default values)
To keep having simple contructors.
Posted By: Rei_Ayanami

Re: UI-System Design - 03/04/12 21:11

Hmn, this would require a rewrite of the whole user system, as the actual "create" function looks like this:

Code:
void *LGcreateObject(ESdefineStruct *createStruct);



define struct:

Code:
typedef struct ESdefineStruct 
{
	int objType;
	ESmetricStruct *metrics;
	ESsystemStruct *system;
	void *specific;
} ESdefineStruct;



(I already explained the containing structs above)
Posted By: MrGuest

Re: UI-System Design - 03/05/12 23:47

Use datatype RECT for x, y, width and height, create POINT if it doesn't already exist for scaleX,Y and alignX,Y.

You could also have a default size defined

LiteGuiLabelDefaults(POINT* scale, POINT* align) so when these aren't passed they're used for default values
have LiteGuiLabelFlag(LABEL* lbl, long flags) for being able to set things after they're created

also support similar to most application Ex for each function
LiteGuiLabelEx(where you do pass every possible parameter)

Just food for thought
© 2024 lite-C Forums