single bg color
This commit is contained in:
1 parent
e0f54dde75
commit
56d4b2dd88
4 files changed
+6
-42
No files matched your search
@@ -12,7 +12,6 @@
|
||||
|
||||
#include "../raybri.h"
|
||||
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <libEGL/libEGL.h>
|
||||
@@ -41,25 +40,6 @@ static void sr_log(const char *text)
|
||||
fflush(stderr);
|
||||
}
|
||||
|
||||
static void sr_hsv_to_rgb(float h, float s, float v, float *r, float *g, float *b)
|
||||
{
|
||||
float i = floorf(h * 6.0f);
|
||||
float f = h * 6.0f - i;
|
||||
float p = v * (1.0f - s);
|
||||
float q = v * (1.0f - f * s);
|
||||
float t = v * (1.0f - (1.0f - f) * s);
|
||||
|
||||
switch (((int)i) % 6)
|
||||
{
|
||||
case 0: *r = v; *g = t; *b = p; break;
|
||||
case 1: *r = q; *g = v; *b = p; break;
|
||||
case 2: *r = p; *g = v; *b = t; break;
|
||||
case 3: *r = p; *g = q; *b = v; break;
|
||||
case 4: *r = t; *g = p; *b = v; break;
|
||||
default: *r = v; *g = p; *b = q; break;
|
||||
}
|
||||
}
|
||||
|
||||
// (Re)create the EGL window surface on the layer handed to us by UIKit.
|
||||
static int sr_create_surface(void)
|
||||
{
|
||||
@@ -181,20 +161,13 @@ void raybri_resize(int width, int height)
|
||||
sr_log("surface recreated");
|
||||
}
|
||||
|
||||
void raybri_render(double time)
|
||||
void raybri_render(void)
|
||||
{
|
||||
if (!sr_ready) return;
|
||||
|
||||
if (eglMakeCurrent(sr_display, sr_surface, sr_surface, sr_context) == EGL_FALSE) return;
|
||||
|
||||
// Background colour cycles through the hue wheel over time.
|
||||
float hue = fmodf((float)time * 0.15f, 1.0f);
|
||||
float r = 0.0f;
|
||||
float g = 0.0f;
|
||||
float b = 0.0f;
|
||||
sr_hsv_to_rgb(hue, 0.65f, 0.85f, &r, &g, &b);
|
||||
|
||||
rlClearColor((unsigned char)(r * 255.0f), (unsigned char)(g * 255.0f), (unsigned char)(b * 255.0f), 255);
|
||||
rlClearColor(0, 0, 255, 255);
|
||||
rlClearScreenBuffers();
|
||||
|
||||
eglSwapBuffers(sr_display, sr_surface);
|
||||
|
||||
Reference in new issue
Block a user