summaryrefslogtreecommitdiffhomepage
path: root/src/core.c
diff options
context:
space:
mode:
authorRay <[email protected]>2021-06-22 20:14:44 +0200
committerRay <[email protected]>2021-06-22 20:14:44 +0200
commit7f2a071c5168daf0bf8c7ebbf73d75ba1833bb38 (patch)
tree8c7f14f5a839807b6a88b3612f7d3f0af2251a7c /src/core.c
parent2efb50cc63155af0e2ce8fbaf58aecc77b1b9485 (diff)
downloadraylib-7f2a071c5168daf0bf8c7ebbf73d75ba1833bb38.tar.gz
raylib-7f2a071c5168daf0bf8c7ebbf73d75ba1833bb38.zip
Formatting review
Diffstat (limited to 'src/core.c')
-rw-r--r--src/core.c35
1 files changed, 20 insertions, 15 deletions
diff --git a/src/core.c b/src/core.c
index 9bf9837b..41ef4b4f 100644
--- a/src/core.c
+++ b/src/core.c
@@ -1953,7 +1953,7 @@ void BeginDrawing(void)
void EndDrawing(void)
{
rlDrawRenderBatchActive(); // Update and draw internal render batch
-
+
#if defined(SUPPORT_MOUSE_CURSOR_POINT)
// Draw a small rectangle on mouse position for user reference
if (!CORE.Input.Mouse.cursorHidden)
@@ -2021,7 +2021,7 @@ void EndDrawing(void)
#if !defined(SUPPORT_CUSTOM_FRAME_CONTROL)
SwapScreenBuffer(); // Copy back buffer to front buffer (screen)
-
+
// Frame time control system
CORE.Time.current = GetTime();
CORE.Time.draw = CORE.Time.current - CORE.Time.previous;
@@ -2043,7 +2043,7 @@ void EndDrawing(void)
PollInputEvents(); // Poll user events
#endif
-
+
#if defined(SUPPORT_EVENTS_AUTOMATION)
// Events recording and playing logic
if (eventsRecording) RecordAutomationEvent(CORE.Time.frameCounter);
@@ -2642,8 +2642,8 @@ void SetTargetFPS(int fps)
int GetFPS(void)
{
int fps = 0;
-
-#if !defined(SUPPORT_CUSTOM_FRAME_CONTROL)
+
+#if !defined(SUPPORT_CUSTOM_FRAME_CONTROL)
#define FPS_CAPTURE_FRAMES_COUNT 30 // 30 captures
#define FPS_AVERAGE_TIME_SECONDS 0.5f // 500 millisecondes
#define FPS_STEP (FPS_AVERAGE_TIME_SECONDS/FPS_CAPTURE_FRAMES_COUNT)
@@ -2663,7 +2663,7 @@ int GetFPS(void)
history[index] = fpsFrame/FPS_CAPTURE_FRAMES_COUNT;
average += history[index];
}
-
+
fps = (int)roundf(1.0f/average);
#endif
@@ -5102,19 +5102,22 @@ 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
CORE.Window.currentFbo.width = width;
@@ -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
+#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)
@@ -6875,7 +6880,7 @@ static void LoadAutomationEvents(const char *fileName)
{
sscanf(buffer, "e %d %d %d %d %d", &events[count].frame, &events[count].type,
&events[count].params[0], &events[count].params[1], &events[count].params[2]);
-
+
count++;
}