From 7b650ffa188eed3a41775de42daf11c798308e07 Mon Sep 17 00:00:00 2001 From: Irmen de Jong Date: Sat, 6 Oct 2018 02:16:07 +0200 Subject: [PATCH] added bitmap characters --- compiler/compiler.iml | 1 + compiler/examples/cube3d.p8 | 3 +- compiler/examples/mandelbrot.p8 | 4 +- compiler/examples/swirl.p8 | 1 - compiler/res/charset/c64/charset-normal.png | Bin 0 -> 9080 bytes compiler/res/charset/c64/charset-shifted.png | Bin 0 -> 9178 bytes .../src/prog8/compiler/target/c64/Charset.kt | 37 ++++++++++++++++++ compiler/src/prog8/stackvm/ScreenDialog.kt | 22 +++++++++-- compiler/src/prog8/stackvm/StackVm.kt | 2 +- 9 files changed, 61 insertions(+), 9 deletions(-) create mode 100644 compiler/res/charset/c64/charset-normal.png create mode 100644 compiler/res/charset/c64/charset-shifted.png create mode 100644 compiler/src/prog8/compiler/target/c64/Charset.kt diff --git a/compiler/compiler.iml b/compiler/compiler.iml index 200b1a8d0..9319f77cf 100644 --- a/compiler/compiler.iml +++ b/compiler/compiler.iml @@ -5,6 +5,7 @@ + diff --git a/compiler/examples/cube3d.p8 b/compiler/examples/cube3d.p8 index a1cde3590..db22c00b4 100644 --- a/compiler/examples/cube3d.p8 +++ b/compiler/examples/cube3d.p8 @@ -36,7 +36,8 @@ if irq.time_changed { irq.time_changed = 0 _vm_gfx_clearscr(0) - _vm_gfx_text(14, 5, 5, "Spin to Win !!!") + _vm_gfx_text(8, 6, 1, "Spin") + _vm_gfx_text(29, 11, 1, "to Win !") for i in 0 to width//10 { _vm_gfx_line(i*2+width//2-width//10, 130, i*10.w, 199, 6) diff --git a/compiler/examples/mandelbrot.p8 b/compiler/examples/mandelbrot.p8 index 6096ee6c7..d1c1d4234 100644 --- a/compiler/examples/mandelbrot.p8 +++ b/compiler/examples/mandelbrot.p8 @@ -21,7 +21,7 @@ byte ploty _vm_gfx_clearscr(11) - _vm_gfx_text(2, 1, 7, "Calculating Mandelbrot Fractal...") + _vm_gfx_text(2, 1, 1, "Calculating Mandelbrot Fractal...") for pixely in yoffset to yoffset+height-1 { yy = flt((pixely-yoffset))/height/3.6+0.4 @@ -46,7 +46,7 @@ } } - _vm_gfx_text(11, 21, 7, "Finished!") + _vm_gfx_text(11, 21, 1, "Finished!") } } diff --git a/compiler/examples/swirl.p8 b/compiler/examples/swirl.p8 index 3052a7510..a4efcb892 100644 --- a/compiler/examples/swirl.p8 +++ b/compiler/examples/swirl.p8 @@ -8,7 +8,6 @@ sub start() { _vm_gfx_clearscr(0) - _vm_gfx_text(2, 2, 7, "Swirl !!!") float x float y diff --git a/compiler/res/charset/c64/charset-normal.png b/compiler/res/charset/c64/charset-normal.png new file mode 100644 index 0000000000000000000000000000000000000000..7ce5db790c22629f2387738f697aa986a67a9520 GIT binary patch literal 9080 zcmV-;BZu6HP) zaB^>EX>4U6ba`-PAZ2)IW&i+q+O3;ujwQE}rT=pky#!9iVL7Cc1bPR({QizdNP2pu zDxeCL0YyaKyw{y>!x@ZJxc~3}zVLte(`L<~S|4q;7Wq?Woq6%gh(CXRex_Kz@86&L z$8YKHuZQx-hcYh}ewLrVw)^ulEnc_3KG5s$>-+Dohwi`E8NV0${f9p;Saj#iFTd{_ zzZWX`=k@ga_b`7yx9Yz<&hLNw{Jv&CKmPsiwG)hET(9JiZ%HNcz3DE66_inyUgLW# zjW_8vz0$w$>7Qd4;(rpn?Ef6QxPISJ{vL`D+wU9Nzs2bH^<@7XyDvijx}x;Quleu) z5PMqjU;q3|?A|-$z5DZYt2QFl!tX=H-%EVI@y1Ok%lEOySLZ+D_x^oNz6OuzWbBa5 z&6kHXQzo)6)pXKIFWv8_CufN@-`x3`v*+@?HcHPk`;+vm6SNTsc`Qyqy1B zOZx6Rzx#O_-1#KlnG+XFeBwWRg@1bSfAaO`h2B%XQ&KQVefmjoR!y@EWlrCDmzwSU z#?-#}eqZ6wEdBLIi7jN%zAz6SaK-&|iEZhx+A3e33-7a7L;Put)X(n)2od)-7DE-+ z6k95mT8cgAo)U2!_0#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P$J^*a@2*E8 z47c{rF8syd+S-mTyz{*eYZt-V#y9I`U0Zu;ZQZt=Zvm3)e4vZIacjKOT=%PRZu!Cs z_LH|=+jR9g!doA%BY|?ZW+DA@0G-F`JlKGU;T#gEZ-0&S87GLb2Dl2JtZmk=57w{! zx@|vqp#^9gYa{t}gWb?ukI$v`u6NDtI{a?C+D|;2i8lOp6=^iupc?7H_2bU+k$=wL zwPVqO_kHba5B@fO^f5GkS=ZkBFV-Ow1*itMvv6?h*bK)BHhODU4jZ9cx%VF|p;ip` z7uS9NrEwijLR)uzOeR5wZt2cz2C0s9>^_9<58F4vuOs&gyN$EU|Gl&>yh-g#9%L|({LQ`vlv%O`df!CV81gfIMt`tV$b8M6ry4)}1PbRC>PQeT+nZVI#iE5+= zEykV2y?>VVT8S(lizby4m8ul@eR`uvmTFN|DuIPDnS^R^6NB}>W-}Z|8dAp0wdR$H zI#Uw0Vo;nO3h}Dc8S==y$^<2oTJvj0$wSJsSW!jUTbcc6L@8B4+$-#s+AJ2Qsfi;0 zg~o_nHgP5(0A>(T#v!6%(3B9w8lfpSQX64dspK_IA2gDYKOYgh#(`FFC=`1q3D-Df z*ZS#j<@AlEQLl_fConH+oECW{XEWNO7gw7JZ6-+p@@8}W?rjeI>uPZTy8c4IGfOH1S^@n(I*w0mpoP{QppI=Jb-3$K>SOQA|9WjSPQ}PhaSa2 zV@# { + + val transparent = BufferedImage(img.width, img.height, BufferedImage.TYPE_INT_ARGB) + transparent.createGraphics().drawImage(img, 0, 0, null) + + val black = Color(0,0,0).rgb + val nopixel = Color(0,0,0,0).rgb + for(y in 0 until transparent.height) { + for(x in 0 until transparent.width) { + val col = transparent.getRGB(x, y) + if(col==black) + transparent.setRGB(x, y, nopixel) + } + } + + val numColumns = transparent.width / 8 + val charImages = (0..255).map { + val charX = it % numColumns + val charY = it/ numColumns + transparent.getSubimage(charX*8, charY*8, 8, 8) + } + return charImages.toTypedArray() + } + + val normalChars = scanChars(normalImg) + val shiftedChars = scanChars(shiftedImg) +} diff --git a/compiler/src/prog8/stackvm/ScreenDialog.kt b/compiler/src/prog8/stackvm/ScreenDialog.kt index beb99e74f..92b9f4bd1 100644 --- a/compiler/src/prog8/stackvm/ScreenDialog.kt +++ b/compiler/src/prog8/stackvm/ScreenDialog.kt @@ -1,5 +1,7 @@ package prog8.stackvm +import prog8.compiler.target.c64.Charset +import prog8.compiler.target.c64.Petscii import java.awt.* import java.awt.image.BufferedImage import javax.swing.JButton @@ -13,7 +15,6 @@ class BitmapScreenPanel : JPanel() { private val image = BufferedImage(SCREENWIDTH, SCREENHEIGHT, BufferedImage.TYPE_INT_ARGB) private val g2d = image.graphics as Graphics2D - init { val size = Dimension(image.width * SCALING, image.height * SCALING) minimumSize = size @@ -42,9 +43,22 @@ class BitmapScreenPanel : JPanel() { g2d.drawLine(x1, y1, x2, y2) } fun writeText(x: Int, y: Int, text: String, color: Int) { - g2d.font = Font(Font.MONOSPACED, Font.PLAIN, 10) - g2d.color = palette[color and 15] - g2d.drawString(text, x, y + g2d.font.size - 1) + if(color!=1) { + TODO("text can only be white for now") + } + var xx=x + var yy=y + for(sc in Petscii.encodeScreencode(text, true)) { + setChar(xx, yy, sc) + xx++ + if(xx>=(SCREENWIDTH/8)) { + yy++ + xx=0 + } + } + } + fun setChar(x: Int, y: Int, screenCode: Short) { + g2d.drawImage(Charset.shiftedChars[screenCode.toInt()], 8*x, 8*y , null) } diff --git a/compiler/src/prog8/stackvm/StackVm.kt b/compiler/src/prog8/stackvm/StackVm.kt index f91b5c916..df8d5944e 100644 --- a/compiler/src/prog8/stackvm/StackVm.kt +++ b/compiler/src/prog8/stackvm/StackVm.kt @@ -1375,7 +1375,7 @@ class StackVm(private var traceOutputFile: String?) { val color = evalstack.pop() val (cy, cx) = evalstack.pop2() val text = heap.get(textPtr.heapId) - canvas?.writeText(8*cx.integerValue(), 8*cy.integerValue(), text.str!!, color.integerValue()) + canvas?.writeText(cx.integerValue(), cy.integerValue(), text.str!!, color.integerValue()) } Syscall.FUNC_RND -> evalstack.push(Value(DataType.BYTE, rnd.nextInt() and 255)) Syscall.FUNC_RNDW -> evalstack.push(Value(DataType.WORD, rnd.nextInt() and 65535))