@@ -245,7 +245,7 @@ std::vector<int> VideoDriver_Allegro::GetListOfMonitorRefreshRates()
|
||||
}
|
||||
|
||||
struct AllegroVkMapping {
|
||||
uint16 vk_from;
|
||||
uint16_t vk_from;
|
||||
byte vk_count;
|
||||
byte map_to;
|
||||
};
|
||||
@@ -306,7 +306,7 @@ static const AllegroVkMapping _vk_mapping[] = {
|
||||
AS(KEY_TILDE, WKC_BACKQUOTE),
|
||||
};
|
||||
|
||||
static uint32 ConvertAllegroKeyIntoMy(WChar *character)
|
||||
static uint32_t ConvertAllegroKeyIntoMy(char32_t *character)
|
||||
{
|
||||
int scancode;
|
||||
int unicode = ureadkey(&scancode);
|
||||
@@ -406,7 +406,7 @@ bool VideoDriver_Allegro::PollEvent()
|
||||
if ((key_shifts & KB_ALT_FLAG) && (key[KEY_ENTER] || key[KEY_F])) {
|
||||
ToggleFullScreen(!_fullscreen);
|
||||
} else if (keypressed()) {
|
||||
WChar character;
|
||||
char32_t character;
|
||||
uint keycode = ConvertAllegroKeyIntoMy(&character);
|
||||
HandleKeypress(keycode, character);
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ private:
|
||||
int window_height; ///< Current window height in pixel
|
||||
int window_pitch;
|
||||
|
||||
uint32 palette[256]; ///< Colour Palette
|
||||
uint32_t palette[256]; ///< Colour Palette
|
||||
|
||||
void BlitIndexedToView32(int left, int top, int right, int bottom);
|
||||
void UpdatePalette(uint first_color, uint num_colors);
|
||||
|
||||
@@ -567,11 +567,11 @@ void VideoDriver_Cocoa::MainLoopReal()
|
||||
static FVideoDriver_CocoaQuartz iFVideoDriver_CocoaQuartz;
|
||||
|
||||
/** Clear buffer to opaque black. */
|
||||
static void ClearWindowBuffer(uint32 *buffer, uint32 pitch, uint32 height)
|
||||
static void ClearWindowBuffer(uint32_t *buffer, uint32_t pitch, uint32_t height)
|
||||
{
|
||||
uint32 fill = Colour(0, 0, 0).data;
|
||||
for (uint32 y = 0; y < height; y++) {
|
||||
for (uint32 x = 0; x < pitch; x++) {
|
||||
uint32_t fill = Colour(0, 0, 0).data;
|
||||
for (uint32_t y = 0; y < height; y++) {
|
||||
for (uint32_t x = 0; x < pitch; x++) {
|
||||
buffer[y * pitch + x] = fill;
|
||||
}
|
||||
}
|
||||
@@ -645,14 +645,14 @@ void VideoDriver_CocoaQuartz::AllocateBackingStore(bool)
|
||||
|
||||
this->window_width = (int)newframe.size.width;
|
||||
this->window_height = (int)newframe.size.height;
|
||||
this->window_pitch = Align(this->window_width, 16 / sizeof(uint32)); // Quartz likes lines that are multiple of 16-byte.
|
||||
this->window_pitch = Align(this->window_width, 16 / sizeof(uint32_t)); // Quartz likes lines that are multiple of 16-byte.
|
||||
this->buffer_depth = BlitterFactory::GetCurrentBlitter()->GetScreenDepth();
|
||||
|
||||
/* Create Core Graphics Context */
|
||||
free(this->window_buffer);
|
||||
this->window_buffer = malloc(this->window_pitch * this->window_height * sizeof(uint32));
|
||||
this->window_buffer = malloc(this->window_pitch * this->window_height * sizeof(uint32_t));
|
||||
/* Initialize with opaque black. */
|
||||
ClearWindowBuffer((uint32 *)this->window_buffer, this->window_pitch, this->window_height);
|
||||
ClearWindowBuffer((uint32_t *)this->window_buffer, this->window_pitch, this->window_height);
|
||||
|
||||
CGContextRelease(this->cgcontext);
|
||||
this->cgcontext = CGBitmapContextCreate(
|
||||
@@ -700,9 +700,9 @@ void VideoDriver_CocoaQuartz::AllocateBackingStore(bool)
|
||||
*/
|
||||
void VideoDriver_CocoaQuartz::BlitIndexedToView32(int left, int top, int right, int bottom)
|
||||
{
|
||||
const uint32 *pal = this->palette;
|
||||
const uint8 *src = (uint8*)this->pixel_buffer;
|
||||
uint32 *dst = (uint32*)this->window_buffer;
|
||||
const uint32_t *pal = this->palette;
|
||||
const uint8_t *src = (uint8_t*)this->pixel_buffer;
|
||||
uint32_t *dst = (uint32_t*)this->window_buffer;
|
||||
uint width = this->window_width;
|
||||
uint pitch = this->window_pitch;
|
||||
|
||||
@@ -719,10 +719,10 @@ void VideoDriver_CocoaQuartz::UpdatePalette(uint first_color, uint num_colors)
|
||||
if (this->buffer_depth != 8) return;
|
||||
|
||||
for (uint i = first_color; i < first_color + num_colors; i++) {
|
||||
uint32 clr = 0xff000000;
|
||||
clr |= (uint32)_cur_palette.palette[i].r << 16;
|
||||
clr |= (uint32)_cur_palette.palette[i].g << 8;
|
||||
clr |= (uint32)_cur_palette.palette[i].b;
|
||||
uint32_t clr = 0xff000000;
|
||||
clr |= (uint32_t)_cur_palette.palette[i].r << 16;
|
||||
clr |= (uint32_t)_cur_palette.palette[i].g << 8;
|
||||
clr |= (uint32_t)_cur_palette.palette[i].b;
|
||||
this->palette[i] = clr;
|
||||
}
|
||||
|
||||
|
||||
@@ -109,7 +109,7 @@ static NSUInteger CountUtf16Units(const char *from, const char *to)
|
||||
NSUInteger i = 0;
|
||||
|
||||
while (from < to) {
|
||||
WChar c;
|
||||
char32_t c;
|
||||
size_t len = Utf8Decode(&c, from);
|
||||
i += len < 4 ? 1 : 2; // Watch for surrogate pairs.
|
||||
from += len;
|
||||
@@ -127,7 +127,7 @@ static NSUInteger CountUtf16Units(const char *from, const char *to)
|
||||
static const char *Utf8AdvanceByUtf16Units(const char *str, NSUInteger count)
|
||||
{
|
||||
for (NSUInteger i = 0; i < count && *str != '\0'; ) {
|
||||
WChar c;
|
||||
char32_t c;
|
||||
size_t len = Utf8Decode(&c, str);
|
||||
i += len < 4 ? 1 : 2; // Watch for surrogates.
|
||||
str += len;
|
||||
@@ -141,9 +141,9 @@ static const char *Utf8AdvanceByUtf16Units(const char *str, NSUInteger count)
|
||||
* @param s String to convert.
|
||||
* @return Vector of UTF-32 characters.
|
||||
*/
|
||||
static std::vector<WChar> NSStringToUTF32(NSString *s)
|
||||
static std::vector<char32_t> NSStringToUTF32(NSString *s)
|
||||
{
|
||||
std::vector<WChar> unicode_str;
|
||||
std::vector<char32_t> unicode_str;
|
||||
|
||||
unichar lead = 0;
|
||||
for (NSUInteger i = 0; i < s.length; i++) {
|
||||
@@ -164,7 +164,7 @@ static std::vector<WChar> NSStringToUTF32(NSString *s)
|
||||
#ifdef HAVE_TOUCHBAR_SUPPORT
|
||||
static void CGDataFreeCallback(void *, const void *data, size_t)
|
||||
{
|
||||
delete[] (const uint32 *)data;
|
||||
delete[] (const uint32_t *)data;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -179,7 +179,7 @@ static NSImage *NSImageFromSprite(SpriteID sprite_id, ZoomLevel zoom)
|
||||
|
||||
/* Fetch the sprite and create a new bitmap */
|
||||
Dimension dim = GetSpriteSize(sprite_id, nullptr, zoom);
|
||||
std::unique_ptr<uint32[]> buffer = DrawSpriteToRgbaBuffer(sprite_id, zoom);
|
||||
std::unique_ptr<uint32_t[]> buffer = DrawSpriteToRgbaBuffer(sprite_id, zoom);
|
||||
if (!buffer) return nullptr; // Failed to blit sprite for some reason.
|
||||
|
||||
CFAutoRelease<CGDataProvider> data(CGDataProviderCreateWithData(nullptr, buffer.release(), dim.width * dim.height * 4, &CGDataFreeCallback));
|
||||
@@ -678,7 +678,7 @@ void CocoaDialog(const char *title, const char *message, const char *buttonLabel
|
||||
|
||||
- (BOOL)emulateRightButton:(NSEvent *)event
|
||||
{
|
||||
uint32 keymask = 0;
|
||||
uint32_t keymask = 0;
|
||||
if (_settings_client.gui.right_mouse_btn_emulation == RMBE_COMMAND) keymask |= NSEventModifierFlagCommand;
|
||||
if (_settings_client.gui.right_mouse_btn_emulation == RMBE_CONTROL) keymask |= NSEventModifierFlagControl;
|
||||
|
||||
@@ -784,7 +784,7 @@ void CocoaDialog(const char *title, const char *message, const char *buttonLabel
|
||||
}
|
||||
|
||||
|
||||
- (BOOL)internalHandleKeycode:(unsigned short)keycode unicode:(WChar)unicode pressed:(BOOL)down modifiers:(NSUInteger)modifiers
|
||||
- (BOOL)internalHandleKeycode:(unsigned short)keycode unicode:(char32_t)unicode pressed:(BOOL)down modifiers:(NSUInteger)modifiers
|
||||
{
|
||||
switch (keycode) {
|
||||
case QZ_UP: SB(_dirkeys, 1, 1, down); break;
|
||||
@@ -817,7 +817,7 @@ void CocoaDialog(const char *title, const char *message, const char *buttonLabel
|
||||
if (down) {
|
||||
/* Map keycode to OTTD code. */
|
||||
auto vk = std::find_if(std::begin(_vk_mapping), std::end(_vk_mapping), [=](const CocoaVkMapping &m) { return m.vk_from == keycode; });
|
||||
uint32 pressed_key = vk != std::end(_vk_mapping) ? vk->map_to : 0;
|
||||
uint32_t pressed_key = vk != std::end(_vk_mapping) ? vk->map_to : 0;
|
||||
|
||||
if (modifiers & NSEventModifierFlagShift) pressed_key |= WKC_SHIFT;
|
||||
if (modifiers & NSEventModifierFlagControl) pressed_key |= (_settings_client.gui.right_mouse_btn_emulation != RMBE_CONTROL ? WKC_CTRL : WKC_META);
|
||||
@@ -865,7 +865,7 @@ void CocoaDialog(const char *title, const char *message, const char *buttonLabel
|
||||
}
|
||||
|
||||
/* Convert UTF-16 characters to UCS-4 chars. */
|
||||
std::vector<WChar> unicode_str = NSStringToUTF32([ event characters ]);
|
||||
std::vector<char32_t> unicode_str = NSStringToUTF32([ event characters ]);
|
||||
if (unicode_str.empty()) unicode_str.push_back(0);
|
||||
|
||||
if (EditBoxInGlobalFocus()) {
|
||||
@@ -894,7 +894,7 @@ void CocoaDialog(const char *title, const char *message, const char *buttonLabel
|
||||
}
|
||||
|
||||
/* Convert UTF-16 characters to UCS-4 chars. */
|
||||
std::vector<WChar> unicode_str = NSStringToUTF32([ event characters ]);
|
||||
std::vector<char32_t> unicode_str = NSStringToUTF32([ event characters ]);
|
||||
if (unicode_str.empty()) unicode_str.push_back(0);
|
||||
|
||||
[ self internalHandleKeycode:event.keyCode unicode:unicode_str[0] pressed:NO modifiers:event.modifierFlags ];
|
||||
|
||||
@@ -943,7 +943,7 @@ bool OpenGLBackend::Resize(int w, int h, bool force)
|
||||
if (_glClearBufferSubData != nullptr) {
|
||||
_glClearBufferSubData(GL_PIXEL_UNPACK_BUFFER, GL_RGBA8, 0, line_pixel_count * bpp / 8, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, &black.data);
|
||||
} else {
|
||||
ClearPixelBuffer<uint32>(line_pixel_count, black.data);
|
||||
ClearPixelBuffer<uint32_t>(line_pixel_count, black.data);
|
||||
}
|
||||
} else if (bpp == 8) {
|
||||
if (_glClearBufferSubData != nullptr) {
|
||||
@@ -1176,7 +1176,7 @@ void *OpenGLBackend::GetVideoBuffer()
|
||||
* Get a pointer to the memory for the separate animation buffer.
|
||||
* @return Pointer to draw on.
|
||||
*/
|
||||
uint8 *OpenGLBackend::GetAnimBuffer()
|
||||
uint8_t *OpenGLBackend::GetAnimBuffer()
|
||||
{
|
||||
if (this->anim_pbo == 0) return nullptr;
|
||||
|
||||
@@ -1192,7 +1192,7 @@ uint8 *OpenGLBackend::GetAnimBuffer()
|
||||
this->anim_buffer = _glMapBufferRange(GL_PIXEL_UNPACK_BUFFER, 0, static_cast<GLsizeiptr>(_screen.pitch) * _screen.height, GL_MAP_READ_BIT | GL_MAP_WRITE_BIT | GL_MAP_PERSISTENT_BIT | GL_MAP_COHERENT_BIT);
|
||||
}
|
||||
|
||||
return (uint8 *)this->anim_buffer;
|
||||
return (uint8_t *)this->anim_buffer;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1375,7 +1375,7 @@ void OpenGLBackend::RenderOglSprite(OpenGLSprite *gl_sprite, PaletteID pal, int
|
||||
_glTexImage2D(GL_TEXTURE_2D, 0, GL_R8, 1, 1, 0, GL_RED, GL_UNSIGNED_BYTE, &pal);
|
||||
|
||||
/* Create palette remap textures. */
|
||||
std::array<uint8, 256> identity_pal;
|
||||
std::array<uint8_t, 256> identity_pal;
|
||||
std::iota(std::begin(identity_pal), std::end(identity_pal), 0);
|
||||
|
||||
/* Permanent texture for identity remap. */
|
||||
@@ -1479,7 +1479,7 @@ OpenGLSprite::~OpenGLSprite()
|
||||
void OpenGLSprite::Update(uint width, uint height, uint level, const SpriteLoader::CommonPixel * data)
|
||||
{
|
||||
static ReusableBuffer<Colour> buf_rgba;
|
||||
static ReusableBuffer<uint8> buf_pal;
|
||||
static ReusableBuffer<uint8_t> buf_pal;
|
||||
|
||||
_glActiveTexture(GL_TEXTURE0);
|
||||
_glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
|
||||
@@ -1504,7 +1504,7 @@ void OpenGLSprite::Update(uint width, uint height, uint level, const SpriteLoade
|
||||
/* Unpack and align pixel data. */
|
||||
size_t pitch = Align(width, 4);
|
||||
|
||||
uint8 *pal = buf_pal.Allocate(pitch * height);
|
||||
uint8_t *pal = buf_pal.Allocate(pitch * height);
|
||||
const SpriteLoader::CommonPixel *row = data;
|
||||
for (uint y = 0; y < height; y++, pal += pitch, row += width) {
|
||||
for (uint x = 0; x < width; x++) {
|
||||
|
||||
@@ -101,7 +101,7 @@ public:
|
||||
void ClearCursorCache();
|
||||
|
||||
void *GetVideoBuffer();
|
||||
uint8 *GetAnimBuffer();
|
||||
uint8_t *GetAnimBuffer();
|
||||
void ReleaseVideoBuffer(const Rect &update_rect);
|
||||
void ReleaseAnimBuffer(const Rect &update_rect);
|
||||
|
||||
|
||||
@@ -107,7 +107,7 @@ static DBusHandlerResult FcitxDBusMessageFilter(DBusConnection *connection, DBus
|
||||
|
||||
if (dbus_message_is_signal(message, "org.fcitx.Fcitx.InputContext", "UpdatePreedit")) {
|
||||
const char *text = nullptr;
|
||||
int32 cursor;
|
||||
int32_t cursor;
|
||||
if (!dbus_message_get_args(message, nullptr, DBUS_TYPE_STRING, &text, DBUS_TYPE_INT32, &cursor, DBUS_TYPE_INVALID)) return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
|
||||
|
||||
if (text != nullptr && EditBoxInGlobalFocus()) {
|
||||
@@ -136,7 +136,7 @@ static void FcitxInit()
|
||||
|
||||
int pid = getpid();
|
||||
int id = -1;
|
||||
uint32 enable, hk1sym, hk1state, hk2sym, hk2state;
|
||||
uint32_t enable, hk1sym, hk1state, hk2sym, hk2state;
|
||||
DBusMessage *msg = dbus_message_new_method_call(_fcitx_service_name, "/inputmethod", "org.fcitx.Fcitx.InputMethod", "CreateICv3");
|
||||
if (!msg) return;
|
||||
auto guard1 = scope_guard([&]() {
|
||||
@@ -158,7 +158,7 @@ static void FcitxInit()
|
||||
dbus_connection_add_filter(_fcitx_dbus_session_conn, &FcitxDBusMessageFilter, nullptr, nullptr);
|
||||
dbus_connection_flush(_fcitx_dbus_session_conn);
|
||||
|
||||
uint32 caps = CAPACITY_PREEDIT;
|
||||
uint32_t caps = CAPACITY_PREEDIT;
|
||||
DBusMessage *msg2 = dbus_message_new_method_call(_fcitx_service_name, _fcitx_ic_name, "org.fcitx.Fcitx.InputContext", "SetCapacity");
|
||||
if (!msg2) return;
|
||||
auto guard3 = scope_guard([&]() {
|
||||
@@ -174,12 +174,12 @@ static void FcitxInit()
|
||||
_fcitx_mode = true;
|
||||
}
|
||||
|
||||
static uint32 _fcitx_last_keycode = 0;
|
||||
static uint32 _fcitx_last_keysym = 0;
|
||||
static uint16 _last_sdl_key_mod;
|
||||
static uint32_t _fcitx_last_keycode = 0;
|
||||
static uint32_t _fcitx_last_keysym = 0;
|
||||
static uint16_t _last_sdl_key_mod;
|
||||
static bool FcitxProcessKey()
|
||||
{
|
||||
uint32 fcitx_mods = 0;
|
||||
uint32_t fcitx_mods = 0;
|
||||
if (_last_sdl_key_mod & KMOD_SHIFT) fcitx_mods |= FcitxKeyState_Shift;
|
||||
if (_last_sdl_key_mod & KMOD_CAPS) fcitx_mods |= FcitxKeyState_CapsLock;
|
||||
if (_last_sdl_key_mod & KMOD_CTRL) fcitx_mods |= FcitxKeyState_Ctrl;
|
||||
@@ -189,7 +189,7 @@ static bool FcitxProcessKey()
|
||||
if (_last_sdl_key_mod & KMOD_RGUI) fcitx_mods |= FcitxKeyState_Meta;
|
||||
|
||||
int type = FCITX_PRESS_KEY;
|
||||
uint32 event_time = 0;
|
||||
uint32_t event_time = 0;
|
||||
|
||||
DBusMessage *msg = dbus_message_new_method_call(_fcitx_service_name, _fcitx_ic_name, "org.fcitx.Fcitx.InputContext", "ProcessKeyEvent");
|
||||
if (!msg) return false;
|
||||
@@ -203,7 +203,7 @@ static bool FcitxProcessKey()
|
||||
auto guard2 = scope_guard([&]() {
|
||||
dbus_message_unref(reply);
|
||||
});
|
||||
uint32 handled = 0;
|
||||
uint32_t handled = 0;
|
||||
if (!dbus_message_get_args(reply, nullptr, DBUS_TYPE_INT32, &handled, DBUS_TYPE_INVALID)) return false;
|
||||
return handled;
|
||||
}
|
||||
@@ -387,7 +387,7 @@ bool VideoDriver_SDL_Base::CreateMainWindow(uint w, uint h, uint flags)
|
||||
SDL_Surface *icon = SDL_LoadBMP(icon_path.c_str());
|
||||
if (icon != nullptr) {
|
||||
/* Get the colourkey, which will be magenta */
|
||||
uint32 rgbmap = SDL_MapRGB(icon->format, 255, 0, 255);
|
||||
uint32_t rgbmap = SDL_MapRGB(icon->format, 255, 0, 255);
|
||||
|
||||
SDL_SetColorKey(icon, SDL_TRUE, rgbmap);
|
||||
SDL_SetWindowIcon(this->sdl_window, icon);
|
||||
@@ -581,7 +581,7 @@ static const SDLVkMapping _vk_mapping[] = {
|
||||
AS(SDLK_HASH, WKC_HASH),
|
||||
};
|
||||
|
||||
static uint ConvertSdlKeyIntoMy(SDL_Keysym *sym, WChar *character)
|
||||
static uint ConvertSdlKeyIntoMy(SDL_Keysym *sym, char32_t *character)
|
||||
{
|
||||
const SDLVkMapping *map;
|
||||
uint key = 0;
|
||||
@@ -736,7 +736,7 @@ bool VideoDriver_SDL_Base::PollEvent()
|
||||
(ev.key.keysym.sym == SDLK_RETURN || ev.key.keysym.sym == SDLK_f)) {
|
||||
if (ev.key.repeat == 0) ToggleFullScreen(!_fullscreen);
|
||||
} else {
|
||||
WChar character;
|
||||
char32_t character;
|
||||
|
||||
uint keycode = ConvertSdlKeyIntoMy(&ev.key.keysym, &character);
|
||||
// Only handle non-text keys here. Text is handled in
|
||||
@@ -768,7 +768,7 @@ bool VideoDriver_SDL_Base::PollEvent()
|
||||
uint keycode = ConvertSdlKeycodeIntoMy(kc);
|
||||
|
||||
if (keycode == WKC_BACKQUOTE && FocusedWindowIsConsole()) {
|
||||
WChar character;
|
||||
char32_t character;
|
||||
Utf8Decode(&character, ev.text.text);
|
||||
HandleKeypress(keycode, character);
|
||||
} else {
|
||||
@@ -913,7 +913,7 @@ void VideoDriver_SDL_Base::Stop()
|
||||
|
||||
void VideoDriver_SDL_Base::InputLoop()
|
||||
{
|
||||
uint32 mod = SDL_GetModState();
|
||||
uint32_t mod = SDL_GetModState();
|
||||
const Uint8 *keys = SDL_GetKeyboardState(nullptr);
|
||||
|
||||
bool old_ctrl_pressed = _ctrl_pressed;
|
||||
|
||||
@@ -245,7 +245,7 @@ bool VideoDriver_SDL::CreateMainSurface(uint w, uint h)
|
||||
icon = SDL_LoadBMP(icon_path.c_str());
|
||||
if (icon != nullptr) {
|
||||
/* Get the colourkey, which will be magenta */
|
||||
uint32 rgbmap = SDL_MapRGB(icon->format, 255, 0, 255);
|
||||
uint32_t rgbmap = SDL_MapRGB(icon->format, 255, 0, 255);
|
||||
|
||||
SDL_SetColorKey(icon, SDL_SRCCOLORKEY, rgbmap);
|
||||
SDL_WM_SetIcon(icon, nullptr);
|
||||
@@ -378,7 +378,7 @@ bool VideoDriver_SDL::ClaimMousePointer()
|
||||
}
|
||||
|
||||
struct SDLVkMapping {
|
||||
uint16 vk_from;
|
||||
uint16_t vk_from;
|
||||
byte vk_count;
|
||||
byte map_to;
|
||||
};
|
||||
@@ -439,7 +439,7 @@ static const SDLVkMapping _vk_mapping[] = {
|
||||
AS(SDLK_HASH, WKC_HASH),
|
||||
};
|
||||
|
||||
static uint ConvertSdlKeyIntoMy(SDL_keysym *sym, WChar *character)
|
||||
static uint ConvertSdlKeyIntoMy(SDL_keysym *sym, char32_t *character)
|
||||
{
|
||||
const SDLVkMapping *map;
|
||||
uint key = 0;
|
||||
@@ -559,7 +559,7 @@ bool VideoDriver_SDL::PollEvent()
|
||||
(ev.key.keysym.sym == SDLK_RETURN || ev.key.keysym.sym == SDLK_f)) {
|
||||
ToggleFullScreen(!_fullscreen);
|
||||
} else {
|
||||
WChar character;
|
||||
char32_t character;
|
||||
uint keycode = ConvertSdlKeyIntoMy(&ev.key.keysym, &character);
|
||||
HandleKeypress(keycode, character);
|
||||
}
|
||||
@@ -633,7 +633,7 @@ void VideoDriver_SDL::Stop()
|
||||
|
||||
void VideoDriver_SDL::InputLoop()
|
||||
{
|
||||
uint32 mod = SDL_GetModState();
|
||||
uint32_t mod = SDL_GetModState();
|
||||
int numkeys;
|
||||
Uint8 *keys = SDL_GetKeyState(&numkeys);
|
||||
|
||||
|
||||
@@ -142,7 +142,7 @@ public:
|
||||
* Get a pointer to the animation buffer of the video back-end.
|
||||
* @return Pointer to the buffer or nullptr if no animation buffer is supported.
|
||||
*/
|
||||
inline uint8 *GetAnimBuffer()
|
||||
inline uint8_t *GetAnimBuffer()
|
||||
{
|
||||
return this->anim_buffer;
|
||||
}
|
||||
@@ -361,7 +361,7 @@ protected:
|
||||
std::recursive_mutex game_state_mutex;
|
||||
std::mutex game_thread_wait_mutex;
|
||||
|
||||
uint8 *anim_buffer = nullptr; ///< Animation buffer, (not used by all drivers, here because it is accessed very frequently)
|
||||
uint8_t *anim_buffer = nullptr; ///< Animation buffer, (not used by all drivers, here because it is accessed very frequently)
|
||||
|
||||
static void GameThreadThunk(VideoDriver *drv);
|
||||
|
||||
|
||||
@@ -124,7 +124,7 @@ static uint MapWindowsKey(uint sym)
|
||||
}
|
||||
|
||||
/** Colour depth to use for fullscreen display modes. */
|
||||
uint8 VideoDriver_Win32Base::GetFullscreenBpp()
|
||||
uint8_t VideoDriver_Win32Base::GetFullscreenBpp()
|
||||
{
|
||||
/* Check modes for the relevant fullscreen bpp */
|
||||
return _support8bpp != S8BPP_HARDWARE ? 32 : BlitterFactory::GetCurrentBlitter()->GetScreenDepth();
|
||||
@@ -241,9 +241,9 @@ bool VideoDriver_Win32Base::MakeWindow(bool full_screen, bool resize)
|
||||
}
|
||||
|
||||
/** Forward key presses to the window system. */
|
||||
static LRESULT HandleCharMsg(uint keycode, WChar charcode)
|
||||
static LRESULT HandleCharMsg(uint keycode, char32_t charcode)
|
||||
{
|
||||
static WChar prev_char = 0;
|
||||
static char32_t prev_char = 0;
|
||||
|
||||
/* Did we get a lead surrogate? If yes, store and exit. */
|
||||
if (Utf16IsLeadSurrogate(charcode)) {
|
||||
@@ -401,7 +401,7 @@ static void CancelIMEComposition(HWND hwnd)
|
||||
|
||||
LRESULT CALLBACK WndProcGdi(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
static uint32 keycode = 0;
|
||||
static uint32_t keycode = 0;
|
||||
static bool console = false;
|
||||
|
||||
VideoDriver_Win32Base *video_driver = (VideoDriver_Win32Base *)GetWindowLongPtr(hwnd, GWLP_USERDATA);
|
||||
@@ -473,8 +473,8 @@ LRESULT CALLBACK WndProcGdi(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
return 0;
|
||||
|
||||
case WM_MOUSEMOVE: {
|
||||
int x = (int16)LOWORD(lParam);
|
||||
int y = (int16)HIWORD(lParam);
|
||||
int x = (int16_t)LOWORD(lParam);
|
||||
int y = (int16_t)HIWORD(lParam);
|
||||
|
||||
/* If the mouse was not in the window and it has moved it means it has
|
||||
* come into the window, so start drawing the mouse. Also start
|
||||
@@ -494,8 +494,8 @@ LRESULT CALLBACK WndProcGdi(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
* end, we only care about the current mouse position and not bygone events. */
|
||||
MSG m;
|
||||
while (PeekMessage(&m, hwnd, WM_MOUSEMOVE, WM_MOUSEMOVE, PM_REMOVE | PM_NOYIELD | PM_QS_INPUT)) {
|
||||
x = (int16)LOWORD(m.lParam);
|
||||
y = (int16)HIWORD(m.lParam);
|
||||
x = (int16_t)LOWORD(m.lParam);
|
||||
y = (int16_t)HIWORD(m.lParam);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -795,7 +795,7 @@ static const Dimension default_resolutions[] = {
|
||||
{ 1920, 1200 }
|
||||
};
|
||||
|
||||
static void FindResolutions(uint8 bpp)
|
||||
static void FindResolutions(uint8_t bpp)
|
||||
{
|
||||
_resolutions.clear();
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ protected:
|
||||
void ClientSizeChanged(int w, int h, bool force = false);
|
||||
|
||||
/** Get screen depth to use for fullscreen mode. */
|
||||
virtual uint8 GetFullscreenBpp();
|
||||
virtual uint8_t GetFullscreenBpp();
|
||||
/** (Re-)create the backing store. */
|
||||
virtual bool AllocateBackingStore(int w, int h, bool force = false) = 0;
|
||||
/** Get a pointer to the video buffer. */
|
||||
@@ -149,7 +149,7 @@ protected:
|
||||
HGLRC gl_rc; ///< OpenGL context.
|
||||
std::string driver_info; ///< Information string about selected driver.
|
||||
|
||||
uint8 GetFullscreenBpp() override { return 32; } // OpenGL is always 32 bpp.
|
||||
uint8_t GetFullscreenBpp() override { return 32; } // OpenGL is always 32 bpp.
|
||||
|
||||
void Paint() override;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user