Merge branch 'master' into useless_dcc_math

This commit is contained in:
Tim Sarbin 2021-01-01 20:02:19 -05:00 committed by GitHub
commit 9a1e8c67a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 10 additions and 52 deletions

View File

@ -1,10 +1,9 @@
---
name: pull_request
"on": [pull_request]
jobs:
build:
name: Build
runs-on: ubuntu-latest
name: ''
runs-on: self-hosted
continue-on-error: true
steps:
- name: Set up Go 1.14

View File

@ -1,39 +0,0 @@
---
name: build
"on":
push:
branches:
- master
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.14
uses: actions/setup-go@v2.1.3
with:
go-version: 1.14
id: go
- name: Check out code
uses: actions/checkout@v2.3.4
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y xvfb libxcursor-dev libxrandr-dev libxinerama-dev libxi-dev libgl1-mesa-dev libsdl2-dev libasound2-dev > /dev/null 2>&1
- name: Run golangci-lint
continue-on-error: false
uses: golangci/golangci-lint-action@v2.3.0
with:
version: v1.32
- name: Run tests
env:
DISPLAY: ":99.0"
run: |
xvfb-run --auto-servernum go test -v -race ./...
- name: Build binary
run: go build .

View File

@ -1,7 +1,5 @@
package d2interface
import "github.com/hajimehoshi/ebiten/v2"
type renderCallback = func(Surface) error
type updateCallback = func() error
@ -21,6 +19,6 @@ type Renderer interface {
GetCursorPos() (int, int)
CurrentFPS() float64
ShowPanicScreen(message string)
Print(target *ebiten.Image, str string) error
PrintAt(target *ebiten.Image, str string, x, y int)
Print(target interface{}, str string) error
PrintAt(target interface{}, str string, x, y int)
}

View File

@ -37,16 +37,16 @@ type GlyphPrinter struct {
// Basic Latin and C1 Controls and Latin-1 Supplement.
//
// DebugPrint always returns nil as of 1.5.0-alpha.
func (p *GlyphPrinter) Print(target *ebiten.Image, str string) error {
p.PrintAt(target, str, 0, 0)
func (p *GlyphPrinter) Print(target interface{}, str string) error {
p.PrintAt(target.(*ebiten.Image), str, 0, 0)
return nil
}
// PrintAt draws the string str on the image at (x, y) position.
// The available runes are in U+0000 to U+00FF, which is C0 Controls and
// Basic Latin and C1 Controls and Latin-1 Supplement.
func (p *GlyphPrinter) PrintAt(target *ebiten.Image, str string, x, y int) {
p.drawDebugText(target, str, x, y, false)
func (p *GlyphPrinter) PrintAt(target interface{}, str string, x, y int) {
p.drawDebugText(target.(*ebiten.Image), str, x, y, false)
}
func (p *GlyphPrinter) drawDebugText(target *ebiten.Image, str string, ox, oy int, shadow bool) {

View File

@ -795,11 +795,11 @@ func (g *GameControls) isInActiveMenusRect(px, py int) bool {
// Render draws the GameControls onto the target
func (g *GameControls) Render(target d2interface.Surface) error {
if err := g.renderPanels(target); err != nil {
if err := g.hud.Render(target); err != nil {
return err
}
if err := g.hud.Render(target); err != nil {
if err := g.renderPanels(target); err != nil {
return err
}