Formatting review

This commit is contained in:
Ray 2021-06-22 20:14:44 +02:00
parent 2efb50cc63
commit 7f2a071c51
4 changed files with 29 additions and 25 deletions

View file

@ -5102,17 +5102,20 @@ static void ErrorCallback(int error, const char *description)
{
TRACELOG(LOG_WARNING, "GLFW: Error: %i Description: %s", error, description);
}
#if defined(PLATFORM_WEB)
EM_JS(int, CanvasGetWidth, (), { return canvas.clientWidth; });
EM_JS(int, CanvasGetHeight, (), { return canvas.clientHeight; });
EM_JS(int, GetCanvasWidth, (), { return canvas.clientWidth; });
EM_JS(int, GetCanvasHeight, (), { return canvas.clientHeight; });
static EM_BOOL EmscriptenResizeCallback(int eventType, const EmscriptenUiEvent *e, void *userData)
{
// Don't resize non-resizeable windows
if ((CORE.Window.flags & FLAG_WINDOW_RESIZABLE) == 0) return true;
// This event is called whenever the window changes sizes, so the size of
// the canvas object is explicitly retrieved below
int width = CanvasGetWidth();
int height = CanvasGetHeight();
// This event is called whenever the window changes sizes,
// so the size of the canvas object is explicitly retrieved below
int width = GetCanvasWidth();
int height = GetCanvasHeight();
emscripten_set_canvas_element_size("#canvas",width,height);
SetupViewport(width, height); // Reset viewport and projection matrix for new size
@ -5126,9 +5129,11 @@ static EM_BOOL EmscriptenResizeCallback(int eventType, const EmscriptenUiEvent *
// Set current screen size
CORE.Window.screen.width = width;
CORE.Window.screen.height = height;
// NOTE: Postprocessing texture is not scaled to new size
}
#endif
// GLFW3 WindowSize Callback, runs when window is resizedLastFrame
// NOTE: Window resizing not allowed by default
static void WindowSizeCallback(GLFWwindow *window, int width, int height)

View file

@ -931,8 +931,7 @@ void DrawTextRecEx(Font font, const char *text, Rectangle rec, float fontSize, f
{
glyphWidth = (font.chars[index].advanceX == 0) ? font.recs[index].width*scaleFactor : font.chars[index].advanceX*scaleFactor;
if (i + 1 < length)
glyphWidth = glyphWidth + spacing;
if (i + 1 < length) glyphWidth = glyphWidth + spacing;
}
// NOTE: When wordWrap is ON we first measure how much of the text we can draw before going outside of the rec container