mirror of
https://github.com/irmen/prog8.git
synced 2024-12-25 08:29:25 +00:00
renamed gfx_hires4 module to just gfx_hires
to be consistent with gfx_lores
This commit is contained in:
parent
648d9fc269
commit
3b4a5e27f7
@ -12,7 +12,7 @@
|
||||
; This is compatible with the CX16's screen mode 128. (void cx16.set_screen_mode(128))
|
||||
;
|
||||
|
||||
gfx_hires4 {
|
||||
gfx_hires {
|
||||
|
||||
%option ignore_unused
|
||||
|
||||
@ -144,7 +144,7 @@ gfx_hires4 {
|
||||
and #3
|
||||
tay
|
||||
lda cx16.VERA_DATA0
|
||||
and p8b_gfx_hires4.p8s_plot.p8v_mask4c,y
|
||||
and p8b_gfx_hires.p8s_plot.p8v_mask4c,y
|
||||
ora p8v_colorbits,y
|
||||
sta cx16.VERA_DATA0
|
||||
cpy #%00000011 ; next vera byte?
|
||||
@ -189,11 +189,11 @@ gfx_hires4 {
|
||||
cx16.r2L = lsb(xx) & 3
|
||||
when color & 3 {
|
||||
0 -> color = 0
|
||||
1 -> color = gfx_hires4.plot.shiftedleft_4c_1[cx16.r2L]
|
||||
2 -> color = gfx_hires4.plot.shiftedleft_4c_2[cx16.r2L]
|
||||
3 -> color = gfx_hires4.plot.shiftedleft_4c_3[cx16.r2L]
|
||||
1 -> color = gfx_hires.plot.shiftedleft_4c_1[cx16.r2L]
|
||||
2 -> color = gfx_hires.plot.shiftedleft_4c_2[cx16.r2L]
|
||||
3 -> color = gfx_hires.plot.shiftedleft_4c_3[cx16.r2L]
|
||||
}
|
||||
ubyte @shared mask = gfx_hires4.plot.mask4c[lsb(xx) & 3]
|
||||
ubyte @shared mask = gfx_hires.plot.mask4c[lsb(xx) & 3]
|
||||
repeat lheight {
|
||||
%asm {{
|
||||
lda cx16.VERA_DATA0
|
||||
@ -561,7 +561,7 @@ gfx_hires4 {
|
||||
lda p8v_xx
|
||||
and #3
|
||||
tay
|
||||
lda p8b_gfx_hires4.p8s_plot.p8v_shift4c,y
|
||||
lda p8b_gfx_hires.p8s_plot.p8v_shift4c,y
|
||||
tay
|
||||
pla
|
||||
cpy #0
|
||||
@ -704,7 +704,7 @@ skip:
|
||||
|
||||
sub fill_scanline_left_2bpp() -> bool {
|
||||
uword vx = xx as uword
|
||||
void gfx_hires4.addr_mul_24_for_highres_4c(yy as uword,vx)
|
||||
void gfx_hires.addr_mul_24_for_highres_4c(yy as uword,vx)
|
||||
cx16.r1L |= %0001_1000 ; auto decrement
|
||||
set_vera_address()
|
||||
cmask = amask[lsb(vx) & 3] ; set the color mask for the first color pel
|
||||
@ -748,7 +748,7 @@ set_byte:
|
||||
}
|
||||
|
||||
sub fill_scanline_right_2bpp() {
|
||||
void gfx_hires4.addr_mul_24_for_highres_4c(yy as uword,xx as uword)
|
||||
void gfx_hires.addr_mul_24_for_highres_4c(yy as uword,xx as uword)
|
||||
cx16.r1L |= %00010000 ; auto increment
|
||||
set_vera_address()
|
||||
cmask = amask[lsb(xx) & 3] ; set the color mask for the first color pel
|
||||
@ -891,12 +891,12 @@ set_byte:
|
||||
if_cs {
|
||||
cx16.r2L = cx16.r7L & 3 ; xbits
|
||||
when cx16.r11L & 3 {
|
||||
1 -> cx16.r12L = gfx_hires4.plot.shiftedleft_4c_1[cx16.r2L]
|
||||
2 -> cx16.r12L = gfx_hires4.plot.shiftedleft_4c_2[cx16.r2L]
|
||||
3 -> cx16.r12L = gfx_hires4.plot.shiftedleft_4c_3[cx16.r2L]
|
||||
1 -> cx16.r12L = gfx_hires.plot.shiftedleft_4c_1[cx16.r2L]
|
||||
2 -> cx16.r12L = gfx_hires.plot.shiftedleft_4c_2[cx16.r2L]
|
||||
3 -> cx16.r12L = gfx_hires.plot.shiftedleft_4c_3[cx16.r2L]
|
||||
else -> cx16.r12L = 0
|
||||
}
|
||||
cx16.VERA_DATA0 = cx16.VERA_DATA0 & gfx_hires4.plot.mask4c[cx16.r2L] | cx16.r12L
|
||||
cx16.VERA_DATA0 = cx16.VERA_DATA0 & gfx_hires.plot.mask4c[cx16.r2L] | cx16.r12L
|
||||
}
|
||||
cx16.r7++
|
||||
if (cx16.r7 & 3) == 0 {
|
@ -4,7 +4,7 @@
|
||||
; Wraps the graphics functions that are in ROM.
|
||||
; Only lo-res 320x240 256 color mode for now.
|
||||
; Unlike graphics module on the C64, you can use colors() to set new drawing colors for every draw operation.
|
||||
; For other resolutions or other color modes, use the "gfx_lores", "gfx_hires4", or "monogfx" module instead.
|
||||
; For other resolutions or other color modes, use the "gfx_lores", "gfx_hires", or "monogfx" module instead.
|
||||
; Note: there is no color palette manipulation here, you have to do that yourself or use the "palette" module.
|
||||
;
|
||||
; NOTE: For sake of speed, NO BOUNDS CHECKING is performed in most routines!
|
||||
|
@ -2,7 +2,7 @@
|
||||
; Using the full-screen 640x480 and 320x240 screen modes, in 1 bpp mode (black/white).
|
||||
;
|
||||
; No text layer is currently shown, but text can be drawn as part of the bitmap itself.
|
||||
; For color bitmap graphics, see the gfx_lores or gfx_hires4 libraries.
|
||||
; For color bitmap graphics, see the gfx_lores or gfx_hires libraries.
|
||||
;
|
||||
; NOTE: For sake of speed, NO BOUNDS CHECKING is performed in most routines!
|
||||
; You'll have to make sure yourself that you're not writing outside of bitmap boundaries!
|
||||
|
@ -28,7 +28,7 @@ verafx {
|
||||
|
||||
sub clear(ubyte vbank, uword vaddr, ubyte data, uword num_longwords) {
|
||||
; use cached 4-byte write to quickly clear a portion of the video memory to a given byte value
|
||||
; this routine is around 3 times faster as gfx_hires4/gfx_lores.clear_screen()
|
||||
; this routine is around 3 times faster as gfx_hires/gfx_lores.clear_screen()
|
||||
cx16.VERA_CTRL = 0
|
||||
cx16.VERA_ADDR_H = vbank | %00110000 ; 4-byte increment
|
||||
cx16.VERA_ADDR_M = msb(vaddr)
|
||||
|
@ -147,7 +147,7 @@ class TestCompilerOnExamplesCx16: FunSpec({
|
||||
"starszoom",
|
||||
"tehtriz",
|
||||
"test_gfx_lores",
|
||||
"test_gfx_hires4",
|
||||
"test_gfx_hires",
|
||||
"testmonogfx",
|
||||
),
|
||||
listOf(false, true)
|
||||
|
@ -5,7 +5,6 @@
|
||||
%import compression
|
||||
%import conv
|
||||
%import cx16logo
|
||||
%import diskio
|
||||
%import math
|
||||
%import prog8_lib
|
||||
%import string
|
||||
|
@ -9,7 +9,7 @@
|
||||
%import diskio
|
||||
%import emudbg
|
||||
%import floats
|
||||
%import gfx_hires4
|
||||
%import gfx_hires
|
||||
%import gfx_lores
|
||||
%import graphics
|
||||
%import math
|
||||
|
@ -5,7 +5,6 @@
|
||||
%import compression
|
||||
%import conv
|
||||
%import cx16logo
|
||||
%import diskio
|
||||
%import math
|
||||
%import prog8_lib
|
||||
%import string
|
||||
|
@ -919,8 +919,7 @@ gfx_lores and gfx_hires (cx16 only)
|
||||
Full-screen multicolor bitmap graphics routines, available on the Cx16 machine only.
|
||||
|
||||
- gfx_lores: optimized routines for 320x240 256 color bitmap graphics mode. Compatible with X16 screen mode 128.
|
||||
- gfx_hires4: optimized routines for 640x480 4 color bitmap graphics mode
|
||||
- bitmap mode
|
||||
- gfx_hires: optimized routines for 640x480 4 color bitmap graphics mode
|
||||
- enable bitmap graphics mode, also back to text mode
|
||||
- drawing and reading individual pixels
|
||||
- drawing lines, rectangles, filled rectangles, circles, discs
|
||||
@ -928,7 +927,7 @@ Full-screen multicolor bitmap graphics routines, available on the Cx16 machine o
|
||||
- drawing text inside the bitmap
|
||||
|
||||
Read the `gfx_lores source code <https://github.com/irmen/prog8/tree/master/compiler/res/prog8lib/cx16/gfx_lores.p8>`_
|
||||
or `gfx_hires4 source code <https://github.com/irmen/prog8/tree/master/compiler/res/prog8lib/cx16/gfx_hires4.p8>`_
|
||||
or `gfx_hires source code <https://github.com/irmen/prog8/tree/master/compiler/res/prog8lib/cx16/gfx_hires.p8>`_
|
||||
to see what's in there.
|
||||
|
||||
They share the same routines.
|
||||
|
@ -8,6 +8,7 @@ TODO
|
||||
Future Things and Ideas
|
||||
^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
- implement const long to store a 32 bit signed integer value. (constants should be able to be long?)
|
||||
- something to reduce the need to use fully qualified names all the time. 'with' ? Or 'using <prefix>'?
|
||||
- Why are blocks without an addr moved BEHIND a block with an address? That's done in the StatementReorderer.
|
||||
- on the C64: make the floating point routines @banked so that basic can be permanently banked out even if you use floats? But this will crash when the call is done from program code at $a000+
|
||||
@ -24,13 +25,11 @@ Future Things and Ideas
|
||||
- Improve the SublimeText syntax file for prog8, you can also install this for 'bat': https://github.com/sharkdp/bat?tab=readme-ov-file#adding-new-syntaxes--language-definitions
|
||||
- Does it make codegen easier if everything is an expression? Start with the PtProgram ast , get rid of the statements there -> expressions that have Void data type
|
||||
- Can we support signed % (remainder) somehow?
|
||||
|
||||
- instead of copy-pasting inline asmsubs, make them into a 64tass macro and use that instead.
|
||||
that will allow them to be reused from custom user written assembly code as well.
|
||||
- Multidimensional arrays and chained indexing, purely as syntactic sugar over regular arrays. Probaby only useful if we have typed pointers.
|
||||
- make a form of "manual generics" possible like: varsub routine(T arg)->T where T is expanded to a specific type
|
||||
(this is already done hardcoded for several of the builtin functions)
|
||||
|
||||
- [much work:] more support for (64tass) SEGMENTS ?
|
||||
- (What, how, isn't current BSS support enough?)
|
||||
- Add a mechanism to allocate variables into golden ram (or segments really) (see GoldenRam class)
|
||||
@ -40,7 +39,6 @@ Future Things and Ideas
|
||||
- OR.... do all this automatically if 'golden' is enabled as a compiler option? So compiler allocates in ZP first, then Golden Ram, then regular ram
|
||||
- OR.... make all this more generic and use some %segment option to create real segments for 64tass?
|
||||
- (need separate step in codegen and IR to write the "golden" variables)
|
||||
|
||||
- [problematic due to using 64tass:] better support for building library programs, where unused .proc are NOT deleted from the assembly.
|
||||
Perhaps replace all uses of .proc/.pend/.endproc by .block/.bend will fix that with a compiler flag?
|
||||
But all library code written in asm uses .proc already..... (textual search/replace when writing the actual asm?)
|
||||
|
@ -1,38 +1,38 @@
|
||||
%import textio
|
||||
%import palette
|
||||
%import string
|
||||
%import gfx_hires4
|
||||
%import gfx_hires
|
||||
|
||||
; Mockup of a classic Amiga Workbench screen.
|
||||
|
||||
main {
|
||||
|
||||
sub start() {
|
||||
gfx_hires4.graphics_mode() ; select 640*480 mode, 4 colors
|
||||
gfx_hires.graphics_mode() ; select 640*480 mode, 4 colors
|
||||
mouse.set_pointer_image()
|
||||
cx16.mouse_config(-1, 640/8, 240/8)
|
||||
uword[4] amigacolors = [$aaa, $000, $fff, $68c] ; gray, black, white, lightblue
|
||||
palette.set_rgb(amigacolors, len(amigacolors))
|
||||
|
||||
cx16.VERA_DC_VSCALE = 64 ; have the vertical resolution so it is 640*240 - more or less Amiga's default non interlaced mode
|
||||
gfx_hires4.text_charset(1)
|
||||
gfx_hires.text_charset(1)
|
||||
|
||||
screen_titlebar()
|
||||
window_workbench()
|
||||
window_system()
|
||||
window_shell()
|
||||
gfx_hires4.text(240, 210, 1, iso:"640x480(240) 4 colors")
|
||||
gfx_hires4.text(240, 220, 1, iso:"Mockup drawn using Prog8 gfx_hires4 library")
|
||||
gfx_hires.text(240, 210, 1, iso:"640x480(240) 4 colors")
|
||||
gfx_hires.text(240, 220, 1, iso:"Mockup drawn using Prog8 gfx_hires library")
|
||||
|
||||
repeat {
|
||||
}
|
||||
}
|
||||
|
||||
sub screen_titlebar() {
|
||||
gfx_hires4.fillrect(0, 0, gfx_hires4.WIDTH, 10, 2)
|
||||
gfx_hires4.text(8,1, 1, iso:"AmigaOS 3.1 2,002,448 graphics mem 16,504,384 other mem")
|
||||
gfx_hires4.horizontal_line(0, 10, gfx_hires4.WIDTH, 1)
|
||||
widget.window_order_icon(gfx_hires4.WIDTH-widget.window_order_icon.width, 0, false)
|
||||
gfx_hires.fillrect(0, 0, gfx_hires.WIDTH, 10, 2)
|
||||
gfx_hires.text(8,1, 1, iso:"AmigaOS 3.1 2,002,448 graphics mem 16,504,384 other mem")
|
||||
gfx_hires.horizontal_line(0, 10, gfx_hires.WIDTH, 1)
|
||||
widget.window_order_icon(gfx_hires.WIDTH-widget.window_order_icon.width, 0, false)
|
||||
}
|
||||
|
||||
|
||||
@ -43,7 +43,7 @@ main {
|
||||
const uword height = 220
|
||||
|
||||
widget.window_titlebar(win_x, win_y, width, iso:"Workbench", false)
|
||||
; gfx_hires4.fillrect(win_x+3, win_y+11, width-4, height-11-2,0) ; clear window pane
|
||||
; gfx_hires.fillrect(win_x+3, win_y+11, width-4, height-11-2,0) ; clear window pane
|
||||
widget.window_leftborder(win_x, win_y, height, false)
|
||||
widget.window_bottomborder(win_x, win_y, width, height)
|
||||
widget.window_rightborder(win_x, win_y, width, height, false)
|
||||
@ -56,12 +56,12 @@ main {
|
||||
}
|
||||
|
||||
sub vector_v(uword x, uword y) {
|
||||
gfx_hires4.horizontal_line(x, y, 12, 1)
|
||||
gfx_hires4.horizontal_line(x+16, y+16, 11,1)
|
||||
gfx_hires4.line(x,y,x+16,y+16,1)
|
||||
gfx_hires4.line(x+11,y,x+16+5,y+10,1)
|
||||
gfx_hires4.line(x+16+5,y+10,x+47,y-16,1)
|
||||
gfx_hires4.line(x+16+10,y+16,x+46+12,y-16,1)
|
||||
gfx_hires.horizontal_line(x, y, 12, 1)
|
||||
gfx_hires.horizontal_line(x+16, y+16, 11,1)
|
||||
gfx_hires.line(x,y,x+16,y+16,1)
|
||||
gfx_hires.line(x+11,y,x+16+5,y+10,1)
|
||||
gfx_hires.line(x+16+5,y+10,x+47,y-16,1)
|
||||
gfx_hires.line(x+16+10,y+16,x+46+12,y-16,1)
|
||||
}
|
||||
|
||||
sub window_system() {
|
||||
@ -71,7 +71,7 @@ main {
|
||||
const uword win_y = 40
|
||||
|
||||
widget.window_titlebar(win_x, win_y, width, iso:"System", false)
|
||||
gfx_hires4.fillrect(win_x+3, win_y+11, width-4, height-11-2, 0) ; clear window pane
|
||||
gfx_hires.fillrect(win_x+3, win_y+11, width-4, height-11-2, 0) ; clear window pane
|
||||
widget.window_leftborder(win_x, win_y, height, false)
|
||||
widget.window_bottomborder(win_x, win_y, width, height)
|
||||
widget.window_rightborder(win_x, win_y, width, height, false)
|
||||
@ -90,14 +90,14 @@ main {
|
||||
const uword height = 65
|
||||
|
||||
widget.window_titlebar(win_x, win_y, width, iso:"AmigaShell", true)
|
||||
gfx_hires4.fillrect(win_x+3, win_y+11, width-4, height-11-2,0) ; clear window pane
|
||||
gfx_hires.fillrect(win_x+3, win_y+11, width-4, height-11-2,0) ; clear window pane
|
||||
widget.window_leftborder(win_x, win_y, height, true)
|
||||
widget.window_bottomborder(win_x, win_y, width, height)
|
||||
widget.window_rightborder(win_x, win_y, width, height, true)
|
||||
|
||||
gfx_hires4.text(win_x+5, win_y+12, 1, iso:"New Shell process 3")
|
||||
gfx_hires4.text(win_x+5, win_y+12+8, 1, iso:"3.Workbench3.1:>")
|
||||
gfx_hires4.fillrect(win_x+5+17*8, win_y+12+8, 8, 8, 1) ; cursor
|
||||
gfx_hires.text(win_x+5, win_y+12, 1, iso:"New Shell process 3")
|
||||
gfx_hires.text(win_x+5, win_y+12+8, 1, iso:"3.Workbench3.1:>")
|
||||
gfx_hires.fillrect(win_x+5+17*8, win_y+12+8, 8, 8, 1) ; cursor
|
||||
}
|
||||
}
|
||||
|
||||
@ -147,15 +147,15 @@ mouse {
|
||||
widget {
|
||||
|
||||
sub highlightedrect(uword x, uword y, uword width, uword height, bool fill, bool active) {
|
||||
gfx_hires4.horizontal_line(x, y, width, 2)
|
||||
gfx_hires4.vertical_line(x, y+1, height-1, 2)
|
||||
gfx_hires4.vertical_line(x+width-1, y+1, height-1, 1)
|
||||
gfx_hires4.horizontal_line(x+1, y+height-1, width-2, 1)
|
||||
gfx_hires.horizontal_line(x, y, width, 2)
|
||||
gfx_hires.vertical_line(x, y+1, height-1, 2)
|
||||
gfx_hires.vertical_line(x+width-1, y+1, height-1, 1)
|
||||
gfx_hires.horizontal_line(x+1, y+height-1, width-2, 1)
|
||||
if fill {
|
||||
if active
|
||||
gfx_hires4.fillrect(x+1,y+1,width-2,height-2, 3)
|
||||
gfx_hires.fillrect(x+1,y+1,width-2,height-2, 3)
|
||||
else
|
||||
gfx_hires4.fillrect(x+1,y+1,width-2,height-2, 0)
|
||||
gfx_hires.fillrect(x+1,y+1,width-2,height-2, 0)
|
||||
}
|
||||
}
|
||||
|
||||
@ -165,17 +165,17 @@ widget {
|
||||
highlightedrect(x, y, width, height, false, false)
|
||||
uword middlex = x+width/2+1
|
||||
ubyte halfstring = string.length(caption) * 4
|
||||
gfx_hires4.text(middlex-halfstring,y+height+1,1,caption)
|
||||
gfx_hires4.disc(x+width/4+4, y+height/2, height/2-3, 1)
|
||||
gfx_hires4.fillrect(x+20,y+12,width/2,height/2-4,3)
|
||||
gfx_hires.text(middlex-halfstring,y+height+1,1,caption)
|
||||
gfx_hires.disc(x+width/4+4, y+height/2, height/2-3, 1)
|
||||
gfx_hires.fillrect(x+20,y+12,width/2,height/2-4,3)
|
||||
}
|
||||
|
||||
|
||||
sub window_titlebar(uword x, uword y, uword width, uword titlestr, bool active) {
|
||||
const ubyte height = 11
|
||||
widget.highlightedrect(x+widget.window_close_icon.width, y, width-64, height, true, active)
|
||||
gfx_hires4.plot(x+widget.window_close_icon.width, y+height-1, 1) ; correct bottom left corner
|
||||
gfx_hires4.text(x+26, y+1, 1, titlestr)
|
||||
gfx_hires.plot(x+widget.window_close_icon.width, y+height-1, 1) ; correct bottom left corner
|
||||
gfx_hires.text(x+26, y+1, 1, titlestr)
|
||||
widget.window_close_icon(x, y, active)
|
||||
widget.window_order_icon(x+width-22, y, active)
|
||||
widget.window_flipsize_icon(x+width-44, y, active)
|
||||
@ -185,66 +185,66 @@ widget {
|
||||
const uword width = 22
|
||||
const uword height = 11
|
||||
highlightedrect(x, y, width, height, true, active)
|
||||
gfx_hires4.plot(x, y+height-1, 1) ; correct bottom left corner
|
||||
gfx_hires4.rect(x+5, y+2, width-9, height-4, 1)
|
||||
gfx_hires4.rect(x+5, y+2, 7, 4, 1)
|
||||
gfx_hires4.fillrect(x+6, y+3, 5, 2, 2)
|
||||
gfx_hires.plot(x, y+height-1, 1) ; correct bottom left corner
|
||||
gfx_hires.rect(x+5, y+2, width-9, height-4, 1)
|
||||
gfx_hires.rect(x+5, y+2, 7, 4, 1)
|
||||
gfx_hires.fillrect(x+6, y+3, 5, 2, 2)
|
||||
}
|
||||
|
||||
sub window_order_icon(uword x, uword y, bool active) {
|
||||
const uword width = 22
|
||||
const uword height = 11
|
||||
highlightedrect(x, y, width, height, true, active)
|
||||
gfx_hires4.plot(x, y+height-1, 1) ; correct bottom left corner
|
||||
gfx_hires4.rect(x+4, y+2, 10, 5, 1) ; back
|
||||
gfx_hires4.fillrect(x+9, y+5, 8, 3, 2) ; white front
|
||||
gfx_hires4.rect(x+8, y+4, 10, 5, 1) ; front
|
||||
gfx_hires.plot(x, y+height-1, 1) ; correct bottom left corner
|
||||
gfx_hires.rect(x+4, y+2, 10, 5, 1) ; back
|
||||
gfx_hires.fillrect(x+9, y+5, 8, 3, 2) ; white front
|
||||
gfx_hires.rect(x+8, y+4, 10, 5, 1) ; front
|
||||
}
|
||||
|
||||
sub window_close_icon(uword x, uword y, bool active) {
|
||||
const uword width = 20
|
||||
const uword height = 11
|
||||
highlightedrect(x, y, width, height, true, active)
|
||||
gfx_hires4.plot(x, y+height-1, 1) ; correct bottom left corner
|
||||
gfx_hires4.rect(x+7, y+3, 5, 5, 1)
|
||||
gfx_hires4.fillrect(x+8, y+4, 3, 3, 2)
|
||||
gfx_hires.plot(x, y+height-1, 1) ; correct bottom left corner
|
||||
gfx_hires.rect(x+7, y+3, 5, 5, 1)
|
||||
gfx_hires.fillrect(x+8, y+4, 3, 3, 2)
|
||||
}
|
||||
|
||||
sub window_leftborder(uword x, uword y, uword height, bool active) {
|
||||
gfx_hires4.vertical_line(x, y, height, 2)
|
||||
gfx_hires.vertical_line(x, y, height, 2)
|
||||
ubyte color = 0
|
||||
if active
|
||||
color = 3
|
||||
gfx_hires4.vertical_line(x+1, y+11, height-11, color)
|
||||
gfx_hires4.vertical_line(x+2, y+11, height-11, 1)
|
||||
gfx_hires.vertical_line(x+1, y+11, height-11, color)
|
||||
gfx_hires.vertical_line(x+2, y+11, height-11, 1)
|
||||
}
|
||||
|
||||
sub window_bottomborder(uword x, uword y, uword width, uword height) {
|
||||
gfx_hires4.horizontal_line(x+3, y+height-2, width-3, 2)
|
||||
gfx_hires4.horizontal_line(x, y+height-1, width, 1)
|
||||
gfx_hires.horizontal_line(x+3, y+height-2, width-3, 2)
|
||||
gfx_hires.horizontal_line(x, y+height-1, width, 1)
|
||||
}
|
||||
|
||||
sub window_rightborder(uword x, uword y, uword width, uword height, bool active) {
|
||||
gfx_hires4.vertical_line(x+width-1-16, y+11, height-13,2)
|
||||
gfx_hires4.vertical_line(x+width-1, y+11, height-11,1)
|
||||
gfx_hires.vertical_line(x+width-1-16, y+11, height-13,2)
|
||||
gfx_hires.vertical_line(x+width-1, y+11, height-11,1)
|
||||
ubyte color = 0
|
||||
if active
|
||||
color = 3
|
||||
gfx_hires4.fillrect(x+width-1-15, y+11, 15, height-12, color)
|
||||
gfx_hires.fillrect(x+width-1-15, y+11, 15, height-12, color)
|
||||
|
||||
gfx_hires4.horizontal_line(x+width-1-13, y+height-3, 11, 1)
|
||||
gfx_hires4.vertical_line(x+width-1-3, y+height-3-5, 5, 1)
|
||||
gfx_hires4.line(x+width-1-13,y+height-3, x+width-1-3, y+height-3-5, 1)
|
||||
gfx_hires4.horizontal_line(x+width-1-16, y+height-10, 16, 2)
|
||||
gfx_hires.horizontal_line(x+width-1-13, y+height-3, 11, 1)
|
||||
gfx_hires.vertical_line(x+width-1-3, y+height-3-5, 5, 1)
|
||||
gfx_hires.line(x+width-1-13,y+height-3, x+width-1-3, y+height-3-5, 1)
|
||||
gfx_hires.horizontal_line(x+width-1-16, y+height-10, 16, 2)
|
||||
|
||||
highlightedrect(x+width-13, y+12, 10, height-43, false, false)
|
||||
gfx_hires4.horizontal_line(x+width-1-16, y+height-11, 16, 1)
|
||||
gfx_hires4.horizontal_line(x+width-1-16, y+height-20, 16, 2)
|
||||
gfx_hires4.horizontal_line(x+width-1-16, y+height-21, 16, 1)
|
||||
gfx_hires4.horizontal_line(x+width-1-16, y+height-30, 16, 2)
|
||||
gfx_hires4.line(x+width-1-13, y+height-23, x+width-9, y+height-28, 1)
|
||||
gfx_hires4.line(x+width-1-3, y+height-23, x+width-9, y+height-28, 1)
|
||||
gfx_hires4.line(x+width-1-13, y+height-18, x+width-9, y+height-13, 1)
|
||||
gfx_hires4.line(x+width-1-3, y+height-18, x+width-9, y+height-13, 1)
|
||||
gfx_hires.horizontal_line(x+width-1-16, y+height-11, 16, 1)
|
||||
gfx_hires.horizontal_line(x+width-1-16, y+height-20, 16, 2)
|
||||
gfx_hires.horizontal_line(x+width-1-16, y+height-21, 16, 1)
|
||||
gfx_hires.horizontal_line(x+width-1-16, y+height-30, 16, 2)
|
||||
gfx_hires.line(x+width-1-13, y+height-23, x+width-9, y+height-28, 1)
|
||||
gfx_hires.line(x+width-1-3, y+height-23, x+width-9, y+height-28, 1)
|
||||
gfx_hires.line(x+width-1-13, y+height-18, x+width-9, y+height-13, 1)
|
||||
gfx_hires.line(x+width-1-3, y+height-18, x+width-9, y+height-13, 1)
|
||||
}
|
||||
}
|
||||
|
73
examples/cx16/test_gfx_hires.p8
Normal file
73
examples/cx16/test_gfx_hires.p8
Normal file
@ -0,0 +1,73 @@
|
||||
%import gfx_hires
|
||||
%import textio
|
||||
%import math
|
||||
|
||||
%option no_sysinit
|
||||
%zeropage basicsafe
|
||||
|
||||
|
||||
main {
|
||||
|
||||
sub start() {
|
||||
gfx_hires.graphics_mode()
|
||||
draw()
|
||||
sys.wait(120)
|
||||
gfx_hires.text_mode()
|
||||
txt.print("done!\n")
|
||||
}
|
||||
|
||||
sub draw() {
|
||||
gfx_hires.rect(10,10, 1, 1, 4)
|
||||
gfx_hires.rect(20,10, 2, 1, 4)
|
||||
gfx_hires.rect(30,10, 3, 1, 4)
|
||||
gfx_hires.rect(40,10, 1, 2, 4)
|
||||
gfx_hires.rect(50,10, 1, 3, 4)
|
||||
gfx_hires.rect(60,10, 2, 2, 4)
|
||||
gfx_hires.rect(70,10, 3, 3, 4)
|
||||
gfx_hires.rect(80,10, 4, 4, 4)
|
||||
gfx_hires.rect(90,10, 5, 5, 4)
|
||||
gfx_hires.rect(100,10, 8, 8, 4)
|
||||
gfx_hires.rect(110,10, 20, 5, 4)
|
||||
gfx_hires.rect(80, 80, 200, 140, 4)
|
||||
|
||||
gfx_hires.fillrect(10,40, 1, 1, 5)
|
||||
gfx_hires.fillrect(20,40, 2, 1, 5)
|
||||
gfx_hires.fillrect(30,40, 3, 1, 5)
|
||||
gfx_hires.fillrect(40,40, 1, 2, 5)
|
||||
gfx_hires.fillrect(50,40, 1, 3, 5)
|
||||
gfx_hires.fillrect(60,40, 2, 2, 5)
|
||||
gfx_hires.fillrect(70,40, 3, 3, 5)
|
||||
gfx_hires.fillrect(80,40, 4, 4, 5)
|
||||
gfx_hires.fillrect(90,40, 5, 5, 5)
|
||||
gfx_hires.fillrect(100,40, 8, 8, 5)
|
||||
gfx_hires.fillrect(110,40, 20, 5, 5)
|
||||
gfx_hires.fillrect(82, 82, 200-4, 140-4, 5)
|
||||
|
||||
ubyte i
|
||||
for i in 0 to 254 step 4 {
|
||||
uword x1 = ((gfx_hires.WIDTH-256)/2 as uword) + math.sin8u(i)
|
||||
uword y1 = (gfx_hires.HEIGHT-128)/2 + math.cos8u(i)/2
|
||||
uword x2 = ((gfx_hires.WIDTH-64)/2 as uword) + math.sin8u(i)/4
|
||||
uword y2 = (gfx_hires.HEIGHT-64)/2 + math.cos8u(i)/4
|
||||
gfx_hires.line(x1, y1, x2, y2, i+1)
|
||||
}
|
||||
|
||||
sys.wait(60)
|
||||
gfx_hires.clear_screen(2)
|
||||
gfx_hires.clear_screen(0)
|
||||
|
||||
ubyte radius
|
||||
|
||||
for radius in 110 downto 8 step -4 {
|
||||
gfx_hires.circle(gfx_hires.WIDTH/2, (gfx_hires.HEIGHT/2 as ubyte), radius, radius)
|
||||
}
|
||||
|
||||
gfx_hires.disc(gfx_hires.WIDTH/2, gfx_hires.HEIGHT/2, 80, 2)
|
||||
|
||||
ubyte tp
|
||||
for tp in 0 to 15 {
|
||||
gfx_hires.text(19+tp,20+tp*11, 7, sc:"ScreenCODE text! 1234![]<>#$%&*()")
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -1,73 +0,0 @@
|
||||
%import gfx_hires4
|
||||
%import textio
|
||||
%import math
|
||||
|
||||
%option no_sysinit
|
||||
%zeropage basicsafe
|
||||
|
||||
|
||||
main {
|
||||
|
||||
sub start() {
|
||||
gfx_hires4.graphics_mode()
|
||||
draw()
|
||||
sys.wait(120)
|
||||
gfx_hires4.text_mode()
|
||||
txt.print("done!\n")
|
||||
}
|
||||
|
||||
sub draw() {
|
||||
gfx_hires4.rect(10,10, 1, 1, 4)
|
||||
gfx_hires4.rect(20,10, 2, 1, 4)
|
||||
gfx_hires4.rect(30,10, 3, 1, 4)
|
||||
gfx_hires4.rect(40,10, 1, 2, 4)
|
||||
gfx_hires4.rect(50,10, 1, 3, 4)
|
||||
gfx_hires4.rect(60,10, 2, 2, 4)
|
||||
gfx_hires4.rect(70,10, 3, 3, 4)
|
||||
gfx_hires4.rect(80,10, 4, 4, 4)
|
||||
gfx_hires4.rect(90,10, 5, 5, 4)
|
||||
gfx_hires4.rect(100,10, 8, 8, 4)
|
||||
gfx_hires4.rect(110,10, 20, 5, 4)
|
||||
gfx_hires4.rect(80, 80, 200, 140, 4)
|
||||
|
||||
gfx_hires4.fillrect(10,40, 1, 1, 5)
|
||||
gfx_hires4.fillrect(20,40, 2, 1, 5)
|
||||
gfx_hires4.fillrect(30,40, 3, 1, 5)
|
||||
gfx_hires4.fillrect(40,40, 1, 2, 5)
|
||||
gfx_hires4.fillrect(50,40, 1, 3, 5)
|
||||
gfx_hires4.fillrect(60,40, 2, 2, 5)
|
||||
gfx_hires4.fillrect(70,40, 3, 3, 5)
|
||||
gfx_hires4.fillrect(80,40, 4, 4, 5)
|
||||
gfx_hires4.fillrect(90,40, 5, 5, 5)
|
||||
gfx_hires4.fillrect(100,40, 8, 8, 5)
|
||||
gfx_hires4.fillrect(110,40, 20, 5, 5)
|
||||
gfx_hires4.fillrect(82, 82, 200-4, 140-4, 5)
|
||||
|
||||
ubyte i
|
||||
for i in 0 to 254 step 4 {
|
||||
uword x1 = ((gfx_hires4.WIDTH-256)/2 as uword) + math.sin8u(i)
|
||||
uword y1 = (gfx_hires4.HEIGHT-128)/2 + math.cos8u(i)/2
|
||||
uword x2 = ((gfx_hires4.WIDTH-64)/2 as uword) + math.sin8u(i)/4
|
||||
uword y2 = (gfx_hires4.HEIGHT-64)/2 + math.cos8u(i)/4
|
||||
gfx_hires4.line(x1, y1, x2, y2, i+1)
|
||||
}
|
||||
|
||||
sys.wait(60)
|
||||
gfx_hires4.clear_screen(2)
|
||||
gfx_hires4.clear_screen(0)
|
||||
|
||||
ubyte radius
|
||||
|
||||
for radius in 110 downto 8 step -4 {
|
||||
gfx_hires4.circle(gfx_hires4.WIDTH/2, (gfx_hires4.HEIGHT/2 as ubyte), radius, radius)
|
||||
}
|
||||
|
||||
gfx_hires4.disc(gfx_hires4.WIDTH/2, gfx_hires4.HEIGHT/2, 80, 2)
|
||||
|
||||
ubyte tp
|
||||
for tp in 0 to 15 {
|
||||
gfx_hires4.text(19+tp,20+tp*11, 7, sc:"ScreenCODE text! 1234![]<>#$%&*()")
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user