...

Source file src/code.rocket9labs.com/tslocum/etk/kibodo/key.go

Documentation: code.rocket9labs.com/tslocum/etk/kibodo

     1  package kibodo
     2  
     3  import (
     4  	"time"
     5  
     6  	"github.com/hajimehoshi/ebiten/v2"
     7  )
     8  
     9  // Key represents a virtual key.
    10  type Key struct {
    11  	LowerLabel string
    12  	UpperLabel string
    13  	LowerInput *Input
    14  	UpperInput *Input
    15  	Wide       bool
    16  
    17  	x, y int
    18  	w, h int
    19  
    20  	pressed        bool
    21  	pressedTime    time.Time
    22  	pressedTouchID ebiten.TouchID
    23  	repeatTime     time.Time
    24  }
    25  
    26  // Input represents the input event from a key press.
    27  type Input struct {
    28  	Rune rune
    29  	Key  ebiten.Key
    30  }
    31  
    32  func (i *Input) String() string {
    33  	if i.Rune > 0 {
    34  		return string(i.Rune)
    35  	}
    36  	return i.Key.String()
    37  }
    38  

View as plain text