/tutorial/vision/opengl/example1.e

http://github.com/tybor/Liberty · Specman e · 50 lines · 38 code · 12 blank · 0 comment · 0 complexity · 8c09329cc83148ccaf43de920fd9063a MD5 · raw file

  1. class EXAMPLE1
  2. inherit
  3. GRAPHIC
  4. creation
  5. make
  6. feature{ANY}
  7. world : WORLD
  8. pyramid : PYRAMID
  9. rot : REAL
  10. make is
  11. local
  12. win: TOPLEVEL_WINDOW
  13. exit : BUTTON
  14. do
  15. create win.default_create
  16. win.set_title("GL Test")
  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. create exit.with_label(win, U"Click: Exit | Move: Turn")
  23. exit.when_pointer_move(agent turn)
  24. exit.when_left_clicked(agent finish_program)
  25. win.when_close_requested(agent finish_program)
  26. vision.start
  27. end
  28. turn is
  29. do
  30. rot := rot + 2
  31. pyramid.turn(rot, -3*rot)
  32. world.display_gl
  33. end
  34. finish_program is
  35. do
  36. vision.loop_stack.break
  37. end
  38. end