1
0
mirror of git://projects.qi-hardware.com/iris.git synced 2025-04-21 12:27:27 +03:00

real demo

This commit is contained in:
Bas Wijnen
2010-02-18 17:35:37 +01:00
parent fb85d0f1d7
commit 7c43204a7e
3 changed files with 12 additions and 7 deletions

View File

@@ -21,9 +21,8 @@
static unsigned *framebuffer
static int const r = 10
static int colour
void ball (int x, int y, bool print):
void ball (int x, int y, unsigned colour):
for int ty = y - r; ty < y + r; ++ty:
if ty < 0 || ty >= 240:
continue
@@ -32,11 +31,11 @@ void ball (int x, int y, bool print):
continue
if (x - tx) * (x - tx) + (y - ty) * (y - ty) > r * r:
continue
framebuffer[ty * 320 + tx] = (print ? colour : 0)
framebuffer[ty * 320 + tx] = (colour)
Kernel::Num start ():
Kernel::my_parent.init_done ()
colour = 0x3f30ff
int colour = 0x3f30ff
framebuffer = (unsigned *)0x15000
Display display = Kernel::my_parent.get_device <Display> (0x10000)
int x = r, y = r, dx = 3, dy = 0
@@ -44,7 +43,7 @@ Kernel::Num start ():
while true:
display.set_eof_cb (eof)
Kernel::wait ()
ball (x, y, false)
ball (x, y, 0)
x += dx
y += dy
if y + r >= 240:
@@ -59,4 +58,4 @@ Kernel::Num start ():
if y == 240 - r && dy == 0:
dy = -21
++dy
ball (x, y, true)
ball (x, y, colour)