bool InputClass::Frame() { bool result; // Read the current state of the keyboard. result = ReadKeyboard(); if(!result) { return false; } POINT pt; GetCursorPos( &pt ); //ScreenToClient( hwnd, &pt ); m_mouseX = pt.x; m_mouseY = pt.y; // Read the current state of the mouse. result = ReadMouse(); if(!result) { return false; } // Process the changes in the mouse and keyboard. ProcessInput(); return true; }
void ReadInput( void ) { int i; if ( WaitingToQuit ) return; old_input = new_input; new_input++; if ( new_input >= INPUT_BUFFERS ) new_input = 0; ReadMouse(); ReadKeyboard(); if ( JoystickInput ) { for (i = 0; i < Num_Joysticks; i++) { if (JoystickInfo[i].connected) joystick_poll(i); } } flush_input = false; }
bool InputManager::ReadFrame() { //result, for asserts bool result; //copy current keyboard and mouse states into previous states, to save previous frame states prev_keyboardState = input_keyboardState; prev_mouseState = input_mouseState; //copy current mousePos into the previous, as well prev_MousePos = input_MousePos; //read keyboard state result = ReadKeyboard(); assert(result && "Keyboard Read Failed"); //read mouse state result = ReadMouse(); assert(result && "Mouse Read Failed"); //process changes in mouse+keyboard ProcessInput(); //return true, for success return true; }
void DInput::Update() { // Grab this frames key presses ReadKeyboard(); ReadMouse(); // Update mouse positions mousePosX_ += mouse_state_.lX; mousePosY_ += mouse_state_.lY; mouseWheel_ += mouse_state_.lZ; }
int MouseIn(int x1,int y1,int x2,int y2) { int mouse_flag=0; Mouse m; m=ReadMouse(); if( (x1<m.x) && (m.x<x2) && (m.y>y1) && (m.y<y2) ) { mouse_flag=1; } return mouse_flag; }
void EventClass::Render() { // Read the current state of the keyboard. ReadKeyboard(); // Read the current state of the mouse. ReadMouse(); // Process the changes in the mouse and keyboard. ProcessInput(); }
void InputManager::Update() { myRelMouseX = 0; myRelMouseY = 0; myPreviousMouseState = myMouseState; for (unsigned int i = 0; i < 256; i++) { myPreviousKeyboardState[i] = myKeyboardState[i]; } ReadKeyboard(); ReadMouse(); HandleMouseInput(); myScrollWheelPos += GetRelativeScrollWheel(); }
//Each frame we read the input and then process it bool Input::Frame() { bool result; result=ReadKeyboard(); if (!result) return false; result=ReadMouse(); if (!result) return false; ProcessInput(); return true; }
bool Input::Frame() { bool result; // Read the current state of the keyboard. result = ReadKeyboard(); if(!result) return false; // Read the current state of the mouse. result = ReadMouse(); if(!result) return false; // Process the changes in the mouse and keyboard. ProcessInput(); return true; }
//================================================================================ unsigned int ATHInputManager::Update() { ReadKeyboard(); m_fMouseDiffX = 0.0f; m_fMouseDiffY = 0.0f; if( ReadMouse() ) { LONG lXMovement = m_diMouseState.lX; m_fMouseDiffX = lXMovement * m_fSensitivity; m_fMouseX += m_fMouseDiffX; LONG lYMovement = m_diMouseState.lY; m_fMouseDiffY = lYMovement * m_fSensitivity; m_fMouseY += m_fMouseDiffY; // Z is the scroll wheel, sensitivty doesnt change it LONG lZMovement = m_diMouseState.lZ; m_fMouseDiffZ = (float)lZMovement; if( m_fMouseX < 0 ) m_fMouseX = 0; if (m_fMouseY < 0 ) m_fMouseY = 0; if( m_fMouseX > (int)m_unScreenWidth ) m_fMouseX = (float)m_unScreenWidth; if( m_fMouseY > (int)m_unScreenHeight ) m_fMouseY = (float)m_unScreenHeight; //if (m_fMouseDiffY != 0.0f || m_fMouseDiffX != 0.0f) //std::cout << m_fMouseX << " " << m_fMouseY << '\n'; } SendKeyboardEvent(); SendMouseEvent(); return 0; }
bool InputClass::Frame() { bool result; result = ReadKeyboard(); if(!result) { return false; } result = ReadMouse(); if(!result) { return false; } ProcessInput(); return true; }
bool InputReader::Update() { bool result; result = ReadKeyboard(); if(result == false) { return false; } result = ReadMouse(); if(result == false) { return false; } ProcessInput(); return true; }
bool Input::Frame() { bool result; // Read the current state of the pKeyboard. result = ReadKeyboard(); if(!result) { return false; } // Read the current state of the pMouse. result = ReadMouse(); if(!result) { return false; } return true; }
bool InputWrapper::Update() { if (myIsInitialized == true) { bool result; // Read the current state of the keyboard. result = ReadKeyboard(); if (result == false) { return false; } // Read the current state of the mouse. result = ReadMouse(); if (result == false) { return false; } } return true; }
bool Gamescontroller::Frame() { bool result; result = ReadKeybord(); if (!result) { return false; } result = ReadMouse(); if (!result) { return false; } ProcessInput(); GetCursorPos(&m_MousePos); ScreenToClient(m_hWnd, &m_MousePos); return true; }
bool DirectInput::Update() { bool result; //Read the current state of the keyboard result = ReadKeyboard(); if(!result) { return false; } //Raad the current state of the mouse result = ReadMouse(); if(!result) { return false; } //Process the changes in the mouse and keyboard ProcessInput(); return true; }
void Input::Pole() { ReadKeyboard(); ReadMouse(); }
////////////////////////////////////////////////////////////////////////////// // Program Entry Point int main(int argc, char **argv) { int argNumCells; (void) randomize(); if (argc == 2) { // Grab argument, convert to integer; init cells with passed arg. argNumCells = (int)atoi((char*)argv[1]); (void) initializeCells(argNumCells); // Display message, showing # of init'ed cells. printf("[Game of Life:] Initialized %d Cells.", argNumCells); // Wait a second. delay(1000); } // No arguments were passed? Initialize Default # of cells. else { (void) initializeCells(INIT_CELLS); delay(1000); } // Initialize 0x13H Graphics Mode, 320x200x256 (void) initgraph(); // Display program message, copyright etc. (void) displayMessage(); // Draw a border around the cell area. (void) drawShadedBorder(); #ifdef __MOUSE_ENABLED (void) ShowMouse(); #endif // Enter main loop while ( !kbhit() ) { ////////////////////////////////////////////////////////////////////////////// // From my general feelings I am guessing that opening a bracket in an #ifdef // expecting to close that bracket if there is a following #ifdef a few lines // down is somewhat of a different idea. This technique allows me to let the // user click per iteration that they want to see. #ifdef __MOUSE_ENABLED (void)ReadMouse(); if (MOUSE_BUTTON_1_PRESSED) { #endif // Display & Process cells, then wait delay time, Reapeat until // keystroke is enacted. (void) displayCells(); (void) processCells(); #ifdef __MOUSE_ENABLED (void) processCells(); } // <-- END funky idea. #endif // @see #define DELAY_TIME (void) delay(DELAY_TIME); } #ifdef __MOUSE_ENABLED (void) HideMouse(); #endif // End graphics mode. (void) endgraph(); // Exit politely. return EXIT_SUCCESS; }
void DrawMouse() { ReadMouse(); TCopySprite(mx,my,4,5,mousepic); }
void UpdateMouse(int show_flag) { int i,j,px,py; static int old_x,old_y; static int savimage[16][16]; static int flag=1; int x,y; int mose_pot[1][16]= { 0x3fff,0x1fff,0x0fff,0x07ff,/* arrow¼ýÍ· */ 0x03ff,0x01ff,0x00ff,0x007f, 0x003f,0x00ff,0x01ff,0x10ff, 0x30ff,0xf87f,0xf87f,0xfc3f, }; Mouse m; m=ReadMouse(); x=m.x; y=m.y; if(flag==1) { old_x=x; old_y=y; for(i=0,py=y;i<16;i++,py++) { for(j=0,px=x;j<16;j++,px++) { savimage[i][j]=getpixel(px,py); } } flag=0; } if( show_flag==1 ) { if( (x!=old_x)||(y!=old_y) ) { for(i=0;i<16;i++) { for(j=0;j<16;j++) { if( !((mose_pot[0][i]>>(15-j))&1==1) ) { putpixel(old_x+j,old_y+i,savimage[i][j]); } } } for(i=0,py=y;i<16;i++,py++) { for(j=0,px=x;j<16;j++,px++) { savimage[i][j]=getpixel(px,py); } } for(i=0;i<16;i++) { for(j=0;j<16;j++) { if( !((mose_pot[0][i]>>(15-j))&1==1) ) { putpixel(x+j,y+i,GREEN); } } } } } if( show_flag==0 ) { for(i=0;i<16;i++) { for(j=0;j<16;j++) { if( !((mose_pot[0][i]>>(15-j))&1==1) ) putpixel(x+j,y+i,savimage[i][j]); } } flag=1; } old_x=x; old_y=y; }
void Welcome() { Mouse m; setbkcolor(WHITE); setviewport(40, 40, 600, 440, 1); setfillstyle(SOLID_FILL, LIGHTCYAN); setcolor(YELLOW); rectangle(0, 0, 560, 400); floodfill(50, 50, 14); setviewport(40, 40, 580, 420, 1); rectangle(20, 20, 540, 380); setfillstyle(SOLID_FILL, LIGHTMAGENTA); floodfill(21, 300, YELLOW); setcolor(BLACK); settextstyle(TRIPLEX_FONT, HORIZ_DIR, 8); outtextxy(110, 55, "Welcome"); DisChinese("今天你是设计师",170,165,2,2,10,10); setcolor(BLUE); setfillstyle(SOLID_FILL, YELLOW); ellipse(450,335,0,360,60,20); floodfill(450, 335, BLUE); DisChinese("开始",430,328,1,1,20,DARKGRAY); setcolor(WHITE); setfillstyle(SOLID_FILL, WHITE); arc(260,818,85,130,470); arc(270,820,85,130,470); arc(285,822,85,130,470); line(61,227,74,400); line(61,227,164,211); line(164,211,174,360); line(184,277,254,265); line(184,277,190,355); line(254,265,260,355); bar(85,245,108,270); bar(131,245,155,270); bar(85,300,108,330); bar(131,300,155,330); bar(199,287,215,302); bar(230,282,246,298); bar(199,320,215,335); bar(230,320,246,335); while (1) { ShowMouse(); m=ReadMouse(); if (m.b == 1) { if (MouseIn(430,305,500,395)) { HideMouse(); cleardevice(); closegraph(); break; } } } }