Quote:If I may make one suggestion, I think they'd look even better if their lighting would not become a bit inconsistent when they are rotated.
I thought about this and agree that flat shading is more suitable because of the rotation. If I wasn't going to include rotation features then I'd keep the lighting because I think it looks so much better. I have already updated my current components - below is my crib sheet that I refer to / update before programming the components:
Quote:I'm very curious about how much of a framework MyGUI actually provides, in terms of how much it handles for the user willing to extend it.
If you look at the MyGUIObject class you get an idea of the features I think should be common in all objects.
To summarise, each MyGUIObject has all these variables available:
- public MyGUI _parent;
- public MyGUIStyle _style;
- public int _x, _y, _width, _height;
- public int _id;
- public float _rotation; // radians
- public float _scale = 1.0;
- public boolean _visible = true;
- public boolean _disabled = false;
- public String _actionCommand = "";
- protected int localMouseX, localMouseY;
- protected boolean dragged, hover, lastHover;
And all these methods:
- MyGUIObject()
- MyGUIObject(int x, int y)
- boolean hasFocus()
- boolean isDragged()
- void mousePressed()
- void mouseReleased()
- void mouseDragged()
- void draw()
- void drawStates()
- void setID(int newID)
- void setParent(MyGUI parent)
- void setActionCommand(String command)
- void setStyle(MyGUIStyle style)
- void enable()
- void disable()
- void rotateDegrees(float degs)
- void rotateRadians(float rads)
- boolean checkForHit()
And I'm still adding to them where I feel a common feature can be added. The MyGUI object automatically calls the mousePressed(), mouseReleased() etc. methods, and I've included basic logic for setting up and tracking the different states. checkForHit() is most important because it tracks the mouse position relative to the bounding box of the object (based on _x, _y, _width and _height).
Programmers wanting to extend MyGUI with their own objects will have to consider all the different draw states by using the methods and boolean values provided, and can write their own custom responses to mouse and key events by simply overriding methods in the parent class. A good example of this is the MyGUIDragButton which extends MyGUIButton, which in-turn extends MyGUIObject.
Quote:A good example of what I mean may be how I would implement a text input field with MyGUI. Would it handle such things as focus and mouse-overs automatically?
This is something I will am considering, I just want to get some simpler objects done first. The default mouse methods of MyGUIObject already track things like when the object has focus, checkForHit is used to set the hover state directly, there is the isFocused() method to see if it has focus (as only one object can have focus at a time). a MyGUITextInput will be very similar to a MyGUIButton except it will have complex rendering logic for the positioning of the text as you type, positioning of the cursor and filtering of characters. Then I suppose I'd have to consider MyGUITextArea - a multiline version?
Quote:I think it would be awesome if you found the time to write a short programmer's guide on these issues and general points on how to extend MyGUI.
I definitely will be writing lots of documentation for this project, I just need to improve/optimize the core so that its heading in the right direction.
Thanks for your input.
- Markavian