Add command to show plugins in use
This commit is contained in:
parent
97c187acb9
commit
338c6efd14
6 changed files with 38 additions and 3 deletions
|
@ -179,3 +179,5 @@ void window::set_sound_rate(uint32_t rate_n, uint32_t rate_d)
|
|||
uint32_t g = gcd(rate_n, rate_d);
|
||||
calculate_sampledup(rate_n / g, rate_d / g);
|
||||
}
|
||||
|
||||
const char* sound_plugin_name = "SDL sound plugin";
|
||||
|
|
|
@ -1317,8 +1317,10 @@ void poll_inputs_internal() throw(std::bad_alloc)
|
|||
{
|
||||
SDL_Event e;
|
||||
while(state != WINSTATE_NORMAL) {
|
||||
if(SDL_WaitEvent(&e))
|
||||
poll_joysticks();
|
||||
if(SDL_PollEvent(&e))
|
||||
do_event(e);
|
||||
::wait_usec(10000);
|
||||
if(delayed_close_flag) {
|
||||
state = WINSTATE_NORMAL;
|
||||
return;
|
||||
|
@ -1331,12 +1333,15 @@ void window::poll_inputs() throw(std::bad_alloc)
|
|||
SDL_Event e;
|
||||
while(1) {
|
||||
assert(state == WINSTATE_NORMAL);
|
||||
poll_joysticks();
|
||||
if(!pause_active && !SDL_PollEvent(&e))
|
||||
break;
|
||||
else if(!pause_active)
|
||||
do_event(e);
|
||||
else if(SDL_WaitEvent(&e))
|
||||
else if(SDL_PollEvent(&e))
|
||||
do_event(e);
|
||||
else
|
||||
::wait_usec(10000);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1421,6 +1426,7 @@ void window::wait_usec(uint64_t usec) throw(std::bad_alloc)
|
|||
uint64_t end_at = get_utime() + usec;
|
||||
while(!wait_canceled) {
|
||||
SDL_Event e;
|
||||
poll_joysticks();
|
||||
while(SDL_PollEvent(&e))
|
||||
do_event(e);
|
||||
uint64_t curtime = get_utime();
|
||||
|
@ -1475,3 +1481,11 @@ void window::set_window_compensation(uint32_t xoffset, uint32_t yoffset, uint32_
|
|||
vc_hscl = hscl;
|
||||
vc_vscl = vscl;
|
||||
}
|
||||
|
||||
void poll_joysticks()
|
||||
{
|
||||
//We poll it in event loop for SDL.
|
||||
}
|
||||
|
||||
const char* graphics_plugin_name = "SDL graphics plugin";
|
||||
const char* joystick_plugin_name = "SDL joystick plugin";
|
||||
|
|
|
@ -23,3 +23,5 @@ void sound_quit() {}
|
|||
void window::sound_enable(bool enable) throw() {}
|
||||
void window::play_audio_sample(uint16_t left, uint16_t right) throw() {}
|
||||
void window::set_sound_rate(uint32_t rate_n, uint32_t rate_d) {}
|
||||
|
||||
const char* sound_plugin_name = "Dummy sound plugin";
|
||||
|
|
|
@ -47,3 +47,5 @@ uint64_t get_ticks_msec() throw()
|
|||
static uint64_t c = 0;
|
||||
return c++;
|
||||
}
|
||||
|
||||
const char* graphics_plugin_name = "Dummy graphics plugin";
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include "window.hpp"
|
||||
#include "command.hpp"
|
||||
#include <boost/iostreams/categories.hpp>
|
||||
#include <boost/iostreams/copy.hpp>
|
||||
#include <boost/iostreams/stream.hpp>
|
||||
|
@ -10,6 +11,14 @@
|
|||
|
||||
namespace
|
||||
{
|
||||
function_ptr_command<> identify_key("show-plugins", "Show plugins in use",
|
||||
"Syntax: show-plugins\nShows plugins in use.\n",
|
||||
[]() throw(std::bad_alloc, std::runtime_error) {
|
||||
window::message(std::string("Graphics:\t") + graphics_plugin_name);
|
||||
window::message(std::string("Sound:\t") + sound_plugin_name);
|
||||
window::message(std::string("Joystick:\t") + joystick_plugin_name);
|
||||
});
|
||||
|
||||
class window_output
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -105,7 +105,7 @@ public:
|
|||
|
||||
/**
|
||||
* Processes inputs. If in non-modal mode (normal mode without pause), this returns quickly. Otherwise it waits
|
||||
* for modal mode to exit.
|
||||
* for modal mode to exit. Also needs to call poll_joysticks().
|
||||
*
|
||||
* throws std::bad_alloc: Not enough memory.
|
||||
*/
|
||||
|
@ -189,4 +189,10 @@ private:
|
|||
window& operator==(const window&);
|
||||
};
|
||||
|
||||
void poll_joysticks();
|
||||
|
||||
extern const char* sound_plugin_name;
|
||||
extern const char* graphics_plugin_name;
|
||||
extern const char* joystick_plugin_name;
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Reference in a new issue