mirror of
https://github.com/SFML/SFML.git
synced 2024-11-24 20:31:05 +08:00
Replace sf::Uint32
with std::uint32_t
This commit is contained in:
parent
056f66a2b8
commit
e294090c8e
@ -396,7 +396,7 @@ public:
|
||||
vkWaitForFences(device, 1, &fence, VK_TRUE, std::numeric_limits<uint64_t>::max());
|
||||
|
||||
if (commandBuffers.size())
|
||||
vkFreeCommandBuffers(device, commandPool, static_cast<sf::Uint32>(commandBuffers.size()), commandBuffers.data());
|
||||
vkFreeCommandBuffers(device, commandPool, static_cast<std::uint32_t>(commandBuffers.size()), commandBuffers.data());
|
||||
|
||||
commandBuffers.clear();
|
||||
|
||||
@ -477,7 +477,7 @@ public:
|
||||
}
|
||||
|
||||
// Retrieve the available instance layers
|
||||
uint32_t objectCount = 0;
|
||||
std::uint32_t objectCount = 0;
|
||||
|
||||
std::vector<VkLayerProperties> layers;
|
||||
|
||||
@ -537,9 +537,9 @@ public:
|
||||
VkInstanceCreateInfo instanceCreateInfo = VkInstanceCreateInfo();
|
||||
instanceCreateInfo.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
|
||||
instanceCreateInfo.pApplicationInfo = &applicationInfo;
|
||||
instanceCreateInfo.enabledLayerCount = static_cast<sf::Uint32>(validationLayers.size());
|
||||
instanceCreateInfo.enabledLayerCount = static_cast<std::uint32_t>(validationLayers.size());
|
||||
instanceCreateInfo.ppEnabledLayerNames = validationLayers.data();
|
||||
instanceCreateInfo.enabledExtensionCount = static_cast<sf::Uint32>(requiredExtentions.size());
|
||||
instanceCreateInfo.enabledExtensionCount = static_cast<std::uint32_t>(requiredExtentions.size());
|
||||
instanceCreateInfo.ppEnabledExtensionNames = requiredExtentions.data();
|
||||
|
||||
// Try to create a Vulkan instance with debug report enabled
|
||||
@ -550,7 +550,7 @@ public:
|
||||
{
|
||||
requiredExtentions.pop_back();
|
||||
|
||||
instanceCreateInfo.enabledExtensionCount = static_cast<sf::Uint32>(requiredExtentions.size());
|
||||
instanceCreateInfo.enabledExtensionCount = static_cast<std::uint32_t>(requiredExtentions.size());
|
||||
instanceCreateInfo.ppEnabledExtensionNames = requiredExtentions.data();
|
||||
|
||||
result = vkCreateInstance(&instanceCreateInfo, 0, &instance);
|
||||
@ -607,7 +607,7 @@ public:
|
||||
}
|
||||
|
||||
// Retrieve list of GPUs
|
||||
uint32_t objectCount = 0;
|
||||
std::uint32_t objectCount = 0;
|
||||
|
||||
std::vector<VkPhysicalDevice> devices;
|
||||
|
||||
@ -720,7 +720,7 @@ public:
|
||||
void setupLogicalDevice()
|
||||
{
|
||||
// Select a queue family that supports graphics operations and surface presentation
|
||||
uint32_t objectCount = 0;
|
||||
std::uint32_t objectCount = 0;
|
||||
|
||||
std::vector<VkQueueFamilyProperties> queueFamilyProperties;
|
||||
|
||||
@ -734,7 +734,7 @@ public:
|
||||
{
|
||||
VkBool32 surfaceSupported = VK_FALSE;
|
||||
|
||||
vkGetPhysicalDeviceSurfaceSupportKHR(gpu, static_cast<sf::Uint32>(i), surface, &surfaceSupported);
|
||||
vkGetPhysicalDeviceSurfaceSupportKHR(gpu, static_cast<std::uint32_t>(i), surface, &surfaceSupported);
|
||||
|
||||
if ((queueFamilyProperties[i].queueFlags & VK_QUEUE_GRAPHICS_BIT) && (surfaceSupported == VK_TRUE))
|
||||
{
|
||||
@ -754,7 +754,7 @@ public:
|
||||
VkDeviceQueueCreateInfo deviceQueueCreateInfo = VkDeviceQueueCreateInfo();
|
||||
deviceQueueCreateInfo.sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO;
|
||||
deviceQueueCreateInfo.queueCount = 1;
|
||||
deviceQueueCreateInfo.queueFamilyIndex = static_cast<uint32_t>(queueFamilyIndex);
|
||||
deviceQueueCreateInfo.queueFamilyIndex = static_cast<std::uint32_t>(queueFamilyIndex);
|
||||
deviceQueueCreateInfo.pQueuePriorities = &queuePriority;
|
||||
|
||||
// Enable the swapchain extension
|
||||
@ -780,14 +780,14 @@ public:
|
||||
}
|
||||
|
||||
// Retrieve a handle to the logical device command queue
|
||||
vkGetDeviceQueue(device, static_cast<uint32_t>(queueFamilyIndex), 0, &queue);
|
||||
vkGetDeviceQueue(device, static_cast<std::uint32_t>(queueFamilyIndex), 0, &queue);
|
||||
}
|
||||
|
||||
// Query surface formats and set up swapchain
|
||||
void setupSwapchain()
|
||||
{
|
||||
// Select a surface format that supports RGBA color format
|
||||
uint32_t objectCount = 0;
|
||||
std::uint32_t objectCount = 0;
|
||||
|
||||
std::vector<VkSurfaceFormatKHR> surfaceFormats;
|
||||
|
||||
@ -871,14 +871,14 @@ public:
|
||||
return;
|
||||
}
|
||||
|
||||
swapchainExtent.width = clamp<uint32_t>(window.getSize().x,
|
||||
surfaceCapabilities.minImageExtent.width,
|
||||
surfaceCapabilities.maxImageExtent.width);
|
||||
swapchainExtent.height = clamp<uint32_t>(window.getSize().y,
|
||||
surfaceCapabilities.minImageExtent.height,
|
||||
surfaceCapabilities.maxImageExtent.height);
|
||||
swapchainExtent.width = clamp<std::uint32_t>(window.getSize().x,
|
||||
surfaceCapabilities.minImageExtent.width,
|
||||
surfaceCapabilities.maxImageExtent.width);
|
||||
swapchainExtent.height = clamp<std::uint32_t>(window.getSize().y,
|
||||
surfaceCapabilities.minImageExtent.height,
|
||||
surfaceCapabilities.maxImageExtent.height);
|
||||
|
||||
auto imageCount = clamp<uint32_t>(2, surfaceCapabilities.minImageCount, surfaceCapabilities.maxImageCount);
|
||||
auto imageCount = clamp<std::uint32_t>(2, surfaceCapabilities.minImageCount, surfaceCapabilities.maxImageCount);
|
||||
|
||||
VkSwapchainCreateInfoKHR swapchainCreateInfo = VkSwapchainCreateInfoKHR();
|
||||
swapchainCreateInfo.sType = VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR;
|
||||
@ -908,7 +908,7 @@ public:
|
||||
void setupSwapchainImages()
|
||||
{
|
||||
// Retrieve swapchain images
|
||||
uint32_t objectCount = 0;
|
||||
std::uint32_t objectCount = 0;
|
||||
|
||||
if (vkGetSwapchainImagesKHR(device, swapchain, &objectCount, 0) != VK_SUCCESS)
|
||||
{
|
||||
@ -968,7 +968,7 @@ public:
|
||||
return;
|
||||
}
|
||||
|
||||
std::vector<uint32_t> buffer(static_cast<std::size_t>(file.getSize()) / sizeof(uint32_t));
|
||||
std::vector<std::uint32_t> buffer(static_cast<std::size_t>(file.getSize()) / sizeof(std::uint32_t));
|
||||
|
||||
if (file.read(buffer.data(), file.getSize()) != file.getSize())
|
||||
{
|
||||
@ -976,7 +976,7 @@ public:
|
||||
return;
|
||||
}
|
||||
|
||||
shaderModuleCreateInfo.codeSize = buffer.size() * sizeof(uint32_t);
|
||||
shaderModuleCreateInfo.codeSize = buffer.size() * sizeof(std::uint32_t);
|
||||
shaderModuleCreateInfo.pCode = buffer.data();
|
||||
|
||||
if (vkCreateShaderModule(device, &shaderModuleCreateInfo, 0, &vertexShaderModule) != VK_SUCCESS)
|
||||
@ -996,7 +996,7 @@ public:
|
||||
return;
|
||||
}
|
||||
|
||||
std::vector<uint32_t> buffer(static_cast<std::size_t>(file.getSize()) / sizeof(uint32_t));
|
||||
std::vector<std::uint32_t> buffer(static_cast<std::size_t>(file.getSize()) / sizeof(std::uint32_t));
|
||||
|
||||
if (file.read(buffer.data(), file.getSize()) != file.getSize())
|
||||
{
|
||||
@ -1004,7 +1004,7 @@ public:
|
||||
return;
|
||||
}
|
||||
|
||||
shaderModuleCreateInfo.codeSize = buffer.size() * sizeof(uint32_t);
|
||||
shaderModuleCreateInfo.codeSize = buffer.size() * sizeof(std::uint32_t);
|
||||
shaderModuleCreateInfo.pCode = buffer.data();
|
||||
|
||||
if (vkCreateShaderModule(device, &shaderModuleCreateInfo, 0, &fragmentShaderModule) != VK_SUCCESS)
|
||||
@ -1314,7 +1314,7 @@ public:
|
||||
// We want to be able to reset command buffers after submitting them
|
||||
VkCommandPoolCreateInfo commandPoolCreateInfo = VkCommandPoolCreateInfo();
|
||||
commandPoolCreateInfo.sType = VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO;
|
||||
commandPoolCreateInfo.queueFamilyIndex = static_cast<uint32_t>(queueFamilyIndex);
|
||||
commandPoolCreateInfo.queueFamilyIndex = static_cast<std::uint32_t>(queueFamilyIndex);
|
||||
commandPoolCreateInfo.flags = VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT;
|
||||
|
||||
// Create our command pool
|
||||
@ -1351,7 +1351,7 @@ public:
|
||||
VkPhysicalDeviceMemoryProperties memoryProperties = VkPhysicalDeviceMemoryProperties();
|
||||
vkGetPhysicalDeviceMemoryProperties(gpu, &memoryProperties);
|
||||
|
||||
uint32_t memoryType = 0;
|
||||
std::uint32_t memoryType = 0;
|
||||
|
||||
for (; memoryType < memoryProperties.memoryTypeCount; ++memoryType)
|
||||
{
|
||||
@ -1637,8 +1637,8 @@ public:
|
||||
}
|
||||
|
||||
// Helper to create a generic image with the specified size, format, usage and memory flags
|
||||
bool createImage(uint32_t width,
|
||||
uint32_t height,
|
||||
bool createImage(std::uint32_t width,
|
||||
std::uint32_t height,
|
||||
VkFormat format,
|
||||
VkImageTiling tiling,
|
||||
VkImageUsageFlags usage,
|
||||
@ -1674,7 +1674,7 @@ public:
|
||||
VkPhysicalDeviceMemoryProperties memoryProperties = VkPhysicalDeviceMemoryProperties();
|
||||
vkGetPhysicalDeviceMemoryProperties(gpu, &memoryProperties);
|
||||
|
||||
uint32_t memoryType = 0;
|
||||
std::uint32_t memoryType = 0;
|
||||
|
||||
for (; memoryType < memoryProperties.memoryTypeCount; ++memoryType)
|
||||
{
|
||||
@ -2179,17 +2179,17 @@ public:
|
||||
|
||||
descriptorPoolSizes[0] = VkDescriptorPoolSize();
|
||||
descriptorPoolSizes[0].type = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER;
|
||||
descriptorPoolSizes[0].descriptorCount = static_cast<uint32_t>(swapchainImages.size());
|
||||
descriptorPoolSizes[0].descriptorCount = static_cast<std::uint32_t>(swapchainImages.size());
|
||||
|
||||
descriptorPoolSizes[1] = VkDescriptorPoolSize();
|
||||
descriptorPoolSizes[1].type = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER;
|
||||
descriptorPoolSizes[1].descriptorCount = static_cast<uint32_t>(swapchainImages.size());
|
||||
descriptorPoolSizes[1].descriptorCount = static_cast<std::uint32_t>(swapchainImages.size());
|
||||
|
||||
VkDescriptorPoolCreateInfo descriptorPoolCreateInfo = VkDescriptorPoolCreateInfo();
|
||||
descriptorPoolCreateInfo.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO;
|
||||
descriptorPoolCreateInfo.poolSizeCount = 2;
|
||||
descriptorPoolCreateInfo.pPoolSizes = descriptorPoolSizes;
|
||||
descriptorPoolCreateInfo.maxSets = static_cast<uint32_t>(swapchainImages.size());
|
||||
descriptorPoolCreateInfo.maxSets = static_cast<std::uint32_t>(swapchainImages.size());
|
||||
|
||||
// Create the descriptor pool
|
||||
if (vkCreateDescriptorPool(device, &descriptorPoolCreateInfo, 0, &descriptorPool) != VK_SUCCESS)
|
||||
@ -2208,7 +2208,7 @@ public:
|
||||
VkDescriptorSetAllocateInfo descriptorSetAllocateInfo = VkDescriptorSetAllocateInfo();
|
||||
descriptorSetAllocateInfo.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO;
|
||||
descriptorSetAllocateInfo.descriptorPool = descriptorPool;
|
||||
descriptorSetAllocateInfo.descriptorSetCount = static_cast<uint32_t>(swapchainImages.size());
|
||||
descriptorSetAllocateInfo.descriptorSetCount = static_cast<std::uint32_t>(swapchainImages.size());
|
||||
descriptorSetAllocateInfo.pSetLayouts = descriptorSetLayouts.data();
|
||||
|
||||
descriptorSets.resize(swapchainImages.size());
|
||||
@ -2272,7 +2272,7 @@ public:
|
||||
commandBufferAllocateInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO;
|
||||
commandBufferAllocateInfo.commandPool = commandPool;
|
||||
commandBufferAllocateInfo.level = VK_COMMAND_BUFFER_LEVEL_PRIMARY;
|
||||
commandBufferAllocateInfo.commandBufferCount = static_cast<uint32_t>(commandBuffers.size());
|
||||
commandBufferAllocateInfo.commandBufferCount = static_cast<std::uint32_t>(commandBuffers.size());
|
||||
|
||||
// Allocate the command buffers from our command pool
|
||||
if (vkAllocateCommandBuffers(device, &commandBufferAllocateInfo, commandBuffers.data()) != VK_SUCCESS)
|
||||
@ -2480,7 +2480,7 @@ public:
|
||||
|
||||
void draw()
|
||||
{
|
||||
uint32_t imageIndex = 0;
|
||||
std::uint32_t imageIndex = 0;
|
||||
|
||||
// If the objects we need to submit this frame are still pending, wait here
|
||||
vkWaitForFences(device, 1, &fences[currentFrame], VK_TRUE, std::numeric_limits<uint64_t>::max());
|
||||
|
@ -167,9 +167,6 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
namespace sf
|
||||
{
|
||||
// 32 bits integer types
|
||||
using Uint32 = std::uint32_t;
|
||||
|
||||
// 64 bits integer types
|
||||
using Int64 = std::int64_t;
|
||||
using Uint64 = std::uint64_t;
|
||||
|
@ -66,7 +66,7 @@ public:
|
||||
/// \param color Number containing the RGBA components (in that order)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
constexpr explicit Color(Uint32 color);
|
||||
constexpr explicit Color(std::uint32_t color);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Retrieve the color as a 32-bit unsigned integer
|
||||
@ -74,7 +74,7 @@ public:
|
||||
/// \return Color represented as a 32-bit unsigned integer
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
constexpr Uint32 toInteger() const;
|
||||
constexpr std::uint32_t toInteger() const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Static member data
|
||||
|
@ -40,7 +40,7 @@ a(alpha)
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
constexpr Color::Color(Uint32 color) :
|
||||
constexpr Color::Color(std::uint32_t color) :
|
||||
r(static_cast<std::uint8_t>((color & 0xff000000) >> 24)),
|
||||
g(static_cast<std::uint8_t>((color & 0x00ff0000) >> 16)),
|
||||
b(static_cast<std::uint8_t>((color & 0x0000ff00) >> 8)),
|
||||
@ -50,9 +50,9 @@ a(static_cast<std::uint8_t>(color & 0x000000ff))
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
constexpr Uint32 Color::toInteger() const
|
||||
constexpr std::uint32_t Color::toInteger() const
|
||||
{
|
||||
return static_cast<Uint32>((r << 24) | (g << 16) | (b << 8) | a);
|
||||
return static_cast<std::uint32_t>((r << 24) | (g << 16) | (b << 8) | a);
|
||||
}
|
||||
|
||||
|
||||
|
@ -199,7 +199,7 @@ public:
|
||||
/// \return The glyph corresponding to \a codePoint and \a characterSize
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
const Glyph& getGlyph(Uint32 codePoint, unsigned int characterSize, bool bold, float outlineThickness = 0) const;
|
||||
const Glyph& getGlyph(std::uint32_t codePoint, unsigned int characterSize, bool bold, float outlineThickness = 0) const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Determine if this font has a glyph representing the requested code point
|
||||
@ -217,7 +217,7 @@ public:
|
||||
/// \return True if the codepoint has a glyph representation, false otherwise
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
bool hasGlyph(Uint32 codePoint) const;
|
||||
bool hasGlyph(std::uint32_t codePoint) const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the kerning offset of two glyphs
|
||||
@ -235,7 +235,7 @@ public:
|
||||
/// \return Kerning value for \a first and \a second, in pixels
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
float getKerning(Uint32 first, Uint32 second, unsigned int characterSize, bool bold = false) const;
|
||||
float getKerning(std::uint32_t first, std::uint32_t second, unsigned int characterSize, bool bold = false) const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the line spacing
|
||||
@ -391,7 +391,7 @@ private:
|
||||
/// \return The glyph corresponding to \a codePoint and \a characterSize
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Glyph loadGlyph(Uint32 codePoint, unsigned int characterSize, bool bold, float outlineThickness) const;
|
||||
Glyph loadGlyph(std::uint32_t codePoint, unsigned int characterSize, bool bold, float outlineThickness) const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Find a suitable rectangle within the texture for a glyph
|
||||
|
@ -73,7 +73,7 @@ public:
|
||||
////////////////////////////////////////////////////////////
|
||||
RenderWindow(VideoMode mode,
|
||||
const String& title,
|
||||
Uint32 style = Style::Default,
|
||||
std::uint32_t style = Style::Default,
|
||||
const ContextSettings& settings = ContextSettings());
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
|
@ -215,7 +215,7 @@ public:
|
||||
/// \see getStyle
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void setStyle(Uint32 style);
|
||||
void setStyle(std::uint32_t style);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the fill color of the text
|
||||
@ -329,7 +329,7 @@ public:
|
||||
/// \see setStyle
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Uint32 getStyle() const;
|
||||
std::uint32_t getStyle() const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the fill color of the text
|
||||
@ -433,7 +433,7 @@ private:
|
||||
unsigned int m_characterSize; //!< Base size of characters, in pixels
|
||||
float m_letterSpacingFactor; //!< Spacing factor between letters
|
||||
float m_lineSpacingFactor; //!< Spacing factor between lines
|
||||
Uint32 m_style; //!< Text style (see Style enum)
|
||||
std::uint32_t m_style; //!< Text style (see Style enum)
|
||||
Color m_fillColor; //!< Text fill color
|
||||
Color m_outlineColor; //!< Text outline color
|
||||
float m_outlineThickness; //!< Thickness of the text's outline
|
||||
|
@ -86,7 +86,7 @@ public:
|
||||
/// \see toInteger
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
explicit IpAddress(Uint32 address);
|
||||
explicit IpAddress(std::uint32_t address);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get a string representation of the address
|
||||
@ -116,7 +116,7 @@ public:
|
||||
/// \see toString
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Uint32 toInteger() const;
|
||||
std::uint32_t toInteger() const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the computer's local address
|
||||
@ -171,7 +171,7 @@ private:
|
||||
////////////////////////////////////////////////////////////
|
||||
// Member data
|
||||
////////////////////////////////////////////////////////////
|
||||
Uint32 m_address; //!< Address stored as an unsigned 32 bits integer
|
||||
std::uint32_t m_address; //!< Address stored as an unsigned 32 bits integer
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
|
@ -238,7 +238,7 @@ public:
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \overload
|
||||
////////////////////////////////////////////////////////////
|
||||
Packet& operator>>(Uint32& data);
|
||||
Packet& operator>>(std::uint32_t& data);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \overload
|
||||
@ -319,7 +319,7 @@ public:
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \overload
|
||||
////////////////////////////////////////////////////////////
|
||||
Packet& operator<<(Uint32 data);
|
||||
Packet& operator<<(std::uint32_t data);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \overload
|
||||
@ -468,7 +468,7 @@ private:
|
||||
///
|
||||
/// Usage example:
|
||||
/// \code
|
||||
/// sf::Uint32 x = 24;
|
||||
/// std::uint32_t x = 24;
|
||||
/// std::string s = "hello";
|
||||
/// double d = 5.89;
|
||||
///
|
||||
@ -486,7 +486,7 @@ private:
|
||||
/// socket.receive(packet);
|
||||
///
|
||||
/// // Extract the variables contained in the packet
|
||||
/// sf::Uint32 x;
|
||||
/// std::uint32_t x;
|
||||
/// std::string s;
|
||||
/// double d;
|
||||
/// if (packet >> x >> s >> d)
|
||||
|
@ -221,7 +221,7 @@ private:
|
||||
{
|
||||
PendingPacket();
|
||||
|
||||
Uint32 Size; //!< Data of packet size
|
||||
std::uint32_t Size; //!< Data of packet size
|
||||
std::size_t SizeReceived; //!< Number of size bytes received so far
|
||||
std::vector<char> Data; //!< Data of the packet
|
||||
};
|
||||
|
@ -50,8 +50,8 @@ public:
|
||||
////////////////////////////////////////////////////////////
|
||||
// Types
|
||||
////////////////////////////////////////////////////////////
|
||||
using Iterator = std::basic_string<Uint32>::iterator; //!< Iterator type
|
||||
using ConstIterator = std::basic_string<Uint32>::const_iterator; //!< Read-only iterator type
|
||||
using Iterator = std::basic_string<std::uint32_t>::iterator; //!< Iterator type
|
||||
using ConstIterator = std::basic_string<std::uint32_t>::const_iterator; //!< Read-only iterator type
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Static member data
|
||||
@ -92,7 +92,7 @@ public:
|
||||
/// \param utf32Char UTF-32 character to convert
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
String(Uint32 utf32Char);
|
||||
String(std::uint32_t utf32Char);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Construct from a null-terminated C-style ANSI string and a locale
|
||||
@ -140,7 +140,7 @@ public:
|
||||
/// \param utf32String UTF-32 string to assign
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
String(const Uint32* utf32String);
|
||||
String(const std::uint32_t* utf32String);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Construct from an UTF-32 string
|
||||
@ -148,7 +148,7 @@ public:
|
||||
/// \param utf32String UTF-32 string to assign
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
String(const std::basic_string<Uint32>& utf32String);
|
||||
String(const std::basic_string<std::uint32_t>& utf32String);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Copy constructor
|
||||
@ -202,8 +202,8 @@ public:
|
||||
/// \brief Create a new sf::String from a UTF-32 encoded string
|
||||
///
|
||||
/// This function is provided for consistency, it is equivalent to
|
||||
/// using the constructors that takes a const sf::Uint32* or
|
||||
/// a std::basic_string<sf::Uint32>.
|
||||
/// using the constructors that takes a const std::uint32_t* or
|
||||
/// a std::basic_string<std::uint32_t>.
|
||||
///
|
||||
/// \param begin Forward iterator to the beginning of the UTF-32 sequence
|
||||
/// \param end Forward iterator to the end of the UTF-32 sequence
|
||||
@ -309,7 +309,7 @@ public:
|
||||
/// \see toUtf8, toUtf16
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
std::basic_string<Uint32> toUtf32() const;
|
||||
std::basic_string<std::uint32_t> toUtf32() const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Overload of assignment operator
|
||||
@ -342,7 +342,7 @@ public:
|
||||
/// \return Character at position \a index
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Uint32 operator[](std::size_t index) const;
|
||||
std::uint32_t operator[](std::size_t index) const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Overload of [] operator to access a character by its position
|
||||
@ -355,7 +355,7 @@ public:
|
||||
/// \return Reference to the character at position \a index
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Uint32& operator[](std::size_t index);
|
||||
std::uint32_t& operator[](std::size_t index);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Clear the string
|
||||
@ -479,7 +479,7 @@ public:
|
||||
/// \return Read-only pointer to the array of characters
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
const Uint32* getData() const;
|
||||
const std::uint32_t* getData() const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Return an iterator to the beginning of the string
|
||||
@ -536,7 +536,7 @@ private:
|
||||
////////////////////////////////////////////////////////////
|
||||
// Member data
|
||||
////////////////////////////////////////////////////////////
|
||||
std::basic_string<Uint32> m_string; //!< Internal string of UTF-32 characters
|
||||
std::basic_string<std::uint32_t> m_string; //!< Internal string of UTF-32 characters
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
|
@ -70,7 +70,7 @@ public:
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename In>
|
||||
static In decode(In begin, In end, Uint32& output, Uint32 replacement = 0);
|
||||
static In decode(In begin, In end, std::uint32_t& output, std::uint32_t replacement = 0);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Encode a single UTF-8 character
|
||||
@ -86,7 +86,7 @@ public:
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename Out>
|
||||
static Out encode(Uint32 input, Out output, std::uint8_t replacement = 0);
|
||||
static Out encode(std::uint32_t input, Out output, std::uint8_t replacement = 0);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Advance to the next UTF-8 character
|
||||
@ -276,7 +276,7 @@ public:
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename In>
|
||||
static In decode(In begin, In end, Uint32& output, Uint32 replacement = 0);
|
||||
static In decode(In begin, In end, std::uint32_t& output, std::uint32_t replacement = 0);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Encode a single UTF-16 character
|
||||
@ -292,7 +292,7 @@ public:
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename Out>
|
||||
static Out encode(Uint32 input, Out output, std::uint16_t replacement = 0);
|
||||
static Out encode(std::uint32_t input, Out output, std::uint16_t replacement = 0);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Advance to the next UTF-16 character
|
||||
@ -483,7 +483,7 @@ public:
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename In>
|
||||
static In decode(In begin, In end, Uint32& output, Uint32 replacement = 0);
|
||||
static In decode(In begin, In end, std::uint32_t& output, std::uint32_t replacement = 0);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Encode a single UTF-32 character
|
||||
@ -500,7 +500,7 @@ public:
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename Out>
|
||||
static Out encode(Uint32 input, Out output, Uint32 replacement = 0);
|
||||
static Out encode(std::uint32_t input, Out output, std::uint32_t replacement = 0);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Advance to the next UTF-32 character
|
||||
@ -679,7 +679,7 @@ public:
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename In>
|
||||
static Uint32 decodeAnsi(In input, const std::locale& locale = std::locale());
|
||||
static std::uint32_t decodeAnsi(In input, const std::locale& locale = std::locale());
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Decode a single wide character to UTF-32
|
||||
@ -694,7 +694,7 @@ public:
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename In>
|
||||
static Uint32 decodeWide(In input);
|
||||
static std::uint32_t decodeWide(In input);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Encode a single UTF-32 character to ANSI
|
||||
@ -712,7 +712,7 @@ public:
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename Out>
|
||||
static Out encodeAnsi(Uint32 codepoint, Out output, char replacement = 0, const std::locale& locale = std::locale());
|
||||
static Out encodeAnsi(std::uint32_t codepoint, Out output, char replacement = 0, const std::locale& locale = std::locale());
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Encode a single UTF-32 character to wide
|
||||
@ -729,7 +729,7 @@ public:
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename Out>
|
||||
static Out encodeWide(Uint32 codepoint, Out output, wchar_t replacement = 0);
|
||||
static Out encodeWide(std::uint32_t codepoint, Out output, wchar_t replacement = 0);
|
||||
};
|
||||
|
||||
#include <SFML/System/Utf.inl>
|
||||
|
@ -45,7 +45,7 @@ OutputIt priv::copy(InputIt first, InputIt last, OutputIt d_first)
|
||||
}
|
||||
|
||||
template <typename In>
|
||||
In Utf<8>::decode(In begin, In end, Uint32& output, Uint32 replacement)
|
||||
In Utf<8>::decode(In begin, In end, std::uint32_t& output, std::uint32_t replacement)
|
||||
{
|
||||
// clang-format off
|
||||
// Some useful precomputed data
|
||||
@ -61,7 +61,7 @@ In Utf<8>::decode(In begin, In end, Uint32& output, Uint32 replacement)
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5
|
||||
};
|
||||
|
||||
static constexpr Uint32 offsets[6] =
|
||||
static constexpr std::uint32_t offsets[6] =
|
||||
{
|
||||
0x00000000, 0x00003080, 0x000E2080, 0x03C82080, 0xFA082080, 0x82082080
|
||||
};
|
||||
@ -100,7 +100,7 @@ In Utf<8>::decode(In begin, In end, Uint32& output, Uint32 replacement)
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename Out>
|
||||
Out Utf<8>::encode(Uint32 input, Out output, std::uint8_t replacement)
|
||||
Out Utf<8>::encode(std::uint32_t input, Out output, std::uint8_t replacement)
|
||||
{
|
||||
// Some useful precomputed data
|
||||
static constexpr std::uint8_t firstBytes[7] = {0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC};
|
||||
@ -151,7 +151,7 @@ Out Utf<8>::encode(Uint32 input, Out output, std::uint8_t replacement)
|
||||
template <typename In>
|
||||
In Utf<8>::next(In begin, In end)
|
||||
{
|
||||
Uint32 codepoint;
|
||||
std::uint32_t codepoint;
|
||||
return decode(begin, end, codepoint);
|
||||
}
|
||||
|
||||
@ -177,8 +177,8 @@ Out Utf<8>::fromAnsi(In begin, In end, Out output, const std::locale& locale)
|
||||
{
|
||||
while (begin < end)
|
||||
{
|
||||
Uint32 codepoint = Utf<32>::decodeAnsi(*begin++, locale);
|
||||
output = encode(codepoint, output);
|
||||
std::uint32_t codepoint = Utf<32>::decodeAnsi(*begin++, locale);
|
||||
output = encode(codepoint, output);
|
||||
}
|
||||
|
||||
return output;
|
||||
@ -191,8 +191,8 @@ Out Utf<8>::fromWide(In begin, In end, Out output)
|
||||
{
|
||||
while (begin < end)
|
||||
{
|
||||
Uint32 codepoint = Utf<32>::decodeWide(*begin++);
|
||||
output = encode(codepoint, output);
|
||||
std::uint32_t codepoint = Utf<32>::decodeWide(*begin++);
|
||||
output = encode(codepoint, output);
|
||||
}
|
||||
|
||||
return output;
|
||||
@ -218,7 +218,7 @@ Out Utf<8>::toAnsi(In begin, In end, Out output, char replacement, const std::lo
|
||||
{
|
||||
while (begin < end)
|
||||
{
|
||||
Uint32 codepoint;
|
||||
std::uint32_t codepoint;
|
||||
begin = decode(begin, end, codepoint);
|
||||
output = Utf<32>::encodeAnsi(codepoint, output, replacement, locale);
|
||||
}
|
||||
@ -233,7 +233,7 @@ Out Utf<8>::toWide(In begin, In end, Out output, wchar_t replacement)
|
||||
{
|
||||
while (begin < end)
|
||||
{
|
||||
Uint32 codepoint;
|
||||
std::uint32_t codepoint;
|
||||
begin = decode(begin, end, codepoint);
|
||||
output = Utf<32>::encodeWide(codepoint, output, replacement);
|
||||
}
|
||||
@ -250,7 +250,7 @@ Out Utf<8>::toLatin1(In begin, In end, Out output, char replacement)
|
||||
// and can thus be treated as (a sub-range of) UTF-32
|
||||
while (begin < end)
|
||||
{
|
||||
Uint32 codepoint;
|
||||
std::uint32_t codepoint;
|
||||
begin = decode(begin, end, codepoint);
|
||||
*output++ = codepoint < 256 ? static_cast<char>(codepoint) : replacement;
|
||||
}
|
||||
@ -273,7 +273,7 @@ Out Utf<8>::toUtf16(In begin, In end, Out output)
|
||||
{
|
||||
while (begin < end)
|
||||
{
|
||||
Uint32 codepoint;
|
||||
std::uint32_t codepoint;
|
||||
begin = decode(begin, end, codepoint);
|
||||
output = Utf<16>::encode(codepoint, output);
|
||||
}
|
||||
@ -288,7 +288,7 @@ Out Utf<8>::toUtf32(In begin, In end, Out output)
|
||||
{
|
||||
while (begin < end)
|
||||
{
|
||||
Uint32 codepoint;
|
||||
std::uint32_t codepoint;
|
||||
begin = decode(begin, end, codepoint);
|
||||
*output++ = codepoint;
|
||||
}
|
||||
@ -299,7 +299,7 @@ Out Utf<8>::toUtf32(In begin, In end, Out output)
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename In>
|
||||
In Utf<16>::decode(In begin, In end, Uint32& output, Uint32 replacement)
|
||||
In Utf<16>::decode(In begin, In end, std::uint32_t& output, std::uint32_t replacement)
|
||||
{
|
||||
std::uint16_t first = *begin++;
|
||||
|
||||
@ -308,7 +308,7 @@ In Utf<16>::decode(In begin, In end, Uint32& output, Uint32 replacement)
|
||||
{
|
||||
if (begin < end)
|
||||
{
|
||||
Uint32 second = *begin++;
|
||||
std::uint32_t second = *begin++;
|
||||
if ((second >= 0xDC00) && (second <= 0xDFFF))
|
||||
{
|
||||
// The second element is valid: convert the two elements to a UTF-32 character
|
||||
@ -339,7 +339,7 @@ In Utf<16>::decode(In begin, In end, Uint32& output, Uint32 replacement)
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename Out>
|
||||
Out Utf<16>::encode(Uint32 input, Out output, std::uint16_t replacement)
|
||||
Out Utf<16>::encode(std::uint32_t input, Out output, std::uint16_t replacement)
|
||||
{
|
||||
if (input <= 0xFFFF)
|
||||
{
|
||||
@ -378,7 +378,7 @@ Out Utf<16>::encode(Uint32 input, Out output, std::uint16_t replacement)
|
||||
template <typename In>
|
||||
In Utf<16>::next(In begin, In end)
|
||||
{
|
||||
Uint32 codepoint;
|
||||
std::uint32_t codepoint;
|
||||
return decode(begin, end, codepoint);
|
||||
}
|
||||
|
||||
@ -404,8 +404,8 @@ Out Utf<16>::fromAnsi(In begin, In end, Out output, const std::locale& locale)
|
||||
{
|
||||
while (begin < end)
|
||||
{
|
||||
Uint32 codepoint = Utf<32>::decodeAnsi(*begin++, locale);
|
||||
output = encode(codepoint, output);
|
||||
std::uint32_t codepoint = Utf<32>::decodeAnsi(*begin++, locale);
|
||||
output = encode(codepoint, output);
|
||||
}
|
||||
|
||||
return output;
|
||||
@ -418,8 +418,8 @@ Out Utf<16>::fromWide(In begin, In end, Out output)
|
||||
{
|
||||
while (begin < end)
|
||||
{
|
||||
Uint32 codepoint = Utf<32>::decodeWide(*begin++);
|
||||
output = encode(codepoint, output);
|
||||
std::uint32_t codepoint = Utf<32>::decodeWide(*begin++);
|
||||
output = encode(codepoint, output);
|
||||
}
|
||||
|
||||
return output;
|
||||
@ -442,7 +442,7 @@ Out Utf<16>::toAnsi(In begin, In end, Out output, char replacement, const std::l
|
||||
{
|
||||
while (begin < end)
|
||||
{
|
||||
Uint32 codepoint;
|
||||
std::uint32_t codepoint;
|
||||
begin = decode(begin, end, codepoint);
|
||||
output = Utf<32>::encodeAnsi(codepoint, output, replacement, locale);
|
||||
}
|
||||
@ -457,7 +457,7 @@ Out Utf<16>::toWide(In begin, In end, Out output, wchar_t replacement)
|
||||
{
|
||||
while (begin < end)
|
||||
{
|
||||
Uint32 codepoint;
|
||||
std::uint32_t codepoint;
|
||||
begin = decode(begin, end, codepoint);
|
||||
output = Utf<32>::encodeWide(codepoint, output, replacement);
|
||||
}
|
||||
@ -488,7 +488,7 @@ Out Utf<16>::toUtf8(In begin, In end, Out output)
|
||||
{
|
||||
while (begin < end)
|
||||
{
|
||||
Uint32 codepoint;
|
||||
std::uint32_t codepoint;
|
||||
begin = decode(begin, end, codepoint);
|
||||
output = Utf<8>::encode(codepoint, output);
|
||||
}
|
||||
@ -511,7 +511,7 @@ Out Utf<16>::toUtf32(In begin, In end, Out output)
|
||||
{
|
||||
while (begin < end)
|
||||
{
|
||||
Uint32 codepoint;
|
||||
std::uint32_t codepoint;
|
||||
begin = decode(begin, end, codepoint);
|
||||
*output++ = codepoint;
|
||||
}
|
||||
@ -522,7 +522,7 @@ Out Utf<16>::toUtf32(In begin, In end, Out output)
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename In>
|
||||
In Utf<32>::decode(In begin, In /*end*/, Uint32& output, Uint32 /*replacement*/)
|
||||
In Utf<32>::decode(In begin, In /*end*/, std::uint32_t& output, std::uint32_t /*replacement*/)
|
||||
{
|
||||
output = *begin++;
|
||||
return begin;
|
||||
@ -531,7 +531,7 @@ In Utf<32>::decode(In begin, In /*end*/, Uint32& output, Uint32 /*replacement*/)
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename Out>
|
||||
Out Utf<32>::encode(Uint32 input, Out output, Uint32 /*replacement*/)
|
||||
Out Utf<32>::encode(std::uint32_t input, Out output, std::uint32_t /*replacement*/)
|
||||
{
|
||||
*output++ = input;
|
||||
return output;
|
||||
@ -655,7 +655,7 @@ Out Utf<32>::toUtf32(In begin, In end, Out output)
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename In>
|
||||
Uint32 Utf<32>::decodeAnsi(In input, [[maybe_unused]] const std::locale& locale)
|
||||
std::uint32_t Utf<32>::decodeAnsi(In input, [[maybe_unused]] const std::locale& locale)
|
||||
{
|
||||
// On Windows, GCC's standard library (glibc++) has almost
|
||||
// no support for Unicode stuff. As a consequence, in this
|
||||
@ -668,7 +668,7 @@ Uint32 Utf<32>::decodeAnsi(In input, [[maybe_unused]] const std::locale& locale)
|
||||
|
||||
wchar_t character = 0;
|
||||
mbtowc(&character, &input, 1);
|
||||
return static_cast<Uint32>(character);
|
||||
return static_cast<std::uint32_t>(character);
|
||||
|
||||
#else
|
||||
|
||||
@ -676,7 +676,7 @@ Uint32 Utf<32>::decodeAnsi(In input, [[maybe_unused]] const std::locale& locale)
|
||||
const auto& facet = std::use_facet<std::ctype<wchar_t>>(locale);
|
||||
|
||||
// Use the facet to convert each character of the input string
|
||||
return static_cast<Uint32>(facet.widen(input));
|
||||
return static_cast<std::uint32_t>(facet.widen(input));
|
||||
|
||||
#endif
|
||||
}
|
||||
@ -684,7 +684,7 @@ Uint32 Utf<32>::decodeAnsi(In input, [[maybe_unused]] const std::locale& locale)
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename In>
|
||||
Uint32 Utf<32>::decodeWide(In input)
|
||||
std::uint32_t Utf<32>::decodeWide(In input)
|
||||
{
|
||||
// The encoding of wide characters is not well defined and is left to the system;
|
||||
// however we can safely assume that it is UCS-2 on Windows and
|
||||
@ -692,13 +692,13 @@ Uint32 Utf<32>::decodeWide(In input)
|
||||
// In both cases, a simple copy is enough (UCS-2 is a subset of UCS-4,
|
||||
// and UCS-4 *is* UTF-32).
|
||||
|
||||
return static_cast<Uint32>(input);
|
||||
return static_cast<std::uint32_t>(input);
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename Out>
|
||||
Out Utf<32>::encodeAnsi(Uint32 codepoint, Out output, char replacement, [[maybe_unused]] const std::locale& locale)
|
||||
Out Utf<32>::encodeAnsi(std::uint32_t codepoint, Out output, char replacement, [[maybe_unused]] const std::locale& locale)
|
||||
{
|
||||
// On Windows, gcc's standard library (glibc++) has almost
|
||||
// no support for Unicode stuff. As a consequence, in this
|
||||
@ -733,7 +733,7 @@ Out Utf<32>::encodeAnsi(Uint32 codepoint, Out output, char replacement, [[maybe_
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename Out>
|
||||
Out Utf<32>::encodeWide(Uint32 codepoint, Out output, wchar_t replacement)
|
||||
Out Utf<32>::encodeWide(std::uint32_t codepoint, Out output, wchar_t replacement)
|
||||
{
|
||||
// The encoding of wide characters is not well defined and is left to the system;
|
||||
// however we can safely assume that it is UCS-2 on Windows and
|
||||
|
@ -80,13 +80,13 @@ struct ContextSettings
|
||||
////////////////////////////////////////////////////////////
|
||||
// Member data
|
||||
////////////////////////////////////////////////////////////
|
||||
unsigned int depthBits; //!< Bits of the depth buffer
|
||||
unsigned int stencilBits; //!< Bits of the stencil buffer
|
||||
unsigned int antialiasingLevel; //!< Level of antialiasing
|
||||
unsigned int majorVersion; //!< Major number of the context version to create
|
||||
unsigned int minorVersion; //!< Minor number of the context version to create
|
||||
Uint32 attributeFlags; //!< The attribute flags to create the context with
|
||||
bool sRgbCapable; //!< Whether the context framebuffer is sRGB capable
|
||||
unsigned int depthBits; //!< Bits of the depth buffer
|
||||
unsigned int stencilBits; //!< Bits of the stencil buffer
|
||||
unsigned int antialiasingLevel; //!< Level of antialiasing
|
||||
unsigned int majorVersion; //!< Major number of the context version to create
|
||||
unsigned int minorVersion; //!< Minor number of the context version to create
|
||||
std::uint32_t attributeFlags; //!< The attribute flags to create the context with
|
||||
bool sRgbCapable; //!< Whether the context framebuffer is sRGB capable
|
||||
};
|
||||
|
||||
} // namespace sf
|
||||
|
@ -74,7 +74,7 @@ public:
|
||||
////////////////////////////////////////////////////////////
|
||||
struct TextEvent
|
||||
{
|
||||
Uint32 unicode; //!< UTF-32 Unicode value of the character
|
||||
std::uint32_t unicode; //!< UTF-32 Unicode value of the character
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
|
@ -83,7 +83,7 @@ public:
|
||||
////////////////////////////////////////////////////////////
|
||||
Window(VideoMode mode,
|
||||
const String& title,
|
||||
Uint32 style = Style::Default,
|
||||
std::uint32_t style = Style::Default,
|
||||
const ContextSettings& settings = ContextSettings());
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
@ -122,7 +122,7 @@ public:
|
||||
/// \param style %Window style, a bitwise OR combination of sf::Style enumerators
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void create(VideoMode mode, const String& title, Uint32 style = Style::Default) override;
|
||||
void create(VideoMode mode, const String& title, std::uint32_t style = Style::Default) override;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Create (or recreate) the window
|
||||
@ -141,7 +141,7 @@ public:
|
||||
/// \param settings Additional settings for the underlying OpenGL context
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
virtual void create(VideoMode mode, const String& title, Uint32 style, const ContextSettings& settings);
|
||||
virtual void create(VideoMode mode, const String& title, std::uint32_t style, const ContextSettings& settings);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Create (or recreate) the window from an existing control
|
||||
|
@ -81,7 +81,7 @@ public:
|
||||
/// \param style %Window style, a bitwise OR combination of sf::Style enumerators
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
WindowBase(VideoMode mode, const String& title, Uint32 style = Style::Default);
|
||||
WindowBase(VideoMode mode, const String& title, std::uint32_t style = Style::Default);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Construct the window from an existing control
|
||||
@ -123,7 +123,7 @@ public:
|
||||
/// \param style %Window style, a bitwise OR combination of sf::Style enumerators
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
virtual void create(VideoMode mode, const String& title, Uint32 style = Style::Default);
|
||||
virtual void create(VideoMode mode, const String& title, std::uint32_t style = Style::Default);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Create (or recreate) the window from an existing control
|
||||
|
@ -68,24 +68,24 @@ bool decode(sf::InputStream& stream, std::uint16_t& value)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool decode24bit(sf::InputStream& stream, sf::Uint32& value)
|
||||
bool decode24bit(sf::InputStream& stream, std::uint32_t& value)
|
||||
{
|
||||
unsigned char bytes[3];
|
||||
if (static_cast<std::size_t>(stream.read(bytes, static_cast<sf::Int64>(sizeof(bytes)))) != sizeof(bytes))
|
||||
return false;
|
||||
|
||||
value = static_cast<sf::Uint32>(bytes[0] | (bytes[1] << 8) | (bytes[2] << 16));
|
||||
value = static_cast<std::uint32_t>(bytes[0] | (bytes[1] << 8) | (bytes[2] << 16));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool decode(sf::InputStream& stream, sf::Uint32& value)
|
||||
bool decode(sf::InputStream& stream, std::uint32_t& value)
|
||||
{
|
||||
unsigned char bytes[sizeof(value)];
|
||||
if (static_cast<std::size_t>(stream.read(bytes, static_cast<sf::Int64>(sizeof(bytes)))) != sizeof(bytes))
|
||||
return false;
|
||||
|
||||
value = static_cast<sf::Uint32>(bytes[0] | (bytes[1] << 8) | (bytes[2] << 16) | (bytes[3] << 24));
|
||||
value = static_cast<std::uint32_t>(bytes[0] | (bytes[1] << 8) | (bytes[2] << 16) | (bytes[3] << 24));
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -184,7 +184,7 @@ Uint64 SoundFileReaderWav::read(std::int16_t* samples, Uint64 maxCount)
|
||||
|
||||
case 3:
|
||||
{
|
||||
Uint32 sample = 0;
|
||||
std::uint32_t sample = 0;
|
||||
if (decode24bit(*m_stream, sample))
|
||||
*samples++ = static_cast<std::int16_t>(sample >> 8);
|
||||
else
|
||||
@ -194,7 +194,7 @@ Uint64 SoundFileReaderWav::read(std::int16_t* samples, Uint64 maxCount)
|
||||
|
||||
case 4:
|
||||
{
|
||||
Uint32 sample = 0;
|
||||
std::uint32_t sample = 0;
|
||||
if (decode(*m_stream, sample))
|
||||
*samples++ = static_cast<std::int16_t>(sample >> 16);
|
||||
else
|
||||
@ -236,7 +236,7 @@ bool SoundFileReaderWav::parseHeader(Info& info)
|
||||
if (static_cast<std::size_t>(m_stream->read(subChunkId, static_cast<Int64>(sizeof(subChunkId)))) !=
|
||||
sizeof(subChunkId))
|
||||
return false;
|
||||
Uint32 subChunkSize = 0;
|
||||
std::uint32_t subChunkSize = 0;
|
||||
if (!decode(*m_stream, subChunkSize))
|
||||
return false;
|
||||
Int64 subChunkStart = m_stream->tell();
|
||||
@ -262,13 +262,13 @@ bool SoundFileReaderWav::parseHeader(Info& info)
|
||||
info.channelCount = channelCount;
|
||||
|
||||
// Sample rate
|
||||
Uint32 sampleRate = 0;
|
||||
std::uint32_t sampleRate = 0;
|
||||
if (!decode(*m_stream, sampleRate))
|
||||
return false;
|
||||
info.sampleRate = sampleRate;
|
||||
|
||||
// Byte rate
|
||||
Uint32 byteRate = 0;
|
||||
std::uint32_t byteRate = 0;
|
||||
if (!decode(*m_stream, byteRate))
|
||||
return false;
|
||||
|
||||
@ -302,7 +302,7 @@ bool SoundFileReaderWav::parseHeader(Info& info)
|
||||
return false;
|
||||
|
||||
// Channel mask
|
||||
Uint32 channelMask = 0;
|
||||
std::uint32_t channelMask = 0;
|
||||
if (!decode(*m_stream, channelMask))
|
||||
return false;
|
||||
|
||||
|
@ -50,7 +50,7 @@ void encode(std::ostream& stream, std::uint16_t value)
|
||||
stream.write(reinterpret_cast<const char*>(bytes), sizeof(bytes));
|
||||
}
|
||||
|
||||
void encode(std::ostream& stream, sf::Uint32 value)
|
||||
void encode(std::ostream& stream, std::uint32_t value)
|
||||
{
|
||||
unsigned char bytes[] = {
|
||||
static_cast<unsigned char>(value & 0x000000FF),
|
||||
@ -128,14 +128,14 @@ bool SoundFileWriterWav::writeHeader(unsigned int sampleRate, unsigned int chann
|
||||
m_file.write(mainChunkId, sizeof(mainChunkId));
|
||||
|
||||
// Write the main chunk header
|
||||
encode(m_file, static_cast<Uint32>(0)); // 0 is a placeholder, will be written later
|
||||
encode(m_file, static_cast<std::uint32_t>(0)); // 0 is a placeholder, will be written later
|
||||
char mainChunkFormat[4] = {'W', 'A', 'V', 'E'};
|
||||
m_file.write(mainChunkFormat, sizeof(mainChunkFormat));
|
||||
|
||||
// Write the sub-chunk 1 ("format") id and size
|
||||
char fmtChunkId[4] = {'f', 'm', 't', ' '};
|
||||
m_file.write(fmtChunkId, sizeof(fmtChunkId));
|
||||
Uint32 fmtChunkSize = 16;
|
||||
std::uint32_t fmtChunkSize = 16;
|
||||
encode(m_file, fmtChunkSize);
|
||||
|
||||
// Write the format (PCM)
|
||||
@ -145,7 +145,7 @@ bool SoundFileWriterWav::writeHeader(unsigned int sampleRate, unsigned int chann
|
||||
// Write the sound attributes
|
||||
encode(m_file, static_cast<std::uint16_t>(channelCount));
|
||||
encode(m_file, sampleRate);
|
||||
Uint32 byteRate = sampleRate * channelCount * 2;
|
||||
std::uint32_t byteRate = sampleRate * channelCount * 2;
|
||||
encode(m_file, byteRate);
|
||||
auto blockAlign = static_cast<std::uint16_t>(channelCount * 2);
|
||||
encode(m_file, blockAlign);
|
||||
@ -155,7 +155,7 @@ bool SoundFileWriterWav::writeHeader(unsigned int sampleRate, unsigned int chann
|
||||
// Write the sub-chunk 2 ("data") id and size
|
||||
char dataChunkId[4] = {'d', 'a', 't', 'a'};
|
||||
m_file.write(dataChunkId, sizeof(dataChunkId));
|
||||
Uint32 dataChunkSize = 0; // placeholder, will be written later
|
||||
std::uint32_t dataChunkSize = 0; // placeholder, will be written later
|
||||
encode(m_file, dataChunkSize);
|
||||
|
||||
return true;
|
||||
@ -171,7 +171,7 @@ void SoundFileWriterWav::close()
|
||||
m_file.flush();
|
||||
|
||||
// Update the main chunk size and data sub-chunk size
|
||||
Uint32 fileSize = static_cast<Uint32>(m_file.tellp());
|
||||
std::uint32_t fileSize = static_cast<std::uint32_t>(m_file.tellp());
|
||||
m_file.seekp(4);
|
||||
encode(m_file, fileSize - 8); // 8 bytes RIFF header
|
||||
m_file.seekp(40);
|
||||
|
@ -425,7 +425,7 @@ bool SoundStream::fillAndPushBuffer(unsigned int bufferNum, bool immediateLoop)
|
||||
|
||||
// Acquire audio data, also address EOF and error cases if they occur
|
||||
Chunk data = {nullptr, 0};
|
||||
for (Uint32 retryCount = 0; !onGetData(data) && (retryCount < BufferRetries); ++retryCount)
|
||||
for (std::uint32_t retryCount = 0; !onGetData(data) && (retryCount < BufferRetries); ++retryCount)
|
||||
{
|
||||
// Check if the stream must loop or stop
|
||||
if (!m_loop)
|
||||
|
@ -79,9 +79,9 @@ inline T reinterpret(const U& input)
|
||||
}
|
||||
|
||||
// Combine outline thickness, boldness and font glyph index into a single 64-bit key
|
||||
sf::Uint64 combine(float outlineThickness, bool bold, sf::Uint32 index)
|
||||
sf::Uint64 combine(float outlineThickness, bool bold, std::uint32_t index)
|
||||
{
|
||||
return (static_cast<sf::Uint64>(reinterpret<sf::Uint32>(outlineThickness)) << 32) |
|
||||
return (static_cast<sf::Uint64>(reinterpret<std::uint32_t>(outlineThickness)) << 32) |
|
||||
(static_cast<sf::Uint64>(bold) << 31) | index;
|
||||
}
|
||||
} // namespace
|
||||
@ -350,7 +350,7 @@ const Font::Info& Font::getInfo() const
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
const Glyph& Font::getGlyph(Uint32 codePoint, unsigned int characterSize, bool bold, float outlineThickness) const
|
||||
const Glyph& Font::getGlyph(std::uint32_t codePoint, unsigned int characterSize, bool bold, float outlineThickness) const
|
||||
{
|
||||
// Get the page corresponding to the character size
|
||||
GlyphTable& glyphs = loadPage(characterSize).glyphs;
|
||||
@ -376,14 +376,14 @@ const Glyph& Font::getGlyph(Uint32 codePoint, unsigned int characterSize, bool b
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
bool Font::hasGlyph(Uint32 codePoint) const
|
||||
bool Font::hasGlyph(std::uint32_t codePoint) const
|
||||
{
|
||||
return FT_Get_Char_Index(m_fontHandles ? m_fontHandles->face.get() : nullptr, codePoint) != 0;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
float Font::getKerning(Uint32 first, Uint32 second, unsigned int characterSize, bool bold) const
|
||||
float Font::getKerning(std::uint32_t first, std::uint32_t second, unsigned int characterSize, bool bold) const
|
||||
{
|
||||
// Special case where first or second is 0 (null character)
|
||||
if (first == 0 || second == 0)
|
||||
@ -548,7 +548,7 @@ Font::Page& Font::loadPage(unsigned int characterSize) const
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
Glyph Font::loadGlyph(Uint32 codePoint, unsigned int characterSize, bool bold, float outlineThickness) const
|
||||
Glyph Font::loadGlyph(std::uint32_t codePoint, unsigned int characterSize, bool bold, float outlineThickness) const
|
||||
{
|
||||
// The glyph to return
|
||||
Glyph glyph;
|
||||
|
@ -79,7 +79,7 @@ bool isActive(sf::Uint64 id)
|
||||
}
|
||||
|
||||
// Convert an sf::BlendMode::Factor constant to the corresponding OpenGL constant.
|
||||
sf::Uint32 factorToGlConstant(sf::BlendMode::Factor blendFactor)
|
||||
std::uint32_t factorToGlConstant(sf::BlendMode::Factor blendFactor)
|
||||
{
|
||||
// clang-format off
|
||||
switch (blendFactor)
|
||||
@ -104,7 +104,7 @@ sf::Uint32 factorToGlConstant(sf::BlendMode::Factor blendFactor)
|
||||
|
||||
|
||||
// Convert an sf::BlendMode::BlendEquation constant to the corresponding OpenGL constant.
|
||||
sf::Uint32 equationToGlConstant(sf::BlendMode::Equation blendEquation)
|
||||
std::uint32_t equationToGlConstant(sf::BlendMode::Equation blendEquation)
|
||||
{
|
||||
switch (blendEquation)
|
||||
{
|
||||
|
@ -42,7 +42,7 @@ RenderWindow::RenderWindow() : m_defaultFrameBuffer(0)
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
RenderWindow::RenderWindow(VideoMode mode, const String& title, Uint32 style, const ContextSettings& settings) :
|
||||
RenderWindow::RenderWindow(VideoMode mode, const String& title, std::uint32_t style, const ContextSettings& settings) :
|
||||
m_defaultFrameBuffer(0)
|
||||
{
|
||||
// Don't call the base class constructor because it contains virtual function calls
|
||||
|
@ -205,7 +205,7 @@ void Text::setLineSpacing(float spacingFactor)
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
void Text::setStyle(Uint32 style)
|
||||
void Text::setStyle(std::uint32_t style)
|
||||
{
|
||||
if (m_style != style)
|
||||
{
|
||||
@ -298,7 +298,7 @@ float Text::getLineSpacing() const
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
Uint32 Text::getStyle() const
|
||||
std::uint32_t Text::getStyle() const
|
||||
{
|
||||
return m_style;
|
||||
}
|
||||
@ -344,11 +344,11 @@ Vector2f Text::findCharacterPos(std::size_t index) const
|
||||
float lineSpacing = m_font->getLineSpacing(m_characterSize) * m_lineSpacingFactor;
|
||||
|
||||
// Compute the position
|
||||
Vector2f position;
|
||||
Uint32 prevChar = 0;
|
||||
Vector2f position;
|
||||
std::uint32_t prevChar = 0;
|
||||
for (std::size_t i = 0; i < index; ++i)
|
||||
{
|
||||
Uint32 curChar = m_string[i];
|
||||
std::uint32_t curChar = m_string[i];
|
||||
|
||||
// Apply the kerning offset
|
||||
position.x += m_font->getKerning(prevChar, curChar, m_characterSize, isBold);
|
||||
@ -465,14 +465,14 @@ void Text::ensureGeometryUpdate() const
|
||||
auto y = static_cast<float>(m_characterSize);
|
||||
|
||||
// Create one quad for each character
|
||||
auto minX = static_cast<float>(m_characterSize);
|
||||
auto minY = static_cast<float>(m_characterSize);
|
||||
float maxX = 0.f;
|
||||
float maxY = 0.f;
|
||||
Uint32 prevChar = 0;
|
||||
auto minX = static_cast<float>(m_characterSize);
|
||||
auto minY = static_cast<float>(m_characterSize);
|
||||
float maxX = 0.f;
|
||||
float maxY = 0.f;
|
||||
std::uint32_t prevChar = 0;
|
||||
for (std::size_t i = 0; i < m_string.getSize(); ++i)
|
||||
{
|
||||
Uint32 curChar = m_string[i];
|
||||
std::uint32_t curChar = m_string[i];
|
||||
|
||||
// Skip the \r char to avoid weird graphical issues
|
||||
if (curChar == U'\r')
|
||||
|
@ -62,7 +62,7 @@ std::optional<IpAddress> IpAddress::resolve(std::string_view address)
|
||||
return Any;
|
||||
|
||||
// Try to convert the address as a byte representation ("xxx.xxx.xxx.xxx")
|
||||
if (const Uint32 ip = inet_addr(address.data()); ip != INADDR_NONE)
|
||||
if (const std::uint32_t ip = inet_addr(address.data()); ip != INADDR_NONE)
|
||||
return IpAddress(ntohl(ip));
|
||||
|
||||
// Not a valid address, try to convert it as a host name
|
||||
@ -75,7 +75,7 @@ std::optional<IpAddress> IpAddress::resolve(std::string_view address)
|
||||
sockaddr_in sin;
|
||||
std::memcpy(&sin, result->ai_addr, sizeof(*result->ai_addr));
|
||||
|
||||
const Uint32 ip = sin.sin_addr.s_addr;
|
||||
const std::uint32_t ip = sin.sin_addr.s_addr;
|
||||
freeaddrinfo(result);
|
||||
|
||||
return IpAddress(ntohl(ip));
|
||||
@ -93,7 +93,7 @@ m_address(htonl(static_cast<std::uint32_t>((byte0 << 24) | (byte1 << 16) | (byte
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
IpAddress::IpAddress(Uint32 address) : m_address(htonl(address))
|
||||
IpAddress::IpAddress(std::uint32_t address) : m_address(htonl(address))
|
||||
{
|
||||
}
|
||||
|
||||
@ -109,7 +109,7 @@ std::string IpAddress::toString() const
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
Uint32 IpAddress::toInteger() const
|
||||
std::uint32_t IpAddress::toInteger() const
|
||||
{
|
||||
return ntohl(m_address);
|
||||
}
|
||||
|
@ -188,7 +188,7 @@ Packet& Packet::operator>>(std::int32_t& data)
|
||||
if (checkSize(sizeof(data)))
|
||||
{
|
||||
std::memcpy(&data, &m_data[m_readPos], sizeof(data));
|
||||
data = static_cast<std::int32_t>(ntohl(static_cast<uint32_t>(data)));
|
||||
data = static_cast<std::int32_t>(ntohl(static_cast<std::uint32_t>(data)));
|
||||
m_readPos += sizeof(data);
|
||||
}
|
||||
|
||||
@ -197,7 +197,7 @@ Packet& Packet::operator>>(std::int32_t& data)
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
Packet& Packet::operator>>(Uint32& data)
|
||||
Packet& Packet::operator>>(std::uint32_t& data)
|
||||
{
|
||||
if (checkSize(sizeof(data)))
|
||||
{
|
||||
@ -284,7 +284,7 @@ Packet& Packet::operator>>(double& data)
|
||||
Packet& Packet::operator>>(char* data)
|
||||
{
|
||||
// First extract string length
|
||||
Uint32 length = 0;
|
||||
std::uint32_t length = 0;
|
||||
*this >> length;
|
||||
|
||||
if ((length > 0) && checkSize(length))
|
||||
@ -305,7 +305,7 @@ Packet& Packet::operator>>(char* data)
|
||||
Packet& Packet::operator>>(std::string& data)
|
||||
{
|
||||
// First extract string length
|
||||
Uint32 length = 0;
|
||||
std::uint32_t length = 0;
|
||||
*this >> length;
|
||||
|
||||
data.clear();
|
||||
@ -326,15 +326,15 @@ Packet& Packet::operator>>(std::string& data)
|
||||
Packet& Packet::operator>>(wchar_t* data)
|
||||
{
|
||||
// First extract string length
|
||||
Uint32 length = 0;
|
||||
std::uint32_t length = 0;
|
||||
*this >> length;
|
||||
|
||||
if ((length > 0) && checkSize(length * sizeof(Uint32)))
|
||||
if ((length > 0) && checkSize(length * sizeof(std::uint32_t)))
|
||||
{
|
||||
// Then extract characters
|
||||
for (Uint32 i = 0; i < length; ++i)
|
||||
for (std::uint32_t i = 0; i < length; ++i)
|
||||
{
|
||||
Uint32 character = 0;
|
||||
std::uint32_t character = 0;
|
||||
*this >> character;
|
||||
data[i] = static_cast<wchar_t>(character);
|
||||
}
|
||||
@ -349,16 +349,16 @@ Packet& Packet::operator>>(wchar_t* data)
|
||||
Packet& Packet::operator>>(std::wstring& data)
|
||||
{
|
||||
// First extract string length
|
||||
Uint32 length = 0;
|
||||
std::uint32_t length = 0;
|
||||
*this >> length;
|
||||
|
||||
data.clear();
|
||||
if ((length > 0) && checkSize(length * sizeof(Uint32)))
|
||||
if ((length > 0) && checkSize(length * sizeof(std::uint32_t)))
|
||||
{
|
||||
// Then extract characters
|
||||
for (Uint32 i = 0; i < length; ++i)
|
||||
for (std::uint32_t i = 0; i < length; ++i)
|
||||
{
|
||||
Uint32 character = 0;
|
||||
std::uint32_t character = 0;
|
||||
*this >> character;
|
||||
data += static_cast<wchar_t>(character);
|
||||
}
|
||||
@ -372,16 +372,16 @@ Packet& Packet::operator>>(std::wstring& data)
|
||||
Packet& Packet::operator>>(String& data)
|
||||
{
|
||||
// First extract the string length
|
||||
Uint32 length = 0;
|
||||
std::uint32_t length = 0;
|
||||
*this >> length;
|
||||
|
||||
data.clear();
|
||||
if ((length > 0) && checkSize(length * sizeof(Uint32)))
|
||||
if ((length > 0) && checkSize(length * sizeof(std::uint32_t)))
|
||||
{
|
||||
// Then extract characters
|
||||
for (Uint32 i = 0; i < length; ++i)
|
||||
for (std::uint32_t i = 0; i < length; ++i)
|
||||
{
|
||||
Uint32 character = 0;
|
||||
std::uint32_t character = 0;
|
||||
*this >> character;
|
||||
data += character;
|
||||
}
|
||||
@ -436,16 +436,16 @@ Packet& Packet::operator<<(std::uint16_t data)
|
||||
////////////////////////////////////////////////////////////
|
||||
Packet& Packet::operator<<(std::int32_t data)
|
||||
{
|
||||
std::int32_t toWrite = static_cast<std::int32_t>(htonl(static_cast<uint32_t>(data)));
|
||||
std::int32_t toWrite = static_cast<std::int32_t>(htonl(static_cast<std::uint32_t>(data)));
|
||||
append(&toWrite, sizeof(toWrite));
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
Packet& Packet::operator<<(Uint32 data)
|
||||
Packet& Packet::operator<<(std::uint32_t data)
|
||||
{
|
||||
Uint32 toWrite = htonl(data);
|
||||
std::uint32_t toWrite = htonl(data);
|
||||
append(&toWrite, sizeof(toWrite));
|
||||
return *this;
|
||||
}
|
||||
@ -511,7 +511,7 @@ Packet& Packet::operator<<(double data)
|
||||
Packet& Packet::operator<<(const char* data)
|
||||
{
|
||||
// First insert string length
|
||||
auto length = static_cast<Uint32>(std::strlen(data));
|
||||
auto length = static_cast<std::uint32_t>(std::strlen(data));
|
||||
*this << length;
|
||||
|
||||
// Then insert characters
|
||||
@ -525,7 +525,7 @@ Packet& Packet::operator<<(const char* data)
|
||||
Packet& Packet::operator<<(const std::string& data)
|
||||
{
|
||||
// First insert string length
|
||||
auto length = static_cast<Uint32>(data.size());
|
||||
auto length = static_cast<std::uint32_t>(data.size());
|
||||
*this << length;
|
||||
|
||||
// Then insert characters
|
||||
@ -540,12 +540,12 @@ Packet& Packet::operator<<(const std::string& data)
|
||||
Packet& Packet::operator<<(const wchar_t* data)
|
||||
{
|
||||
// First insert string length
|
||||
auto length = static_cast<Uint32>(std::wcslen(data));
|
||||
auto length = static_cast<std::uint32_t>(std::wcslen(data));
|
||||
*this << length;
|
||||
|
||||
// Then insert characters
|
||||
for (const wchar_t* c = data; *c != L'\0'; ++c)
|
||||
*this << static_cast<Uint32>(*c);
|
||||
*this << static_cast<std::uint32_t>(*c);
|
||||
|
||||
return *this;
|
||||
}
|
||||
@ -555,14 +555,14 @@ Packet& Packet::operator<<(const wchar_t* data)
|
||||
Packet& Packet::operator<<(const std::wstring& data)
|
||||
{
|
||||
// First insert string length
|
||||
auto length = static_cast<Uint32>(data.size());
|
||||
auto length = static_cast<std::uint32_t>(data.size());
|
||||
*this << length;
|
||||
|
||||
// Then insert characters
|
||||
if (length > 0)
|
||||
{
|
||||
for (wchar_t c : data)
|
||||
*this << static_cast<Uint32>(c);
|
||||
*this << static_cast<std::uint32_t>(c);
|
||||
}
|
||||
|
||||
return *this;
|
||||
@ -573,7 +573,7 @@ Packet& Packet::operator<<(const std::wstring& data)
|
||||
Packet& Packet::operator<<(const String& data)
|
||||
{
|
||||
// First insert the string length
|
||||
auto length = static_cast<Uint32>(data.getSize());
|
||||
auto length = static_cast<std::uint32_t>(data.getSize());
|
||||
*this << length;
|
||||
|
||||
// Then insert characters
|
||||
|
@ -322,7 +322,7 @@ Socket::Status TcpSocket::send(Packet& packet)
|
||||
const void* data = packet.onSend(size);
|
||||
|
||||
// First convert the packet size to network byte order
|
||||
Uint32 packetSize = htonl(static_cast<Uint32>(size));
|
||||
std::uint32_t packetSize = htonl(static_cast<std::uint32_t>(size));
|
||||
|
||||
// Allocate memory for the data block to send
|
||||
m_blockToSendBuffer.resize(sizeof(packetSize) + size);
|
||||
@ -371,8 +371,8 @@ Socket::Status TcpSocket::receive(Packet& packet)
|
||||
packet.clear();
|
||||
|
||||
// We start by getting the size of the incoming packet
|
||||
Uint32 packetSize = 0;
|
||||
std::size_t received = 0;
|
||||
std::uint32_t packetSize = 0;
|
||||
std::size_t received = 0;
|
||||
if (m_pendingPacket.SizeReceived < sizeof(m_pendingPacket.Size))
|
||||
{
|
||||
// Loop until we've received the entire size of the packet
|
||||
|
@ -39,7 +39,7 @@ namespace sf
|
||||
namespace priv
|
||||
{
|
||||
////////////////////////////////////////////////////////////
|
||||
sockaddr_in SocketImpl::createAddress(Uint32 address, unsigned short port)
|
||||
sockaddr_in SocketImpl::createAddress(std::uint32_t address, unsigned short port)
|
||||
{
|
||||
sockaddr_in addr;
|
||||
std::memset(&addr, 0, sizeof(addr));
|
||||
|
@ -66,7 +66,7 @@ public:
|
||||
/// \return sockaddr_in ready to be used by socket functions
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
static sockaddr_in createAddress(Uint32 address, unsigned short port);
|
||||
static sockaddr_in createAddress(std::uint32_t address, unsigned short port);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Return the value of the invalid socket
|
||||
|
@ -35,7 +35,7 @@ namespace sf
|
||||
namespace priv
|
||||
{
|
||||
////////////////////////////////////////////////////////////
|
||||
sockaddr_in SocketImpl::createAddress(Uint32 address, unsigned short port)
|
||||
sockaddr_in SocketImpl::createAddress(std::uint32_t address, unsigned short port)
|
||||
{
|
||||
sockaddr_in addr;
|
||||
std::memset(&addr, 0, sizeof(addr));
|
||||
|
@ -62,7 +62,7 @@ public:
|
||||
/// \return sockaddr_in ready to be used by socket functions
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
static sockaddr_in createAddress(Uint32 address, unsigned short port);
|
||||
static sockaddr_in createAddress(std::uint32_t address, unsigned short port);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Return the value of the invalid socket
|
||||
|
@ -35,7 +35,7 @@
|
||||
namespace sf
|
||||
{
|
||||
////////////////////////////////////////////////////////////
|
||||
const std::size_t String::InvalidPos = std::basic_string<Uint32>::npos;
|
||||
const std::size_t String::InvalidPos = std::basic_string<std::uint32_t>::npos;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
@ -59,7 +59,7 @@ String::String(wchar_t wideChar)
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
String::String(Uint32 utf32Char)
|
||||
String::String(std::uint32_t utf32Char)
|
||||
{
|
||||
m_string += utf32Char;
|
||||
}
|
||||
@ -112,7 +112,7 @@ String::String(const std::wstring& wideString)
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
String::String(const Uint32* utf32String)
|
||||
String::String(const std::uint32_t* utf32String)
|
||||
{
|
||||
if (utf32String)
|
||||
m_string = utf32String;
|
||||
@ -120,7 +120,7 @@ String::String(const Uint32* utf32String)
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
String::String(const std::basic_string<Uint32>& utf32String) : m_string(utf32String)
|
||||
String::String(const std::basic_string<std::uint32_t>& utf32String) : m_string(utf32String)
|
||||
{
|
||||
}
|
||||
|
||||
@ -210,7 +210,7 @@ std::basic_string<std::uint16_t> String::toUtf16() const
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
std::basic_string<Uint32> String::toUtf32() const
|
||||
std::basic_string<std::uint32_t> String::toUtf32() const
|
||||
{
|
||||
return m_string;
|
||||
}
|
||||
@ -233,14 +233,14 @@ String& String::operator+=(const String& right)
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
Uint32 String::operator[](std::size_t index) const
|
||||
std::uint32_t String::operator[](std::size_t index) const
|
||||
{
|
||||
return m_string[index];
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
Uint32& String::operator[](std::size_t index)
|
||||
std::uint32_t& String::operator[](std::size_t index)
|
||||
{
|
||||
return m_string[index];
|
||||
}
|
||||
@ -319,7 +319,7 @@ String String::substring(std::size_t position, std::size_t length) const
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
const Uint32* String::getData() const
|
||||
const std::uint32_t* String::getData() const
|
||||
{
|
||||
return m_string.c_str();
|
||||
}
|
||||
|
@ -425,10 +425,10 @@ int WindowImplAndroid::processKeyEvent(AInputEvent* _event, ActivityStates& /* s
|
||||
event.type = Event::KeyReleased;
|
||||
forwardEvent(event);
|
||||
|
||||
if (Uint32 unicode = static_cast<Uint32>(getUnicode(_event)))
|
||||
if (std::uint32_t unicode = static_cast<std::uint32_t>(getUnicode(_event)))
|
||||
{
|
||||
event.type = Event::TextEntered;
|
||||
event.text.unicode = static_cast<Uint32>(unicode);
|
||||
event.text.unicode = static_cast<std::uint32_t>(unicode);
|
||||
forwardEvent(event);
|
||||
}
|
||||
return 1;
|
||||
@ -448,10 +448,10 @@ int WindowImplAndroid::processKeyEvent(AInputEvent* _event, ActivityStates& /* s
|
||||
// https://code.google.com/p/android/issues/detail?id=33998
|
||||
return 0;
|
||||
}
|
||||
else if (Uint32 unicode = static_cast<Uint32>(getUnicode(_event))) // This is a repeated sequence
|
||||
else if (std::uint32_t unicode = static_cast<std::uint32_t>(getUnicode(_event))) // This is a repeated sequence
|
||||
{
|
||||
event.type = Event::TextEntered;
|
||||
event.text.unicode = static_cast<Uint32>(unicode);
|
||||
event.text.unicode = static_cast<std::uint32_t>(unicode);
|
||||
|
||||
std::int32_t repeats = AKeyEvent_getRepeatCount(_event);
|
||||
for (std::int32_t i = 0; i < repeats; ++i)
|
||||
@ -473,7 +473,7 @@ int WindowImplAndroid::processMotionEvent(AInputEvent* _event, ActivityStates& s
|
||||
|
||||
if (device == AINPUT_SOURCE_MOUSE)
|
||||
event.type = Event::MouseMoved;
|
||||
else if (static_cast<Uint32>(device) & AINPUT_SOURCE_TOUCHSCREEN)
|
||||
else if (static_cast<std::uint32_t>(device) & AINPUT_SOURCE_TOUCHSCREEN)
|
||||
event.type = Event::TouchMoved;
|
||||
|
||||
std::size_t pointerCount = AMotionEvent_getPointerCount(_event);
|
||||
@ -492,7 +492,7 @@ int WindowImplAndroid::processMotionEvent(AInputEvent* _event, ActivityStates& s
|
||||
|
||||
states.mousePosition = Vector2i(event.mouseMove.x, event.mouseMove.y);
|
||||
}
|
||||
else if (static_cast<Uint32>(device) & AINPUT_SOURCE_TOUCHSCREEN)
|
||||
else if (static_cast<std::uint32_t>(device) & AINPUT_SOURCE_TOUCHSCREEN)
|
||||
{
|
||||
if (states.touchEvents[id].x == x && states.touchEvents[id].y == y)
|
||||
continue;
|
||||
@ -558,7 +558,7 @@ int WindowImplAndroid::processPointerEvent(bool isDown, AInputEvent* _event, Act
|
||||
if (id >= 0 && id < Mouse::ButtonCount)
|
||||
states.isButtonPressed[id] = false;
|
||||
}
|
||||
else if (static_cast<Uint32>(device) & AINPUT_SOURCE_TOUCHSCREEN)
|
||||
else if (static_cast<std::uint32_t>(device) & AINPUT_SOURCE_TOUCHSCREEN)
|
||||
{
|
||||
event.type = Event::TouchEnded;
|
||||
event.touch.finger = static_cast<unsigned int>(id);
|
||||
|
@ -421,7 +421,7 @@ void DRMContext::createContext(DRMContext* shared)
|
||||
////////////////////////////////////////////////////////////
|
||||
void DRMContext::createSurface(const Vector2u& size, unsigned int /*bpp*/, bool scanout)
|
||||
{
|
||||
sf::Uint32 flags = GBM_BO_USE_RENDERING;
|
||||
std::uint32_t flags = GBM_BO_USE_RENDERING;
|
||||
|
||||
m_scanOut = scanout;
|
||||
if (m_scanOut)
|
||||
|
@ -866,7 +866,7 @@ void GlContext::initialize(const ContextSettings& requestedSettings)
|
||||
|
||||
if (std::strstr(extensionString, "GL_ARB_compatibility"))
|
||||
{
|
||||
m_settings.attributeFlags &= ~static_cast<Uint32>(ContextSettings::Core);
|
||||
m_settings.attributeFlags &= ~static_cast<std::uint32_t>(ContextSettings::Core);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -45,8 +45,8 @@ NSString* stringToNSString(const std::string& string)
|
||||
////////////////////////////////////////////////////////////
|
||||
NSString* sfStringToNSString(const sf::String& string)
|
||||
{
|
||||
sf::Uint32 length = static_cast<sf::Uint32>(string.getSize() * sizeof(sf::Uint32));
|
||||
const void* data = reinterpret_cast<const void*>(string.getData());
|
||||
std::uint32_t length = static_cast<std::uint32_t>(string.getSize() * sizeof(std::uint32_t));
|
||||
const void* data = reinterpret_cast<const void*>(string.getData());
|
||||
|
||||
NSStringEncoding encoding;
|
||||
if (NSHostByteOrder() == NS_LittleEndian)
|
||||
|
@ -80,7 +80,7 @@ bool CursorImpl::loadFromPixelsARGB(const std::uint8_t* pixels, Vector2u size, V
|
||||
const std::size_t numPixels = static_cast<std::size_t>(size.x) * static_cast<std::size_t>(size.y);
|
||||
for (std::size_t pixelIndex = 0; pixelIndex < numPixels; ++pixelIndex)
|
||||
{
|
||||
cursorImage->pixels[pixelIndex] = static_cast<Uint32>(
|
||||
cursorImage->pixels[pixelIndex] = static_cast<std::uint32_t>(
|
||||
pixels[pixelIndex * 4 + 2] + (pixels[pixelIndex * 4 + 1] << 8) + (pixels[pixelIndex * 4 + 0] << 16) +
|
||||
(pixels[pixelIndex * 4 + 3] << 24));
|
||||
}
|
||||
|
@ -135,7 +135,7 @@ bool VulkanImplX11::isAvailable(bool requireGraphics)
|
||||
// Retrieve the available instance extensions
|
||||
std::vector<VkExtensionProperties> extensionProperties;
|
||||
|
||||
uint32_t extensionCount = 0;
|
||||
std::uint32_t extensionCount = 0;
|
||||
|
||||
wrapper.vkEnumerateInstanceExtensionProperties(0, &extensionCount, nullptr);
|
||||
|
||||
|
@ -1940,7 +1940,7 @@ bool WindowImplX11::processEvent(XEvent& windowEvent)
|
||||
{
|
||||
// There might be more than 1 characters in this event,
|
||||
// so we must iterate it
|
||||
Uint32 unicode = 0;
|
||||
std::uint32_t unicode = 0;
|
||||
std::uint8_t* iter = keyBuffer;
|
||||
while (iter < keyBuffer + length)
|
||||
{
|
||||
@ -1964,7 +1964,7 @@ bool WindowImplX11::processEvent(XEvent& windowEvent)
|
||||
{
|
||||
Event textEvent;
|
||||
textEvent.type = Event::TextEntered;
|
||||
textEvent.text.unicode = static_cast<Uint32>(keyBuffer[0]);
|
||||
textEvent.text.unicode = static_cast<std::uint32_t>(keyBuffer[0]);
|
||||
pushEvent(textEvent);
|
||||
}
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ bool CursorImpl::loadFromPixels(const std::uint8_t* pixels, Vector2u size, Vecto
|
||||
bitmapHeader.bV5BlueMask = 0x000000ff;
|
||||
bitmapHeader.bV5AlphaMask = 0xff000000;
|
||||
|
||||
Uint32* bitmapData = nullptr;
|
||||
std::uint32_t* bitmapData = nullptr;
|
||||
|
||||
HDC screenDC = GetDC(nullptr);
|
||||
HBITMAP color = CreateDIBSection(screenDC,
|
||||
@ -91,10 +91,10 @@ bool CursorImpl::loadFromPixels(const std::uint8_t* pixels, Vector2u size, Vecto
|
||||
|
||||
// Fill our bitmap with the cursor color data
|
||||
// We'll have to swap the red and blue channels here
|
||||
Uint32* bitmapOffset = bitmapData;
|
||||
std::uint32_t* bitmapOffset = bitmapData;
|
||||
for (std::size_t remaining = size.x * size.y; remaining > 0; --remaining, pixels += 4)
|
||||
{
|
||||
*bitmapOffset++ = static_cast<Uint32>((pixels[3] << 24) | (pixels[0] << 16) | (pixels[1] << 8) | pixels[2]);
|
||||
*bitmapOffset++ = static_cast<std::uint32_t>((pixels[3] << 24) | (pixels[0] << 16) | (pixels[1] << 8) | pixels[2]);
|
||||
}
|
||||
|
||||
// Create a dummy mask bitmap (it won't be used)
|
||||
|
@ -134,7 +134,7 @@ bool VulkanImplWin32::isAvailable(bool requireGraphics)
|
||||
// Retrieve the available instance extensions
|
||||
std::vector<VkExtensionProperties> extensionProperties;
|
||||
|
||||
uint32_t extensionCount = 0;
|
||||
std::uint32_t extensionCount = 0;
|
||||
|
||||
wrapper.vkEnumerateInstanceExtensionProperties(nullptr, &extensionCount, nullptr);
|
||||
|
||||
|
@ -159,7 +159,7 @@ m_cursorGrabbed(false)
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
WindowImplWin32::WindowImplWin32(VideoMode mode, const String& title, Uint32 style, const ContextSettings& /*settings*/) :
|
||||
WindowImplWin32::WindowImplWin32(VideoMode mode, const String& title, std::uint32_t style, const ContextSettings& /*settings*/) :
|
||||
m_handle(nullptr),
|
||||
m_callback(0),
|
||||
m_cursorVisible(true), // might need to call GetCursorInfo
|
||||
@ -712,7 +712,7 @@ void WindowImplWin32::processEvent(UINT message, WPARAM wParam, LPARAM lParam)
|
||||
if (m_keyRepeatEnabled || ((lParam & (1 << 30)) == 0))
|
||||
{
|
||||
// Get the code of the typed character
|
||||
auto character = static_cast<Uint32>(wParam);
|
||||
auto character = static_cast<std::uint32_t>(wParam);
|
||||
|
||||
// Check if it is the first part of a surrogate pair, or a regular character
|
||||
if ((character >= 0xD800) && (character <= 0xDBFF))
|
||||
|
@ -63,7 +63,7 @@ public:
|
||||
/// \param settings Additional settings for the underlying OpenGL context
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
WindowImplWin32(VideoMode mode, const String& title, Uint32 style, const ContextSettings& settings);
|
||||
WindowImplWin32(VideoMode mode, const String& title, std::uint32_t style, const ContextSettings& settings);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Destructor
|
||||
|
@ -43,7 +43,7 @@ Window::Window() : m_context(), m_frameTimeLimit(Time::Zero)
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
Window::Window(VideoMode mode, const String& title, Uint32 style, const ContextSettings& settings) :
|
||||
Window::Window(VideoMode mode, const String& title, std::uint32_t style, const ContextSettings& settings) :
|
||||
m_context(),
|
||||
m_frameTimeLimit(Time::Zero)
|
||||
{
|
||||
@ -66,14 +66,14 @@ Window::~Window()
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
void Window::create(VideoMode mode, const String& title, Uint32 style)
|
||||
void Window::create(VideoMode mode, const String& title, std::uint32_t style)
|
||||
{
|
||||
Window::create(mode, title, style, ContextSettings());
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
void Window::create(VideoMode mode, const String& title, Uint32 style, const ContextSettings& settings)
|
||||
void Window::create(VideoMode mode, const String& title, std::uint32_t style, const ContextSettings& settings)
|
||||
{
|
||||
// Destroy the previous window implementation
|
||||
close();
|
||||
@ -85,7 +85,7 @@ void Window::create(VideoMode mode, const String& title, Uint32 style, const Con
|
||||
if (getFullscreenWindow())
|
||||
{
|
||||
err() << "Creating two fullscreen windows is not allowed, switching to windowed mode" << std::endl;
|
||||
style &= ~static_cast<Uint32>(Style::Fullscreen);
|
||||
style &= ~static_cast<std::uint32_t>(Style::Fullscreen);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -104,7 +104,7 @@ void Window::create(VideoMode mode, const String& title, Uint32 style, const Con
|
||||
// Check validity of style according to the underlying platform
|
||||
#if defined(SFML_SYSTEM_IOS) || defined(SFML_SYSTEM_ANDROID)
|
||||
if (style & Style::Fullscreen)
|
||||
style &= ~static_cast<Uint32>(Style::Titlebar);
|
||||
style &= ~static_cast<std::uint32_t>(Style::Titlebar);
|
||||
else
|
||||
style |= Style::Titlebar;
|
||||
#else
|
||||
|
@ -52,7 +52,7 @@ WindowBase::WindowBase() : m_impl(), m_size(0, 0)
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
WindowBase::WindowBase(VideoMode mode, const String& title, Uint32 style) : m_impl(), m_size(0, 0)
|
||||
WindowBase::WindowBase(VideoMode mode, const String& title, std::uint32_t style) : m_impl(), m_size(0, 0)
|
||||
{
|
||||
WindowBase::create(mode, title, style);
|
||||
}
|
||||
@ -73,7 +73,7 @@ WindowBase::~WindowBase()
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
void WindowBase::create(VideoMode mode, const String& title, Uint32 style)
|
||||
void WindowBase::create(VideoMode mode, const String& title, std::uint32_t style)
|
||||
{
|
||||
// Destroy the previous window implementation
|
||||
close();
|
||||
@ -85,7 +85,7 @@ void WindowBase::create(VideoMode mode, const String& title, Uint32 style)
|
||||
if (getFullscreenWindow())
|
||||
{
|
||||
err() << "Creating two fullscreen windows is not allowed, switching to windowed mode" << std::endl;
|
||||
style &= ~static_cast<Uint32>(Style::Fullscreen);
|
||||
style &= ~static_cast<std::uint32_t>(Style::Fullscreen);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -104,7 +104,7 @@ void WindowBase::create(VideoMode mode, const String& title, Uint32 style)
|
||||
// Check validity of style according to the underlying platform
|
||||
#if defined(SFML_SYSTEM_IOS) || defined(SFML_SYSTEM_ANDROID)
|
||||
if (style & Style::Fullscreen)
|
||||
style &= ~static_cast<Uint32>(Style::Titlebar);
|
||||
style &= ~static_cast<std::uint32_t>(Style::Titlebar);
|
||||
else
|
||||
style |= Style::Titlebar;
|
||||
#else
|
||||
|
@ -101,7 +101,7 @@ struct WindowImpl::JoystickStatesImpl
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
std::unique_ptr<WindowImpl> WindowImpl::create(VideoMode mode, const String& title, Uint32 style, const ContextSettings& settings)
|
||||
std::unique_ptr<WindowImpl> WindowImpl::create(VideoMode mode, const String& title, std::uint32_t style, const ContextSettings& settings)
|
||||
{
|
||||
return std::make_unique<WindowImplType>(mode, title, style, settings);
|
||||
}
|
||||
|
@ -69,7 +69,10 @@ public:
|
||||
/// \return Pointer to the created window
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
static std::unique_ptr<WindowImpl> create(VideoMode mode, const String& title, Uint32 style, const ContextSettings& settings);
|
||||
static std::unique_ptr<WindowImpl> create(VideoMode mode,
|
||||
const String& title,
|
||||
std::uint32_t style,
|
||||
const ContextSettings& settings);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Create a new window depending on to the current OS
|
||||
|
@ -99,7 +99,7 @@
|
||||
/// \param character The typed character
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
- (void)notifyCharacter:(sf::Uint32)character;
|
||||
- (void)notifyCharacter:(std::uint32_t)character;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Tells if the dimensions of the current window must be flipped when switching to a given orientation
|
||||
|
@ -324,7 +324,7 @@ std::vector<sf::Vector2i> touchPositions;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
- (void)notifyCharacter:(sf::Uint32)character
|
||||
- (void)notifyCharacter:(std::uint32_t)character
|
||||
{
|
||||
if (self.sfWindow)
|
||||
{
|
||||
|
@ -77,7 +77,7 @@
|
||||
const char* end = utf8 + std::strlen(utf8);
|
||||
while (utf8 < end)
|
||||
{
|
||||
sf::Uint32 character;
|
||||
std::uint32_t character;
|
||||
utf8 = sf::Utf8::decode(utf8, end, character);
|
||||
[[SFAppDelegate getInstance] notifyCharacter:character];
|
||||
}
|
||||
|
@ -23,9 +23,9 @@ TEST_CASE("sf::Image - [graphics]")
|
||||
CHECK(image.getSize() == sf::Vector2u(10, 10));
|
||||
CHECK(image.getPixelsPtr() != nullptr);
|
||||
|
||||
for (sf::Uint32 i = 0; i < 10; ++i)
|
||||
for (std::uint32_t i = 0; i < 10; ++i)
|
||||
{
|
||||
for (sf::Uint32 j = 0; j < 10; ++j)
|
||||
for (std::uint32_t j = 0; j < 10; ++j)
|
||||
{
|
||||
CHECK(image.getPixel(sf::Vector2u(i, j)) == sf::Color(0, 0, 0));
|
||||
}
|
||||
@ -40,9 +40,9 @@ TEST_CASE("sf::Image - [graphics]")
|
||||
CHECK(image.getSize() == sf::Vector2u(10, 10));
|
||||
CHECK(image.getPixelsPtr() != nullptr);
|
||||
|
||||
for (sf::Uint32 i = 0; i < 10; ++i)
|
||||
for (std::uint32_t i = 0; i < 10; ++i)
|
||||
{
|
||||
for (sf::Uint32 j = 0; j < 10; ++j)
|
||||
for (std::uint32_t j = 0; j < 10; ++j)
|
||||
{
|
||||
CHECK(image.getPixel(sf::Vector2u(i, j)) == sf::Color::Red);
|
||||
}
|
||||
@ -67,9 +67,9 @@ TEST_CASE("sf::Image - [graphics]")
|
||||
CHECK(image.getSize() == sf::Vector2u(10, 10));
|
||||
CHECK(image.getPixelsPtr() != nullptr);
|
||||
|
||||
for (sf::Uint32 i = 0; i < 10; ++i)
|
||||
for (std::uint32_t i = 0; i < 10; ++i)
|
||||
{
|
||||
for (sf::Uint32 j = 0; j < 10; ++j)
|
||||
for (std::uint32_t j = 0; j < 10; ++j)
|
||||
{
|
||||
CHECK(image.getPixel(sf::Vector2u(i, j)) == sf::Color::Red);
|
||||
}
|
||||
@ -99,9 +99,9 @@ TEST_CASE("sf::Image - [graphics]")
|
||||
image2.create(sf::Vector2u(10, 10));
|
||||
CHECK(image2.copy(image1, sf::Vector2u(0, 0)));
|
||||
|
||||
for (sf::Uint32 i = 0; i < 10; ++i)
|
||||
for (std::uint32_t i = 0; i < 10; ++i)
|
||||
{
|
||||
for (sf::Uint32 j = 0; j < 10; ++j)
|
||||
for (std::uint32_t j = 0; j < 10; ++j)
|
||||
{
|
||||
CHECK(image1.getPixel(sf::Vector2u(i, j)) == image2.getPixel(sf::Vector2u(i, j)));
|
||||
}
|
||||
@ -117,9 +117,9 @@ TEST_CASE("sf::Image - [graphics]")
|
||||
image2.create(sf::Vector2u(10, 10));
|
||||
CHECK(image2.copy(image1, sf::Vector2u(0, 0), sf::IntRect(sf::Vector2i(0, 0), sf::Vector2i(5, 5))));
|
||||
|
||||
for (sf::Uint32 i = 0; i < 10; ++i)
|
||||
for (std::uint32_t i = 0; i < 10; ++i)
|
||||
{
|
||||
for (sf::Uint32 j = 0; j < 10; ++j)
|
||||
for (std::uint32_t j = 0; j < 10; ++j)
|
||||
{
|
||||
if (i <= 4 && j <= 4)
|
||||
CHECK(image2.getPixel(sf::Vector2u(i, j)) == sf::Color::Blue);
|
||||
@ -151,9 +151,9 @@ TEST_CASE("sf::Image - [graphics]")
|
||||
image2.create(sf::Vector2u(10, 10), source);
|
||||
CHECK(image1.copy(image2, sf::Vector2u(0, 0), sf::IntRect(sf::Vector2i(0, 0), sf::Vector2i(10, 10)), true));
|
||||
|
||||
for (sf::Uint32 i = 0; i < 10; ++i)
|
||||
for (std::uint32_t i = 0; i < 10; ++i)
|
||||
{
|
||||
for (sf::Uint32 j = 0; j < 10; ++j)
|
||||
for (std::uint32_t j = 0; j < 10; ++j)
|
||||
{
|
||||
CHECK(image1.getPixel(sf::Vector2u(i, j)) == composite);
|
||||
}
|
||||
@ -168,9 +168,9 @@ TEST_CASE("sf::Image - [graphics]")
|
||||
image2.create(sf::Vector2u(10, 10), sf::Color::Red);
|
||||
CHECK(!image2.copy(image1, sf::Vector2u(0, 0), sf::IntRect(sf::Vector2i(0, 0), sf::Vector2i(9, 9))));
|
||||
|
||||
for (sf::Uint32 i = 0; i < 10; ++i)
|
||||
for (std::uint32_t i = 0; i < 10; ++i)
|
||||
{
|
||||
for (sf::Uint32 j = 0; j < 10; ++j)
|
||||
for (std::uint32_t j = 0; j < 10; ++j)
|
||||
{
|
||||
CHECK(image2.getPixel(sf::Vector2u(i, j)) == sf::Color::Red);
|
||||
}
|
||||
@ -187,9 +187,9 @@ TEST_CASE("sf::Image - [graphics]")
|
||||
image2.create(sf::Vector2u(10, 10), sf::Color::Red);
|
||||
CHECK(!image2.copy(image1, sf::Vector2u(0, 0), sf::IntRect(sf::Vector2i(5, 5), sf::Vector2i(9, 9))));
|
||||
|
||||
for (sf::Uint32 i = 0; i < 10; ++i)
|
||||
for (std::uint32_t i = 0; i < 10; ++i)
|
||||
{
|
||||
for (sf::Uint32 j = 0; j < 10; ++j)
|
||||
for (std::uint32_t j = 0; j < 10; ++j)
|
||||
{
|
||||
CHECK(image2.getPixel(sf::Vector2u(i, j)) == sf::Color::Red);
|
||||
}
|
||||
@ -205,9 +205,9 @@ TEST_CASE("sf::Image - [graphics]")
|
||||
image.create(sf::Vector2u(10, 10), sf::Color::Blue);
|
||||
image.createMaskFromColor(sf::Color::Blue);
|
||||
|
||||
for (sf::Uint32 i = 0; i < 10; ++i)
|
||||
for (std::uint32_t i = 0; i < 10; ++i)
|
||||
{
|
||||
for (sf::Uint32 j = 0; j < 10; ++j)
|
||||
for (std::uint32_t j = 0; j < 10; ++j)
|
||||
{
|
||||
CHECK(image.getPixel(sf::Vector2u(i, j)) == sf::Color(0, 0, 255, 0));
|
||||
}
|
||||
@ -220,9 +220,9 @@ TEST_CASE("sf::Image - [graphics]")
|
||||
image.create(sf::Vector2u(10, 10), sf::Color::Blue);
|
||||
image.createMaskFromColor(sf::Color::Blue, 100);
|
||||
|
||||
for (sf::Uint32 i = 0; i < 10; ++i)
|
||||
for (std::uint32_t i = 0; i < 10; ++i)
|
||||
{
|
||||
for (sf::Uint32 j = 0; j < 10; ++j)
|
||||
for (std::uint32_t j = 0; j < 10; ++j)
|
||||
{
|
||||
CHECK(image.getPixel(sf::Vector2u(i, j)) == sf::Color(0, 0, 255, 100));
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ TEST_CASE("sf::IpAddress class - [network]")
|
||||
CHECK(ipAddress.toInteger() == 0x8EFA45EE);
|
||||
}
|
||||
|
||||
SUBCASE("Uint32 constructor")
|
||||
SUBCASE("std::uint32_t constructor")
|
||||
{
|
||||
const sf::IpAddress ipAddress(0xDEADBEEF);
|
||||
CHECK(ipAddress.toString() == "222.173.190.239"s);
|
||||
|
@ -14,8 +14,6 @@ TEST_CASE("SFML/Config.hpp")
|
||||
|
||||
SUBCASE("Fixed width types")
|
||||
{
|
||||
CHECK(sizeof(sf::Uint32) == 4);
|
||||
|
||||
CHECK(sizeof(sf::Int64) == 8);
|
||||
CHECK(sizeof(sf::Uint64) == 8);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user