Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
18
Task/Draw-a-pixel/Nim/draw-a-pixel-1.nim
Normal file
18
Task/Draw-a-pixel/Nim/draw-a-pixel-1.nim
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
import rapid/gfx
|
||||
|
||||
var
|
||||
window = initRWindow()
|
||||
.size(320, 240)
|
||||
.title("Rosetta Code - draw a pixel")
|
||||
.open()
|
||||
surface = window.openGfx()
|
||||
|
||||
surface.loop:
|
||||
draw ctx, step:
|
||||
ctx.clear(gray(0))
|
||||
ctx.begin()
|
||||
ctx.point((100.0, 100.0, rgb(255, 0, 0)))
|
||||
ctx.draw(prPoints)
|
||||
discard step # Prevent unused variable warnings
|
||||
update step:
|
||||
discard step
|
||||
13
Task/Draw-a-pixel/Nim/draw-a-pixel-2.nim
Normal file
13
Task/Draw-a-pixel/Nim/draw-a-pixel-2.nim
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
import sdl2
|
||||
|
||||
discard sdl2.init(INIT_EVERYTHING)
|
||||
|
||||
let window = createWindow("Pixel", 100, 100, 320, 240, SDL_WINDOW_SHOWN)
|
||||
let renderer = createRenderer(window, -1, Renderer_Accelerated)
|
||||
|
||||
renderer.clear()
|
||||
renderer.setDrawColor((255u8, 0u8, 0u8, 0u8))
|
||||
renderer.drawPoint(100, 100)
|
||||
renderer.present()
|
||||
|
||||
delay(5000)
|
||||
Loading…
Add table
Add a link
Reference in a new issue