Advertisement
Guest User

Untitled

a guest
Jul 21st, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.02 KB | None | 0 0
  1. #include "polybus.h"
  2.  
  3. #include "pandaSystem.h"
  4. #include "genericAsyncTask.h"
  5. #include "asyncTaskManager.h"
  6. #include "lens.h"
  7. #include "camera.h"
  8. #include "mouseButton.h"
  9. #include "graphicsWindow.h"
  10. #include "mouseData.h"
  11.  
  12.  
  13. AsyncTask::DoneStatus mouseUpdate(GenericAsyncTask* task, void* data)
  14. {
  15. WindowFramework *windowFramework = (WindowFramework *)data;
  16. // NodePath *Cube = (NodePath *)data1;
  17.  
  18. double x = windowFramework->get_graphics_output()->get_x_size();
  19. double y = windowFramework->get_graphics_output()->get_y_size();
  20.  
  21. windowFramework->get_graphics_window()->move_pointer(0, x/2, y/2);
  22.  
  23. // Cube->set_h(Cube->get_h() - (x - x/2)*0.1);
  24.  
  25.  
  26. cout<<x<<endl<<y<<endl;
  27.  
  28. return AsyncTask::DS_cont;
  29. }
  30.  
  31. AsyncTask::DoneStatus moveUpdate(GenericAsyncTask* task, void* data)
  32. {
  33. return AsyncTask::DS_cont;
  34. }
  35.  
  36. AsyncTask::DoneStatus jumpUpdate(GenericAsyncTask* task, void* data){
  37. return AsyncTask::DS_cont;
  38. }
  39.  
  40.  
  41. void sys_exit(const Event* eventPtr, void* dataPtr)
  42. {
  43. exit(0);
  44. }
  45.  
  46.  
  47.  
  48. polybus::polybus(WindowFramework* windowFramework)
  49. : vh_windowFramework(windowFramework)
  50. {
  51. PandaFramework framework;
  52.  
  53. vh_windowFramework->enable_keyboard();
  54. // Set up the key input
  55. framework.define_key("escape" , "sysExit" , sys_exit , NULL);
  56.  
  57. vh_windowFramework->set_background_type(WindowFramework::BT_black);
  58.  
  59. // Load the environment model.
  60. NodePath level = NodePath("level");
  61. NodePath cube = vh_windowFramework->load_model(framework.get_models(), "models/cube");
  62. // Reparent the model to render.
  63. cube.reparent_to(level);
  64. level.reparent_to(vh_windowFramework->get_render());
  65. // Apply scale and position transforms to the model.
  66. level.set_pos(0, 3, 0);
  67.  
  68.  
  69. taskMgr->add(new GenericAsyncTask("updates mouse", mouseUpdate, (void*)vh_windowFramework));
  70.  
  71. cam_node->get_lens(0)->set_fov(140);
  72.  
  73. }
  74.  
  75. polybus::~polybus(){
  76.  
  77. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement