Reviewed code TODOs
This commit is contained in:
parent
685273675b
commit
823abf666e
7 changed files with 19 additions and 25 deletions
|
@ -280,9 +280,9 @@ Sound LoadSoundFromWave(Wave wave)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load sound to memory from rRES file (raylib Resource)
|
// Load sound to memory from rRES file (raylib Resource)
|
||||||
|
// TODO: Maybe rresName could be directly a char array with all the data?
|
||||||
Sound LoadSoundFromRES(const char *rresName, int resId)
|
Sound LoadSoundFromRES(const char *rresName, int resId)
|
||||||
{
|
{
|
||||||
// NOTE: rresName could be directly a char array with all the data!!! --> TODO
|
|
||||||
Sound sound = { 0 };
|
Sound sound = { 0 };
|
||||||
|
|
||||||
#if defined(AUDIO_STANDALONE)
|
#if defined(AUDIO_STANDALONE)
|
||||||
|
|
|
@ -375,7 +375,7 @@ static void ProcessCamera(Camera *camera, Vector3 *playerPosition)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Focus to center
|
// Focus to center
|
||||||
// TODO: Move this function out of the module?
|
// TODO: Move this function out of this module?
|
||||||
if (IsKeyDown('Z')) camera->target = (Vector3){ 0.0f, 0.0f, 0.0f };
|
if (IsKeyDown('Z')) camera->target = (Vector3){ 0.0f, 0.0f, 0.0f };
|
||||||
|
|
||||||
// Camera position update
|
// Camera position update
|
||||||
|
|
17
src/core.c
17
src/core.c
|
@ -359,7 +359,7 @@ void InitWindow(int width, int height, struct android_app *state)
|
||||||
if (orientation == ACONFIGURATION_ORIENTATION_PORT) TraceLog(INFO, "PORTRAIT window orientation");
|
if (orientation == ACONFIGURATION_ORIENTATION_PORT) TraceLog(INFO, "PORTRAIT window orientation");
|
||||||
else if (orientation == ACONFIGURATION_ORIENTATION_LAND) TraceLog(INFO, "LANDSCAPE window orientation");
|
else if (orientation == ACONFIGURATION_ORIENTATION_LAND) TraceLog(INFO, "LANDSCAPE window orientation");
|
||||||
|
|
||||||
// TODO: Review, it doesn't work...
|
// TODO: Automatic orientation doesn't seem to work
|
||||||
if (width <= height)
|
if (width <= height)
|
||||||
{
|
{
|
||||||
AConfiguration_setOrientation(app->config, ACONFIGURATION_ORIENTATION_PORT);
|
AConfiguration_setOrientation(app->config, ACONFIGURATION_ORIENTATION_PORT);
|
||||||
|
@ -1246,7 +1246,7 @@ int GetTouchY(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns touch position XY
|
// Returns touch position XY
|
||||||
// TODO: touch position should be scaled depending on display size and render size
|
// TODO: Touch position should be scaled depending on display size and render size
|
||||||
Vector2 GetTouchPosition(int index)
|
Vector2 GetTouchPosition(int index)
|
||||||
{
|
{
|
||||||
Vector2 position = { -1.0f, -1.0f };
|
Vector2 position = { -1.0f, -1.0f };
|
||||||
|
@ -1257,7 +1257,7 @@ Vector2 GetTouchPosition(int index)
|
||||||
|
|
||||||
if ((screenWidth > displayWidth) || (screenHeight > displayHeight))
|
if ((screenWidth > displayWidth) || (screenHeight > displayHeight))
|
||||||
{
|
{
|
||||||
// TODO: Seems to work ok but... review!
|
// TODO: Review touch position scaling for screenSize vs displaySize
|
||||||
position.x = position.x*((float)screenWidth/(float)(displayWidth - renderOffsetX)) - renderOffsetX/2;
|
position.x = position.x*((float)screenWidth/(float)(displayWidth - renderOffsetX)) - renderOffsetX/2;
|
||||||
position.y = position.y*((float)screenHeight/(float)(displayHeight - renderOffsetY)) - renderOffsetY/2;
|
position.y = position.y*((float)screenHeight/(float)(displayHeight - renderOffsetY)) - renderOffsetY/2;
|
||||||
}
|
}
|
||||||
|
@ -1668,8 +1668,7 @@ static void KeyCallback(GLFWwindow *window, int key, int scancode, int action, i
|
||||||
#endif
|
#endif
|
||||||
else currentKeyState[key] = action;
|
else currentKeyState[key] = action;
|
||||||
|
|
||||||
// HACK for GuiTextBox, to deteck back key
|
// TODO: Review (and remove) this HACK for GuiTextBox, to deteck back key
|
||||||
// TODO: Review...
|
|
||||||
if ((key == 259) && (action == GLFW_PRESS)) lastKeyPressed = 3;
|
if ((key == 259) && (action == GLFW_PRESS)) lastKeyPressed = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1678,8 +1677,6 @@ static void MouseButtonCallback(GLFWwindow *window, int button, int action, int
|
||||||
{
|
{
|
||||||
currentMouseState[button] = action;
|
currentMouseState[button] = action;
|
||||||
|
|
||||||
// TODO: Test mouse gestures
|
|
||||||
|
|
||||||
#define ENABLE_MOUSE_GESTURES
|
#define ENABLE_MOUSE_GESTURES
|
||||||
#if defined(ENABLE_MOUSE_GESTURES)
|
#if defined(ENABLE_MOUSE_GESTURES)
|
||||||
// Process mouse events as touches to be able to use mouse-gestures
|
// Process mouse events as touches to be able to use mouse-gestures
|
||||||
|
@ -2046,7 +2043,7 @@ static bool GetKeyStatus(int key)
|
||||||
#if defined(PLATFORM_DESKTOP) || defined(PLATFORM_WEB)
|
#if defined(PLATFORM_DESKTOP) || defined(PLATFORM_WEB)
|
||||||
return glfwGetKey(window, key);
|
return glfwGetKey(window, key);
|
||||||
#elif defined(PLATFORM_ANDROID)
|
#elif defined(PLATFORM_ANDROID)
|
||||||
// TODO: Check virtual keyboard (?)
|
// TODO: Check for virtual keyboard
|
||||||
return false;
|
return false;
|
||||||
#elif defined(PLATFORM_RPI)
|
#elif defined(PLATFORM_RPI)
|
||||||
// NOTE: Keys states are filled in PollInputEvents()
|
// NOTE: Keys states are filled in PollInputEvents()
|
||||||
|
@ -2061,7 +2058,7 @@ static bool GetMouseButtonStatus(int button)
|
||||||
#if defined(PLATFORM_DESKTOP) || defined(PLATFORM_WEB)
|
#if defined(PLATFORM_DESKTOP) || defined(PLATFORM_WEB)
|
||||||
return glfwGetMouseButton(window, button);
|
return glfwGetMouseButton(window, button);
|
||||||
#elif defined(PLATFORM_ANDROID)
|
#elif defined(PLATFORM_ANDROID)
|
||||||
// TODO: Check virtual keyboard (?)
|
// TODO: Check for virtual keyboard
|
||||||
return false;
|
return false;
|
||||||
#elif defined(PLATFORM_RPI)
|
#elif defined(PLATFORM_RPI)
|
||||||
// NOTE: mouse buttons array is filled on PollInputEvents()
|
// NOTE: mouse buttons array is filled on PollInputEvents()
|
||||||
|
@ -2382,7 +2379,7 @@ static void RestoreKeyboard(void)
|
||||||
// Init gamepad system
|
// Init gamepad system
|
||||||
static void InitGamepad(void)
|
static void InitGamepad(void)
|
||||||
{
|
{
|
||||||
// TODO: Gamepad support
|
// TODO: Add Gamepad support
|
||||||
if ((gamepadStream = open(DEFAULT_GAMEPAD_DEV, O_RDONLY|O_NONBLOCK)) < 0) TraceLog(WARNING, "Gamepad device could not be opened, no gamepad available");
|
if ((gamepadStream = open(DEFAULT_GAMEPAD_DEV, O_RDONLY|O_NONBLOCK)) < 0) TraceLog(WARNING, "Gamepad device could not be opened, no gamepad available");
|
||||||
else TraceLog(INFO, "Gamepad device initialized successfully");
|
else TraceLog(INFO, "Gamepad device initialized successfully");
|
||||||
}
|
}
|
||||||
|
|
|
@ -704,7 +704,6 @@ Model LoadHeightmap(Image heightmap, Vector3 size)
|
||||||
// TODO: Calculate normals in an efficient way
|
// TODO: Calculate normals in an efficient way
|
||||||
|
|
||||||
nCounter += 18; // 6 vertex, 18 floats
|
nCounter += 18; // 6 vertex, 18 floats
|
||||||
|
|
||||||
trisCounter += 2;
|
trisCounter += 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
10
src/rlgl.c
10
src/rlgl.c
|
@ -171,7 +171,7 @@ typedef struct {
|
||||||
typedef struct {
|
typedef struct {
|
||||||
GLuint textureId;
|
GLuint textureId;
|
||||||
int vertexCount;
|
int vertexCount;
|
||||||
// TODO: DrawState state -> Blending mode, shader
|
// TODO: Store draw state -> blending mode, shader
|
||||||
} DrawCall;
|
} DrawCall;
|
||||||
|
|
||||||
// pixel type (same as Color type)
|
// pixel type (same as Color type)
|
||||||
|
@ -1475,11 +1475,7 @@ void rlglDrawModel(Model model, Vector3 position, Vector3 rotationAxis, float ro
|
||||||
// Calculate model-view-projection matrix (MVP)
|
// Calculate model-view-projection matrix (MVP)
|
||||||
Matrix matMVP = MatrixMultiply(matModelView, matProjection); // Transform to screen-space coordinates
|
Matrix matMVP = MatrixMultiply(matModelView, matProjection); // Transform to screen-space coordinates
|
||||||
|
|
||||||
// NOTE: Drawing in OpenGL 3.3+, matrices are passed to shader
|
// Send combined model-view-projection matrix to shader
|
||||||
// TODO: Reduce number of matrices passed to shaders, use only matMVP
|
|
||||||
//glUniformMatrix4fv(model.material.shader.modelLoc, 1, false, MatrixToFloat(matModel));
|
|
||||||
//glUniformMatrix4fv(model.material.shader.viewLoc, 1, false, MatrixToFloat(matView));
|
|
||||||
|
|
||||||
glUniformMatrix4fv(model.shader.mvpLoc, 1, false, MatrixToFloat(matMVP));
|
glUniformMatrix4fv(model.shader.mvpLoc, 1, false, MatrixToFloat(matMVP));
|
||||||
|
|
||||||
// Apply color tinting to model
|
// Apply color tinting to model
|
||||||
|
@ -1900,7 +1896,7 @@ void rlglGenerateMipmaps(Texture2D texture)
|
||||||
int mipmapCount = GenerateMipmaps(data, texture.width, texture.height);
|
int mipmapCount = GenerateMipmaps(data, texture.width, texture.height);
|
||||||
|
|
||||||
// TODO: Adjust mipmap size depending on texture format!
|
// TODO: Adjust mipmap size depending on texture format!
|
||||||
int size = texture.width*texture.height*4;
|
int size = texture.width*texture.height*4; // RGBA 32bit only
|
||||||
int offset = size;
|
int offset = size;
|
||||||
|
|
||||||
int mipWidth = texture.width/2;
|
int mipWidth = texture.width/2;
|
||||||
|
|
|
@ -346,7 +346,7 @@ void DrawTextEx(SpriteFont spriteFont, const char *text, Vector2 position, int f
|
||||||
|
|
||||||
for(int i = 0; i < length; i++)
|
for(int i = 0; i < length; i++)
|
||||||
{
|
{
|
||||||
// TODO: Right now we are supposing characters follow a continous order and start at FONT_FIRST_CHAR,
|
// TODO: Right now we are supposing characters that follow a continous order and start at FONT_FIRST_CHAR,
|
||||||
// this sytem can be improved to support any characters order and init value...
|
// this sytem can be improved to support any characters order and init value...
|
||||||
// An intermediate table could be created to link char values with predefined char position index in chars rectangle array
|
// An intermediate table could be created to link char values with predefined char position index in chars rectangle array
|
||||||
|
|
||||||
|
|
|
@ -712,7 +712,7 @@ void ImageDither(Image *image, int rBpp, int gBpp, int bBpp, int aBpp)
|
||||||
{
|
{
|
||||||
oldpixel = pixels[y*image->width + x];
|
oldpixel = pixels[y*image->width + x];
|
||||||
|
|
||||||
// TODO: New pixel obtained by bits truncate, it would be better to round values (check ImageFormat())
|
// NOTE: New pixel obtained by bits truncate, it would be better to round values (check ImageFormat())
|
||||||
newpixel.r = oldpixel.r>>(8 - rBpp); // R bits
|
newpixel.r = oldpixel.r>>(8 - rBpp); // R bits
|
||||||
newpixel.g = oldpixel.g>>(8 - gBpp); // G bits
|
newpixel.g = oldpixel.g>>(8 - gBpp); // G bits
|
||||||
newpixel.b = oldpixel.b>>(8 - bBpp); // B bits
|
newpixel.b = oldpixel.b>>(8 - bBpp); // B bits
|
||||||
|
@ -769,7 +769,7 @@ void ImageDither(Image *image, int rBpp, int gBpp, int bBpp, int aBpp)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Convert image to POT (power-of-two)
|
// Convert image to POT (power-of-two)
|
||||||
// NOTE: Requirement on OpenGL ES 2.0 (RPI, HTML5)
|
// NOTE: It could be useful on OpenGL ES 2.0 (RPI, HTML5)
|
||||||
void ImageToPOT(Image *image, Color fillColor)
|
void ImageToPOT(Image *image, Color fillColor)
|
||||||
{
|
{
|
||||||
Color *pixels = GetImageData(*image); // Get pixels data
|
Color *pixels = GetImageData(*image); // Get pixels data
|
||||||
|
@ -896,7 +896,9 @@ void ImageCrop(Image *image, Rectangle crop)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Resize and image to new size
|
// Resize and image to new size
|
||||||
// NOTE: Uses stb default scaling filter
|
// NOTE: Uses stb default scaling filters (both bicubic):
|
||||||
|
// STBIR_DEFAULT_FILTER_UPSAMPLE STBIR_FILTER_CATMULLROM
|
||||||
|
// STBIR_DEFAULT_FILTER_DOWNSAMPLE STBIR_FILTER_MITCHELL (high-quality Catmull-Rom)
|
||||||
void ImageResize(Image *image, int newWidth, int newHeight)
|
void ImageResize(Image *image, int newWidth, int newHeight)
|
||||||
{
|
{
|
||||||
// Get data as Color pixels array to work with it
|
// Get data as Color pixels array to work with it
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue