Skip to content

Instantly share code, notes, and snippets.

@od0x0
Created November 10, 2010 21:22
Show Gist options
  • Save od0x0/671544 to your computer and use it in GitHub Desktop.
Save od0x0/671544 to your computer and use it in GitHub Desktop.
@interface UI : NSObject {
AEVec2 windowSize;
UIFont* font;
AEVec2 mouse;
struct{
char left, middle, right, upwheel, downwheel;
}mouseButtons;
AETable* cache;
struct{
AETextBuffer* textBuffer;
size_t caret;
char* activeTextBox;
BOOL wasEditted;
}textbox;
}
-(char*)textboxText;
-(void)pushCharacter:(uint32_t)character;
-(void)setCaret:(size_t)to;
-(void)moveCaret:(int)by;
-(void)backspace;
-(void)setFont:(UIFont*)to;
-(UIFont*)font;
-(void)setMouseButton:(UIMouseButton)button to:(BOOL)state;
-(BOOL)mouseButtonIsDown:(UIMouseButton)button;
-(BOOL)mouseButtonWasJustPressed:(UIMouseButton)button;
-(void)mouseDown:(UIMouseButton)button;
-(void)mouseUp:(UIMouseButton)button;
-(void)setMouse:(AEVec2)to;
-(AEVec2)mouse;
//Handles cache for the few ui elements that need storage from one frame to the next, haven't used it yet
-(id)get:(char*)name;
-(void)set:(char*)name to:(id)object;
-(void)remove:(char*)name;
-(void)begin;
-(void)end;
-(void)setWindowSize:(AEVec2)to;
@end
///Somewhere else, in the application's code
@interface UI (UIElementsCategory)
-(void)doLabel:(char*)cachename withText:(char*)text withAlignment:(int)align at:(UIRect)bounds;
-(BOOL)doTextBox:(char*)cachename withText:(char*)text at:(UIRect)bounds;
-(BOOL)doButton:(char*)cachename withTexture:(AETexture)texture at:(UIRect)bounds;
-(BOOL)doMirroredButton:(char*)cachename withTexture:(AETexture)texture at:(UIRect)bounds;
-(BOOL)doCheckBox:(char*)cachename withPriorState:(BOOL)priorState withTexture:(AETexture)texture at:(UIRect)bounds;
-(BOOL)doDisclosureBox:(char*)cachename withPriorState:(BOOL)priorState withTexture:(AETexture)texture at:(UIRect)bounds;
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment