mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 23:32:09 +00:00
36 lines
517 B
R
36 lines
517 B
R
|
#include "gui/Text.h"
|
||
|
#include "string.h"
|
||
|
#include "draw.h"
|
||
|
|
||
|
@implementation Text
|
||
|
- (id) initWithBounds: (Rect)aRect
|
||
|
{
|
||
|
return [self initWithBounds:aRect text:""];
|
||
|
}
|
||
|
|
||
|
- (id) initWithBounds: (Rect)aRect text:(string)str
|
||
|
{
|
||
|
self = [super initWithBounds:aRect];
|
||
|
text = str_new ();
|
||
|
str_copy (text, str);
|
||
|
return self;
|
||
|
}
|
||
|
|
||
|
- (void) dealloc
|
||
|
{
|
||
|
str_free (text);
|
||
|
}
|
||
|
|
||
|
- (void) setText: (string)str
|
||
|
{
|
||
|
str_copy (text, str);
|
||
|
}
|
||
|
|
||
|
- (void) draw
|
||
|
{
|
||
|
local integer maxlen = xlen / 8;
|
||
|
Draw_nString (xabs, yabs, text, maxlen);
|
||
|
}
|
||
|
|
||
|
@end
|