This repository has been archived by the owner on Feb 26, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
71 changed files
with
1,478 additions
and
322 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
#include "font.h" | ||
|
||
#include "main.h" | ||
|
||
#include <string.h> | ||
|
||
//Font_Bold | ||
s32 Font_Bold_GetWidth(struct FontData *this, const char *text) | ||
{ | ||
return strlen(text) * 13; | ||
} | ||
|
||
void Font_Bold_Draw(struct FontData *this, const char *text, s32 x, s32 y, FontAlign align) | ||
{ | ||
//Offset position based off alignment | ||
switch (align) | ||
{ | ||
case FontAlign_Left: | ||
break; | ||
case FontAlign_Center: | ||
x -= Font_Bold_GetWidth(this, text) >> 1; | ||
break; | ||
case FontAlign_Right: | ||
x -= Font_Bold_GetWidth(this, text); | ||
break; | ||
} | ||
|
||
//Get animation offsets | ||
u32 v0 = 0; | ||
u8 v1 = (frame_count >> 3) & 1; | ||
|
||
//Draw string character by character | ||
u8 c; | ||
while ((c = *text++) != '\0') | ||
{ | ||
//Draw character | ||
if ((c -= 'A') <= 'z' - 'A') //Lower-case will show inverted colours | ||
{ | ||
RECT src = {((c & 0x7) << 5) + ((((v0 >> c) & 1) ^ v1) << 4), (c & ~0x7) << 1, 16, 16}; | ||
Gfx_BlitTex(&this->tex, &src, x, y); | ||
v0 ^= 1 << c; | ||
} | ||
x += 13; | ||
} | ||
} | ||
|
||
//Font functions | ||
void FontData_Load(FontData *this, Font font) | ||
{ | ||
//Load the given font | ||
switch (font) | ||
{ | ||
case Font_Bold: | ||
//Load texture and set functions | ||
Gfx_LoadTex(&this->tex, IO_Read("\\FONT\\BOLDFONT.TIM;1"), GFX_LOADTEX_FREE); | ||
this->get_width = Font_Bold_GetWidth; | ||
this->draw = Font_Bold_Draw; | ||
break; | ||
} | ||
} |
Oops, something went wrong.