-
Notifications
You must be signed in to change notification settings - Fork 0
/
TextView.cpp
36 lines (33 loc) · 1009 Bytes
/
TextView.cpp
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
//
// TextView.cpp
// FFFF
//
// Created by Casey Hanley on 4/23/14.
// Copyright (c) 2014 Casey Hanley. All rights reserved.
//
#include "TextView.h"
#include <SDL2/SDL.h>
#include "SDL2_ttf/SDL_ttf.h"
#include "LTexture.h"
#include <stdio.h>
#include <string>
//------------------------------------------------------------------------------
void TextView::draw(string text, int x, int y, SDL_Renderer *gRenderer){
SDL_Color whiteColor = {255, 255, 255};
font.loadFromRenderedText( text, whiteColor, gRenderer, gFont );
font.render( gRenderer, x, y );
}
//------------------------------------------------------------------------------
TextView::TextView(){
x=0;
y=0;
text="nothing";
gFont = TTF_OpenFont( "AndaleMono.ttf", 16 );
}
//------------------------------------------------------------------------------
TextView::TextView(int x, int y, string text, SDL_Renderer *gRenderer){
x=x;
y=y;
text=text;
gFont = TTF_OpenFont( "AndaleMono.ttf", 16 );
}