mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-02-17 01:11:45 +00:00
Convert Point, Size and Rect to structs.
Group and the menu plist parser are currently broken.
This commit is contained in:
parent
799d46f83d
commit
b0879ba255
19 changed files with 99 additions and 313 deletions
|
@ -1,4 +1,4 @@
|
|||
#include "gui/Point.h"
|
||||
#include "gui/Size.h"
|
||||
#include "draw.h"
|
||||
|
||||
@interface Frame : Object
|
||||
|
@ -8,7 +8,7 @@
|
|||
}
|
||||
- (id) initWithFile: (string) file duration: (float) time;
|
||||
- (void) dealloc;
|
||||
- (Point) size;
|
||||
- (Size) size;
|
||||
- (float) duration;
|
||||
- (void) draw: (integer) x :(integer) y;
|
||||
@end
|
||||
|
|
|
@ -17,9 +17,9 @@
|
|||
[super dealloc];
|
||||
}
|
||||
|
||||
- (Point) size
|
||||
- (Size) size
|
||||
{
|
||||
return [[Point alloc] initWithComponents :[picture width] :[picture height]];
|
||||
return makeSize ([picture width], [picture height]);
|
||||
}
|
||||
|
||||
- (float) duration
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
#include "Frame.h"
|
||||
#include "Array.h"
|
||||
|
||||
@class Point;
|
||||
#include "gui/Point.h"
|
||||
#include "gui/Size.h"
|
||||
|
||||
@interface HUDObject : Object
|
||||
{
|
||||
|
@ -14,7 +15,7 @@
|
|||
- (void) dealloc;
|
||||
- (integer) handle;
|
||||
- (Point) origin;
|
||||
- (Point) size;
|
||||
- (Size) size;
|
||||
- (void) setOrigin: (Point) newPoint;
|
||||
- (void) translate: (Point) addPoint;
|
||||
- (BOOL) isVisible;
|
||||
|
@ -28,7 +29,7 @@
|
|||
}
|
||||
|
||||
- (id) initWithComponents: (integer) x :(integer) y :(string) _text;
|
||||
- (Point) size;
|
||||
- (Size) size;
|
||||
- (string) text;
|
||||
- (void) setText: (string) _text;
|
||||
- (void) display;
|
||||
|
@ -41,7 +42,7 @@
|
|||
|
||||
- (id) initWithComponents: (integer)x :(integer)y :(string) _file;
|
||||
- (void) dealloc;
|
||||
- (Point) size;
|
||||
- (Size) size;
|
||||
- (void) setFile: (string) _file;
|
||||
- (void) display;
|
||||
@end
|
||||
|
@ -58,7 +59,7 @@
|
|||
}
|
||||
- (id) initWithComponents: (integer) x :(integer) y;
|
||||
- (void) dealloc;
|
||||
- (Point) size;
|
||||
- (Size) size;
|
||||
- (void) addFrame: (Frame) frame;
|
||||
- (void) changeFrame;
|
||||
- (void) display;
|
||||
|
|
|
@ -11,7 +11,7 @@ integer HUDHandleClass;
|
|||
- (id) initWithComponents: (integer) x : (integer) y
|
||||
{
|
||||
self = [super init];
|
||||
origin = [[Point alloc] initWithComponents: x :y];
|
||||
origin = makePoint (x, y);
|
||||
visible = YES;
|
||||
|
||||
return self;
|
||||
|
@ -19,7 +19,6 @@ integer HUDHandleClass;
|
|||
|
||||
- (void) dealloc
|
||||
{
|
||||
[origin release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
|
@ -33,19 +32,19 @@ integer HUDHandleClass;
|
|||
return origin;
|
||||
}
|
||||
|
||||
- (Point) size
|
||||
- (Size) size
|
||||
{
|
||||
return NIL;
|
||||
return makeSize (0, 0);
|
||||
}
|
||||
|
||||
- (void) setOrigin: (Point) newPoint
|
||||
{
|
||||
[origin setPoint :newPoint];
|
||||
origin = newPoint;
|
||||
}
|
||||
|
||||
- (void) translate: (Point) addPoint
|
||||
- (void) translate: (Point) offset
|
||||
{
|
||||
[origin addPoint :addPoint];
|
||||
origin = addPoint(origin, offset);
|
||||
}
|
||||
|
||||
- (BOOL) isVisible
|
||||
|
@ -72,9 +71,9 @@ integer HUDHandleClass;
|
|||
return self;
|
||||
}
|
||||
|
||||
- (Point) size
|
||||
- (Size) size
|
||||
{
|
||||
return [[Point alloc] initWithComponents :8*(integer) strlen (text) :8];
|
||||
return makeSize (8*(integer) strlen (text), 8);
|
||||
}
|
||||
|
||||
- (string) text
|
||||
|
@ -90,7 +89,7 @@ integer HUDHandleClass;
|
|||
- (void) display
|
||||
{
|
||||
if (visible)
|
||||
Draw_String ([origin x], [origin y], text);
|
||||
Draw_String (origin.x, origin.y, text);
|
||||
}
|
||||
@end
|
||||
|
||||
|
@ -109,9 +108,9 @@ integer HUDHandleClass;
|
|||
[super dealloc];
|
||||
}
|
||||
|
||||
- (Point) size
|
||||
- (Size) size
|
||||
{
|
||||
return [[Point alloc] initWithComponents :[picture width] :[picture height]];
|
||||
return makeSize ([picture width], [picture height]);
|
||||
}
|
||||
|
||||
- (void) setFile: (string) _file
|
||||
|
@ -123,7 +122,7 @@ integer HUDHandleClass;
|
|||
- (void) display
|
||||
{
|
||||
if (visible)
|
||||
[picture draw :[origin x] :[origin y]];
|
||||
[picture draw :origin.x :origin.y];
|
||||
}
|
||||
@end
|
||||
|
||||
|
@ -146,7 +145,7 @@ integer HUDHandleClass;
|
|||
[super dealloc];
|
||||
}
|
||||
|
||||
- (Point) size
|
||||
- (Size) size
|
||||
{
|
||||
local Frame frame;
|
||||
|
||||
|
@ -188,7 +187,7 @@ integer HUDHandleClass;
|
|||
[self changeFrame];
|
||||
|
||||
f = [frames getItemAt :currentFrame];
|
||||
[f draw :[origin x] :[origin y]];
|
||||
[f draw :origin.x :origin.y];
|
||||
}
|
||||
|
||||
- (void) start
|
||||
|
|
|
@ -561,9 +561,9 @@ void () main_menu =
|
|||
|
||||
void () menu_init =
|
||||
{
|
||||
lanConfig_port_il = [[InputLineBox alloc] initWithBounds:[[Rect alloc] initWithComponents:126 :lanConfig_cursor_table[0] - 8 :8 :4] promptCharacter:' '];
|
||||
lanConfig_port_il = [[InputLineBox alloc] initWithBounds:makeRect (126, lanConfig_cursor_table[0] - 8, 8, 4) promptCharacter:' '];
|
||||
[lanConfig_port_il setWidth:10];
|
||||
lanConfig_join_il = [[InputLineBox alloc] initWithBounds:[[Rect alloc] initWithComponents:70 :lanConfig_cursor_table[2] - 8 :24 :4] promptCharacter:' '];
|
||||
lanConfig_join_il = [[InputLineBox alloc] initWithBounds:makeRect (70, lanConfig_cursor_table[2] - 8, 24, 4) promptCharacter:' '];
|
||||
[lanConfig_join_il setWidth:26];
|
||||
switch (gametype ()) {
|
||||
case "netquake":
|
||||
|
|
|
@ -170,8 +170,8 @@ array_from_plist (PLArray plarray)
|
|||
return array;
|
||||
}
|
||||
|
||||
id
|
||||
string_from_plist (PLString plstring)
|
||||
Rect
|
||||
rect_from_plist (PLString plstring)
|
||||
{
|
||||
local string str = [plstring string];
|
||||
local string tmp;
|
||||
|
@ -185,8 +185,14 @@ string_from_plist (PLString plstring)
|
|||
yp = stoi ([(PLString) [item getObjectAtIndex:1] string]);
|
||||
xl = stoi ([(PLString) [item getObjectAtIndex:2] string]);
|
||||
yl = stoi ([(PLString) [item getObjectAtIndex:3] string]);
|
||||
return [[Rect alloc] initWithComponents:xp :yp :xl :yl];
|
||||
return makeRect (xp, yp, xl, yl);
|
||||
}
|
||||
return makeRect (0, 0, 0, 0);
|
||||
}
|
||||
|
||||
id
|
||||
string_from_plist (PLString plstring)
|
||||
{
|
||||
return NIL;
|
||||
}
|
||||
|
||||
|
@ -403,7 +409,7 @@ MENU_control_options =
|
|||
[view setText:"Bindings"];
|
||||
[control_options addView:view];
|
||||
|
||||
rect = [[Rect alloc] initWithComponents:70 :70 :224 :8];
|
||||
rect = makeRect (70, 70, 224, 8);
|
||||
grab_mouse_view = [[CvarToggleView alloc] initWithBounds:rect title:"Grab mouse" :[[CvarToggle alloc] initWithCvar:"in_grab"]];
|
||||
[control_options addView:grab_mouse_view];
|
||||
|
||||
|
@ -433,8 +439,6 @@ MENU_control_options =
|
|||
lookstrafe_view = [[CvarToggleView alloc] initWithBounds:rect title:"Lookstrafe" :[[CvarToggle alloc] initWithCvar:"lookstrafe"]];
|
||||
[control_options addView:lookstrafe_view];
|
||||
|
||||
[rect release];
|
||||
|
||||
MENU_control_binding ();
|
||||
|
||||
Menu_Item (54, 70, "in_grab", CB_control_options, 0);
|
||||
|
@ -523,7 +527,7 @@ MENU_feature_options =
|
|||
[view setText:"--------"];
|
||||
[feature_options addView:view];
|
||||
|
||||
rect = [[Rect alloc] initWithComponents:70 :60 :224 :8];
|
||||
rect = makeRect (70, 60, 224, 8);
|
||||
autorecord_view = [[CvarToggleView alloc] initWithBounds:rect title:"Autorecord" :[[CvarToggle alloc] initWithCvar:"cl_autorecord"]];
|
||||
[feature_options addView:autorecord_view];
|
||||
|
||||
|
@ -531,8 +535,6 @@ MENU_feature_options =
|
|||
fraglog_view = [[CvarToggleView alloc] initWithBounds:rect title:"Frag Logging" :[[CvarToggle alloc] initWithCvar:"cl_fraglog"]];
|
||||
[feature_options addView:fraglog_view];
|
||||
|
||||
[rect release];
|
||||
|
||||
Menu_Item (54, 70, "cl_autorecord", CB_feature_options, 0);
|
||||
Menu_Item (54, 80, "cl_fraglog", CB_feature_options, 0);
|
||||
Menu_End ();
|
||||
|
@ -720,17 +722,17 @@ MENU_player_options =
|
|||
[view setText:"Pants color"];
|
||||
[player_options addView:view];
|
||||
|
||||
player_config_plname_il = [[InputLineBox alloc] initWithBounds:[[Rect alloc] initWithComponents:120 :PLAYER_CONF_Y_PAD :18 :4] promptCharacter:' '];
|
||||
player_config_plname_il = [[InputLineBox alloc] initWithBounds:makeRect (120, PLAYER_CONF_Y_PAD, 18, 4) promptCharacter:' '];
|
||||
[player_config_plname_il setWidth:18];
|
||||
[player_options addView:player_config_plname_il];
|
||||
|
||||
player_config_tname_il = [[InputLineBox alloc] initWithBounds:[[Rect alloc] initWithComponents:120 :PLAYER_CONF_Y_PAD + 20 :7 :4] promptCharacter:' '];
|
||||
player_config_tname_il = [[InputLineBox alloc] initWithBounds:makeRect (120, PLAYER_CONF_Y_PAD + 20, 7, 4) promptCharacter:' '];
|
||||
[player_config_tname_il setWidth:7];
|
||||
[player_options addView:player_config_tname_il];
|
||||
|
||||
player_config_iactive = NIL;
|
||||
|
||||
rect = [[Rect alloc] initWithComponents:192 :PLAYER_CONF_Y_PAD + 37 :24 :24];
|
||||
rect = makeRect (192, PLAYER_CONF_Y_PAD + 37, 24, 24);
|
||||
topcolor_view = [[CvarColorView alloc] initWithBounds:rect :[[CvarColor alloc] initWithCvar:"topcolor"]];
|
||||
[player_options addView:topcolor_view];
|
||||
|
||||
|
@ -738,8 +740,6 @@ MENU_player_options =
|
|||
bottomcolor_view = [[CvarColorView alloc] initWithBounds:rect :[[CvarColor alloc] initWithCvar:"bottomcolor"]];
|
||||
[player_options addView:bottomcolor_view];
|
||||
|
||||
[rect release];
|
||||
|
||||
Menu_Begin (54, 80, "Player");
|
||||
Menu_FadeScreen (1);
|
||||
Menu_KeyEvent (KEYEV_player_options);
|
||||
|
@ -879,7 +879,7 @@ MENU_network_options =
|
|||
[view setText:"Rate..:"];
|
||||
[network_options addView:view];
|
||||
|
||||
network_config_rate_il = [[InputLineBox alloc] initWithBounds:[[Rect alloc] initWithComponents: 120 :NETWORK_CONF_Y_PAD :9 :4] promptCharacter:' '];
|
||||
network_config_rate_il = [[InputLineBox alloc] initWithBounds:makeRect (120, NETWORK_CONF_Y_PAD, 9, 4) promptCharacter:' '];
|
||||
[network_config_rate_il setWidth:9];
|
||||
[network_options addView:network_config_rate_il];
|
||||
|
||||
|
|
|
@ -179,7 +179,7 @@
|
|||
|
||||
toggle = _toggle;
|
||||
|
||||
rect = [[Rect alloc] initWithComponents:0 :0 :strlen (_title) * 8 :8];
|
||||
rect = makeRect (0, 0, strlen (_title) * 8, 8);
|
||||
title = [[Text alloc] initWithBounds:rect text:_title];
|
||||
|
||||
rect.size.width = 3 * 8;
|
||||
|
@ -338,7 +338,7 @@
|
|||
|
||||
range = _range;
|
||||
|
||||
rect = [[Rect alloc] initWithComponents:0 :0 :strlen (_title) * 8 :8];
|
||||
rect = makeRect (0, 0, strlen (_title) * 8, 8);
|
||||
title = [[Text alloc] initWithBounds:rect text:_title];
|
||||
|
||||
rect.origin.x += rect.size.width + 8;
|
||||
|
@ -465,10 +465,9 @@ void traceon () = #0;
|
|||
- (void) setBasePos: (Point) pos
|
||||
{
|
||||
[super setBasePos:pos];
|
||||
local Point point = [[Point alloc] initWithComponents:xabs :yabs];
|
||||
local Point point = {xabs, yabs};
|
||||
[title setBasePos:point];
|
||||
[view setBasePos:point];
|
||||
[point release];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -97,7 +97,7 @@ void () servlist_filter_menu =
|
|||
|
||||
void () server_list_menu =
|
||||
{
|
||||
serv_maxping = [[InputLine alloc] initWithBounds:[[Rect alloc] initWithComponents:206 :40 :8 :4] promptCharacter:' '];
|
||||
serv_maxping = [[InputLine alloc] initWithBounds:makeRect (206, 40, 8, 4) promptCharacter:' '];
|
||||
[serv_maxping setWidth:5];
|
||||
|
||||
Menu_Begin (54, 52, "");
|
||||
|
|
|
@ -40,9 +40,8 @@
|
|||
- (void) setBasePos: (Point) pos
|
||||
{
|
||||
[super setBasePos:pos];
|
||||
local Point point = [[Point alloc] initWithComponents:xabs :yabs];
|
||||
local Point point = {xabs, yabs};
|
||||
[views makeObjectsPerformSelector:@selector (setBasePos:) withObject:point];
|
||||
[point release];
|
||||
}
|
||||
|
||||
- (void) draw
|
||||
|
|
|
@ -90,9 +90,8 @@ string (inputline_t il) InputLine_GetText = #0;
|
|||
yp = 8;
|
||||
xl = aRect.size.width;
|
||||
yl = aRect.size.height;
|
||||
r = [[Rect alloc] initWithComponents:xp :yp :xl :yl];
|
||||
r = makeRect (xp, yp, xl, yl);
|
||||
input_line = [[InputLine alloc] initWithBounds:r promptCharacter:char];
|
||||
[r release];
|
||||
return self;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,64 +1,19 @@
|
|||
#include "gui/Point.h"
|
||||
|
||||
@implementation Point
|
||||
|
||||
- (id) initWithComponents: (integer)_x : (integer)_y
|
||||
Point makePoint (integer x, integer y)
|
||||
{
|
||||
self = [self init];
|
||||
x = _x;
|
||||
y = _y;
|
||||
return self;
|
||||
Point p = {x, y};
|
||||
return p;
|
||||
}
|
||||
|
||||
- (id) initWithPoint: (Point) aPoint
|
||||
Point addPoint (Point a, Point b)
|
||||
{
|
||||
self = [self init];
|
||||
|
||||
if (!self || !aPoint)
|
||||
return NIL;
|
||||
|
||||
x = [aPoint x];
|
||||
y = [aPoint y];
|
||||
|
||||
return self;
|
||||
Point c = {a.x + b.x, a.y + b.y};
|
||||
return c;
|
||||
}
|
||||
|
||||
- (id) copy
|
||||
Point subtractPoint (Point a, Point b)
|
||||
{
|
||||
local id myCopy = [super copy];
|
||||
|
||||
if (!myCopy)
|
||||
myCopy = [[self class] alloc];
|
||||
|
||||
return [myCopy initWithComponents: x : y];
|
||||
Point c = {a.x - b.x, a.y - b.y};
|
||||
return c;
|
||||
}
|
||||
|
||||
- (integer) x
|
||||
{
|
||||
return x;
|
||||
}
|
||||
|
||||
- (integer) y
|
||||
{
|
||||
return y;
|
||||
}
|
||||
|
||||
- (void) setPoint: (Point)aPoint
|
||||
{
|
||||
x = [aPoint x];
|
||||
y = [aPoint y];
|
||||
}
|
||||
|
||||
- (void) addPoint: (Point) aPoint
|
||||
{
|
||||
x += [aPoint x];
|
||||
y += [aPoint y];
|
||||
}
|
||||
|
||||
- (void) subtractPoint: (Point) aPoint
|
||||
{
|
||||
x -= [aPoint x];
|
||||
y -= [aPoint y];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -3,87 +3,21 @@
|
|||
#include "gui/Size.h"
|
||||
#include "gui/Rect.h"
|
||||
|
||||
@implementation Rect
|
||||
|
||||
- (id) initWithComponents: (integer)x : (integer)y : (integer)w : (integer)h
|
||||
Rect makeRect (integer x, integer y, integer w, integer h)
|
||||
{
|
||||
self = [self init];
|
||||
origin = [[Size alloc] initWithComponents: x : y];
|
||||
size = [[Size alloc] initWithComponents: w : h];
|
||||
return self;
|
||||
//FIXME Rect r = {{x, y}, {w, h}};
|
||||
Rect r;
|
||||
r.origin = makePoint (x, y);
|
||||
r.size = makeSize (w, h);
|
||||
return r;
|
||||
}
|
||||
|
||||
- (id) initWithOrigin: (Point)anOrigin size: (Size)aSize
|
||||
Rect makeRectFromOriginSize (Point origin, Size size)
|
||||
{
|
||||
self = [self init];
|
||||
Rect r;
|
||||
|
||||
if (!self || !anOrigin || !aSize)
|
||||
return NIL;
|
||||
r.origin = origin;
|
||||
r.size = size;
|
||||
|
||||
origin = [anOrigin retain];
|
||||
size = [aSize retain];
|
||||
|
||||
return self;
|
||||
return r;
|
||||
}
|
||||
|
||||
- (id) initWithRect: (Rect)aRect
|
||||
{
|
||||
self = [self init];
|
||||
|
||||
if (!self || !aRect)
|
||||
return NIL;
|
||||
|
||||
[self setRect: aRect];
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (id) copy
|
||||
{
|
||||
local id myCopy = [super copy];
|
||||
|
||||
if (!myCopy)
|
||||
myCopy = [[self class] alloc];
|
||||
|
||||
return [myCopy initWithOrigin: origin size: size];
|
||||
}
|
||||
|
||||
- (Point) origin
|
||||
{
|
||||
return origin;
|
||||
}
|
||||
|
||||
- (Size) size
|
||||
{
|
||||
return size;
|
||||
}
|
||||
|
||||
- (void) setOrigin: (Point)aPoint
|
||||
{
|
||||
if (!aPoint)
|
||||
return;
|
||||
|
||||
if (origin)
|
||||
[origin release];
|
||||
|
||||
origin = [aPoint retain];
|
||||
}
|
||||
|
||||
- (void) setSize: (Size)aSize
|
||||
{
|
||||
if (!aSize)
|
||||
return;
|
||||
|
||||
if (size)
|
||||
[size release];
|
||||
|
||||
size = [aSize retain];
|
||||
}
|
||||
|
||||
- (void) setRect: (Rect)aRect
|
||||
{
|
||||
[self setOrigin: [aRect origin]];
|
||||
[self setSize: [aRect size]];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -1,74 +1,19 @@
|
|||
#include "gui/Size.h"
|
||||
|
||||
@implementation Size
|
||||
|
||||
- (id) initWithComponents: (integer)w : (integer)h
|
||||
Size makeSize (integer width, integer height)
|
||||
{
|
||||
self = [self init];
|
||||
width = w;
|
||||
height = h;
|
||||
return self;
|
||||
Size s = {width, height};
|
||||
return s;
|
||||
}
|
||||
|
||||
- (id) initWithSize: (Size)aSize
|
||||
Size addSize (Size a, Size b)
|
||||
{
|
||||
self = [self init];
|
||||
|
||||
if (!self || !aSize)
|
||||
return NIL;
|
||||
|
||||
width = [aSize width];
|
||||
height = [aSize height];
|
||||
|
||||
return self;
|
||||
Size c = {a.width + b.width, a.height + b.height};
|
||||
return c;
|
||||
}
|
||||
|
||||
- (id) copy
|
||||
Size subtractSize (Size a, Size b)
|
||||
{
|
||||
local id myCopy = [super copy];
|
||||
|
||||
if (!myCopy)
|
||||
myCopy = [[self class] alloc];
|
||||
|
||||
return [myCopy initWithComponents: width : height];
|
||||
Size c = {a.width - b.width, a.height - b.height};
|
||||
return c;
|
||||
}
|
||||
|
||||
- (integer) width
|
||||
{
|
||||
return width;
|
||||
}
|
||||
|
||||
- (integer) height
|
||||
{
|
||||
return height;
|
||||
}
|
||||
|
||||
- (void) setSize: (Size)aSize
|
||||
{
|
||||
width = [aSize width];
|
||||
height = [aSize height];
|
||||
}
|
||||
|
||||
- (void) setWidth: (integer) w
|
||||
{
|
||||
width = w;
|
||||
}
|
||||
|
||||
- (void) setHeight: (integer) h
|
||||
{
|
||||
height = h;
|
||||
}
|
||||
|
||||
- (void) addSize: (Size)aSize
|
||||
{
|
||||
width += [aSize width];
|
||||
height += [aSize height];
|
||||
}
|
||||
|
||||
- (void) subtractSize: (Size)aSize
|
||||
{
|
||||
width += [aSize width];
|
||||
height += [aSize height];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -40,9 +40,8 @@
|
|||
|
||||
- (void) setBasePos: (integer) x y: (integer) y
|
||||
{
|
||||
local Point point = [[Point alloc] initWithComponents:x :y];
|
||||
local Point point = {x, y};
|
||||
[self setBasePos:point];
|
||||
[point release];
|
||||
}
|
||||
|
||||
- (void) setBasePos: (Point)pos
|
||||
|
|
|
@ -22,9 +22,6 @@ struct il_data_t {
|
|||
BOOL cursor;
|
||||
};
|
||||
|
||||
@class Rect;
|
||||
@class Point;
|
||||
|
||||
@interface InputLine: View
|
||||
{
|
||||
struct il_data_t control;
|
||||
|
|
|
@ -1,26 +1,15 @@
|
|||
#ifndef __ruamoko_gui_Point_h
|
||||
#define __ruamoko_gui_Point_h
|
||||
|
||||
#include "Object.h"
|
||||
struct Point {
|
||||
integer x;
|
||||
integer y;
|
||||
};
|
||||
|
||||
@interface Point: Object
|
||||
{
|
||||
@public
|
||||
integer x;
|
||||
integer y;
|
||||
}
|
||||
typedef struct Point Point;
|
||||
|
||||
- (id) initWithComponents: (integer)_x : (integer)_y;
|
||||
- (id) initWithPoint: (Point)aPoint;
|
||||
- (id) copy;
|
||||
|
||||
- (void) addPoint: (Point)aPoint;
|
||||
- (void) subtractPoint: (Point)aPoint;
|
||||
|
||||
- (integer) x;
|
||||
- (integer) y;
|
||||
|
||||
- (void) setPoint: (Point)aPoint;
|
||||
@end
|
||||
@extern Point makePoint (integer x, integer y);
|
||||
@extern Point addPoint (Point a, Point b);
|
||||
@extern Point subtractPoint (Point a, Point b);
|
||||
|
||||
#endif //__ruamoko_gui_Point_h
|
||||
|
|
|
@ -1,21 +1,17 @@
|
|||
#ifndef __ruamoko_gui_Rect_h
|
||||
#define __ruamoko_gui_Rect_h
|
||||
|
||||
#include "Object.h"
|
||||
#include "gui/Point.h"
|
||||
#include "gui/Size.h"
|
||||
|
||||
@interface Rect: Object
|
||||
{
|
||||
@public
|
||||
struct Rect {
|
||||
Point origin;
|
||||
Size size;
|
||||
}
|
||||
};
|
||||
typedef struct Rect Rect;
|
||||
|
||||
- (id) initWithComponents: (integer)x : (integer)y : (integer)w : (integer)h;
|
||||
- (id) initWithOrigin: (Point)anOrigin size: (Size)aSize;
|
||||
- (id) initWithRect: (Rect)aRect;
|
||||
- (id) copy;
|
||||
@extern Rect makeRect (integer x, integer y, integer w, integer h);
|
||||
@extern Rect makeRectFromOriginSize (Point origin, Size size);
|
||||
|
||||
#if 0
|
||||
- (BOOL) intersectsRect: (Rect)aRect;
|
||||
|
@ -31,13 +27,4 @@
|
|||
- (Rect) offsetBySize: (Size)aSize;
|
||||
#endif
|
||||
|
||||
- (Point) origin;
|
||||
- (Size) size;
|
||||
|
||||
- (void) setOrigin: (Point)aPoint;
|
||||
- (void) setSize: (Size)aSize;
|
||||
- (void) setRect: (Rect)aRect;
|
||||
|
||||
@end
|
||||
|
||||
#endif //__ruamoko_gui_Rect_h
|
||||
|
|
|
@ -1,29 +1,15 @@
|
|||
#ifndef __ruamoko_gui_Size_h
|
||||
#define __ruamoko_gui_Size_h
|
||||
|
||||
#include "Object.h"
|
||||
struct Size {
|
||||
integer width;
|
||||
integer height;
|
||||
};
|
||||
|
||||
@interface Size: Object
|
||||
{
|
||||
@public
|
||||
integer width;
|
||||
integer height;
|
||||
}
|
||||
typedef struct Size Size;
|
||||
|
||||
- (id) initWithComponents: (integer)w : (integer)h;
|
||||
- (id) initWithSize: (Size)aSize;
|
||||
- (id) copy;
|
||||
|
||||
- (integer) width;
|
||||
- (integer) height;
|
||||
|
||||
- (void) setSize: (Size)aSize;
|
||||
- (void) setWidth: (integer)w;
|
||||
- (void) setHeight: (integer)h;
|
||||
|
||||
- (void) addSize: (Size)aSize;
|
||||
- (void) subtractSize: (Size)aSize;
|
||||
|
||||
@end
|
||||
@extern Size makeSize (integer width, integer height);
|
||||
@extern Size addSize (Size a, Size b);
|
||||
@extern Size subtractSize (Size a, Size b);
|
||||
|
||||
#endif //__ruamoko_gui_Size_h
|
||||
|
|
|
@ -2,10 +2,7 @@
|
|||
#define __ruamoko_gui_View_h
|
||||
|
||||
#include "Object.h"
|
||||
|
||||
@class Point;
|
||||
@class Size;
|
||||
@class Rect;
|
||||
#include "gui/Rect.h"
|
||||
|
||||
@interface View: Object
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue