/tutorial/vision/opengl/example3.e

http://github.com/tybor/Liberty · Specman e · 51 lines · 38 code · 13 blank · 0 comment · 0 complexity · f7a0b17934e40ef4623047dc949e3aa6 MD5 · raw file

  1. class EXAMPLE3
  2. inherit
  3. GRAPHIC
  4. creation
  5. make
  6. feature{ANY}
  7. world : WORLD
  8. pyramid : PYRAMID
  9. win: TOPLEVEL_WINDOW
  10. angle : REAL
  11. make is
  12. local
  13. anim : SIMPLE_PERIODIC_JOB
  14. do
  15. create win.default_create
  16. win.set_title("MyLe")
  17. win.set_background_color(white_color)
  18. win.map
  19. create world.make(win)
  20. create pyramid.make_with_position(0, 0, -6)
  21. world.add_opaque_object(pyramid)
  22. win.when_close_requested(agent finish_program)
  23. create anim.set_work(agent turn, Void, 1, 0.02)
  24. vision.loop_stack.add_job(anim)
  25. vision.start
  26. end
  27. turn : BOOLEAN is
  28. do
  29. angle := angle + 3
  30. pyramid.turn(angle, -3*angle)
  31. world.display_gl
  32. Result := True
  33. end
  34. finish_program is
  35. do
  36. vision.loop_stack.break
  37. end
  38. end