Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed cannot use display error #8

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 17 additions & 17 deletions go-gopher-gba/gopher.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,19 +75,19 @@ func main() {
func drawGophers() {

// Display a textual message "Gopher" with Google colors
tinyfont.DrawChar(display, &fonts.Bold24pt7b, 36, 60, 'G', gBlue)
tinyfont.DrawChar(display, &fonts.Bold24pt7b, 71, 60, 'o', gRed)
tinyfont.DrawChar(display, &fonts.Bold24pt7b, 98, 60, 'p', gYellow)
tinyfont.DrawChar(display, &fonts.Bold24pt7b, 126, 60, 'h', gGreen)
tinyfont.DrawChar(display, &fonts.Bold24pt7b, 154, 60, 'e', gBlue)
tinyfont.DrawChar(display, &fonts.Bold24pt7b, 180, 60, 'r', gRed)
tinyfont.DrawChar(&display, &fonts.Bold24pt7b, 36, 60, 'G', gBlue)
tinyfont.DrawChar(&display, &fonts.Bold24pt7b, 71, 60, 'o', gRed)
tinyfont.DrawChar(&display, &fonts.Bold24pt7b, 98, 60, 'p', gYellow)
tinyfont.DrawChar(&display, &fonts.Bold24pt7b, 126, 60, 'h', gGreen)
tinyfont.DrawChar(&display, &fonts.Bold24pt7b, 154, 60, 'e', gBlue)
tinyfont.DrawChar(&display, &fonts.Bold24pt7b, 180, 60, 'r', gRed)

// Display a "press START button" message - center
tinyfont.WriteLine(display, &tinyfont.TomThumb, 85, 90, "Press START button", white)
tinyfont.WriteLine(&display, &tinyfont.TomThumb, 85, 90, "Press START button", white)

// Display two gophers
tinyfont.DrawChar(display, &fonts.Regular58pt, 5, 140, 'B', green)
tinyfont.DrawChar(display, &fonts.Regular58pt, 195, 140, 'X', red)
tinyfont.DrawChar(&display, &fonts.Regular58pt, 5, 140, 'B', green)
tinyfont.DrawChar(&display, &fonts.Regular58pt, 195, 140, 'X', red)
}

func update(interrupt.Interrupt) {
Expand All @@ -100,7 +100,7 @@ func update(interrupt.Interrupt) {
// Clear display
clearScreen()
// Display gopher
tinyfont.DrawChar(display, &fonts.Regular58pt, x, y, 'B', green)
tinyfont.DrawChar(&display, &fonts.Regular58pt, x, y, 'B', green)
// Go back to Menu
case keySELECT:
clearScreen()
Expand All @@ -111,44 +111,44 @@ func update(interrupt.Interrupt) {
clearScreen()
x = x + 10
// display gopher at right
tinyfont.DrawChar(display, &fonts.Regular58pt, x, y, 'B', green)
tinyfont.DrawChar(&display, &fonts.Regular58pt, x, y, 'B', green)
// Gopher go to the left
case keyLEFT:
// Clear display
clearScreen()
x = x - 10
// display gopher at right
tinyfont.DrawChar(display, &fonts.Regular58pt, x, y, 'B', green)
tinyfont.DrawChar(&display, &fonts.Regular58pt, x, y, 'B', green)
// Gopher go to the down
case keyDOWN:
// Clear display
clearScreen()
y = y + 10
tinyfont.DrawChar(display, &fonts.Regular58pt, x, y, 'B', green)
tinyfont.DrawChar(&display, &fonts.Regular58pt, x, y, 'B', green)
// Gopher go to the up
case keyUP:
// Clear display
clearScreen()
y = y - 10
tinyfont.DrawChar(display, &fonts.Regular58pt, x, y, 'B', green)
tinyfont.DrawChar(&display, &fonts.Regular58pt, x, y, 'B', green)
//Gopher jump
case keyA:
// Clear display
clearScreen()
// Display the gopher up
y = y - 20
tinyfont.DrawChar(display, &fonts.Regular58pt, x, y, 'B', green)
tinyfont.DrawChar(&display, &fonts.Regular58pt, x, y, 'B', green)
// Clear the display
clearScreen()
// Display the gopher down
y = y + 20
tinyfont.DrawChar(display, &fonts.Regular58pt, x, y, 'B', green)
tinyfont.DrawChar(&display, &fonts.Regular58pt, x, y, 'B', green)
}
}

func clearScreen() {
tinydraw.FilledRectangle(
display,
&display,
int16(0), int16(0),
screenWidth, screenHeight,
black,
Expand Down