Original author: Pierre Sarrazin. Public-domain library and demo. Source: http://sarrazip.com/dev/cardgame-0.1.15.tar.gz Archive SHA-256: ca706dddd96fec63b829f8958c2e47485b0e1166129d45fda0b6369404c1bb54
33 lines
821 B
C
33 lines
821 B
C
#include "pmode4game_private.h"
|
|
|
|
|
|
void
|
|
drawChar(unsigned char c)
|
|
{
|
|
if (c == '\n')
|
|
textPosX = BYTES_PER_SCREEN_ROW - 1; // go to end of current line
|
|
else
|
|
drawCharWithoutMovingCursor(c);
|
|
|
|
// Advance cursor.
|
|
if (textPosX == BYTES_PER_SCREEN_ROW - 1) // if column finished, go to next row
|
|
{
|
|
textPosX = 0;
|
|
if (textPosY == TEXT_ROWS_PER_SCREEN - 1) // if at last row, wrap around
|
|
{
|
|
if (textAreaScrollCallback)
|
|
{
|
|
// This may call moveCursor(), which may change textPosX and textPosY.
|
|
(*textAreaScrollCallback)(textAreaScrollCallbackUserData);
|
|
}
|
|
else
|
|
textPosY = 0; // wrap around
|
|
}
|
|
else
|
|
++textPosY;
|
|
}
|
|
else
|
|
++textPosX;
|
|
}
|
|
|