Removed trailing spaces
This commit is contained in:
parent
963de06d08
commit
d4382f4a52
@ -664,7 +664,7 @@ void SetAudioBufferPitch(AudioBuffer *buffer, float pitch)
|
||||
// Set pan for an audio buffer
|
||||
void SetAudioBufferPan(AudioBuffer *buffer, float pan)
|
||||
{
|
||||
if (pan < 0.0f) pan = 0.0f;
|
||||
if (pan < 0.0f) pan = 0.0f;
|
||||
else if (pan > 1.0f) pan = 1.0f;
|
||||
|
||||
if (buffer != NULL) buffer->pan = pan;
|
||||
@ -998,7 +998,7 @@ bool ExportWaveAsCode(Wave wave, const char *fileName)
|
||||
success = SaveFileText(fileName, txtData);
|
||||
|
||||
RL_FREE(txtData);
|
||||
|
||||
|
||||
if (success != 0) TRACELOG(LOG_INFO, "FILEIO: [%s] Wave as code exported successfully", fileName);
|
||||
else TRACELOG(LOG_WARNING, "FILEIO: [%s] Failed to export wave as code", fileName);
|
||||
|
||||
|
36
src/rcore.c
36
src/rcore.c
@ -722,7 +722,7 @@ struct android_app *GetAndroidApp(void)
|
||||
void InitWindow(int width, int height, const char *title)
|
||||
{
|
||||
TRACELOG(LOG_INFO, "Initializing raylib %s", RAYLIB_VERSION);
|
||||
|
||||
|
||||
TRACELOG(LOG_INFO, "Supported raylib modules:");
|
||||
TRACELOG(LOG_INFO, " > rcore:..... loaded (mandatory)");
|
||||
TRACELOG(LOG_INFO, " > rlgl:...... loaded (mandatory)");
|
||||
@ -731,12 +731,12 @@ void InitWindow(int width, int height, const char *title)
|
||||
#else
|
||||
TRACELOG(LOG_INFO, " > rshapes:... not loaded (optional)");
|
||||
#endif
|
||||
#if defined(SUPPORT_MODULE_RTEXTURES)
|
||||
#if defined(SUPPORT_MODULE_RTEXTURES)
|
||||
TRACELOG(LOG_INFO, " > rtextures:. loaded (optional)");
|
||||
#else
|
||||
TRACELOG(LOG_INFO, " > rtextures:. not loaded (optional)");
|
||||
#endif
|
||||
#if defined(SUPPORT_MODULE_RTEXT)
|
||||
#endif
|
||||
#if defined(SUPPORT_MODULE_RTEXT)
|
||||
TRACELOG(LOG_INFO, " > rtext:..... loaded (optional)");
|
||||
#else
|
||||
TRACELOG(LOG_INFO, " > rtext:..... not loaded (optional)");
|
||||
@ -746,7 +746,7 @@ void InitWindow(int width, int height, const char *title)
|
||||
#else
|
||||
TRACELOG(LOG_INFO, " > rmodels:... not loaded (optional)");
|
||||
#endif
|
||||
#if defined(SUPPORT_MODULE_RAUDIO)
|
||||
#if defined(SUPPORT_MODULE_RAUDIO)
|
||||
TRACELOG(LOG_INFO, " > raudio:.... loaded (optional)");
|
||||
#else
|
||||
TRACELOG(LOG_INFO, " > raudio:.... not loaded (optional)");
|
||||
@ -890,7 +890,7 @@ void InitWindow(int width, int height, const char *title)
|
||||
//emscripten_set_resize_callback(EMSCRIPTEN_EVENT_TARGET_WINDOW, NULL, 1, EmscriptenResizeCallback);
|
||||
// Trigger this once to get initial window sizing
|
||||
//EmscriptenResizeCallback(EMSCRIPTEN_EVENT_RESIZE, NULL, NULL);
|
||||
|
||||
|
||||
// Support keyboard events -> Not used, GLFW.JS takes care of that
|
||||
//emscripten_set_keypress_callback("#canvas", NULL, 1, EmscriptenKeyboardCallback);
|
||||
//emscripten_set_keydown_callback("#canvas", NULL, 1, EmscriptenKeyboardCallback);
|
||||
@ -1276,7 +1276,7 @@ void ToggleFullscreen(void)
|
||||
int width, height;
|
||||
emscripten_get_canvas_element_size("#canvas", &width, &height);
|
||||
TRACELOG(LOG_WARNING, "Emscripten: Exit fullscreen: Canvas size: %i x %i", width, height);
|
||||
|
||||
|
||||
CORE.Window.fullscreen = false; // Toggle fullscreen flag
|
||||
CORE.Window.flags &= ~FLAG_FULLSCREEN_MODE;
|
||||
}
|
||||
@ -2750,7 +2750,7 @@ void TakeScreenshot(const char *fileName)
|
||||
|
||||
char path[2048] = { 0 };
|
||||
strcpy(path, TextFormat("%s/%s", CORE.Storage.basePath, fileName));
|
||||
|
||||
|
||||
ExportImage(image, path); // WARNING: Module required: rtextures
|
||||
RL_FREE(imgData);
|
||||
|
||||
@ -2798,7 +2798,7 @@ bool FileExists(const char *fileName)
|
||||
|
||||
// NOTE: Alternatively, stat() can be used instead of access()
|
||||
//#include <sys/stat.h>
|
||||
//struct stat statbuf;
|
||||
//struct stat statbuf;
|
||||
//if (stat(filename, &statbuf) == 0) result = true;
|
||||
|
||||
return result;
|
||||
@ -2856,9 +2856,9 @@ bool DirectoryExists(const char *dirPath)
|
||||
int GetFileLength(const char *fileName)
|
||||
{
|
||||
int size = 0;
|
||||
|
||||
|
||||
FILE *file = fopen(fileName, "rb");
|
||||
|
||||
|
||||
if (file != NULL)
|
||||
{
|
||||
fseek(file, 0L, SEEK_END);
|
||||
@ -3093,7 +3093,7 @@ char **GetDirectoryFiles(const char *dirPath, int *fileCount)
|
||||
if (dir != NULL) // It's a directory
|
||||
{
|
||||
// Count files
|
||||
while ((entity = readdir(dir)) != NULL) counter++;
|
||||
while ((entity = readdir(dir)) != NULL) counter++;
|
||||
|
||||
dirFileCount = counter;
|
||||
*fileCount = dirFileCount;
|
||||
@ -3101,7 +3101,7 @@ char **GetDirectoryFiles(const char *dirPath, int *fileCount)
|
||||
// Memory allocation for dirFileCount
|
||||
dirFilesPath = (char **)RL_MALLOC(dirFileCount*sizeof(char *));
|
||||
for (int i = 0; i < dirFileCount; i++) dirFilesPath[i] = (char *)RL_MALLOC(MAX_FILEPATH_LENGTH*sizeof(char));
|
||||
|
||||
|
||||
// Reset our position in the directory to the beginning
|
||||
rewinddir(dir);
|
||||
|
||||
@ -4162,7 +4162,7 @@ static bool InitGraphicsDevice(int width, int height)
|
||||
glfwSwapInterval(1);
|
||||
TRACELOG(LOG_INFO, "DISPLAY: Trying to enable VSYNC");
|
||||
}
|
||||
|
||||
|
||||
int fbWidth = CORE.Window.screen.width;
|
||||
int fbHeight = CORE.Window.screen.height;
|
||||
|
||||
@ -4187,7 +4187,7 @@ static bool InitGraphicsDevice(int width, int height)
|
||||
CORE.Window.render.height = fbHeight;
|
||||
CORE.Window.currentFbo.width = fbWidth;
|
||||
CORE.Window.currentFbo.height = fbHeight;
|
||||
|
||||
|
||||
TRACELOG(LOG_INFO, "DISPLAY: Device initialized successfully");
|
||||
TRACELOG(LOG_INFO, " > Display size: %i x %i", CORE.Window.display.width, CORE.Window.display.height);
|
||||
TRACELOG(LOG_INFO, " > Screen size: %i x %i", CORE.Window.screen.width, CORE.Window.screen.height);
|
||||
@ -4601,7 +4601,7 @@ static bool InitGraphicsDevice(int width, int height)
|
||||
CORE.Window.render.height = CORE.Window.screen.height;
|
||||
CORE.Window.currentFbo.width = CORE.Window.render.width;
|
||||
CORE.Window.currentFbo.height = CORE.Window.render.height;
|
||||
|
||||
|
||||
TRACELOG(LOG_INFO, "DISPLAY: Device initialized successfully");
|
||||
TRACELOG(LOG_INFO, " > Display size: %i x %i", CORE.Window.display.width, CORE.Window.display.height);
|
||||
TRACELOG(LOG_INFO, " > Screen size: %i x %i", CORE.Window.screen.width, CORE.Window.screen.height);
|
||||
@ -4940,7 +4940,7 @@ void PollInputEvents(void)
|
||||
|
||||
// Register previous touch states
|
||||
for (int i = 0; i < MAX_TOUCH_POINTS; i++) CORE.Input.Touch.previousTouchState[i] = CORE.Input.Touch.currentTouchState[i];
|
||||
|
||||
|
||||
// Reset touch positions
|
||||
// TODO: It resets on PLATFORM_WEB the mouse position and not filled again until a move-event,
|
||||
// so, if mouse is not moved it returns a (0, 0) position... this behaviour should be reviewed!
|
||||
@ -5224,7 +5224,7 @@ static void KeyCallback(GLFWwindow *window, int key, int scancode, int action, i
|
||||
CORE.Input.Keyboard.keyPressedQueue[CORE.Input.Keyboard.keyPressedQueueCount] = key;
|
||||
CORE.Input.Keyboard.keyPressedQueueCount++;
|
||||
}
|
||||
|
||||
|
||||
// Check the exit key to set close window
|
||||
if ((key == CORE.Input.Keyboard.exitKey) && (action == GLFW_PRESS)) glfwSetWindowShouldClose(CORE.Window.handle, GLFW_TRUE);
|
||||
|
||||
|
@ -1692,7 +1692,7 @@ bool ExportMesh(Mesh mesh, const char *fileName)
|
||||
{
|
||||
for (int i = 0, v = 0; i < mesh.triangleCount; i++, v += 3)
|
||||
{
|
||||
byteCount += sprintf(txtData + byteCount, "f %i/%i/%i %i/%i/%i %i/%i/%i\n",
|
||||
byteCount += sprintf(txtData + byteCount, "f %i/%i/%i %i/%i/%i %i/%i/%i\n",
|
||||
mesh.indices[v] + 1, mesh.indices[v] + 1, mesh.indices[v] + 1,
|
||||
mesh.indices[v + 1] + 1, mesh.indices[v + 1] + 1, mesh.indices[v + 1] + 1,
|
||||
mesh.indices[v + 2] + 1, mesh.indices[v + 2] + 1, mesh.indices[v + 2] + 1);
|
||||
@ -4543,7 +4543,7 @@ static Image LoadImageFromCgltfImage(cgltf_image *cgltfImage, const char *texPat
|
||||
|
||||
cgltf_options options = { 0 };
|
||||
cgltf_result result = cgltf_load_buffer_base64(&options, outSize, cgltfImage->uri + i + 1, &data);
|
||||
|
||||
|
||||
if (result == cgltf_result_success)
|
||||
{
|
||||
image = LoadImageFromMemory(".png", (unsigned char *)data, outSize);
|
||||
@ -4571,12 +4571,12 @@ static Image LoadImageFromCgltfImage(cgltf_image *cgltfImage, const char *texPat
|
||||
|
||||
// Check mime_type for image: (cgltfImage->mime_type == "image/png")
|
||||
// NOTE: Detected that some models define mime_type as "image\\/png"
|
||||
if ((strcmp(cgltfImage->mime_type, "image\\/png") == 0) ||
|
||||
if ((strcmp(cgltfImage->mime_type, "image\\/png") == 0) ||
|
||||
(strcmp(cgltfImage->mime_type, "image/png") == 0)) image = LoadImageFromMemory(".png", data, (int)cgltfImage->buffer_view->size);
|
||||
else if ((strcmp(cgltfImage->mime_type, "image\\/jpeg") == 0) ||
|
||||
(strcmp(cgltfImage->mime_type, "image/jpeg") == 0)) image = LoadImageFromMemory(".jpg", data, (int)cgltfImage->buffer_view->size);
|
||||
else TRACELOG(LOG_WARNING, "MODEL: glTF image data MIME type not recognized", TextFormat("%s/%s", texPath, cgltfImage->uri));
|
||||
|
||||
|
||||
RL_FREE(data);
|
||||
}
|
||||
|
||||
@ -4637,7 +4637,7 @@ static Model LoadGLTF(const char *fileName)
|
||||
cgltf_options options = { 0 };
|
||||
cgltf_data *data = NULL;
|
||||
cgltf_result result = cgltf_parse(&options, fileData, dataSize, &data);
|
||||
|
||||
|
||||
if (result == cgltf_result_success)
|
||||
{
|
||||
if (data->file_type == cgltf_file_type_glb) TRACELOG(LOG_INFO, "MODEL: [%s] Model basic data (glb) loaded successfully", fileName);
|
||||
@ -4665,7 +4665,7 @@ static Model LoadGLTF(const char *fileName)
|
||||
for (int i = 0; i < model.meshCount; i++) model.meshes[i].vboId = (unsigned int*)RL_CALLOC(MAX_MESH_VERTEX_BUFFERS, sizeof(unsigned int));
|
||||
|
||||
// NOTE: We keep an extra slot for default material, in case some mesh requires it
|
||||
model.materialCount = (int)data->materials_count + 1;
|
||||
model.materialCount = (int)data->materials_count + 1;
|
||||
model.materials = RL_CALLOC(model.materialCount, sizeof(Material));
|
||||
model.materials[0] = LoadMaterialDefault(); // Load default material (index: 0)
|
||||
|
||||
@ -4708,8 +4708,8 @@ static Model LoadGLTF(const char *fileName)
|
||||
model.materials[j].maps[MATERIAL_MAP_ROUGHNESS].texture = LoadTextureFromImage(imMetallicRoughness);
|
||||
UnloadImage(imMetallicRoughness);
|
||||
}
|
||||
|
||||
// Load metallic/roughness material properties
|
||||
|
||||
// Load metallic/roughness material properties
|
||||
float roughness = data->materials[i].pbr_metallic_roughness.roughness_factor;
|
||||
model.materials[j].maps[MATERIAL_MAP_ROUGHNESS].value = roughness;
|
||||
|
||||
@ -4757,7 +4757,7 @@ static Model LoadGLTF(const char *fileName)
|
||||
}
|
||||
}
|
||||
|
||||
// Other possible materials not supported by raylib pipeline:
|
||||
// Other possible materials not supported by raylib pipeline:
|
||||
// has_clearcoat, has_transmission, has_volume, has_ior, has specular, has_sheen
|
||||
}
|
||||
|
||||
@ -4787,7 +4787,7 @@ static Model LoadGLTF(const char *fileName)
|
||||
|
||||
if ((attribute->component_type == cgltf_component_type_r_32f) && (attribute->type == cgltf_type_vec3))
|
||||
{
|
||||
// Init raylib mesh vertices to copy glTF attribute data
|
||||
// Init raylib mesh vertices to copy glTF attribute data
|
||||
model.meshes[meshIndex].vertexCount = (int)attribute->count;
|
||||
model.meshes[meshIndex].vertices = RL_MALLOC(attribute->count*3*sizeof(float));
|
||||
|
||||
|
@ -6,12 +6,12 @@
|
||||
* Shapes can be draw using 3 types of primitives: LINES, TRIANGLES and QUADS.
|
||||
* Some functions implement two drawing options: TRIANGLES and QUADS, by default TRIANGLES
|
||||
* are used but QUADS implementation can be selected with SUPPORT_QUADS_DRAW_MODE define
|
||||
*
|
||||
* Some functions define texture coordinates (rlTexCoord2f()) for the shapes and use a
|
||||
*
|
||||
* Some functions define texture coordinates (rlTexCoord2f()) for the shapes and use a
|
||||
* user-provided texture with SetShapesTexture(), the pourpouse of this implementation
|
||||
* is allowing to reduce draw calls when combined with a texture-atlas.
|
||||
*
|
||||
* By default, raylib sets the default texture and rectangle at InitWindow()[rcore] to one
|
||||
* By default, raylib sets the default texture and rectangle at InitWindow()[rcore] to one
|
||||
* white character of default font [rtext], this way, raylib text and shapes can be draw with
|
||||
* a single draw call and it also allows users to configure it the same way with their own fonts.
|
||||
*
|
||||
@ -723,7 +723,7 @@ void DrawRectanglePro(Rectangle rec, Vector2 origin, float rotation, Color color
|
||||
rlCheckRenderBatchLimit(4);
|
||||
|
||||
rlSetTexture(texShapes.id);
|
||||
|
||||
|
||||
rlBegin(RL_QUADS);
|
||||
|
||||
rlNormal3f(0.0f, 0.0f, 1.0f);
|
||||
@ -742,13 +742,13 @@ void DrawRectanglePro(Rectangle rec, Vector2 origin, float rotation, Color color
|
||||
rlVertex2f(topRight.x, topRight.y);
|
||||
|
||||
rlEnd();
|
||||
|
||||
|
||||
rlSetTexture(0);
|
||||
#else
|
||||
rlCheckRenderBatchLimit(6);
|
||||
|
||||
rlBegin(RL_TRIANGLES);
|
||||
|
||||
|
||||
rlColor4ub(color.r, color.g, color.b, color.a);
|
||||
|
||||
rlVertex2f(topLeft.x, topLeft.y);
|
||||
@ -1609,7 +1609,7 @@ bool CheckCollisionPointRec(Vector2 point, Rectangle rec)
|
||||
bool CheckCollisionPointCircle(Vector2 point, Vector2 center, float radius)
|
||||
{
|
||||
bool collision = false;
|
||||
|
||||
|
||||
collision = CheckCollisionCircles(point, 0, center, radius);
|
||||
|
||||
return collision;
|
||||
@ -1681,7 +1681,7 @@ bool CheckCollisionCircleRec(Vector2 center, float radius, Rectangle rec)
|
||||
(dy - rec.height/2.0f)*(dy - rec.height/2.0f);
|
||||
|
||||
collision = (cornerDistanceSq <= (radius*radius));
|
||||
|
||||
|
||||
return collision;
|
||||
}
|
||||
|
||||
@ -1695,10 +1695,10 @@ bool CheckCollisionLines(Vector2 startPos1, Vector2 endPos1, Vector2 startPos2,
|
||||
if (fabsf(div) >= FLT_EPSILON)
|
||||
{
|
||||
collision = true;
|
||||
|
||||
|
||||
float xi = ((startPos2.x - endPos2.x)*(startPos1.x*endPos1.y - startPos1.y*endPos1.x) - (startPos1.x - endPos1.x)*(startPos2.x*endPos2.y - startPos2.y*endPos2.x))/div;
|
||||
float yi = ((startPos2.y - endPos2.y)*(startPos1.x*endPos1.y - startPos1.y*endPos1.x) - (startPos1.y - endPos1.y)*(startPos2.x*endPos2.y - startPos2.y*endPos2.x))/div;
|
||||
|
||||
|
||||
if (((fabsf(startPos1.x - endPos1.x) > FLT_EPSILON) && (xi < fminf(startPos1.x, endPos1.x) || (xi > fmaxf(startPos1.x, endPos1.x)))) ||
|
||||
((fabsf(startPos2.x - endPos2.x) > FLT_EPSILON) && (xi < fminf(startPos2.x, endPos2.x) || (xi > fmaxf(startPos2.x, endPos2.x)))) ||
|
||||
((fabsf(startPos1.y - endPos1.y) > FLT_EPSILON) && (yi < fminf(startPos1.y, endPos1.y) || (yi > fmaxf(startPos1.y, endPos1.y)))) ||
|
||||
|
@ -825,7 +825,7 @@ void UnloadFont(Font font)
|
||||
bool ExportFontAsCode(Font font, const char *fileName)
|
||||
{
|
||||
bool success = false;
|
||||
|
||||
|
||||
#ifndef TEXT_BYTES_PER_LINE
|
||||
#define TEXT_BYTES_PER_LINE 20
|
||||
#endif
|
||||
@ -865,7 +865,7 @@ bool ExportFontAsCode(Font font, const char *fileName)
|
||||
Image image = LoadImageFromTexture(font.texture);
|
||||
if (image.format != PIXELFORMAT_UNCOMPRESSED_GRAY_ALPHA) TRACELOG(LOG_WARNING, "Font export as code: Font image format is not GRAY+ALPHA!");
|
||||
int imageDataSize = GetPixelDataSize(image.width, image.height, image.format);
|
||||
|
||||
|
||||
// Image data is usually GRAYSCALE + ALPHA and can be reduced to GRAYSCALE
|
||||
//ImageFormat(&image, PIXELFORMAT_UNCOMPRESSED_GRAYSCALE);
|
||||
|
||||
@ -874,7 +874,7 @@ bool ExportFontAsCode(Font font, const char *fileName)
|
||||
// WARNING: Data is compressed using raylib CompressData() DEFLATE,
|
||||
// it requires to be decompressed with raylib DecompressData(), that requires
|
||||
// compiling raylib with SUPPORT_COMPRESSION_API config flag enabled
|
||||
|
||||
|
||||
// Compress font image data
|
||||
int compDataSize = 0;
|
||||
unsigned char *compData = CompressData(image.data, imageDataSize, &compDataSize);
|
||||
|
@ -133,7 +133,7 @@
|
||||
#if defined(SUPPORT_FILEFORMAT_QOI)
|
||||
#define QOI_MALLOC RL_MALLOC
|
||||
#define QOI_FREE RL_FREE
|
||||
|
||||
|
||||
#define QOI_IMPLEMENTATION
|
||||
#include "external/qoi.h"
|
||||
#endif
|
||||
@ -375,7 +375,7 @@ Image LoadImageFromMemory(const char *fileType, const unsigned char *fileData, i
|
||||
}
|
||||
#endif
|
||||
#if defined(SUPPORT_FILEFORMAT_QOI)
|
||||
else if (strcmp(fileType, ".qoi") == 0)
|
||||
else if (strcmp(fileType, ".qoi") == 0)
|
||||
{
|
||||
qoi_desc desc = { 0 };
|
||||
image.data = qoi_decode(fileData, dataSize, &desc, 4);
|
||||
@ -500,7 +500,7 @@ bool ExportImage(Image image, const char *fileName)
|
||||
else if (IsFileExtension(fileName, ".tga")) success = stbi_write_tga(fileName, image.width, image.height, channels, imgData);
|
||||
#endif
|
||||
#if defined(SUPPORT_FILEFORMAT_JPG)
|
||||
else if (IsFileExtension(fileName, ".jpg") ||
|
||||
else if (IsFileExtension(fileName, ".jpg") ||
|
||||
IsFileExtension(fileName, ".jpeg")) success = stbi_write_jpg(fileName, image.width, image.height, channels, imgData, 90); // JPG quality: between 1 and 100
|
||||
#endif
|
||||
#if defined(SUPPORT_FILEFORMAT_QOI)
|
||||
@ -510,11 +510,11 @@ bool ExportImage(Image image, const char *fileName)
|
||||
if (image.format == PIXELFORMAT_UNCOMPRESSED_R8G8B8) channels = 3;
|
||||
else if (image.format == PIXELFORMAT_UNCOMPRESSED_R8G8B8A8) channels = 4;
|
||||
else TRACELOG(LOG_WARNING, "IMAGE: Image pixel format must be R8G8B8 or R8G8B8A8");
|
||||
|
||||
|
||||
if ((channels == 3) || (channels == 4))
|
||||
{
|
||||
qoi_desc desc = { 0 };
|
||||
desc.width = image.width;
|
||||
desc.width = image.width;
|
||||
desc.height = image.height;
|
||||
desc.channels = channels;
|
||||
desc.colorspace = QOI_SRGB;
|
||||
@ -2771,7 +2771,7 @@ void ImageDraw(Image *dst, Image src, Rectangle srcRec, Rectangle dstRec, Color
|
||||
// [x] Consider fast path: same src/dst format with no alpha -> direct line copy
|
||||
// [-] GetPixelColor(): Get Vector4 instead of Color, easier for ColorAlphaBlend()
|
||||
// [ ] Support f32bit channels drawing
|
||||
|
||||
|
||||
// TODO: Support PIXELFORMAT_UNCOMPRESSED_R32, PIXELFORMAT_UNCOMPRESSED_R32G32B32, PIXELFORMAT_UNCOMPRESSED_R32G32B32A32
|
||||
|
||||
Color colSrc, colDst, blend;
|
||||
@ -2954,7 +2954,7 @@ TextureCubemap LoadTextureCubemap(Image image, int layout)
|
||||
ImageFormat(&faces, image.format);
|
||||
|
||||
// NOTE: Image formating does not work with compressed textures
|
||||
|
||||
|
||||
for (int i = 0; i < 6; i++) ImageDraw(&faces, image, faceRecs[i], (Rectangle){ 0, (float)size*i, (float)size, (float)size }, WHITE);
|
||||
}
|
||||
|
||||
|
112
src/shell.html
112
src/shell.html
@ -3,14 +3,14 @@
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
|
||||
|
||||
<title>raylib web game</title>
|
||||
|
||||
|
||||
<meta name="title" content="raylib web game">
|
||||
<meta name="description" content="New raylib web videogame, developed using raylib videogames library">
|
||||
<meta name="keywords" content="raylib, games, html5, programming, C, C++, library, learn, videogames">
|
||||
<meta name="viewport" content="width=device-width">
|
||||
|
||||
|
||||
<!-- Open Graph metatags for sharing -->
|
||||
<meta property="og:title" content="raylib web game">
|
||||
<meta property="og:image:type" content="image/png">
|
||||
@ -26,30 +26,30 @@
|
||||
<meta name="twitter:image" content="https://www.raylib.com/common/raylib_logo.png">
|
||||
<meta name="twitter:url" content="https://www.raylib.com/games.html">
|
||||
<meta name="twitter:description" content="New raylib web game, developed using raylib videogames library">
|
||||
|
||||
|
||||
<!-- Favicon -->
|
||||
<link rel="shortcut icon" href="https://www.raylib.com/favicon.ico">
|
||||
|
||||
|
||||
<style>
|
||||
body {
|
||||
font-family: arial;
|
||||
margin: 0;
|
||||
body {
|
||||
font-family: arial;
|
||||
margin: 0;
|
||||
padding: none;
|
||||
}
|
||||
|
||||
#header {
|
||||
width: 100%;
|
||||
height: 80px;
|
||||
background-color: #888888;
|
||||
|
||||
#header {
|
||||
width: 100%;
|
||||
height: 80px;
|
||||
background-color: #888888;
|
||||
}
|
||||
|
||||
|
||||
/* NOTE: raylib logo is embedded in the page as base64 png image */
|
||||
#logo {
|
||||
width:64px;
|
||||
height:64px;
|
||||
float:left;
|
||||
position:relative;
|
||||
margin:10px;
|
||||
#logo {
|
||||
width:64px;
|
||||
height:64px;
|
||||
float:left;
|
||||
position:relative;
|
||||
margin:10px;
|
||||
background-image:url('data:image/png;base64,\
|
||||
iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAIAAAAlC+aJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADs\
|
||||
MAAA7DAcdvqGQAAAAadEVYdFNvZnR3YXJlAFBhaW50Lk5FVCB2My41LjExR/NCNwAAA7JJREFUaEPtk0FyWzEMQ+37X7fZhxX4\
|
||||
@ -67,23 +67,23 @@ mlxfNFiP5mw4wlbMh4F5Ddxp5jNINBdCEz9zPOC1zD7Q0HBdmXndwv0TMtydEdzlWJT4VZ8Qt9Qn4/on
|
||||
jwE50AGjLCVuS8Yt4H7OgZLKK5EKOsLviEWJSL/+0uMi7gLUSBseYwqEbXvSHCec1CJvZPyHCmYQffaBBfOTCGHM2aEbZi1+gO\
|
||||
1XTWVXMnzrhAn5DSOZVsiQlHnSITKzGj6DeTcZWc/3oy7h9//PF4PL4BlvsWrb6RE+oAAAAASUVORK5CYII=');
|
||||
}
|
||||
|
||||
|
||||
.emscripten { padding-right: 0; margin-left: auto; margin-right: auto; display: block; }
|
||||
div.emscripten { text-align: center; }
|
||||
div.emscripten { text-align: center; }
|
||||
div.emscripten_border { border: 1px solid black; }
|
||||
|
||||
|
||||
/* NOTE: Canvas *must not* have any border or padding, or mouse coords will be wrong */
|
||||
canvas.emscripten {
|
||||
border: 0px none;
|
||||
background: black;
|
||||
canvas.emscripten {
|
||||
border: 0px none;
|
||||
background: black;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.spinner {
|
||||
height: 30px;
|
||||
width: 30px;
|
||||
margin: 0;
|
||||
margin-top: 20px;
|
||||
|
||||
.spinner {
|
||||
height: 30px;
|
||||
width: 30px;
|
||||
margin: 0;
|
||||
margin-top: 20px;
|
||||
margin-left: 20px;
|
||||
display: inline-block;
|
||||
vertical-align: top;
|
||||
@ -114,7 +114,7 @@ jwE50AGjLCVuS8Yt4H7OgZLKK5EKOsLviEWJSL/+0uMi7gLUSBseYwqEbXvSHCec1CJvZPyHCmYQffaB
|
||||
from {transform: rotate(0deg);}
|
||||
to {transform: rotate(360deg);}
|
||||
}
|
||||
|
||||
|
||||
#status {
|
||||
display: inline-block;
|
||||
vertical-align: top;
|
||||
@ -123,12 +123,12 @@ jwE50AGjLCVuS8Yt4H7OgZLKK5EKOsLviEWJSL/+0uMi7gLUSBseYwqEbXvSHCec1CJvZPyHCmYQffaB
|
||||
font-weight: bold;
|
||||
color: rgb(40, 40, 40);
|
||||
}
|
||||
|
||||
|
||||
#progress {
|
||||
height: 0px;
|
||||
width: 0px;
|
||||
}
|
||||
|
||||
|
||||
#controls {
|
||||
display: inline-block;
|
||||
float: right;
|
||||
@ -136,7 +136,7 @@ jwE50AGjLCVuS8Yt4H7OgZLKK5EKOsLviEWJSL/+0uMi7gLUSBseYwqEbXvSHCec1CJvZPyHCmYQffaB
|
||||
margin-top: 15px;
|
||||
margin-right: 20px;
|
||||
}
|
||||
|
||||
|
||||
#output {
|
||||
width: 100%;
|
||||
height: 140px;
|
||||
@ -148,7 +148,7 @@ jwE50AGjLCVuS8Yt4H7OgZLKK5EKOsLviEWJSL/+0uMi7gLUSBseYwqEbXvSHCec1CJvZPyHCmYQffaB
|
||||
font-family: 'Lucida Console', Monaco, monospace;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
|
||||
input[type=button] {
|
||||
background-color: lightgray;
|
||||
border: 4px solid darkgray;
|
||||
@ -158,7 +158,7 @@ jwE50AGjLCVuS8Yt4H7OgZLKK5EKOsLviEWJSL/+0uMi7gLUSBseYwqEbXvSHCec1CJvZPyHCmYQffaB
|
||||
width: 140px;
|
||||
height: 50px;
|
||||
}
|
||||
|
||||
|
||||
input[type=button]:hover {
|
||||
background-color: #f5f5f5ff;
|
||||
border-color: black;
|
||||
@ -168,7 +168,7 @@ jwE50AGjLCVuS8Yt4H7OgZLKK5EKOsLviEWJSL/+0uMi7gLUSBseYwqEbXvSHCec1CJvZPyHCmYQffaB
|
||||
<body>
|
||||
<div id="header">
|
||||
<a id="logo" href="https://www.raylib.com"></a>
|
||||
|
||||
|
||||
<div class="spinner" id='spinner'></div>
|
||||
<div class="emscripten" id="status">Downloading...</div>
|
||||
|
||||
@ -181,11 +181,11 @@ jwE50AGjLCVuS8Yt4H7OgZLKK5EKOsLviEWJSL/+0uMi7gLUSBseYwqEbXvSHCec1CJvZPyHCmYQffaB
|
||||
<progress value="0" max="100" id="progress" hidden=1></progress>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="emscripten_border">
|
||||
<canvas class="emscripten" id="canvas" oncontextmenu="event.preventDefault()" tabindex=-1></canvas>
|
||||
</div>
|
||||
|
||||
|
||||
<textarea id="output" rows="8"></textarea>
|
||||
|
||||
<script type='text/javascript' src="https://cdn.jsdelivr.net/gh/eligrey/FileSaver.js/dist/FileSaver.min.js"> </script>
|
||||
@ -216,9 +216,9 @@ jwE50AGjLCVuS8Yt4H7OgZLKK5EKOsLviEWJSL/+0uMi7gLUSBseYwqEbXvSHCec1CJvZPyHCmYQffaB
|
||||
postRun: [],
|
||||
print: (function() {
|
||||
var element = document.querySelector('#output');
|
||||
|
||||
|
||||
if (element) element.value = ''; // Clear browser cache
|
||||
|
||||
|
||||
return function(text) {
|
||||
if (arguments.length > 1) text = Array.prototype.slice.call(arguments).join(' ');
|
||||
// These replacements are necessary if you render to raw HTML
|
||||
@ -227,7 +227,7 @@ jwE50AGjLCVuS8Yt4H7OgZLKK5EKOsLviEWJSL/+0uMi7gLUSBseYwqEbXvSHCec1CJvZPyHCmYQffaB
|
||||
//text = text.replace(/>/g, ">");
|
||||
//text = text.replace('\n', '<br>', 'g');
|
||||
console.log(text);
|
||||
|
||||
|
||||
if (element) {
|
||||
element.value += text + "\n";
|
||||
element.scrollTop = element.scrollHeight; // focus on bottom
|
||||
@ -236,7 +236,7 @@ jwE50AGjLCVuS8Yt4H7OgZLKK5EKOsLviEWJSL/+0uMi7gLUSBseYwqEbXvSHCec1CJvZPyHCmYQffaB
|
||||
})(),
|
||||
printErr: function(text) {
|
||||
if (arguments.length > 1) text = Array.prototype.slice.call(arguments).join(' ');
|
||||
|
||||
|
||||
console.error(text);
|
||||
},
|
||||
canvas: (function() {
|
||||
@ -252,15 +252,15 @@ jwE50AGjLCVuS8Yt4H7OgZLKK5EKOsLviEWJSL/+0uMi7gLUSBseYwqEbXvSHCec1CJvZPyHCmYQffaB
|
||||
setStatus: function(text) {
|
||||
if (!Module.setStatus.last) Module.setStatus.last = { time: Date.now(), text: '' };
|
||||
if (text === Module.setStatus.last.text) return;
|
||||
|
||||
|
||||
var m = text.match(/([^(]+)\((\d+(\.\d+)?)\/(\d+)\)/);
|
||||
var now = Date.now();
|
||||
|
||||
|
||||
if (m && now - Module.setStatus.last.time < 30) return; // If this is a progress update, skip it if too soon
|
||||
|
||||
|
||||
Module.setStatus.last.time = now;
|
||||
Module.setStatus.last.text = text;
|
||||
|
||||
|
||||
if (m) {
|
||||
text = m[1];
|
||||
progressElement.value = parseInt(m[2])*100;
|
||||
@ -273,7 +273,7 @@ jwE50AGjLCVuS8Yt4H7OgZLKK5EKOsLviEWJSL/+0uMi7gLUSBseYwqEbXvSHCec1CJvZPyHCmYQffaB
|
||||
progressElement.hidden = true;
|
||||
if (!text) spinnerElement.style.display = 'none';
|
||||
}
|
||||
|
||||
|
||||
statusElement.innerHTML = text;
|
||||
},
|
||||
totalDependencies: 0,
|
||||
@ -283,24 +283,24 @@ jwE50AGjLCVuS8Yt4H7OgZLKK5EKOsLviEWJSL/+0uMi7gLUSBseYwqEbXvSHCec1CJvZPyHCmYQffaB
|
||||
},
|
||||
//noInitialRun: true
|
||||
};
|
||||
|
||||
|
||||
Module.setStatus('Downloading...');
|
||||
|
||||
|
||||
window.onerror = function() {
|
||||
Module.setStatus('Exception thrown, see JavaScript console');
|
||||
spinnerElement.style.display = 'none';
|
||||
Module.setStatus = function(text) { if (text) Module.printErr('[post-exception status] ' + text); };
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
<!-- REF: https://developers.google.com/web/updates/2018/11/web-audio-autoplay -->
|
||||
<script type='text/javascript'>
|
||||
var audioBtn = document.querySelector('#btn-audio');
|
||||
|
||||
|
||||
// An array of all contexts to resume on the page
|
||||
const audioContexList = [];
|
||||
(function() {
|
||||
// A proxy object to intercept AudioContexts and
|
||||
// A proxy object to intercept AudioContexts and
|
||||
// add them to the array for tracking and resuming later
|
||||
self.AudioContext = new Proxy(self.AudioContext, {
|
||||
construct(target, args) {
|
||||
@ -318,7 +318,7 @@ jwE50AGjLCVuS8Yt4H7OgZLKK5EKOsLviEWJSL/+0uMi7gLUSBseYwqEbXvSHCec1CJvZPyHCmYQffaB
|
||||
if (ctx.state == "suspended") { ctx.resume(); resumed = true; }
|
||||
else if (ctx.state == "running") ctx.suspend();
|
||||
});
|
||||
|
||||
|
||||
if (resumed) audioBtn.value = "🔇 SUSPEND";
|
||||
else audioBtn.value = "🔈 RESUME";
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user