Add support for rotation.

This commit is contained in:
Themaister 2012-03-30 19:09:34 +02:00
parent 29ccd1a5a1
commit 5d4e32ef9d
3 changed files with 19 additions and 2 deletions

View File

@ -156,6 +156,7 @@ typedef struct video_driver
void (*set_swap_block_state)(void *data, bool toggle); // Block swapping from being called in ::frame().
void (*swap)(void *data); // Explicitly swap buffers. Only useful when set_swap_block_state() is set to true.
#endif
void (*set_rotation)(void *data, unsigned rotation);
} video_driver_t;
typedef struct driver
@ -233,6 +234,7 @@ extern const input_driver_t input_xdk360;
#define video_alive_func() driver.video->alive(driver.video_data)
#define video_focus_func() driver.video->focus(driver.video_data)
#define video_xml_shader_func(path) driver.video->xml_shader(driver.video_data, path)
#define video_set_rotation_func(rotate) driver.video->set_rotation(driver.video_data, rotate)
#define video_free_func() driver.video->free(driver.video_data)
#define input_init_func() driver.input->init()

View File

@ -417,6 +417,17 @@ static bool environment_cb(unsigned cmd, void *data)
*(snes_audio_sample_batch_t*)data = audio_sample_batch;
break;
case SNES_ENVIRONMENT_SET_ROTATION:
{
unsigned rotation = *(const unsigned*)data;
SSNES_LOG("Environ SET_ROTATION: %u\n", rotation);
if (driver.video && driver.video_data && driver.video->set_rotation)
video_set_rotation_func(rotation);
else
return false;
break;
}
default:
SSNES_LOG("Environ UNSUPPORTED (#%u).\n", cmd);
return false;

View File

@ -129,8 +129,12 @@ extern "C" {
//
#define SNES_ENVIRONMENT_GET_AUDIO_BATCH_CB 13 // snes_audio_sample_batch_t * --
// Retrieves callback to a more optimized audio callback.
//
#define SNES_ENVIRONMENT_SET_ROTATION 14 // const unsigned * --
// Sets screen rotation of graphics.
// Is only implemented if rotation can be accelerated by hardware.
// Valid values are 0, 1, 2, 3, which rotates screen by 0, 90, 180, 270 degrees
// counter-clockwise respectively.
struct snes_message
{