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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user