better font api
git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@229 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
parent
66196a56c7
commit
d6c787f1a7
6 changed files with 16 additions and 10 deletions
10
src/draw.c
10
src/draw.c
|
|
@ -359,13 +359,19 @@ void MwDrawTriangle(MwWidget handle, MwRect* rect, MwLLColor color, int invert,
|
|||
MwLLFreeColor(darker);
|
||||
}
|
||||
|
||||
void MwDrawText(MwWidget handle, MwPoint* point, const char* text, int bold, MwLLColor color) {
|
||||
void MwDrawText(MwWidget handle, MwPoint* point, const char* text, int bold, int align, MwLLColor color) {
|
||||
int i, x, y, sx, sy;
|
||||
MwRect r;
|
||||
|
||||
sx = point->x - strlen(text) * FontWidth * FontScale / 2;
|
||||
sx = point->x;
|
||||
sy = point->y - FontHeight * FontScale / 2;
|
||||
|
||||
if(align == MwALIGNMENT_CENTER) {
|
||||
sx -= strlen(text) * FontWidth * FontScale / 2;
|
||||
} else if(align == MwALIGNMENT_END) {
|
||||
sx -= strlen(text) * FontWidth * FontScale;
|
||||
}
|
||||
|
||||
for(i = 0; text[i] != 0; i++) {
|
||||
for(y = 0; y < FontHeight; y++) {
|
||||
for(x = 0; x < FontWidth; x++) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue