screen

package
v0.0.0-...-476d645 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 3, 2021 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CursorPos

type CursorPos struct {
	X        int
	Y        int
	Display  bool
	Scroll   bool
	Sequence []rune
	// contains filtered or unexported fields
}

CursorPos represents the position of the cursor on the screen It also manages the extents of the screen, so that the cursor Cannot go outside the screen.

The Scroll flag is there to indicate to the calling object that it should scroll up. This object will not handle the scrolling, and the flag can be cleared by either moving the cursor or by calling the ClearScroll method.

func NewCursorPos

func NewCursorPos(cols int, rows int, sequence []rune) *CursorPos

NewCursorPos creates a new cursor pos

func (*CursorPos) Backspace

func (cpos *CursorPos) Backspace()

Backspace moves the cursor back one space. If it reaches the beginning of the line, it will do nothing.

func (*CursorPos) ClearScroll

func (cpos *CursorPos) ClearScroll()

ClearScroll clears the scroll flag

func (*CursorPos) NewLine

func (cpos *CursorPos) NewLine()

NewLine moves the cursor to the beginning of the next line. If it exceeds the number of rows on the screen, it will set the Scroll flag.

func (*CursorPos) NextLine

func (cpos *CursorPos) NextLine()

NextLine moves the cursor to the next line, but at the same col. If it exceeds the number of rows on the screen, will set the Scroll flag.

func (*CursorPos) NextLocation

func (cpos *CursorPos) NextLocation()

NextLocation moves the cursor right by one It will move to the next line if you're at the end of a line

func (*CursorPos) NextSequence

func (cpos *CursorPos) NextSequence() rune

NextSequence returns the next rune in the cursor sequence

type DebugScreen

type DebugScreen struct {
	Active bool
	// contains filtered or unexported fields
}

DebugScreen is the output for the debug info

func NewDebugScreen

func NewDebugScreen(parent *Screen) *DebugScreen

NewDebugScreen creates a new debug window

func (*DebugScreen) CleanUp

func (s *DebugScreen) CleanUp()

CleanUp cleans all resources created by the debug window

func (*DebugScreen) DrawCodeLines

func (s *DebugScreen) DrawCodeLines(renderer *sdl.Renderer, PC uint16) error

DrawCodeLines draws the debug code lines to the screen

func (*DebugScreen) DrawScreen

func (s *DebugScreen) DrawScreen()

DrawScreen draws the entire screen

func (*DebugScreen) DrawStack

func (s *DebugScreen) DrawStack(renderer *sdl.Renderer, em EmulatorInterface) error

DrawStack draws the stack info to the specified renderer

func (*DebugScreen) Hide

func (s *DebugScreen) Hide()

Hide hides the debug window

func (*DebugScreen) Show

func (s *DebugScreen) Show(em EmulatorInterface, status *utils.ComputerStatus)

Show shows the debug window

type EmulatorInterface

type EmulatorInterface interface {
	GetCPU() *i6502.Cpu
	ReadMemory(address uint16) uint8
}

EmulatorInterface provides a de-coupled interface to the emulator to avoid circular package dependencies

type Screen

type Screen struct {
	Busy bool
	// contains filtered or unexported fields
}

Screen represents the main object to display text output

func NewScreen

func NewScreen(cols int, rows int, status *utils.ComputerStatus) *Screen

NewScreen creates a new screen object

func (*Screen) CleanUp

func (s *Screen) CleanUp()

CleanUp cleans up all the resources creates by the screen object

func (*Screen) DisableDebug

func (s *Screen) DisableDebug()

DisableDebug turns off debugging/single step

func (*Screen) DrawScreen

func (s *Screen) DrawScreen()

DrawScreen draws the entire screen

func (*Screen) EnableDebug

func (s *Screen) EnableDebug(em EmulatorInterface)

EnableDebug turns on debugging/single step

func (*Screen) GetFontHeight

func (s *Screen) GetFontHeight() int32

GetFontHeight return the height of a row

func (*Screen) GetFontWidth

func (s *Screen) GetFontWidth() int32

GetFontWidth returns the width of an individual character

func (Screen) GetPosition

func (s Screen) GetPosition() (x, y int32)

GetPosition returns the position of the screen returns -1, -1 if window not created

func (Screen) GetSize

func (s Screen) GetSize() (w, h int32)

GetSize returns the size of the screen returns -1,-1 if window not create

func (*Screen) GetWindowPosition

func (s *Screen) GetWindowPosition() (x, y int32)

GetWindowPosition returns the current window position

func (Screen) IsBusy

func (s Screen) IsBusy() bool

IsBusy returns if the screen is busy

func (*Screen) IsEmulatorOnOffClicked

func (s *Screen) IsEmulatorOnOffClicked(x int32, y int32) bool

IsEmulatorOnOffClicked returns if x,y is within the rectangle of the graphic on/off switch

func (*Screen) ProcessRune

func (s *Screen) ProcessRune(r rune)

ProcessRune processes an ASCII character

func (*Screen) Reset

func (s *Screen) Reset()

Reset resets the screen to startup state

func (*Screen) Show

func (s *Screen) Show() error

Show initializes the main screen and shows it

func (*Screen) UpdateScreen

func (s *Screen) UpdateScreen()

UpdateScreen allows an external process to force an update of the screen

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL