@@ -83,7 +83,8 @@ int audio::start_streaming(std::function<void(void *, int)> const &f) | |||
m_streamers.insert(s); | |||
s->m_empty.resize(1024); | |||
s->m_chunk = Mix_QuickLoad_RAW(s->m_empty.data(), s->m_empty.size() * sizeof(uint8_t)); | |||
s->m_chunk = Mix_QuickLoad_RAW(s->m_empty.data(), | |||
(Uint32)(s->m_empty.size() * sizeof(uint8_t))); | |||
s->m_channel = Mix_PlayChannel(-1, s->m_chunk, -1); | |||
s->m_callback = f; | |||
Mix_RegisterEffect(s->m_channel, trampoline, nullptr, s.get()); | |||
@@ -52,7 +52,7 @@ public: | |||
subinitializer.fill_sizes(sizes - 1); | |||
} | |||
void fill_values(T * origin, int prev, ptrdiff_t * sizes) | |||
void fill_values(T * origin, ptrdiff_t prev, ptrdiff_t * sizes) | |||
{ | |||
int pos = 0; | |||
@@ -81,7 +81,7 @@ public: | |||
*sizes = max(*sizes, (ptrdiff_t)m_initializers.size()); | |||
} | |||
void fill_values(T * origin, int prev, ptrdiff_t * sizes) | |||
void fill_values(T * origin, ptrdiff_t prev, ptrdiff_t * sizes) | |||
{ | |||
int pos = 0; | |||
@@ -104,24 +104,7 @@ std::shared_ptr<input::device::joystick> input::joystick(int n) | |||
// input::device | |||
// | |||
std::string input::device::keyboard::text() | |||
{ | |||
std::string ret = m_text; | |||
m_text = ""; | |||
return ret; | |||
} | |||
bool input::device::keyboard::capture_text() | |||
{ | |||
return m_input_active; | |||
} | |||
void input::device::keyboard::capture_text(bool status) | |||
{ | |||
m_input_active = status; | |||
} | |||
void input::device::keyboard::internal_add_key(input::key key, const char* name) | |||
void input::device::internal_add_key(input::key key, const char* name) | |||
{ | |||
while ((int)key >= (int)m_key_names.size()) | |||
{ | |||
@@ -154,4 +137,25 @@ void input::device::internal_add_axis(input::axis axis, const char* name) | |||
m_axis_names[(int)axis] = name; | |||
} | |||
// | |||
// input::device::keyboard | |||
// | |||
std::string input::device::keyboard::text() | |||
{ | |||
std::string ret = m_text; | |||
m_text = ""; | |||
return ret; | |||
} | |||
bool input::device::keyboard::capture_text() | |||
{ | |||
return m_input_active; | |||
} | |||
void input::device::keyboard::capture_text(bool status) | |||
{ | |||
m_input_active = status; | |||
} | |||
} /* namespace lol */ |
@@ -70,6 +70,7 @@ public: | |||
// Get the name of this input device | |||
const std::string& name() const { return m_name; } | |||
#if 0 | |||
// | |||
// Bindings section | |||
// | |||
@@ -82,6 +83,7 @@ public: | |||
void bind(input::axis axis, uint16_t event); | |||
void unbind(input::axis axis, uint16_t event); | |||
#endif | |||
// | |||
// Key, button etc. state | |||
@@ -138,6 +140,7 @@ public: | |||
* compile time. */ | |||
void internal_add_button(input::button, char const *name); | |||
void internal_add_axis(input::axis, char const *name); | |||
void internal_add_key(input::key, char const *name); | |||
/* Internal functions for the platform-specific drivers. */ | |||
void internal_begin_frame() | |||
@@ -149,6 +152,13 @@ public: | |||
m_changed_axes.clear(); | |||
} | |||
void internal_set_key(input::key key, bool state) | |||
{ | |||
if (m_keys[(int)key] != state) | |||
(state ? m_pressed_keys : m_released_keys).insert(key); | |||
m_keys[(int)key] = state; | |||
} | |||
void internal_set_button(input::button button, bool state) | |||
{ | |||
if (m_buttons[(int)button] != state) | |||
@@ -238,14 +248,6 @@ public: | |||
bool capture_text(); | |||
void capture_text(bool status); | |||
void internal_add_key(input::key, char const *name); | |||
void internal_set_key(input::key key, bool state) | |||
{ | |||
if (m_keys[(int)key] != state) | |||
(state ? m_pressed_keys : m_released_keys).insert(key); | |||
m_keys[(int)key] = state; | |||
} | |||
void internal_add_text(std::string const &text) | |||
{ | |||
m_text += text; | |||