Removed trail spaces
This commit is contained in:
parent
3e1e7d740f
commit
a103086443
6 changed files with 87 additions and 87 deletions
32
src/core.c
32
src/core.c
|
@ -760,7 +760,7 @@ bool IsWindowResized(void)
|
|||
return windowResized;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
// Check if window is currently hidden
|
||||
|
@ -1684,14 +1684,14 @@ const char *GetFileName(const char *filePath)
|
|||
const char *GetFileNameWithoutExt(const char *filePath)
|
||||
{
|
||||
#define MAX_FILENAMEWITHOUTEXT_LENGTH 64
|
||||
|
||||
|
||||
static char fileName[MAX_FILENAMEWITHOUTEXT_LENGTH];
|
||||
memset(fileName, 0, MAX_FILENAMEWITHOUTEXT_LENGTH);
|
||||
|
||||
|
||||
strcpy(fileName, GetFileName(filePath)); // Get filename with extension
|
||||
|
||||
|
||||
int len = strlen(fileName);
|
||||
|
||||
|
||||
for (int i = 0; (i < len) && (i < MAX_FILENAMEWITHOUTEXT_LENGTH); i++)
|
||||
{
|
||||
if (fileName[i] == '.')
|
||||
|
@ -3154,7 +3154,7 @@ static void PollInputEvents(void)
|
|||
gamepadAxisCount = axisCount;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
windowResized = false;
|
||||
|
||||
#if defined(SUPPORT_EVENTS_WAITING)
|
||||
|
@ -3433,7 +3433,7 @@ static void WindowSizeCallback(GLFWwindow *window, int width, int height)
|
|||
currentHeight = height;
|
||||
|
||||
// NOTE: Postprocessing texture is not scaled to new size
|
||||
|
||||
|
||||
windowResized = true;
|
||||
}
|
||||
|
||||
|
@ -4279,7 +4279,7 @@ static void *EventThread(void *arg)
|
|||
{
|
||||
// Scancode to keycode mapping for US keyboards
|
||||
// TODO: Proabobly replace this with a keymap from the X11 to get the correct regional map for the keyboard (Currently non US keyboards will have the wrong mapping for some keys)
|
||||
static const int keymap_US[] =
|
||||
static const int keymap_US[] =
|
||||
{0,256,49,50,51,52,53,54,55,56,57,48,45,61,259,258,81,87,69,82,84,
|
||||
89,85,73,79,80,91,93,257,341,65,83,68,70,71,72,74,75,76,59,39,96,
|
||||
340,92,90,88,67,86,66,78,77,44,46,47,344,332,342,32,280,290,291,
|
||||
|
@ -4298,7 +4298,7 @@ static void *EventThread(void *arg)
|
|||
|
||||
struct input_event event;
|
||||
InputEventWorker *worker = (InputEventWorker *)arg;
|
||||
|
||||
|
||||
int touchAction = -1;
|
||||
bool gestureUpdate = false;
|
||||
int keycode;
|
||||
|
@ -4400,7 +4400,7 @@ static void *EventThread(void *arg)
|
|||
if ((event.code == BTN_TOUCH) || (event.code == BTN_LEFT))
|
||||
{
|
||||
currentMouseStateEvdev[MOUSE_LEFT_BUTTON] = event.value;
|
||||
|
||||
|
||||
#if defined(SUPPORT_GESTURES_SYSTEM)
|
||||
if (event.value > 0) touchAction = TOUCH_DOWN;
|
||||
else touchAction = TOUCH_UP;
|
||||
|
@ -4415,9 +4415,9 @@ static void *EventThread(void *arg)
|
|||
// Keyboard button parsing
|
||||
if((event.code >= 1) && (event.code <= 255)) //Keyboard keys appear for codes 1 to 255
|
||||
{
|
||||
keycode = keymap_US[event.code & 0xFF]; // The code we get is a scancode so we look up the apropriate keycode
|
||||
keycode = keymap_US[event.code & 0xFF]; // The code we get is a scancode so we look up the apropriate keycode
|
||||
// Make sure we got a valid keycode
|
||||
if((keycode > 0) && (keycode < sizeof(currentKeyState)))
|
||||
if((keycode > 0) && (keycode < sizeof(currentKeyState)))
|
||||
{
|
||||
// Store the key information for raylib to later use
|
||||
currentKeyStateEvdev[keycode] = event.value;
|
||||
|
@ -4449,22 +4449,22 @@ static void *EventThread(void *arg)
|
|||
|
||||
gestureEvent.pointCount = 0;
|
||||
gestureEvent.touchAction = touchAction;
|
||||
|
||||
|
||||
if (touchPosition[0].x >= 0) gestureEvent.pointCount++;
|
||||
if (touchPosition[1].x >= 0) gestureEvent.pointCount++;
|
||||
if (touchPosition[2].x >= 0) gestureEvent.pointCount++;
|
||||
if (touchPosition[3].x >= 0) gestureEvent.pointCount++;
|
||||
|
||||
|
||||
gestureEvent.pointerId[0] = 0;
|
||||
gestureEvent.pointerId[1] = 1;
|
||||
gestureEvent.pointerId[2] = 2;
|
||||
gestureEvent.pointerId[3] = 3;
|
||||
|
||||
|
||||
gestureEvent.position[0] = touchPosition[0];
|
||||
gestureEvent.position[1] = touchPosition[1];
|
||||
gestureEvent.position[2] = touchPosition[2];
|
||||
gestureEvent.position[3] = touchPosition[3];
|
||||
|
||||
|
||||
ProcessGestureEvent(gestureEvent);
|
||||
#endif
|
||||
}
|
||||
|
|
78
src/models.c
78
src/models.c
|
@ -624,19 +624,19 @@ Model LoadModel(const char *fileName)
|
|||
#if defined(SUPPORT_FILEFORMAT_IQM)
|
||||
if (IsFileExtension(fileName, ".iqm")) model = LoadIQM(fileName);
|
||||
#endif
|
||||
|
||||
|
||||
// Make sure model transform is set to identity matrix!
|
||||
model.transform = MatrixIdentity();
|
||||
|
||||
if (model.meshCount == 0)
|
||||
if (model.meshCount == 0)
|
||||
{
|
||||
TraceLog(LOG_WARNING, "[%s] No meshes can be loaded, default to cube mesh", fileName);
|
||||
|
||||
|
||||
model.meshCount = 1;
|
||||
model.meshes = (Mesh *)calloc(model.meshCount, sizeof(Mesh));
|
||||
model.meshes[0] = GenMeshCube(1.0f, 1.0f, 1.0f);
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
// Upload vertex data to GPU (static mesh)
|
||||
for (int i = 0; i < model.meshCount; i++) rlLoadMesh(&model.meshes[i], false);
|
||||
|
@ -645,11 +645,11 @@ Model LoadModel(const char *fileName)
|
|||
if (model.materialCount == 0)
|
||||
{
|
||||
TraceLog(LOG_WARNING, "[%s] No materials can be loaded, default to white material", fileName);
|
||||
|
||||
|
||||
model.materialCount = 1;
|
||||
model.materials = (Material *)calloc(model.materialCount, sizeof(Material));
|
||||
model.materials[0] = LoadMaterialDefault();
|
||||
|
||||
|
||||
model.meshMaterial = (int *)calloc(model.meshCount, sizeof(int));
|
||||
}
|
||||
|
||||
|
@ -665,15 +665,15 @@ Model LoadModelFromMesh(Mesh mesh)
|
|||
Model model = { 0 };
|
||||
|
||||
model.transform = MatrixIdentity();
|
||||
|
||||
|
||||
model.meshCount = 1;
|
||||
model.meshes = (Mesh *)malloc(model.meshCount*sizeof(Mesh));
|
||||
model.meshes[0] = mesh;
|
||||
|
||||
|
||||
model.materialCount = 1;
|
||||
model.materials = (Material *)malloc(model.materialCount*sizeof(Material));
|
||||
model.materials[0] = LoadMaterialDefault();
|
||||
|
||||
|
||||
model.meshMaterial = (int *)malloc(model.meshCount*sizeof(int));
|
||||
model.meshMaterial[0] = 0; // First material index
|
||||
|
||||
|
@ -685,11 +685,11 @@ void UnloadModel(Model model)
|
|||
{
|
||||
for (int i = 0; i < model.meshCount; i++) UnloadMesh(&model.meshes[i]);
|
||||
for (int i = 0; i < model.materialCount; i++) UnloadMaterial(model.materials[i]);
|
||||
|
||||
|
||||
free(model.meshes);
|
||||
free(model.materials);
|
||||
free(model.meshMaterial);
|
||||
|
||||
|
||||
// Unload animation data
|
||||
free(model.bones);
|
||||
free(model.bindPose);
|
||||
|
@ -1817,11 +1817,11 @@ Material LoadMaterial(const char *fileName)
|
|||
{
|
||||
tinyobj_material_t *materials;
|
||||
unsigned int materialCount = 0;
|
||||
|
||||
|
||||
int result = tinyobj_parse_mtl_file(&materials, &materialCount, fileName);
|
||||
|
||||
|
||||
// TODO: Process materials to return
|
||||
|
||||
|
||||
tinyobj_materials_free(materials, materialCount);
|
||||
}
|
||||
#else
|
||||
|
@ -1886,7 +1886,7 @@ void DrawModelEx(Model model, Vector3 position, Vector3 rotationAxis, float rota
|
|||
// Combine model transformation matrix (model.transform) with matrix generated by function parameters (matTransform)
|
||||
model.transform = MatrixMultiply(model.transform, matTransform);
|
||||
|
||||
for (int i = 0; i < model.meshCount; i++)
|
||||
for (int i = 0; i < model.meshCount; i++)
|
||||
{
|
||||
model.materials[model.meshMaterial[i]].maps[MAP_DIFFUSE].color = tint;
|
||||
rlDrawMesh(model.meshes[i], model.materials[model.meshMaterial[i]], model.transform);
|
||||
|
@ -2246,7 +2246,7 @@ BoundingBox MeshBoundingBox(Mesh mesh)
|
|||
// Get min and max vertex to construct bounds (AABB)
|
||||
Vector3 minVertex = { 0 };
|
||||
Vector3 maxVertex = { 0 };
|
||||
|
||||
|
||||
printf("Mesh vertex count: %i\n", mesh.vertexCount);
|
||||
|
||||
if (mesh.vertices != NULL)
|
||||
|
@ -2402,20 +2402,20 @@ static Model LoadOBJ(const char *fileName)
|
|||
{
|
||||
unsigned int flags = TINYOBJ_FLAG_TRIANGULATE;
|
||||
int ret = tinyobj_parse_obj(&attrib, &meshes, &meshCount, &materials, &materialCount, data, dataLength, flags);
|
||||
|
||||
|
||||
if (ret != TINYOBJ_SUCCESS) TraceLog(LOG_WARNING, "[%s] Model data could not be loaded", fileName);
|
||||
else TraceLog(LOG_INFO, "[%s] Model data loaded successfully: %i meshes / %i materials", fileName, meshCount, materialCount);
|
||||
|
||||
|
||||
// Init model meshes array
|
||||
model.meshCount = meshCount;
|
||||
model.meshes = (Mesh *)malloc(model.meshCount*sizeof(Mesh));
|
||||
|
||||
|
||||
// Init model materials array
|
||||
model.materialCount = materialCount;
|
||||
model.materials = (Material *)malloc(model.materialCount*sizeof(Material));
|
||||
model.meshMaterial = (int *)calloc(model.meshCount, sizeof(int));
|
||||
|
||||
/*
|
||||
|
||||
/*
|
||||
// Multiple meshes data reference
|
||||
// NOTE: They are provided as a faces offset
|
||||
typedef struct {
|
||||
|
@ -2424,7 +2424,7 @@ static Model LoadOBJ(const char *fileName)
|
|||
unsigned int length;
|
||||
} tinyobj_shape_t;
|
||||
*/
|
||||
|
||||
|
||||
// Init model meshes
|
||||
for (int m = 0; m < 1; m++)
|
||||
{
|
||||
|
@ -2435,25 +2435,25 @@ static Model LoadOBJ(const char *fileName)
|
|||
mesh.vertices = (float *)malloc(mesh.vertexCount*3*sizeof(float));
|
||||
mesh.texcoords = (float *)malloc(mesh.vertexCount*2*sizeof(float));
|
||||
mesh.normals = (float *)malloc(mesh.vertexCount*3*sizeof(float));
|
||||
|
||||
|
||||
int vCount = 0;
|
||||
int vtCount = 0;
|
||||
int vnCount = 0;
|
||||
|
||||
|
||||
for (int f = 0; f < attrib.num_faces; f++)
|
||||
{
|
||||
// Get indices for the face
|
||||
tinyobj_vertex_index_t idx0 = attrib.faces[3*f + 0];
|
||||
tinyobj_vertex_index_t idx1 = attrib.faces[3*f + 1];
|
||||
tinyobj_vertex_index_t idx2 = attrib.faces[3*f + 2];
|
||||
|
||||
|
||||
// TraceLog(LOG_DEBUG, "Face %i index: v %i/%i/%i . vt %i/%i/%i . vn %i/%i/%i\n", f, idx0.v_idx, idx1.v_idx, idx2.v_idx, idx0.vt_idx, idx1.vt_idx, idx2.vt_idx, idx0.vn_idx, idx1.vn_idx, idx2.vn_idx);
|
||||
|
||||
|
||||
// Fill vertices buffer (float) using vertex index of the face
|
||||
for (int v = 0; v < 3; v++) { mesh.vertices[vCount + v] = attrib.vertices[idx0.v_idx*3 + v]; } vCount +=3;
|
||||
for (int v = 0; v < 3; v++) { mesh.vertices[vCount + v] = attrib.vertices[idx1.v_idx*3 + v]; } vCount +=3;
|
||||
for (int v = 0; v < 3; v++) { mesh.vertices[vCount + v] = attrib.vertices[idx2.v_idx*3 + v]; } vCount +=3;
|
||||
|
||||
|
||||
// Fill texcoords buffer (float) using vertex index of the face
|
||||
// NOTE: Y-coordinate must be flipped upside-down
|
||||
mesh.texcoords[vtCount + 0] = attrib.texcoords[idx0.vt_idx*2 + 0];
|
||||
|
@ -2462,7 +2462,7 @@ static Model LoadOBJ(const char *fileName)
|
|||
mesh.texcoords[vtCount + 1] = 1.0f - attrib.texcoords[idx1.vt_idx*2 + 1]; vtCount += 2;
|
||||
mesh.texcoords[vtCount + 0] = attrib.texcoords[idx2.vt_idx*2 + 0];
|
||||
mesh.texcoords[vtCount + 1] = 1.0f - attrib.texcoords[idx2.vt_idx*2 + 1]; vtCount += 2;
|
||||
|
||||
|
||||
// Fill normals buffer (float) using vertex index of the face
|
||||
for (int v = 0; v < 3; v++) { mesh.normals[vnCount + v] = attrib.normals[idx0.vn_idx*3 + v]; } vnCount +=3;
|
||||
for (int v = 0; v < 3; v++) { mesh.normals[vnCount + v] = attrib.normals[idx1.vn_idx*3 + v]; } vnCount +=3;
|
||||
|
@ -2481,7 +2481,7 @@ static Model LoadOBJ(const char *fileName)
|
|||
// Init material to default
|
||||
// NOTE: Uses default shader, only MAP_DIFFUSE supported
|
||||
model.materials[m] = LoadMaterialDefault();
|
||||
|
||||
|
||||
/*
|
||||
typedef struct {
|
||||
char *name;
|
||||
|
@ -2508,19 +2508,19 @@ static Model LoadOBJ(const char *fileName)
|
|||
char *alpha_texname; // map_d
|
||||
} tinyobj_material_t;
|
||||
*/
|
||||
|
||||
|
||||
model.materials[m].maps[MAP_DIFFUSE].texture = LoadTexture(materials[m].diffuse_texname); //char *diffuse_texname; // map_Kd
|
||||
model.materials[m].maps[MAP_DIFFUSE].color = (Color){ (float)(materials[m].diffuse[0]*255.0f), (float)(materials[m].diffuse[1]*255.0f), (float)(materials[m].diffuse[2]*255.0f), 255 }; //float diffuse[3];
|
||||
model.materials[m].maps[MAP_DIFFUSE].value = 0.0f;
|
||||
|
||||
|
||||
model.materials[m].maps[MAP_SPECULAR].texture = LoadTexture(materials[m].specular_texname); //char *specular_texname; // map_Ks
|
||||
model.materials[m].maps[MAP_SPECULAR].color = (Color){ (float)(materials[m].specular[0]*255.0f), (float)(materials[m].specular[1]*255.0f), (float)(materials[m].specular[2]*255.0f), 255 }; //float specular[3];
|
||||
model.materials[m].maps[MAP_SPECULAR].value = 0.0f;
|
||||
|
||||
|
||||
model.materials[m].maps[MAP_NORMAL].texture = LoadTexture(materials[m].bump_texname); //char *bump_texname; // map_bump, bump
|
||||
model.materials[m].maps[MAP_NORMAL].color = WHITE;
|
||||
model.materials[m].maps[MAP_NORMAL].value = materials[m].shininess;
|
||||
|
||||
|
||||
model.materials[m].maps[MAP_EMISSION].color = (Color){ (float)(materials[m].emission[0]*255.0f), (float)(materials[m].emission[1]*255.0f), (float)(materials[m].emission[2]*255.0f), 255 }; //float emission[3];
|
||||
|
||||
model.materials[m].maps[MAP_HEIGHT].texture = LoadTexture(materials[m].displacement_texname); //char *displacement_texname; // disp
|
||||
|
@ -2579,7 +2579,7 @@ static Model LoadIQM(const char *fileName)
|
|||
} IQMTriangle;
|
||||
|
||||
// NOTE: Adjacency unused by default
|
||||
typedef struct IQMAdjacency {
|
||||
typedef struct IQMAdjacency {
|
||||
unsigned int triangle[3];
|
||||
} IQMAdjacency;
|
||||
|
||||
|
@ -2677,7 +2677,7 @@ static Model LoadIQM(const char *fileName)
|
|||
|
||||
model.meshCount = iqm.num_meshes;
|
||||
model.meshes = malloc(sizeof(Mesh)*iqm.num_meshes);
|
||||
|
||||
|
||||
char name[MESH_NAME_LENGTH];
|
||||
|
||||
for (int i = 0; i < iqm.num_meshes; i++)
|
||||
|
@ -2685,17 +2685,17 @@ static Model LoadIQM(const char *fileName)
|
|||
fseek(iqmFile,iqm.ofs_text+imesh[i].name,SEEK_SET);
|
||||
fread(name, sizeof(char)*MESH_NAME_LENGTH, 1, iqmFile); // Mesh name not used...
|
||||
model.meshes[i].vertexCount = imesh[i].num_vertexes;
|
||||
|
||||
|
||||
model.meshes[i].vertices = malloc(sizeof(float)*imesh[i].num_vertexes*3); // Default vertex positions
|
||||
model.meshes[i].normals = malloc(sizeof(float)*imesh[i].num_vertexes*3); // Default vertex normals
|
||||
model.meshes[i].texcoords = malloc(sizeof(float)*imesh[i].num_vertexes*2); // Default vertex texcoords
|
||||
|
||||
|
||||
model.meshes[i].boneIds = malloc(sizeof(int)*imesh[i].num_vertexes*4); // Up-to 4 bones supported!
|
||||
model.meshes[i].boneWeights = malloc(sizeof(float)*imesh[i].num_vertexes*4); // Up-to 4 bones supported!
|
||||
|
||||
|
||||
model.meshes[i].triangleCount = imesh[i].num_triangles;
|
||||
model.meshes[i].indices = malloc(sizeof(unsigned short)*imesh[i].num_triangles*3);
|
||||
|
||||
|
||||
// Animated verted data, what we actually process for rendering
|
||||
// NOTE: Animated vertex should be re-uploaded to GPU (if not using GPU skinning)
|
||||
model.meshes[i].animVertices = malloc(sizeof(float)*imesh[i].num_vertexes*3);
|
||||
|
|
|
@ -525,7 +525,7 @@ void InitAudioDevice(void)
|
|||
TraceLog(LOG_INFO, "Audio channels: %d -> %d", device.playback.channels, device.playback.internalChannels);
|
||||
TraceLog(LOG_INFO, "Audio sample rate: %d -> %d", device.sampleRate, device.playback.internalSampleRate);
|
||||
TraceLog(LOG_INFO, "Audio buffer size: %d", device.playback.internalBufferSizeInFrames);
|
||||
|
||||
|
||||
isAudioInitialized = MA_TRUE;
|
||||
}
|
||||
|
||||
|
@ -587,7 +587,7 @@ AudioBuffer *CreateAudioBuffer(ma_format format, ma_uint32 channels, ma_uint32 s
|
|||
dspConfig.pUserData = audioBuffer;
|
||||
dspConfig.allowDynamicSampleRate = MA_TRUE; // <-- Required for pitch shifting.
|
||||
ma_result result = ma_pcm_converter_init(&dspConfig, &audioBuffer->dsp);
|
||||
|
||||
|
||||
if (result != MA_SUCCESS)
|
||||
{
|
||||
TraceLog(LOG_ERROR, "CreateAudioBuffer() : Failed to create data conversion pipeline");
|
||||
|
|
14
src/raylib.h
14
src/raylib.h
|
@ -339,7 +339,7 @@ typedef struct Material {
|
|||
|
||||
// Transformation properties
|
||||
typedef struct Transform {
|
||||
Vector3 translation; // Translation
|
||||
Vector3 translation; // Translation
|
||||
Quaternion rotation; // Rotation
|
||||
Vector3 scale; // Scale
|
||||
} Transform;
|
||||
|
@ -353,14 +353,14 @@ typedef struct BoneInfo {
|
|||
// Model type
|
||||
typedef struct Model {
|
||||
Matrix transform; // Local transform matrix
|
||||
|
||||
|
||||
int meshCount; // Number of meshes
|
||||
Mesh *meshes; // Meshes array
|
||||
|
||||
int materialCount; // Number of materials
|
||||
Material *materials; // Materials array
|
||||
int *meshMaterial; // Mesh material number
|
||||
|
||||
|
||||
// Animation data
|
||||
int boneCount; // Number of bones
|
||||
BoneInfo *bones; // Bones information (skeleton)
|
||||
|
@ -371,7 +371,7 @@ typedef struct Model {
|
|||
typedef struct ModelAnimation {
|
||||
int boneCount; // Number of bones
|
||||
BoneInfo *bones; // Bones information (skeleton)
|
||||
|
||||
|
||||
int frameCount; // Number of animation frames
|
||||
Transform **framePoses; // Poses array by frame
|
||||
} ModelAnimation;
|
||||
|
@ -1082,8 +1082,8 @@ RLAPI void DrawRectangleGradientH(int posX, int posY, int width, int height, Col
|
|||
RLAPI void DrawRectangleGradientEx(Rectangle rec, Color col1, Color col2, Color col3, Color col4); // Draw a gradient-filled rectangle with custom vertex colors
|
||||
RLAPI void DrawRectangleLines(int posX, int posY, int width, int height, Color color); // Draw rectangle outline
|
||||
RLAPI void DrawRectangleLinesEx(Rectangle rec, int lineThick, Color color); // Draw rectangle outline with extended parameters
|
||||
RLAPI void DrawRoundedRect(Rectangle rec, float roundness, int segments, Color color); // Draw rectangle with rounded edges
|
||||
RLAPI void DrawRoundedRectLines(Rectangle rec, float roundness, int segments, int lineThick, Color color); // Draw rounded rectangle outline
|
||||
RLAPI void DrawRectangleRounded(Rectangle rec, float roundness, int segments, Color color); // Draw rectangle with rounded edges
|
||||
RLAPI void DrawRectangleRoundedLines(Rectangle rec, float roundness, int segments, int lineThick, Color color); // Draw rectangle with rounded edges outline
|
||||
RLAPI void DrawTriangle(Vector2 v1, Vector2 v2, Vector2 v3, Color color); // Draw a color-filled triangle
|
||||
RLAPI void DrawTriangleLines(Vector2 v1, Vector2 v2, Vector2 v3, Color color); // Draw triangle outline
|
||||
RLAPI void DrawPoly(Vector2 center, int sides, float radius, float rotation, Color color); // Draw a regular polygon (Vector version)
|
||||
|
@ -1201,7 +1201,7 @@ RLAPI void DrawFPS(int posX, int posY);
|
|||
RLAPI void DrawText(const char *text, int posX, int posY, int fontSize, Color color); // Draw text (using default font)
|
||||
RLAPI void DrawTextEx(Font font, const char *text, Vector2 position, float fontSize, float spacing, Color tint); // Draw text using font and additional parameters
|
||||
RLAPI void DrawTextRec(Font font, const char *text, Rectangle rec, float fontSize, float spacing, bool wordWrap, Color tint); // Draw text using font inside rectangle limits
|
||||
RLAPI void DrawTextRecEx(Font font, const char *text, Rectangle rec, float fontSize, float spacing, bool wordWrap, Color tint,
|
||||
RLAPI void DrawTextRecEx(Font font, const char *text, Rectangle rec, float fontSize, float spacing, bool wordWrap, Color tint,
|
||||
int selectStart, int selectLength, Color selectText, Color selectBack); // Draw text using font inside rectangle limits with support for text selection
|
||||
|
||||
// Text misc. functions
|
||||
|
|
28
src/rlgl.h
28
src/rlgl.h
|
@ -1130,22 +1130,22 @@ void rlBegin(int mode)
|
|||
// Make sure current draws[i].vertexCount is aligned a multiple of 4,
|
||||
// that way, following QUADS drawing will keep aligned with index processing
|
||||
// It implies adding some extra alignment vertex at the end of the draw,
|
||||
// those vertex are not processed but they are considered as an additional offset
|
||||
// those vertex are not processed but they are considered as an additional offset
|
||||
// for the next set of vertex to be drawn
|
||||
if (draws[drawsCounter - 1].mode == RL_LINES) draws[drawsCounter - 1].vertexAlignment = ((draws[drawsCounter - 1].vertexCount < 4)? draws[drawsCounter - 1].vertexCount : draws[drawsCounter - 1].vertexCount%4);
|
||||
else if (draws[drawsCounter - 1].mode == RL_TRIANGLES) draws[drawsCounter - 1].vertexAlignment = ((draws[drawsCounter - 1].vertexCount < 4)? 1 : (4 - (draws[drawsCounter - 1].vertexCount%4)));
|
||||
|
||||
|
||||
if (rlCheckBufferLimit(draws[drawsCounter - 1].vertexAlignment)) rlglDraw();
|
||||
else
|
||||
{
|
||||
vertexData[currentBuffer].vCounter += draws[drawsCounter - 1].vertexAlignment;
|
||||
vertexData[currentBuffer].cCounter += draws[drawsCounter - 1].vertexAlignment;
|
||||
vertexData[currentBuffer].tcCounter += draws[drawsCounter - 1].vertexAlignment;
|
||||
|
||||
|
||||
drawsCounter++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (drawsCounter >= MAX_DRAWCALL_REGISTERED) rlglDraw();
|
||||
|
||||
draws[drawsCounter - 1].mode = mode;
|
||||
|
@ -1301,22 +1301,22 @@ void rlEnableTexture(unsigned int id)
|
|||
// Make sure current draws[i].vertexCount is aligned a multiple of 4,
|
||||
// that way, following QUADS drawing will keep aligned with index processing
|
||||
// It implies adding some extra alignment vertex at the end of the draw,
|
||||
// those vertex are not processed but they are considered as an additional offset
|
||||
// those vertex are not processed but they are considered as an additional offset
|
||||
// for the next set of vertex to be drawn
|
||||
if (draws[drawsCounter - 1].mode == RL_LINES) draws[drawsCounter - 1].vertexAlignment = ((draws[drawsCounter - 1].vertexCount < 4)? draws[drawsCounter - 1].vertexCount : draws[drawsCounter - 1].vertexCount%4);
|
||||
else if (draws[drawsCounter - 1].mode == RL_TRIANGLES) draws[drawsCounter - 1].vertexAlignment = ((draws[drawsCounter - 1].vertexCount < 4)? 1 : (4 - (draws[drawsCounter - 1].vertexCount%4)));
|
||||
|
||||
|
||||
if (rlCheckBufferLimit(draws[drawsCounter - 1].vertexAlignment)) rlglDraw();
|
||||
else
|
||||
{
|
||||
vertexData[currentBuffer].vCounter += draws[drawsCounter - 1].vertexAlignment;
|
||||
vertexData[currentBuffer].cCounter += draws[drawsCounter - 1].vertexAlignment;
|
||||
vertexData[currentBuffer].tcCounter += draws[drawsCounter - 1].vertexAlignment;
|
||||
|
||||
|
||||
drawsCounter++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (drawsCounter >= MAX_DRAWCALL_REGISTERED) rlglDraw();
|
||||
|
||||
draws[drawsCounter - 1].textureId = id;
|
||||
|
@ -2044,7 +2044,7 @@ unsigned int rlLoadTexture(void *data, int width, int height, int format, int mi
|
|||
unsigned int rlLoadTextureDepth(int width, int height, int bits, bool useRenderBuffer)
|
||||
{
|
||||
unsigned int id = 0;
|
||||
|
||||
|
||||
#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)
|
||||
unsigned int glInternalFormat = GL_DEPTH_COMPONENT16;
|
||||
|
||||
|
@ -2103,7 +2103,7 @@ unsigned int rlLoadTextureCubemap(void *data, int size, int format)
|
|||
{
|
||||
unsigned int cubemapId = 0;
|
||||
unsigned int dataSize = GetPixelDataSize(size, size, format);
|
||||
|
||||
|
||||
#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)
|
||||
glGenTextures(1, &cubemapId);
|
||||
glBindTexture(GL_TEXTURE_CUBE_MAP, cubemapId);
|
||||
|
@ -2305,7 +2305,7 @@ void rlRenderTextureAttach(RenderTexture2D target, unsigned int id, int attachTy
|
|||
bool rlRenderTextureComplete(RenderTexture target)
|
||||
{
|
||||
bool result = false;
|
||||
|
||||
|
||||
#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, target.id);
|
||||
|
||||
|
@ -4196,7 +4196,7 @@ static void DrawBuffersDefault(void)
|
|||
glUniformMatrix4fv(currentShader.locs[LOC_MATRIX_MVP], 1, false, MatrixToFloat(matMVP));
|
||||
glUniform4f(currentShader.locs[LOC_COLOR_DIFFUSE], 1.0f, 1.0f, 1.0f, 1.0f);
|
||||
glUniform1i(currentShader.locs[LOC_MAP_DIFFUSE], 0); // Provided value refers to the texture unit (active)
|
||||
|
||||
|
||||
// TODO: Support additional texture units on custom shader
|
||||
//if (currentShader->locs[LOC_MAP_SPECULAR] > 0) glUniform1i(currentShader.locs[LOC_MAP_SPECULAR], 1);
|
||||
//if (currentShader->locs[LOC_MAP_NORMAL] > 0) glUniform1i(currentShader.locs[LOC_MAP_NORMAL], 2);
|
||||
|
@ -4231,7 +4231,7 @@ static void DrawBuffersDefault(void)
|
|||
for (int i = 0; i < drawsCounter; i++)
|
||||
{
|
||||
glBindTexture(GL_TEXTURE_2D, draws[i].textureId);
|
||||
|
||||
|
||||
// TODO: Find some way to bind additional textures --> Use global texture IDs? Register them on draw[i]?
|
||||
//if (currentShader->locs[LOC_MAP_SPECULAR] > 0) { glActiveTexture(GL_TEXTURE1); glBindTexture(GL_TEXTURE_2D, textureUnit1_id); }
|
||||
//if (currentShader->locs[LOC_MAP_SPECULAR] > 0) { glActiveTexture(GL_TEXTURE2); glBindTexture(GL_TEXTURE_2D, textureUnit2_id); }
|
||||
|
@ -4248,7 +4248,7 @@ static void DrawBuffersDefault(void)
|
|||
glDrawElements(GL_TRIANGLES, draws[i].vertexCount/4*6, GL_UNSIGNED_SHORT, (GLvoid *)(sizeof(GLushort)*vertexOffset/4*6));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
vertexOffset += (draws[i].vertexCount + draws[i].vertexAlignment);
|
||||
}
|
||||
|
||||
|
|
|
@ -181,7 +181,7 @@ static Image LoadASTC(const char *fileName); // Load ASTC file
|
|||
Image LoadImage(const char *fileName)
|
||||
{
|
||||
Image image = { 0 };
|
||||
|
||||
|
||||
#if defined(SUPPORT_FILEFORMAT_PNG) || \
|
||||
defined(SUPPORT_FILEFORMAT_BMP) || \
|
||||
defined(SUPPORT_FILEFORMAT_TGA) || \
|
||||
|
@ -744,7 +744,7 @@ Image GetTextureData(Texture2D texture)
|
|||
RLAPI Image GetScreenData(void)
|
||||
{
|
||||
Image image = { 0 };
|
||||
|
||||
|
||||
image.width = GetScreenWidth();
|
||||
image.height = GetScreenHeight();
|
||||
image.mipmaps = 1;
|
||||
|
@ -1411,13 +1411,13 @@ void ImageResizeNN(Image *image,int newWidth,int newHeight)
|
|||
void ImageResizeCanvas(Image *image, int newWidth,int newHeight, int offsetX, int offsetY, Color color)
|
||||
{
|
||||
// TODO: Review different scaling situations
|
||||
|
||||
|
||||
if ((newWidth != image->width) || (newHeight != image->height))
|
||||
{
|
||||
if ((newWidth > image->width) && (newHeight > image->height))
|
||||
{
|
||||
Image imTemp = GenImageColor(newWidth, newHeight, color);
|
||||
|
||||
|
||||
Rectangle srcRec = { 0.0f, 0.0f, (float)image->width, (float)image->height };
|
||||
Rectangle dstRec = { (float)offsetX, (float)offsetY, (float)srcRec.width, (float)srcRec.height };
|
||||
|
||||
|
@ -1434,23 +1434,23 @@ void ImageResizeCanvas(Image *image, int newWidth,int newHeight, int offsetX, in
|
|||
else // One side is bigger and the other is smaller
|
||||
{
|
||||
Image imTemp = GenImageColor(newWidth, newHeight, color);
|
||||
|
||||
|
||||
Rectangle srcRec = { 0.0f, 0.0f, (float)image->width, (float)image->height };
|
||||
Rectangle dstRec = { (float)offsetX, (float)offsetY, (float)newWidth, (float)newHeight };
|
||||
|
||||
|
||||
if (newWidth < image->width)
|
||||
{
|
||||
srcRec.x = offsetX;
|
||||
srcRec.width = newWidth;
|
||||
|
||||
|
||||
dstRec.x = 0.0f;
|
||||
}
|
||||
|
||||
|
||||
if (newHeight < image->height)
|
||||
{
|
||||
srcRec.y = offsetY;
|
||||
srcRec.height = newHeight;
|
||||
|
||||
|
||||
dstRec.y = 0.0f;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue