/tutorial/vision/opengl/NeHe/lesson06/lesson06.e

http://github.com/tybor/Liberty · Specman e · 56 lines · 41 code · 15 blank · 0 comment · 0 complexity · 6bbb709f1421f7b76252a1aeccd5f02d MD5 · raw file

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