Skip to content

Commit

Permalink
Minor tweaks to MT32LCDDisplay.
Browse files Browse the repository at this point in the history
  • Loading branch information
MaddTheSane committed Oct 8, 2023
1 parent 11a4793 commit 656e6f2
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions Boxer/MT32LCDDisplay.swift
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,12 @@ class MT32LCDDisplay : NSTextField {
let glyphColor = self.pixelColor

let characterSize = gridTemplate.size
let characterSpacing = 3
let characterSpacing: CGFloat = 3

let glyphSize = NSSize(width: 5, height: 9)
let firstGlyph: Character = "!"

var gridRect = NSRect(origin: .zero, size: CGSize(width: (characterSize.width + CGFloat(characterSpacing)) * 19 + characterSize.width, height: characterSize.height))
var gridRect = NSRect(origin: .zero, size: CGSize(width: (characterSize.width + characterSpacing) * 19 + characterSize.width, height: characterSize.height))

gridRect = centerInRect(gridRect, bounds)
gridRect.origin = integralPoint(gridRect.origin)
Expand All @@ -93,7 +93,11 @@ class MT32LCDDisplay : NSTextField {

let grid = gridTemplate.imageFilled(with: gridColor, at: characterSize)

for c in charsToDisplay {
for (i, c) in charsToDisplay.enumerated() {
if i >= 20 {
break
}

//First, draw the background grid for this character
grid.draw(in: characterRect, from: .zero, operation: .sourceOver, fraction: 1, respectFlipped: true, hints: nil)

Expand Down Expand Up @@ -122,7 +126,7 @@ class MT32LCDDisplay : NSTextField {
tintedGlyph.draw(in: characterRect, from: .zero, operation: .sourceOver, fraction: 1, respectFlipped: true, hints: nil)
}

characterRect.origin.x += characterSize.width + CGFloat(characterSpacing)
characterRect.origin.x += characterSize.width + characterSpacing
}

//Finally, draw the shadowing and lighting effects and the frame
Expand Down

0 comments on commit 656e6f2

Please sign in to comment.