Files
dolphin/Source/Core/InputCommon/ControllerInterface/Xlib/Xlib.h
T

94 lines
1.8 KiB
C++
Raw Normal View History

2015-05-24 06:32:32 +02:00
// Copyright 2010 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#pragma once
#include <X11/keysym.h>
2014-02-17 05:18:15 -05:00
#include <X11/Xlib.h>
#include "InputCommon/ControllerInterface/Device.h"
namespace ciface
{
namespace Xlib
{
2013-06-16 20:07:10 -04:00
void Init(std::vector<Core::Device*>& devices, void* const hwnd);
2013-06-16 20:07:10 -04:00
class KeyboardMouse : public Core::Device
{
2011-03-14 01:20:11 +00:00
private:
struct State
{
char keyboard[32];
unsigned int buttons;
struct
{
float x, y;
} cursor;
};
class Key : public Input
{
friend class KeyboardMouse;
public:
2014-03-08 01:54:44 +01:00
std::string GetName() const override;
2011-03-14 01:20:11 +00:00
Key(Display* display, KeyCode keycode, const char* keyboard);
2014-03-08 01:54:44 +01:00
ControlState GetState() const override;
private:
2014-02-16 15:30:18 -05:00
std::string m_keyname;
Display* const m_display;
2011-03-14 01:20:11 +00:00
const char* const m_keyboard;
2014-02-16 15:30:18 -05:00
const KeyCode m_keycode;
};
class Button : public Input
{
public:
2014-03-08 01:54:44 +01:00
std::string GetName() const override;
2011-03-14 01:20:11 +00:00
Button(unsigned int index, unsigned int& buttons)
: m_buttons(buttons), m_index(index) {}
2014-03-08 01:54:44 +01:00
ControlState GetState() const override;
private:
2011-03-14 01:20:11 +00:00
const unsigned int& m_buttons;
const unsigned int m_index;
};
class Cursor : public Input
{
public:
2014-03-08 01:54:44 +01:00
std::string GetName() const override;
bool IsDetectable() override { return false; }
2011-03-14 01:20:11 +00:00
Cursor(u8 index, bool positive, const float& cursor)
: m_cursor(cursor), m_index(index), m_positive(positive) {}
2014-03-08 01:54:44 +01:00
ControlState GetState() const override;
2011-03-14 01:20:11 +00:00
private:
2011-03-14 01:20:11 +00:00
const float& m_cursor;
2014-02-16 15:30:18 -05:00
const u8 m_index;
const bool m_positive;
};
2011-03-14 01:20:11 +00:00
public:
void UpdateInput() override;
KeyboardMouse(Window window);
~KeyboardMouse();
2014-03-08 01:54:44 +01:00
std::string GetName() const override;
std::string GetSource() const override;
int GetId() const override;
private:
2014-02-16 15:30:18 -05:00
Window m_window;
2011-03-14 01:20:11 +00:00
Display* m_display;
2014-02-16 15:30:18 -05:00
State m_state;
};
}
}