Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "polybus.h"
- #include "pandaSystem.h"
- #include "genericAsyncTask.h"
- #include "asyncTaskManager.h"
- #include "lens.h"
- #include "camera.h"
- #include "mouseButton.h"
- #include "graphicsWindow.h"
- #include "mouseData.h"
- AsyncTask::DoneStatus mouseUpdate(GenericAsyncTask* task, void* data)
- {
- WindowFramework *windowFramework = (WindowFramework *)data;
- // NodePath *Cube = (NodePath *)data1;
- double x = windowFramework->get_graphics_output()->get_x_size();
- double y = windowFramework->get_graphics_output()->get_y_size();
- windowFramework->get_graphics_window()->move_pointer(0, x/2, y/2);
- // Cube->set_h(Cube->get_h() - (x - x/2)*0.1);
- cout<<x<<endl<<y<<endl;
- return AsyncTask::DS_cont;
- }
- AsyncTask::DoneStatus moveUpdate(GenericAsyncTask* task, void* data)
- {
- return AsyncTask::DS_cont;
- }
- AsyncTask::DoneStatus jumpUpdate(GenericAsyncTask* task, void* data){
- return AsyncTask::DS_cont;
- }
- void sys_exit(const Event* eventPtr, void* dataPtr)
- {
- exit(0);
- }
- polybus::polybus(WindowFramework* windowFramework)
- : vh_windowFramework(windowFramework)
- {
- PandaFramework framework;
- vh_windowFramework->enable_keyboard();
- // Set up the key input
- framework.define_key("escape" , "sysExit" , sys_exit , NULL);
- vh_windowFramework->set_background_type(WindowFramework::BT_black);
- // Load the environment model.
- NodePath level = NodePath("level");
- NodePath cube = vh_windowFramework->load_model(framework.get_models(), "models/cube");
- // Reparent the model to render.
- cube.reparent_to(level);
- level.reparent_to(vh_windowFramework->get_render());
- // Apply scale and position transforms to the model.
- level.set_pos(0, 3, 0);
- taskMgr->add(new GenericAsyncTask("updates mouse", mouseUpdate, (void*)vh_windowFramework));
- cam_node->get_lens(0)->set_fov(140);
- }
- polybus::~polybus(){
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement