/tutorial/vision/opengl/example2.e

http://github.com/tybor/Liberty · Specman e · 59 lines · 45 code · 14 blank · 0 comment · 0 complexity · d7ee79726a4bd2b46e1da7f81ee6f5c3 MD5 · raw file

  1. class EXAMPLE2
  2. inherit
  3. GRAPHIC
  4. creation
  5. make
  6. feature{ANY}
  7. world : WORLD
  8. pyramid : PYRAMID
  9. world2 : WORLD
  10. cube : CUBE
  11. rot : REAL
  12. make is
  13. local
  14. win: TOPLEVEL_WINDOW
  15. exit : BUTTON
  16. do
  17. create win.default_create
  18. win.set_title("GL Test")
  19. win.set_background_color(white_color)
  20. win.map
  21. create world.make(win)
  22. create pyramid.make_with_position(0, 0, -6)
  23. world.add_opaque_object(pyramid)
  24. create world2.make(win)
  25. create cube.make_with_position(0, 0, -6)
  26. world2.add_opaque_object(cube)
  27. create exit.with_label(win, U"Click: Exit | Move: Turn")
  28. exit.when_pointer_move(agent turn)
  29. exit.when_left_clicked(agent finish_program)
  30. win.when_close_requested(agent finish_program)
  31. vision.start
  32. end
  33. turn is
  34. do
  35. rot := rot + 2
  36. pyramid.turn(rot, -3*rot)
  37. world.display_gl
  38. cube.turn(-2*rot, rot)
  39. world2.display_gl
  40. end
  41. finish_program is
  42. do
  43. vision.loop_stack.break
  44. end
  45. end