浏览代码

Build: fix several compilation warnings.

legacy
Sam Hocevar 5 年前
父节点
当前提交
9a0b6e4a9a
共有 4 个文件被更改,包括 36 次插入29 次删除
  1. +2
    -1
      src/audio/audio.cpp
  2. +2
    -2
      src/lol/math/arraynd.h
  3. +22
    -18
      src/ui/input.cpp
  4. +10
    -8
      src/ui/input.h

+ 2
- 1
src/audio/audio.cpp 查看文件

@@ -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());


+ 2
- 2
src/lol/math/arraynd.h 查看文件

@@ -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;



+ 22
- 18
src/ui/input.cpp 查看文件

@@ -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 */

+ 10
- 8
src/ui/input.h 查看文件

@@ -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;


正在加载...
取消
保存