Codechange: automatic adding of _t to (u)int types, and WChar to char32_t
for i in `find src -type f|grep -v 3rdparty/fmt|grep -v 3rdparty/catch2|grep -v 3rdparty/opengl|grep -v stdafx.h`; do sed 's/uint16& /uint16 \&/g;s/int8\([ >*),;[]\)/int8_t\1/g;s/int16\([ >*),;[]\)/int16_t\1/g;s/int32\([ >*),;[]\)/int32_t\1/g;s/int64\([ >*),;[]\)/int64_t\1/g;s/ uint32(/ uint32_t(/g;s/_uint8_t/_uint8/;s/Uint8_t/Uint8/;s/ft_int64_t/ft_int64/g;s/uint64$/uint64_t/;s/WChar/char32_t/g;s/char32_t char32_t/char32_t WChar/' -i $i; done
This commit is contained in:
@@ -246,7 +246,7 @@ std::vector<int> VideoDriver_Allegro::GetListOfMonitorRefreshRates()
|
||||
}
|
||||
|
||||
struct AllegroVkMapping {
|
||||
uint16 vk_from;
|
||||
uint16_t vk_from;
|
||||
byte vk_count;
|
||||
byte map_to;
|
||||
};
|
||||
@@ -307,7 +307,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);
|
||||
@@ -407,7 +407,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);
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
class VideoDriver_CocoaOpenGL : public VideoDriver_Cocoa {
|
||||
CGLContextObj gl_context;
|
||||
|
||||
uint8 *anim_buffer; ///< Animation buffer from OpenGL back-end.
|
||||
uint8_t *anim_buffer; ///< Animation buffer from OpenGL back-end.
|
||||
std::string driver_info; ///< Information string about selected driver.
|
||||
|
||||
const char *AllocateContext(bool allow_software);
|
||||
@@ -37,7 +37,7 @@ public:
|
||||
void PopulateSystemSprites() override;
|
||||
|
||||
bool HasAnimBuffer() override { return true; }
|
||||
uint8 *GetAnimBuffer() override { return this->anim_buffer; }
|
||||
uint8_t *GetAnimBuffer() override { return this->anim_buffer; }
|
||||
|
||||
/** Return driver name */
|
||||
const char *GetName() const override { return "cocoa-opengl"; }
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -573,11 +573,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;
|
||||
}
|
||||
}
|
||||
@@ -651,14 +651,14 @@ void VideoDriver_CocoaQuartz::AllocateBackingStore(bool force)
|
||||
|
||||
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(
|
||||
@@ -706,9 +706,9 @@ void VideoDriver_CocoaQuartz::AllocateBackingStore(bool force)
|
||||
*/
|
||||
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;
|
||||
|
||||
@@ -725,10 +725,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)_local_palette.palette[i].r << 16;
|
||||
clr |= (uint32)_local_palette.palette[i].g << 8;
|
||||
clr |= (uint32)_local_palette.palette[i].b;
|
||||
uint32_t clr = 0xff000000;
|
||||
clr |= (uint32_t)_local_palette.palette[i].r << 16;
|
||||
clr |= (uint32_t)_local_palette.palette[i].g << 8;
|
||||
clr |= (uint32_t)_local_palette.palette[i].b;
|
||||
this->palette[i] = clr;
|
||||
}
|
||||
|
||||
|
||||
@@ -107,7 +107,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;
|
||||
@@ -125,7 +125,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;
|
||||
@@ -139,9 +139,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++) {
|
||||
@@ -161,7 +161,7 @@ static std::vector<WChar> NSStringToUTF32(NSString *s)
|
||||
|
||||
static void CGDataFreeCallback(void *, const void *data, size_t)
|
||||
{
|
||||
delete[] (const uint32 *)data;
|
||||
delete[] (const uint32_t *)data;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -176,7 +176,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));
|
||||
@@ -674,7 +674,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;
|
||||
|
||||
@@ -780,7 +780,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;
|
||||
@@ -813,7 +813,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);
|
||||
@@ -861,7 +861,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()) {
|
||||
@@ -890,7 +890,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 ];
|
||||
|
||||
@@ -940,7 +940,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) {
|
||||
@@ -1173,7 +1173,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;
|
||||
|
||||
@@ -1189,7 +1189,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;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1370,7 +1370,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. */
|
||||
@@ -1474,7 +1474,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);
|
||||
@@ -1499,7 +1499,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);
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ public:
|
||||
void PopulateSystemSprites() override;
|
||||
|
||||
bool HasAnimBuffer() override { return true; }
|
||||
uint8 *GetAnimBuffer() override { return this->anim_buffer; }
|
||||
uint8_t *GetAnimBuffer() override { return this->anim_buffer; }
|
||||
|
||||
void ToggleVsync(bool vsync) override;
|
||||
|
||||
@@ -42,7 +42,7 @@ protected:
|
||||
|
||||
private:
|
||||
void *gl_context; ///< OpenGL context.
|
||||
uint8 *anim_buffer; ///< Animation buffer from OpenGL back-end.
|
||||
uint8_t *anim_buffer; ///< Animation buffer from OpenGL back-end.
|
||||
|
||||
const char *AllocateContext();
|
||||
void DestroyContext();
|
||||
|
||||
@@ -166,7 +166,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);
|
||||
@@ -302,7 +302,7 @@ static const SDLVkMapping _vk_mapping[] = {
|
||||
AS(SDLK_PERIOD, WKC_PERIOD)
|
||||
};
|
||||
|
||||
static uint ConvertSdlKeyIntoMy(SDL_Keysym *sym, WChar *character)
|
||||
static uint ConvertSdlKeyIntoMy(SDL_Keysym *sym, char32_t *character)
|
||||
{
|
||||
const SDLVkMapping *map;
|
||||
uint key = 0;
|
||||
@@ -440,7 +440,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
|
||||
@@ -470,7 +470,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 {
|
||||
@@ -575,7 +575,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;
|
||||
|
||||
@@ -240,7 +240,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);
|
||||
@@ -373,7 +373,7 @@ bool VideoDriver_SDL::ClaimMousePointer()
|
||||
}
|
||||
|
||||
struct SDLVkMapping {
|
||||
uint16 vk_from;
|
||||
uint16_t vk_from;
|
||||
byte vk_count;
|
||||
byte map_to;
|
||||
};
|
||||
@@ -433,7 +433,7 @@ static const SDLVkMapping _vk_mapping[] = {
|
||||
AS(SDLK_PERIOD, WKC_PERIOD)
|
||||
};
|
||||
|
||||
static uint ConvertSdlKeyIntoMy(SDL_keysym *sym, WChar *character)
|
||||
static uint ConvertSdlKeyIntoMy(SDL_keysym *sym, char32_t *character)
|
||||
{
|
||||
const SDLVkMapping *map;
|
||||
uint key = 0;
|
||||
@@ -553,7 +553,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);
|
||||
}
|
||||
@@ -627,7 +627,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);
|
||||
|
||||
|
||||
@@ -140,7 +140,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.
|
||||
*/
|
||||
virtual uint8 *GetAnimBuffer()
|
||||
virtual uint8_t *GetAnimBuffer()
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -123,7 +123,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();
|
||||
@@ -239,9 +239,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)) {
|
||||
@@ -399,7 +399,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);
|
||||
@@ -471,8 +471,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
|
||||
@@ -492,8 +492,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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -793,7 +793,7 @@ static const Dimension default_resolutions[] = {
|
||||
{ 1920, 1200 }
|
||||
};
|
||||
|
||||
static void FindResolutions(uint8 bpp)
|
||||
static void FindResolutions(uint8_t bpp)
|
||||
{
|
||||
_resolutions.clear();
|
||||
|
||||
|
||||
@@ -60,7 +60,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. */
|
||||
@@ -136,7 +136,7 @@ public:
|
||||
void ClearSystemSprites() override;
|
||||
|
||||
bool HasAnimBuffer() override { return true; }
|
||||
uint8 *GetAnimBuffer() override { return this->anim_buffer; }
|
||||
uint8_t *GetAnimBuffer() override { return this->anim_buffer; }
|
||||
|
||||
void ToggleVsync(bool vsync) override;
|
||||
|
||||
@@ -147,10 +147,10 @@ public:
|
||||
protected:
|
||||
HDC dc; ///< Window device context.
|
||||
HGLRC gl_rc; ///< OpenGL context.
|
||||
uint8 *anim_buffer; ///< Animation buffer from OpenGL back-end.
|
||||
uint8_t *anim_buffer; ///< Animation buffer from OpenGL back-end.
|
||||
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