mirror of
https://github.com/raylib-cs/raylib-cs
synced 2025-06-30 19:03:42 -04:00
Fix usage of uint in bindings (#246)
This commit is contained in:
@ -93,13 +93,13 @@ public class StorageValues
|
||||
|
||||
// Save integer value to storage file (to defined position)
|
||||
// NOTE: Storage positions is directly related to file memory layout (4 bytes each integer)
|
||||
private static unsafe bool SaveStorageValue(string fileName, uint position, int value)
|
||||
private static unsafe bool SaveStorageValue(string fileName, int position, int value)
|
||||
{
|
||||
using var fileNameBuffer = fileName.ToUtf8Buffer();
|
||||
|
||||
bool success = false;
|
||||
uint dataSize = 0;
|
||||
uint newDataSize = 0;
|
||||
int dataSize = 0;
|
||||
int newDataSize = 0;
|
||||
|
||||
byte* fileData = LoadFileData(fileNameBuffer.AsPointer(), &dataSize);
|
||||
byte* newFileData = null;
|
||||
@ -110,7 +110,7 @@ public class StorageValues
|
||||
{
|
||||
// Increase data size up to position and store value
|
||||
newDataSize = (position + 1) * sizeof(int);
|
||||
newFileData = (byte*)MemRealloc(fileData, (int)newDataSize);
|
||||
newFileData = (byte*)MemRealloc(fileData, (uint)newDataSize);
|
||||
|
||||
if (newFileData != null)
|
||||
{
|
||||
@ -121,7 +121,7 @@ public class StorageValues
|
||||
else
|
||||
{
|
||||
// RL_REALLOC failed
|
||||
uint positionInBytes = position * sizeof(int);
|
||||
int positionInBytes = position * sizeof(int);
|
||||
TraceLog(
|
||||
TraceLogLevel.Warning,
|
||||
@$"FILEIO: [{fileName}] Failed to realloc data ({dataSize}),
|
||||
@ -154,7 +154,7 @@ public class StorageValues
|
||||
TraceLog(TraceLogLevel.Info, $"FILEIO: [{fileName}] File created successfully");
|
||||
|
||||
dataSize = (position + 1) * sizeof(int);
|
||||
fileData = (byte*)MemAlloc((int)dataSize);
|
||||
fileData = (byte*)MemAlloc((uint)dataSize);
|
||||
int* dataPtr = (int*)fileData;
|
||||
dataPtr[position] = value;
|
||||
|
||||
@ -174,7 +174,7 @@ public class StorageValues
|
||||
using var fileNameBuffer = fileName.ToUtf8Buffer();
|
||||
|
||||
int value = 0;
|
||||
uint dataSize = 0;
|
||||
int dataSize = 0;
|
||||
byte* fileData = LoadFileData(fileNameBuffer.AsPointer(), &dataSize);
|
||||
|
||||
if (fileData != null)
|
||||
|
@ -47,7 +47,7 @@ public class AnimationDemo
|
||||
|
||||
Vector3 position = new(0.0f, 0.0f, 0.0f);
|
||||
// Load animation data
|
||||
uint animsCount = 0;
|
||||
int animsCount = 0;
|
||||
var anims = LoadModelAnimations("resources/models/iqm/guyanim.iqm", ref animsCount);
|
||||
int animFrameCounter = 0;
|
||||
|
||||
|
@ -31,7 +31,7 @@ public class FontSdf
|
||||
string msg = "Signed Distance Fields";
|
||||
|
||||
// Loading file to memory
|
||||
uint fileSize = 0;
|
||||
int fileSize = 0;
|
||||
byte* fileData = LoadFileData("resources/fonts/anonymous_pro_bold.ttf", ref fileSize);
|
||||
|
||||
// Default font generation from TTF font
|
||||
|
@ -44,7 +44,7 @@ public class RawData
|
||||
int height = 480;
|
||||
|
||||
// Store pixel data
|
||||
Color* pixels = (Color*)Raylib.MemAlloc(width * height * sizeof(Color));
|
||||
Color* pixels = (Color*)Raylib.MemAlloc((uint)(width * height * sizeof(Color)));
|
||||
for (int y = 0; y < height; y++)
|
||||
{
|
||||
for (int x = 0; x < width; x++)
|
||||
|
Reference in New Issue
Block a user