-
Notifications
You must be signed in to change notification settings - Fork 0
/
FontsAndSpacings.m
47 lines (36 loc) · 1.11 KB
/
FontsAndSpacings.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
//
// Font.m
// Battle Solitare
//
// Created by Kevin Yue on 8/21/14.
// Copyright (c) 2014 Kevin Yue. All rights reserved.
//
#import "FontsAndSpacings.h"
#import "Grid.h"
#import "cocos2d.h"
static FontsAndSpacings* instance;
const float menuFontScale = 12;
const float hudFontScale = 30;
const float scoreOffsetScale = 6;
const float borderRatio = 6;
const float playerRectScale = .75;
NSString * const defaultFont = @"TrajanPro-Regular";
@implementation FontsAndSpacings
+(FontsAndSpacings*)getInstance{
if(instance == nil) {instance = [[self alloc] init];}
return instance;
}
-(id)init{
self = [super init];
[self setupVariables];
return self;
}
-(void)setupVariables{
_menuFontSize = (int) ([CCDirector sharedDirector].winSize.width/ menuFontScale);
_hudFontSize = (int) ([CCDirector sharedDirector].winSize.width / hudFontScale);
_textOffset = (int) ([CCDirector sharedDirector].winSize.width / scoreOffsetScale);
_border = [[Grid getInstance] sideMargin];
_playerRectSize = [[Grid getInstance] verticalMargin] * playerRectScale;
_font = defaultFont;
}
@end