Esempio n. 1
0
void DXInput::Update()
{
	// Check if the system is initialized
	if (!mInitialized)
	{
		// Write to log
		Log::Get()->Write(LogType::Error, "[Input] Failed to update input devices. System not initialized.");
		return;
	}

	// Update keyboard
	if (nullptr != mpKeyboard)
	{
		UpdateKeyboard();
	}

	// Update mouse
	if (nullptr != mpMouse)
	{
		UpdateMouse();
	}

	// Update game pad
	if (nullptr != mpGamePad)
	{
		UpdateGamePad();
	}
}
Esempio n. 2
0
void CDXInput::Update(void)
{
	// Check if the system is initialized
	if (!mInitialized)
	{
		// Write to log
		CLog::Get()->Write(ELogMessageType_ERROR, "[Input] Failed to update input devices. System not initialized.");
		return;
	}

	// Update keyboard
	if (NULL != mpKeyboard)
	{
		UpdateKeyboard();
	}

	// Update mouse
	if (NULL != mpMouse)
	{
		UpdateMouse();
	}

	// Update game pad
	if (NULL != mpGamePad)
	{
		UpdateGamePad();
	}
}
//=============================================================================
// 入力処理の更新処理
//=============================================================================
void UpdateInput(void)
{
	// キーボードの更新
	UpdateKeyboard();

	// マウスの更新
	UpdateMouse();
}
Esempio n. 4
0
void UpdateControls()
{
	HandleMessages();

	if( _input_killswitch ) {
		b4 = b3 = b2 = b1 = right = left = down = up = false;
		return;
	}

	joy_Update();
	mouse_Update();
	UpdateKeyboard();

	byte oldb1 = b1,
		 oldb2 = b2,
	     oldb3 = b3,
		 oldb4 = b4;

	// Overkill (2006-06-25):
	// The following four ifs have been altered to allow custom directional keys.
	if (keys[k_up] || sticks[0].up) up = true; else up = false;
	if (keys[k_left] || sticks[0].left) left = true; else left = false;
	if (keys[k_down] || sticks[0].down) down = true; else down = false;
	if (keys[k_right] || sticks[0].right) right = true; else right = false;

	if (keys[k_b1] || sticks[0].button[j_b1]) b1 = true; else b1 = false;
	if (keys[k_b2] || sticks[0].button[j_b2]) b2 = true; else b2 = false;
	if (keys[k_b3] || sticks[0].button[j_b3]) b3 = true; else b3 = false;
	if (keys[k_b4] || sticks[0].button[j_b4]) b4 = true; else b4 = false;

	if (!up && kill_up) kill_up = false;
	if (!down && kill_down) kill_down = false;
	if (!left && kill_left) kill_left = false;
	if (!right && kill_right) kill_right = false;

	if (!b1 && kill_b1) kill_b1 = false;
	if (!b2 && kill_b2) kill_b2 = false;
	if (!b3 && kill_b3) kill_b3 = false;
	if (!b4 && kill_b4) kill_b4 = false;

	if (up && kill_up) up = false;
	if (down && kill_down) down = false;
	if (left && kill_left) left = false;
	if (right && kill_right) right = false;

	if (b1 && kill_b1) b1 = false;
	if (b2 && kill_b2) b2 = false;
	if (b3 && kill_b3) b3 = false;
	if (b4 && kill_b4) b4 = false;

	//mbg 9/5/05 todo removed for psp
	//TODO LUA
	if (b1 && !oldb1) se->ExecuteCallback(bindbutton[0], true);
	if (b2 && !oldb2) se->ExecuteCallback(bindbutton[1], true);
	if (b3 && !oldb3) se->ExecuteCallback(bindbutton[2], true);
	if (b4 && !oldb4) se->ExecuteCallback(bindbutton[3], true);
}
Esempio n. 5
0
void Input::Update()
{
    inputstate_t inputState;
    if (GetKeyboardState(inputState.keyboardState))
    {
        UpdateKeyboard(&inputState);
    }

    UpdateController();
}
Esempio n. 6
0
void Input::Tick()
{
    InputState inputState;
    if (GetKeyboardState(inputState.KeyboardState))
    {
        UpdateKeyboard(&inputState);
    }

    UpdateController();
}
Esempio n. 7
0
//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
//	Name        : 入力処理の更新処理
//	Description : 入力処理全般を更新する
//	Arguments   : hWnd / ウィンドウハンドル
//	Returns     : None.
//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
void CInput::UpdateInput(HWND hWnd)
{
	// ----- キーボードの更新
	UpdateKeyboard();
	
	// ----- マウスの更新
	UpdateMouse();
	
	// ----- ジョイパッドの更新
	//UpdateJoypad();

	// ----- キー入力の更新
	UpdateInputKey();

	// ----- マウス入力の更新
	UpdateClick();

	// ----- カーソルの更新
	UpdateCursor(hWnd);
}
Esempio n. 8
0
void Cloud::Input::InputManager::Update()
{
    UpdateKeyboard();
    UpdateMouse();
    UpdateControllers();
}
Esempio n. 9
0
int main ( int argc, char** argv )
{
    // initialize SDL video
    if ( SDL_Init( SDL_INIT_VIDEO ) < 0 )
    {
        printf( "Unable to init SDL: %s\n", SDL_GetError() );
        return 1;
    }

    // make sure SDL cleans up before exit
    atexit(SDL_Quit);

    // create a new window
    SDL_Surface* screen = SDL_SetVideoMode(800, 600, 24,
                                           SDL_SWSURFACE);
    if ( !screen )
    {
        printf("Unable to set 640x480 video: %s\n", SDL_GetError());
        return 1;
    }

    SDL_WM_SetCaption("Raw Viewer","Raw Viewer");

    // load an image
    SDL_Surface* buffer = SDL_CreateRGBSurface(SDL_SWSURFACE,600,524,32,0,0,0,0);

    fl=fopen(argv[1],"rb");
    fseek(fl,0,SEEK_END);
    Max=ftell(fl);

    Render(buffer,rejim,WIDT,HIGH,DX);


    // program main loop
    bool done = false;
    while (!done)
    {
        // message processing loop
        FlushHits();
        SDL_Event event;
        while (SDL_PollEvent(&event))
        {
            // check for messages
            switch (event.type)
            {
                // exit if the window is closed
            case SDL_QUIT:
                done = true;
                break;

                // check for keypresses
            case SDL_KEYDOWN:
            {
                SetHit(event.key.keysym.sym);
                break;
            }
            } // end switch
        } // end of message processing
        UpdateKeyboard();

        // DRAWING STARTS HERE

        if (KeyDown(SDLK_ESCAPE))
            done=true;


        // clear screen
        SDL_FillRect(screen, 0, SDL_MapRGB(screen->format, 0, 0, 0));

        SDL_BlitSurface(buffer,0,screen,0);

        lineColor(screen,0,524,600,524,0xFFFFFFFF);
        lineColor(screen,600,0,600,524,0xFFFFFFFF);

        char buf[255];
        sprintf(buf,"Offset:%X",Offs);
        stringColor(screen,700,10,buf,0xFFFFFFFF);
        sprintf(buf,"Width:%d",WIDT);
        stringColor(screen,700,20,buf,0xFFFFFFFF);

        rectangleColor(screen,663,7,670,509,0xFF0000FF);
        FillRect(screen,665,9,4,501*(Offs/(float)Max),0x00FF00);//rectangleColor(screen,664,8,669,8+500*Offs/Max,0x00FF00FF);
        if (WIDT>150)
        {
            rectangleColor(screen,9,549,511,556,0xFF0000FF); //Rect  9,549,502,7,0
            FillRect(screen,10,550,500*DX/(WIDT-150),5,0x00FF00);//	Rect  10,550,500*(Float(DX)/Float(widt-150)),5,1
        }

        switch (rejim)
        {
        case 1:
            sprintf(buf,"1 Bit mode");
            break;
        case 2:
            sprintf(buf,"2 Bit mode");
            break;
        case 3:
            sprintf(buf,"4 Bit mode");
            break;
        case 4:
            sprintf(buf,"8 Bit mode");
            break;
        case 5:
            sprintf(buf,"16 Bit mode RGBA5551");
            break;
        case 6:
            sprintf(buf,"16 Bit mode RGBA4444");
            break;
        case 7:
            sprintf(buf,"16 Bit mode RGB565");
            break;
        case 8:
            sprintf(buf,"16 Bit mode BGRA5551");
            break;
        case 9:
            sprintf(buf,"16 Bit mode BGRA4444");
            break;
        case 10:
            sprintf(buf,"16 Bit mode BGR565");
            break;
        case 11:
            sprintf(buf,"24 Bit mode RGB");
            break;
        case 12:
            sprintf(buf,"24 Bit mode BGR");
            break;
        }

        stringColor(screen,5,580,buf,0xFFFFFFFF);


        if (KeyHit(SDLK_SPACE))
        {
            setka=!setka;
            Render(buffer,rejim,WIDT,HIGH,DX);
        }



        if (KeyDown(SDLK_PERIOD))
        {
            WIDT++;
            DX=0;
            if (WIDT<1)
                WIDT =1;
            Render(buffer,rejim,WIDT,HIGH,DX);
        }
        if (KeyDown(SDLK_COMMA))
        {
            WIDT--;
            DX=0;
            if (WIDT<1)
                WIDT =1;
            Render(buffer,rejim,WIDT,HIGH,DX);
        }
        if (KeyDown(SDLK_SEMICOLON))
        {
            WIDT+=10;
            DX=0;
            if (WIDT<1)
                WIDT =1;
            Render(buffer,rejim,WIDT,HIGH,DX);
        }
        if (KeyDown(SDLK_l))
        {
            WIDT-=10;
            DX=0;
            if (WIDT<1)
                WIDT =1;
            Render(buffer,rejim,WIDT,HIGH,DX);
        }
        if (KeyDown(SDLK_LEFTBRACKET))
        {
            WIDT+=100;
            DX=0;
            if (WIDT<1)
                WIDT =1;
            Render(buffer,rejim,WIDT,HIGH,DX);
        }
        if (KeyDown(SDLK_p))
        {
            WIDT-=100;
            DX=0;
            if (WIDT<1)
                WIDT =1;
            Render(buffer,rejim,WIDT,HIGH,DX);
        }



        if (MouseDown(1))
        {

            if (MouseX()>663 && MouseX()<670 && MouseY()>7 && MouseY()<507)
            {
                Offs=(float)Max*((MouseY()-8.0))/500.0;
                Render(buffer,rejim,WIDT,HIGH,DX);
            }


            if (WIDT>150)
            {
                if (MouseX()>9 && MouseX()<511 && MouseY()>549 && MouseY()<556)
                {
                    DX=(WIDT -150)*((MouseX()-10)/500.0);
                    Render(buffer,rejim,WIDT,HIGH,DX);
                }
            }
        }
        if (MouseDown(3))
        {
            HIGH=MouseY()/4;
            if (HIGH<1)
                HIGH=1;

            if (HIGH> 130)
                HIGH=130;
            Render(buffer,rejim,WIDT,HIGH,DX);
        }


        if (KeyHit(SDLK_1))
        {
            rejim=1;
            Render(buffer,rejim,WIDT,HIGH,DX);
        }
        if (KeyHit(SDLK_2))
        {
            rejim=2;
            Render(buffer,rejim,WIDT,HIGH,DX);
        }
        if (KeyHit(SDLK_3))
        {
            rejim=3;
            Render(buffer,rejim,WIDT,HIGH,DX);
        }
        if (KeyHit(SDLK_4))
        {
            rejim=4;
            Render(buffer,rejim,WIDT,HIGH,DX);
        }
        if (KeyHit(SDLK_5))
        {
            rejim=5;
            Render(buffer,rejim,WIDT,HIGH,DX);
        }
        if (KeyHit(SDLK_6))
        {
            rejim=6;
            Render(buffer,rejim,WIDT,HIGH,DX);
        }
        if (KeyHit(SDLK_7))
        {
            rejim=7;
            Render(buffer,rejim,WIDT,HIGH,DX);
        }
        if (KeyHit(SDLK_8))
        {
            rejim=8;
            Render(buffer,rejim,WIDT,HIGH,DX);
        }
        if (KeyHit(SDLK_9))
        {
            rejim=9;
            Render(buffer,rejim,WIDT,HIGH,DX);
        }
        if (KeyHit(SDLK_0))
        {
            rejim=10;
            Render(buffer,rejim,WIDT,HIGH,DX);
        }

        if (KeyHit(SDLK_MINUS))
        {
            rejim=11;
            Render(buffer,rejim,WIDT,HIGH,DX);
        }

        if (KeyHit(SDLK_EQUALS))
        {
            rejim=12;
            Render(buffer,rejim,WIDT,HIGH,DX);
        }

        if (KeyDown(SDLK_RIGHT))
        {
            Offs++;
            Render(buffer,rejim,WIDT,HIGH,DX);
        }
        if (KeyDown(SDLK_LEFT))
        {
            Offs--;
            Render(buffer,rejim,WIDT,HIGH,DX);
        }

        if (rejim<5)
        {
            if (KeyDown(SDLK_DOWN))
            {
                Offs+=WIDT;
                Render(buffer,rejim,WIDT,HIGH,DX);
            }
            if (KeyDown(SDLK_UP))
            {
                Offs-=WIDT;
                Render(buffer,rejim,WIDT,HIGH,DX);
            }
            if (KeyDown(SDLK_PAGEUP))
            {
                Offs-=WIDT*10;
                Render(buffer,rejim,WIDT,HIGH,DX);
            }
            if (KeyDown(SDLK_PAGEDOWN))
            {
                Offs+=WIDT*10;
                Render(buffer,rejim,WIDT,HIGH,DX);
            }
            if (KeyDown(SDLK_HOME))
            {
                Offs-=WIDT*100;
                Render(buffer,rejim,WIDT,HIGH,DX);
            }
            if (KeyDown(SDLK_END))
            {
                Offs+=WIDT*100;
                Render(buffer,rejim,WIDT,HIGH,DX);
            }
        }
        else if (rejim < 11)
        {
            if (KeyDown(SDLK_DOWN))
            {
                Offs+=WIDT*2;
                Render(buffer,rejim,WIDT,HIGH,DX);
            }
            if (KeyDown(SDLK_UP))
            {
                Offs-=WIDT*2;
                Render(buffer,rejim,WIDT,HIGH,DX);
            }
            if (KeyDown(SDLK_PAGEUP))
            {
                Offs-=WIDT*20;
                Render(buffer,rejim,WIDT,HIGH,DX);
            }
            if (KeyDown(SDLK_PAGEDOWN))
            {
                Offs+=WIDT*20;
                Render(buffer,rejim,WIDT,HIGH,DX);
            }
            if (KeyDown(SDLK_HOME))
            {
                Offs-=WIDT*200;
                Render(buffer,rejim,WIDT,HIGH,DX);
            }
            if (KeyDown(SDLK_END))
            {
                Offs+=WIDT*200;
                Render(buffer,rejim,WIDT,HIGH,DX);
            }
        }
        else if (rejim < 13)
        {
            if (KeyDown(SDLK_DOWN))
            {
                Offs+=WIDT*3;
                Render(buffer,rejim,WIDT,HIGH,DX);
            }
            if (KeyDown(SDLK_UP))
            {
                Offs-=WIDT*3;
                Render(buffer,rejim,WIDT,HIGH,DX);
            }
            if (KeyDown(SDLK_PAGEUP))
            {
                Offs-=WIDT*30;
                Render(buffer,rejim,WIDT,HIGH,DX);
            }
            if (KeyDown(SDLK_PAGEDOWN))
            {
                Offs+=WIDT*30;
                Render(buffer,rejim,WIDT,HIGH,DX);
            }
            if (KeyDown(SDLK_HOME))
            {
                Offs-=WIDT*300;
                Render(buffer,rejim,WIDT,HIGH,DX);
            }
            if (KeyDown(SDLK_END))
            {
                Offs+=WIDT*300;
                Render(buffer,rejim,WIDT,HIGH,DX);
            }
        }


        // DRAWING ENDS HERE


        // finally, update the screen :)
        SDL_Flip(screen);
        SDL_Delay(10);
    } // end main loop

    fclose(fl);

    return 0;
}