2020-03-31 11:48:38 +00:00
|
|
|
#include <string.h>
|
2020-06-21 14:15:17 +00:00
|
|
|
#include "ruamoko/qwaq/debugger/views/floatview.h"
|
2020-03-31 11:48:38 +00:00
|
|
|
|
|
|
|
@implementation FloatView
|
|
|
|
|
2021-06-01 14:52:04 +00:00
|
|
|
-initWithDef:(qdb_def_t)def in:(void *)data type:(qfot_type_t *)type
|
2020-03-31 11:48:38 +00:00
|
|
|
{
|
2021-06-04 04:35:53 +00:00
|
|
|
if (!(self = [super initWithDef:def type:type])) {
|
2020-03-31 11:48:38 +00:00
|
|
|
return nil;
|
|
|
|
}
|
2021-06-01 14:52:04 +00:00
|
|
|
self.data = (float *)(data + def.offset);
|
2020-03-31 11:48:38 +00:00
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
2021-06-01 14:52:04 +00:00
|
|
|
+(FloatView *)withDef:(qdb_def_t)def in:(void *)data type:(qfot_type_t *)type
|
2020-03-31 11:48:38 +00:00
|
|
|
{
|
2021-06-01 14:52:04 +00:00
|
|
|
return [[[self alloc] initWithDef:def in:data type:type] autorelease];
|
2020-03-31 11:48:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
-draw
|
|
|
|
{
|
|
|
|
[super draw];
|
2021-06-19 02:25:05 +00:00
|
|
|
string val = sprintf ("%.9g", data[0]);
|
2020-04-01 10:57:24 +00:00
|
|
|
[self mvprintf:{0, 0}, "%*.*s", xlen, xlen, val];
|
2020-03-31 11:48:38 +00:00
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
@end
|