Sha256: 7e615f9c649e699c299c26dc29026fec279174a943c487f58894b92be825edac

Contents?: true

Size: 953 Bytes

Versions: 3

Compression:

Stored size: 953 Bytes

Contents

#import <Cocoa/Cocoa.h>
#import <Gosu/Font.hpp>
#import <Gosu/Utility.hpp>
#import <Gosu/Window.hpp>

@interface ObjGosuFont : NSObject {
    Gosu::Font* _font;
}
@end

@implementation ObjGosuFont
- (int)height
{
    return _font->height();
}

- (NSString*)name
{
    return [NSString stringWithUTF8String:Gosu::wstringToUTF8(_font->name()).c_str()];
}

- (id)initWithWindow: (id)window fontName: (NSString*)fontName height: (int)height
{
    if (not (self = [super init]))
        return NULL;
    
    _font = new Gosu::Font(((Gosu::Window*)[[window _objcObject] _cppObject])->graphics(),
        Gosu::widen([fontName UTF8String]), height);
    
    return self;
}

/*- (float)widthOfText: (NSString*)text
{
}*/

- (void)drawText: (NSString*)text atX:(float)x y:(float)y z:(float)z
    factorX:(float)factorX factorY:(float)factorY color:(unsigned int)color
{
    _font->draw(Gosu::widen([text UTF8String]), x, y, z, factorX, factorY, color);
}
@end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
gosu-0.7.18 GosuImpl/ObjGosu/ObjGosuFont.mm
gosu-0.7.17 GosuImpl/ObjGosu/ObjGosuFont.mm
gosu-0.7.16 GosuImpl/ObjGosu/ObjGosuFont.mm