Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9876


Ignore:
Timestamp:
Dec 9, 2013, 1:04:09 PM (10 years ago)
Author:
georgr
Message:

lag sorta fixed - it disappears after ~40s, but will reappear for unknown reasons

Location:
code/branches/wiimote
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • code/branches/wiimote/cmake/tools/FindBluetooth.cmake

    r9827 r9876  
    22        #FIND_PATH(BLUETOOTH_INCLUDE_DIR NAMES bluetooth PATHS /usr/include/bluetooth/ /usr/local/include/bluetooth /home/georgr/libbluetooth-dev/libbluetooth-dev/usr/include/bluetooth)
    33        #FIND_LIBRARY(BLUETOOTH_LIBRARY NAMES bluetooth PATHS  /usr/lib/ /usr/lib/x86_64-linux-gnu /home/georgr/libbluetooth-dev/libbluetooth-dev/usr/lib/x86_64-linux-gnu)
    4         FIND_PATH(BLUETOOTH_INCLUDE_DIR bluetooth /home/georgr/libbluetooth-dev/libbluetooth-dev/usr/include/)
    5         FIND_LIBRARY(BLUETOOTH_LIBRARY NAMES bluetooth PATHS  /home/georgr/libbluetooth-dev/libbluetooth-dev/usr/lib/x86_64-linux-gnu/)
     4        FIND_PATH(BLUETOOTH_INCLUDE_DIR bluetooth /usr/include/)
     5        FIND_LIBRARY(BLUETOOTH_LIBRARY NAMES bluetooth PATHS  /usr/lib/x86_64-linux-gnu/)
    66        MESSAGE(STATUS "Bluetooth library test: ${BLUETOOTH_LIBRARY}")
    77        MESSAGE(STATUS "Bluetooth header test: ${BLUETOOTH_INCLUDE_DIR}")
  • code/branches/wiimote/src/libraries/core/input/InputManager.cc

    r9856 r9876  
    255255            wiimote.SetLEDs(LED_MAP[index]);
    256256            try
    257                        {
    258                         orxout()<< "Size of devices vector before wiimote insertion:" << devices_.size() << std::endl;
    259                         devices_.push_back(new WiiMote((unsigned int)devices_.size(), *i, wii));
    260                         //devices_[2] = new WiiMote(devices_.size(), *(new CWiimote()));
    261                         orxout()<< "Size of devices vector after wiimote insertion:" << devices_.size() << std::endl;
    262                         wiimote.SetMotionSensingMode(CWiimote::ON);
    263 
    264                        }
    265                        catch(std::exception& e)  //gotta catch em all
    266                        {
    267                         orxout()<<"Exception loading WiiMote!!!1!11!";
    268                        }
     257                   {
     258                        orxout()<< "Size of devices vector before wiimote insertion:" << devices_.size() << std::endl;
     259                        devices_.push_back(new WiiMote((unsigned int)devices_.size(), *i, wii));
     260                        //devices_[2] = new WiiMote(devices_.size(), *(new CWiimote()));
     261                        orxout()<< "Size of devices vector after wiimote insertion:" << devices_.size() << std::endl;
     262                        wiimote.SetMotionSensingMode(CWiimote::ON);
     263
     264                   }
     265                   catch(std::exception& e)  //gotta catch em all
     266                   {
     267                        orxout()<<"Exception loading WiiMote!!!1!11!";
     268                   }
    269269
    270270
     
    432432            }
    433433        }
     434
    434435        if (bUpdateRequired)
    435436            updateActiveStates();
     
    437438        // Capture all the input and collect the function calls
    438439        // No event gets triggered here yet!
     440
    439441        BOOST_FOREACH(InputDevice* device, devices_)
    440             if (device != NULL)
     442            if (device != NULL || device->getDeviceID()!=2)
    441443                device->update(time);
     444        devices_[2]->update(time);
     445
    442446
    443447        // Collect function calls for the update
  • code/branches/wiimote/src/libraries/core/input/WiiMote.cc

    r9863 r9876  
    1717                //else
    1818                  //orxout(user_warning) << "pointer is not null, yay" << std::endl;
    19                 PWii->Poll();
     19                PWii->RefreshWiimotes();
     20                if(PWii->Poll())
     21                {
     22                        orxout()<<"test11"<<endl;
     23                        switch (p->GetEvent())
     24                        {
     25                                case CWiimote::EVENT_EVENT:
     26                                {
     27                                        if(p->Buttons.isPressed(CButtons::BUTTON_A)||p->Buttons.isJustPressed(CButtons::BUTTON_A)) //ugly hack to just do something on button press easily
     28                                                                                {
     29                                                                                        orxout()<<"fak u dolan"<<endl;
     30                                                                                        CommandExecutor::execute("fire 0", 0, 0);
     31                                                                                }
     32                                        Orientation o;
     33                                        p->Accelerometer.GetOrientation(o.pitch, o.roll, o.yaw);
     34                                        int x = (int)(500*(o.yaw-lastOrientation.yaw)/time.getDeltaTime()); //get difference in orientation, divide by time to make faster movements result in faster orientation change
     35                                        int y = (int)((o.pitch-lastOrientation.pitch)/time.getDeltaTime());
     36                                        orxout()<<time.getDeltaTime()<<std::endl;
     37                                        IntVector2 abs(0, 0);
     38                                        IntVector2 rel(x, y);
     39                                        IntVector2 clippingSize(1920, 1080);
     40                                        lastOrientation.pitch = o.pitch;
     41                                        lastOrientation.yaw = o.yaw;
     42                                        orxout()<<x<<std::endl<<y<<std::endl;
     43                                        if(x!=0 || y!=0)
     44                                        {
     45                                                for (unsigned int i = 0; i < inputStates_.size(); ++i)
     46                                                inputStates_[i]->mouseMoved(abs, rel, clippingSize);    //pass random mouse movements to all input states
     47                                        }
     48                                        break;
     49                                }
     50                                case CWiimote::EVENT_STATUS:
     51                                {
    2052
    21                         p->UpdateStatus(); //perhaps this will help against the lag?
    22                         if(p->Buttons.isPressed(CButtons::BUTTON_A)||p->Buttons.isJustPressed(CButtons::BUTTON_A)) //ugly hack to just do something on button press easily
    23                                 {
    24                                         CommandExecutor::execute("fire 0", 0, 0);
     53                                        break;
    2554                                }
    26                         Orientation o;
     55                                default:
     56                                        break;
    2757
    28                         p->Accelerometer.GetOrientation(o.pitch, o.roll, o.yaw);
    29                         int x = (int)(500*(o.yaw-lastOrientation.yaw)/time.getDeltaTime()); //get difference in orientation, divide by time to make faster movements result in faster orientation change
    30                         int y = (int)((o.pitch-lastOrientation.pitch)/time.getDeltaTime());
    31                         orxout()<<time.getDeltaTime()<<std::endl;
    32                         IntVector2 abs(0, 0);
    33                         IntVector2 rel(x, y);
    34                         IntVector2 clippingSize(1920, 1080);
    35                         lastOrientation.pitch = o.pitch;
    36                         lastOrientation.yaw = o.yaw;
    37                         orxout()<<x<<std::endl<<y<<std::endl;
    38                         if(x!=0 || y!=0)
    39                         {
    40                                 for (unsigned int i = 0; i < inputStates_.size(); ++i)
    41                                                                 inputStates_[i]->mouseMoved(abs, rel, clippingSize);    //pass random mouse movements to all input states
    4258                        }
     59                }
    4360
    4461        }
Note: See TracChangeset for help on using the changeset viewer.