multiplayer pong game for LPC 1768

Dependencies:   mbed MbedJSONValue mbed-rtos Adafruit_ST7735 Adafruit_GFX EthernetInterface DebouncedInterrupt

graphics.cpp

Committer:
vsoltan
Date:
2020-11-15
Revision:
18:32fce82690a1
Parent:
17:32ae1f106002
Child:
19:58cc5465f647

File content as of revision 18:32fce82690a1:


#include "graphics.h"

Graphics::Graphics() {
    printf("\n\rInitializing Graphics: initializing TFT\n\r");
    this->tft = new Adafruit_ST7735(P_MOSI, P_MISO, P_SOCK, P_CS, P_RS, P_DC);
    printf("Initializing Graphics: optimizing display for resolution\n\r");
    tft->initR(INITR_144GREENTAB); 
    tft->setTextColor(ST7735_WHITE);
}

void Graphics::renderLaunchScreen() {
    tft->fillScreen(ST7735_BLACK);
    tft->setTextCursor(20, 20); 
    tft->printf("%s", "Multiplayer Pong");
    tft->setTextCursor(20, 80); 
    tft->printf("%s", "Press any button to continue."); 
}

void Graphics::renderWaitingRoom() {
    tft->fillScreen(ST7735_GREEN);
    tft->setTextCursor(20, 20); 
    tft->printf("%s", "Waiting For Player");
}

void Graphics::renderBall(GameState *gs) {
    
}

void Graphics::renderPlayers(GameState *gs) {
}

void Graphics::renderGameState(GameState *gs) {
    tft->fillScreen(ST7735_RED); 
}