mirror of
git://projects.qi-hardware.com/iris.git
synced 2025-04-21 12:27:27 +03:00
working demo
This commit is contained in:
@@ -418,6 +418,21 @@ static void get_device ():
|
||||
Kernel::panic (0)
|
||||
Kernel::free_cap (reply)
|
||||
|
||||
static void draw_ball ():
|
||||
int const r = 50
|
||||
for int y = -r; y < r; ++y:
|
||||
for int x = -r; x < r; ++x:
|
||||
if x * x + y * y > r * r:
|
||||
((unsigned *)0x15000)[(120 + y) * 320 + 160 + x] = 0x000000
|
||||
else:
|
||||
((unsigned *)0x15000)[(120 + y) * 320 + 160 + x] = 0x3f30ff
|
||||
|
||||
static void draw_square ():
|
||||
int const r = 50
|
||||
for int y = -r; y < r; ++y:
|
||||
for int x = -r; x < r; ++x:
|
||||
((unsigned *)0x15000)[(120 + y) * 320 + 160 + x] = 0xffff00
|
||||
|
||||
Kernel::Num start ():
|
||||
// Wait for the debugging device to be active, in case there is one.
|
||||
Kernel::schedule ()
|
||||
@@ -471,6 +486,7 @@ Kernel::Num start ():
|
||||
Kernel::panic (0, "no display")
|
||||
Kernel::Caps display_caps = display_dev->dev.create_user (Kernel::my_memory, 0, 0x15000)
|
||||
Display display = display_caps.get (0)
|
||||
draw_ball ()
|
||||
Dev *keyboard_dev = Dev::find (Keyboard::ID, 0)
|
||||
if !keyboard_dev:
|
||||
Kernel::panic (0, "no keyboard")
|
||||
@@ -533,7 +549,9 @@ Kernel::Num start ():
|
||||
Kernel::panic (Kernel::recv.data[0].l, "invalid operation from child")
|
||||
break
|
||||
case KEYBOARD:
|
||||
if in_system && Kernel::recv.data[0].l == (Key::ENTER | Keyboard::RELEASE):
|
||||
if !in_system:
|
||||
break
|
||||
if Kernel::recv.data[0].l == (Key::ENTER | Keyboard::RELEASE):
|
||||
for Dev *d = Dev::devs; d; d = d->next:
|
||||
if d->idx != 0:
|
||||
continue
|
||||
@@ -549,24 +567,16 @@ Kernel::Num start ():
|
||||
break
|
||||
if Kernel::recv.data[0].l & Keyboard::RELEASE:
|
||||
continue
|
||||
unsigned const r = 50
|
||||
unsigned which = 0
|
||||
switch Kernel::recv.data[0].l:
|
||||
case Key::VOLUME_DOWN:
|
||||
// Set ball.
|
||||
for int y = -r; y < r; ++y:
|
||||
for int x = -r; x < r; ++x:
|
||||
if x * x + y * y > r * r:
|
||||
((unsigned *)0x15000)[(120 + y) * 320 + 160 + x] = 0x000000
|
||||
else:
|
||||
((unsigned *)0x15000)[(120 + y) * 320 + 160 + x] = 0xffffff
|
||||
draw_ball ()
|
||||
which = 2
|
||||
break
|
||||
case Key::VOLUME_UP:
|
||||
// Set square.
|
||||
for int y = -r; y < r; ++y:
|
||||
for int x = -r; x < r; ++x:
|
||||
((unsigned *)0x15000)[(120 + y) * 320 + 160 + x] = 0xffffff
|
||||
draw_square ()
|
||||
which = 1
|
||||
break
|
||||
if which != 0:
|
||||
|
||||
Reference in New Issue
Block a user