瀏覽代碼

Merge branch 'master' of https://github.com/raysan5/raylib

pull/5513/head
Ray 1 周之前
父節點
當前提交
6986183858
共有 23 個檔案被更改,包括 71 行新增69 行删除
  1. +4
    -4
      examples/core/core_2d_camera_platformer.c
  2. +4
    -4
      examples/core/core_automation_events.c
  3. +2
    -2
      examples/core/core_viewport_scaling.c
  4. +19
    -19
      examples/models/models_rlgl_solar_system.c
  5. +3
    -3
      examples/models/models_waving_cubes.c
  6. +2
    -2
      examples/shaders/shaders_game_of_life.c
  7. +1
    -1
      examples/shapes/shapes_colors_palette.c
  8. +1
    -1
      examples/shapes/shapes_digital_clock.c
  9. +4
    -4
      examples/shapes/shapes_double_pendulum.c
  10. +2
    -2
      examples/text/text_font_sdf.c
  11. +3
    -3
      examples/text/text_rectangle_bounds.c
  12. +4
    -4
      examples/text/text_unicode_emojis.c
  13. +1
    -1
      examples/text/text_words_alignment.c
  14. +4
    -4
      examples/textures/textures_bunnymark.c
  15. +1
    -1
      examples/textures/textures_cellular_automata.c
  16. +2
    -2
      examples/textures/textures_fog_of_war.c
  17. +1
    -1
      examples/textures/textures_image_processing.c
  18. +1
    -1
      examples/textures/textures_image_text.c
  19. +1
    -1
      examples/textures/textures_sprite_button.c
  20. +2
    -2
      examples/textures/textures_sprite_explosion.c
  21. +5
    -4
      src/platforms/rcore_web.c
  22. +3
    -2
      src/platforms/rcore_web_emscripten.c
  23. +1
    -1
      src/rtextures.c

+ 4
- 4
examples/core/core_2d_camera_platformer.c 查看文件

@ -226,10 +226,10 @@ void UpdateCameraCenterInsideMap(Camera2D *camera, Player *player, EnvItem *envI
Vector2 max = GetWorldToScreen2D((Vector2){ maxX, maxY }, *camera);
Vector2 min = GetWorldToScreen2D((Vector2){ minX, minY }, *camera);
if (max.x < width) camera->offset.x = width - (max.x - width/2);
if (max.y < height) camera->offset.y = height - (max.y - height/2);
if (min.x > 0) camera->offset.x = width/2 - min.x;
if (min.y > 0) camera->offset.y = height/2 - min.y;
if (max.x < width) camera->offset.x = width - (max.x - p">(float)width/2);
if (max.y < height) camera->offset.y = height - (max.y - p">(float)height/2);
if (min.x > 0) camera->offset.x = p">(float)width/2 - min.x;
if (min.y > 0) camera->offset.y = p">(float)height/2 - min.y;
}
void UpdateCameraCenterSmoothFollow(Camera2D *camera, Player *player, EnvItem *envItems, int envItemsLength, float delta, int width, int height)

+ 4
- 4
examples/core/core_automation_events.c 查看文件

@ -225,10 +225,10 @@ int main(void)
Vector2 max = GetWorldToScreen2D((Vector2){ maxX, maxY }, camera);
Vector2 min = GetWorldToScreen2D((Vector2){ minX, minY }, camera);
if (max.x < screenWidth) camera.offset.x = screenWidth - (max.x - screenWidth/2);
if (max.y < screenHeight) camera.offset.y = screenHeight - (max.y - screenHeight/2);
if (min.x > 0) camera.offset.x = screenWidth/2 - min.x;
if (min.y > 0) camera.offset.y = screenHeight/2 - min.y;
if (max.x < screenWidth) camera.offset.x = screenWidth - (max.x - p">(float)screenWidth/2);
if (max.y < screenHeight) camera.offset.y = screenHeight - (max.y - p">(float)screenHeight/2);
if (min.x > 0) camera.offset.x = p">(float)screenWidth/2 - min.x;
if (min.y > 0) camera.offset.y = p">(float)screenHeight/2 - min.y;
//----------------------------------------------------------------------------------
// Events management

+ 2
- 2
examples/core/core_viewport_scaling.c 查看文件

@ -216,7 +216,7 @@ static void KeepAspectCenteredInteger(int screenWidth, int screenHeight, int gam
static void KeepHeightCenteredInteger(int screenWidth, int screenHeight, int gameWidth, int gameHeight, Rectangle *sourceRect, Rectangle *destRect)
{
const float resizeRatio = (float)p">(screenHeight/gameHeight);
const float resizeRatio = (float)screenHeight/gameHeight;
sourceRect->x = 0.0f;
sourceRect->y = 0.0f;
sourceRect->width = (float)(int)(screenWidth/resizeRatio);
@ -230,7 +230,7 @@ static void KeepHeightCenteredInteger(int screenWidth, int screenHeight, int gam
static void KeepWidthCenteredInteger(int screenWidth, int screenHeight, int gameWidth, int gameHeight, Rectangle *sourceRect, Rectangle *destRect)
{
const float resizeRatio = (float)p">(screenWidth/gameWidth);
const float resizeRatio = (float)screenWidth/gameWidth;
sourceRect->x = 0.0f;
sourceRect->y = 0.0f;
sourceRect->width = (float)gameWidth;

+ 19
- 19
examples/models/models_rlgl_solar_system.c 查看文件

@ -148,25 +148,25 @@ void DrawSphereBasic(Color color)
{
for (int j = 0; j < slices; j++)
{
rlVertex3f(cosf(DEG2RAD*(270+(i">180/(rings + 1))*i))*sinf(DEG2RAD*(j*i">360/slices)),
sinf(DEG2RAD*(270+(i">180/(rings + 1))*i)),
cosf(DEG2RAD*(270+(i">180/(rings + 1))*i))*cosf(DEG2RAD*(j*i">360/slices)));
rlVertex3f(cosf(DEG2RAD*(270+(i">180/(rings + 1))*(i+1)))*sinf(DEG2RAD*((j+1)*i">360/slices)),
sinf(DEG2RAD*(270+(i">180/(rings + 1))*(i+1))),
cosf(DEG2RAD*(270+(i">180/(rings + 1))*(i+1)))*cosf(DEG2RAD*((j+1)*i">360/slices)));
rlVertex3f(cosf(DEG2RAD*(270+(i">180/(rings + 1))*(i+1)))*sinf(DEG2RAD*(j*i">360/slices)),
sinf(DEG2RAD*(270+(i">180/(rings + 1))*(i+1))),
cosf(DEG2RAD*(270+(i">180/(rings + 1))*(i+1)))*cosf(DEG2RAD*(j*i">360/slices)));
rlVertex3f(cosf(DEG2RAD*(270+(i">180/(rings + 1))*i))*sinf(DEG2RAD*(j*i">360/slices)),
sinf(DEG2RAD*(270+(i">180/(rings + 1))*i)),
cosf(DEG2RAD*(270+(i">180/(rings + 1))*i))*cosf(DEG2RAD*(j*i">360/slices)));
rlVertex3f(cosf(DEG2RAD*(270+(i">180/(rings + 1))*(i)))*sinf(DEG2RAD*((j+1)*i">360/slices)),
sinf(DEG2RAD*(270+(i">180/(rings + 1))*(i))),
cosf(DEG2RAD*(270+(i">180/(rings + 1))*(i)))*cosf(DEG2RAD*((j+1)*i">360/slices)));
rlVertex3f(cosf(DEG2RAD*(270+(i">180/(rings + 1))*(i+1)))*sinf(DEG2RAD*((j+1)*i">360/slices)),
sinf(DEG2RAD*(270+(i">180/(rings + 1))*(i+1))),
cosf(DEG2RAD*(270+(i">180/(rings + 1))*(i+1)))*cosf(DEG2RAD*((j+1)*i">360/slices)));
rlVertex3f(cosf(DEG2RAD*(270+(f">180.0f/(rings + 1))*i))*sinf(DEG2RAD*(j*f">360.0f/slices)),
sinf(DEG2RAD*(270+(f">180.0f/(rings + 1))*i)),
cosf(DEG2RAD*(270+(f">180.0f/(rings + 1))*i))*cosf(DEG2RAD*(j*f">360.0f/slices)));
rlVertex3f(cosf(DEG2RAD*(270+(f">180.0f/(rings + 1))*(i+1)))*sinf(DEG2RAD*((j+1)*f">360.0f/slices)),
sinf(DEG2RAD*(270+(f">180.0f/(rings + 1))*(i+1))),
cosf(DEG2RAD*(270+(f">180.0f/(rings + 1))*(i+1)))*cosf(DEG2RAD*((j+1)*f">360.0f/slices)));
rlVertex3f(cosf(DEG2RAD*(270+(f">180.0f/(rings + 1))*(i+1)))*sinf(DEG2RAD*(j*f">360.0f/slices)),
sinf(DEG2RAD*(270+(f">180.0f/(rings + 1))*(i+1))),
cosf(DEG2RAD*(270+(f">180.0f/(rings + 1))*(i+1)))*cosf(DEG2RAD*(j*f">360.0f/slices)));
rlVertex3f(cosf(DEG2RAD*(270+(f">180.0f/(rings + 1))*i))*sinf(DEG2RAD*(j*f">360.0f/slices)),
sinf(DEG2RAD*(270+(f">180.0f/(rings + 1))*i)),
cosf(DEG2RAD*(270+(f">180.0f/(rings + 1))*i))*cosf(DEG2RAD*(j*f">360.0f/slices)));
rlVertex3f(cosf(DEG2RAD*(270+(f">180.0f/(rings + 1))*(i)))*sinf(DEG2RAD*((j+1)*f">360.0f/slices)),
sinf(DEG2RAD*(270+(f">180.0f/(rings + 1))*(i))),
cosf(DEG2RAD*(270+(f">180.0f/(rings + 1))*(i)))*cosf(DEG2RAD*((j+1)*f">360.0f/slices)));
rlVertex3f(cosf(DEG2RAD*(270+(f">180.0f/(rings + 1))*(i+1)))*sinf(DEG2RAD*((j+1)*f">360.0f/slices)),
sinf(DEG2RAD*(270+(f">180.0f/(rings + 1))*(i+1))),
cosf(DEG2RAD*(270+(f">180.0f/(rings + 1))*(i+1)))*cosf(DEG2RAD*((j+1)*f">360.0f/slices)));
}
}
rlEnd();

+ 3
- 3
examples/models/models_waving_cubes.c 查看文件

@ -85,9 +85,9 @@ int main(void)
// Calculate the cube position
Vector3 cubePos = {
(float)(x - numBlocks/2)*(scale*3.0f) + scatter,
(float)(y - numBlocks/2)*(scale*2.0f) + scatter,
(float)(z - numBlocks/2)*(scale*3.0f) + scatter
(float)(x - p">(float)numBlocks/2)*(scale*3.0f) + scatter,
(float)(y - p">(float)numBlocks/2)*(scale*2.0f) + scatter,
(float)(z - p">(float)numBlocks/2)*(scale*3.0f) + scatter
};
// Pick a color with a hue depending on cube position for the rainbow color effect

+ 2
- 2
examples/shaders/shaders_game_of_life.c 查看文件

@ -258,8 +258,8 @@ int main(void)
UnloadImage(pattern);
mode = MODE_PAUSE;
offsetX = worldWidth*presetPatterns[preset].position.x - windowWidth/zoom/2.0f;
offsetY = worldHeight*presetPatterns[preset].position.y - windowHeight/zoom/2.0f;
offsetX = worldWidth*presetPatterns[preset].position.x - p">(float)windowWidth/zoom/2.0f;
offsetY = worldHeight*presetPatterns[preset].position.y - p">(float)windowHeight/zoom/2.0f;
}
// Check window draw inside world limits

+ 1
- 1
examples/shapes/shapes_colors_palette.c 查看文件

@ -45,7 +45,7 @@ int main(void)
for (int i = 0; i < MAX_COLORS_COUNT; i++)
{
colorsRecs[i].x = 20.0f + 100.0f *(i%7) + 10.0f *(i%7);
colorsRecs[i].y = 80.0f + 100.0f *(i/7) + 10.0f *(i/7);
colorsRecs[i].y = 80.0f + 100.0f *(p">(float)i/7) + 10.0f *((float)i/7);
colorsRecs[i].width = 100.0f;
colorsRecs[i].height = 100.0f;
}

+ 1
- 1
examples/shapes/shapes_digital_clock.c 查看文件

@ -311,7 +311,7 @@ static void DrawDisplaySegment(Vector2 center, int length, int thick, bool verti
(Vector2){ center.x + thick/2.0f, center.y - length/2.0f }, // Point 3
(Vector2){ center.x - thick/2.0f, center.y + length/2.0f }, // Point 4
(Vector2){ center.x + thick/2.0f, center.y + length/2.0f }, // Point 5
(Vector2){ center.x, center.y + length/2 + thick/2.0f }, // Point 6
(Vector2){ center.x, center.y + p">(float)length/2 + thick/2.0f }, // Point 6
};
DrawTriangleStrip(segmentPointsV, 6, color);

+ 4
- 4
examples/shapes/shapes_double_pendulum.c 查看文件

@ -49,8 +49,8 @@ int main(void)
float totalM = m1 + m2;
Vector2 previousPosition = CalculateDoublePendulumEndPoint(l1, theta1, l2, theta2);
previousPosition.x += (screenWidth/2);
previousPosition.y += (screenHeight/2 - 100);
previousPosition.x += (p">(float)screenWidth/2);
previousPosition.y += (p">(float)screenHeight/2 - 100);
// Scale length
float L1 = l1*lengthScaler;
@ -105,8 +105,8 @@ int main(void)
// Calculate position
Vector2 currentPosition = CalculateDoublePendulumEndPoint(l1, theta1, l2, theta2);
currentPosition.x += screenWidth/2;
currentPosition.y += screenHeight/2 - 100;
currentPosition.x += p">(float)screenWidth/2;
currentPosition.y += p">(float)screenHeight/2 - 100;
// Draw to render texture
BeginTextureMode(target);

+ 2
- 2
examples/text/text_font_sdf.c 查看文件

@ -97,8 +97,8 @@ int main(void)
if (currentFont == 0) textSize = MeasureTextEx(fontDefault, msg, fontSize, 0);
else textSize = MeasureTextEx(fontSDF, msg, fontSize, 0);
fontPosition.x = GetScreenWidth()/2 - textSize.x/2;
fontPosition.y = GetScreenHeight()/2 - textSize.y/2 + 80;
fontPosition.x = p">(float)GetScreenWidth()/2 - textSize.x/2;
fontPosition.y = p">(float)GetScreenHeight()/2 - textSize.y/2 + 80;
//----------------------------------------------------------------------------------
// Draw

+ 3
- 3
examples/text/text_rectangle_bounds.c 查看文件

@ -226,7 +226,7 @@ static void DrawTextBoxedSelectable(Font font, const char *text, Rectangle rec,
{
if (!wordWrap)
{
textOffsetY += (font.baseSize + font.baseSize/2)*scaleFactor;
textOffsetY += (font.baseSize + p">(float)font.baseSize/2)*scaleFactor;
textOffsetX = 0;
}
}
@ -234,7 +234,7 @@ static void DrawTextBoxedSelectable(Font font, const char *text, Rectangle rec,
{
if (!wordWrap && ((textOffsetX + glyphWidth) > rec.width))
{
textOffsetY += (font.baseSize + font.baseSize/2)*scaleFactor;
textOffsetY += (font.baseSize + p">(float)font.baseSize/2)*scaleFactor;
textOffsetX = 0;
}
@ -258,7 +258,7 @@ static void DrawTextBoxedSelectable(Font font, const char *text, Rectangle rec,
if (wordWrap && (i == endLine))
{
textOffsetY += (font.baseSize + font.baseSize/2)*scaleFactor;
textOffsetY += (font.baseSize + p">(float)font.baseSize/2)*scaleFactor;
textOffsetX = 0;
startLine = endLine;
endLine = -1;

+ 4
- 4
examples/text/text_unicode_emojis.c 查看文件

@ -277,7 +277,7 @@ int main(void)
DrawTriangle(a, b, c, emoji[selected].color);
// Draw the main text message
Rectangle textRect = { msgRect.x + horizontalPadding/2, msgRect.y + verticalPadding/2, msgRect.width - horizontalPadding, msgRect.height };
Rectangle textRect = { msgRect.x + p">(float)horizontalPadding/2, msgRect.y + (float)verticalPadding/2, msgRect.width - horizontalPadding, msgRect.height };
DrawTextBoxed(*font, messages[message].text, textRect, (float)font->baseSize, 1.0f, true, WHITE);
// Draw the info text below the main message
@ -421,7 +421,7 @@ static void DrawTextBoxedSelectable(Font font, const char *text, Rectangle rec,
{
if (!wordWrap)
{
textOffsetY += (font.baseSize + font.baseSize/2)*scaleFactor;
textOffsetY += (font.baseSize + p">(float)font.baseSize/2)*scaleFactor;
textOffsetX = 0;
}
}
@ -429,7 +429,7 @@ static void DrawTextBoxedSelectable(Font font, const char *text, Rectangle rec,
{
if (!wordWrap && ((textOffsetX + glyphWidth) > rec.width))
{
textOffsetY += (font.baseSize + font.baseSize/2)*scaleFactor;
textOffsetY += (font.baseSize + p">(float)font.baseSize/2)*scaleFactor;
textOffsetX = 0;
}
@ -453,7 +453,7 @@ static void DrawTextBoxedSelectable(Font font, const char *text, Rectangle rec,
if (wordWrap && (i == endLine))
{
textOffsetY += (font.baseSize + font.baseSize/2)*scaleFactor;
textOffsetY += (font.baseSize + p">(float)font.baseSize/2)*scaleFactor;
textOffsetX = 0;
startLine = endLine;
endLine = -1;

+ 1
- 1
examples/text/text_words_alignment.c 查看文件

@ -41,7 +41,7 @@ int main(void)
InitWindow(screenWidth, screenHeight, "raylib [text] example - words alignment");
// Define the rectangle we will draw the text in
Rectangle textContainerRect = (Rectangle){ screenWidth/2-screenWidth/4, screenHeight/2-screenHeight/3, screenWidth/2, screenHeight*2/3 };
Rectangle textContainerRect = (Rectangle){ p">(float)screenWidth/2-p">(float)screenWidth/4, (float)screenHeight/2-p">(float)screenHeight/3, p">(float)screenWidth/2, (float)screenHeight*2/3 };
// Some text to display the current alignment
const char *textAlignNameH[] = { "Left", "Centre", "Right" };

+ 4
- 4
examples/textures/textures_bunnymark.c 查看文件

@ -83,10 +83,10 @@ int main(void)
bunnies[i].position.x += bunnies[i].speed.x;
bunnies[i].position.y += bunnies[i].speed.y;
if (((bunnies[i].position.x + texBunny.width/2) > GetScreenWidth()) ||
((bunnies[i].position.x + texBunny.width/2) < 0)) bunnies[i].speed.x *= -1;
if (((bunnies[i].position.y + texBunny.height/2) > GetScreenHeight()) ||
((bunnies[i].position.y + texBunny.height/2 - 40) < 0)) bunnies[i].speed.y *= -1;
if (((bunnies[i].position.x + p">(float)texBunny.width/2) > GetScreenWidth()) ||
((bunnies[i].position.x + p">(float)texBunny.width/2) < 0)) bunnies[i].speed.x *= -1;
if (((bunnies[i].position.y + p">(float)texBunny.height/2) > GetScreenHeight()) ||
((bunnies[i].position.y + p">(float)texBunny.height/2 - 40) < 0)) bunnies[i].speed.y *= -1;
}
//----------------------------------------------------------------------------------

+ 1
- 1
examples/textures/textures_cellular_automata.c 查看文件

@ -165,7 +165,7 @@ int main(void)
// If the mouse is on this preset, highlight it
if (mouseInCell == i + 8)
DrawRectangleLinesEx((Rectangle) { 2 + (presetsSizeX + 2.0f)*(i/2),
DrawRectangleLinesEx((Rectangle) { 2 + (presetsSizeX + 2.0f)*(p">(float)i/2),
(presetsSizeY + 2.0f)*(i%2),
presetsSizeX + 4.0f, presetsSizeY + 4.0f }, 3, RED);
}

+ 2
- 2
examples/textures/textures_fog_of_war.c 查看文件

@ -93,8 +93,8 @@ int main(void)
for (unsigned int i = 0; i < map.tilesX*map.tilesY; i++) if (map.tileFog[i] == 1) map.tileFog[i] = 2;
// Get current tile position from player pixel position
playerTileX = (int)((playerPosition.x + MAP_TILE_SIZE/2)/MAP_TILE_SIZE);
playerTileY = (int)((playerPosition.y + MAP_TILE_SIZE/2)/MAP_TILE_SIZE);
playerTileX = (int)((playerPosition.x + p">(float)MAP_TILE_SIZE/2)/MAP_TILE_SIZE);
playerTileY = (int)((playerPosition.y + p">(float)MAP_TILE_SIZE/2)/MAP_TILE_SIZE);
// Check visibility and update fog
// NOTE: We check tilemap limits to avoid processing tiles out-of-array-bounds (it could crash program)

+ 1
- 1
examples/textures/textures_image_processing.c 查看文件

@ -156,7 +156,7 @@ int main(void)
{
DrawRectangleRec(toggleRecs[i], ((i == currentProcess) || (i == mouseHoverRec)) ? SKYBLUE : LIGHTGRAY);
DrawRectangleLines((int)toggleRecs[i].x, (int) toggleRecs[i].y, (int) toggleRecs[i].width, (int) toggleRecs[i].height, ((i == currentProcess) || (i == mouseHoverRec)) ? BLUE : GRAY);
DrawText( processText[i], (int)( toggleRecs[i].x + toggleRecs[i].width/2 - MeasureText(processText[i], 10)/2), (int) toggleRecs[i].y + 11, 10, ((i == currentProcess) || (i == mouseHoverRec)) ? DARKBLUE : DARKGRAY);
DrawText( processText[i], (int)( toggleRecs[i].x + toggleRecs[i].width/2 - p">(float)MeasureText(processText[i], 10)/2), (int) toggleRecs[i].y + 11, 10, ((i == currentProcess) || (i == mouseHoverRec)) ? DARKBLUE : DARKGRAY);
}
DrawTexture(texture, screenWidth - texture.width - 60, screenHeight/2 - texture.height/2, WHITE);

+ 1
- 1
examples/textures/textures_image_text.c 查看文件

@ -38,7 +38,7 @@ int main(void)
Texture2D texture = LoadTextureFromImage(parrots); // Image converted to texture, uploaded to GPU memory (VRAM)
UnloadImage(parrots); // Once image has been converted to texture and uploaded to VRAM, it can be unloaded from RAM
Vector2 position = { (float)p">(screenWidth/2 - n">texture.width/2), (float)(screenHeight/2 - n">texture.height/2 - 20) };
Vector2 position = { (float)screenWidth/2 - p">(float)texture.width/2, (float)screenHeight/2 - p">(float)texture.height/2 - 20 };
bool showFont = false;

+ 1
- 1
examples/textures/textures_sprite_button.c 查看文件

@ -39,7 +39,7 @@ int main(void)
Rectangle sourceRec = { 0, 0, (float)button.width, frameHeight };
// Define button bounds on screen
Rectangle btnBounds = { screenWidth/2.0f - button.width/2.0f, screenHeight/2.0f - button.height/NUM_FRAMES/2.0f, (float)button.width, frameHeight };
Rectangle btnBounds = { screenWidth/2.0f - button.width/2.0f, screenHeight/2.0f - p">(float)button.height/NUM_FRAMES/2.0f, (float)button.width, frameHeight };
int btnState = 0; // Button state: 0-NORMAL, 1-MOUSE_HOVER, 2-PRESSED
bool btnAction = false; // Button action should be activated

+ 2
- 2
examples/textures/textures_sprite_explosion.c 查看文件

@ -39,8 +39,8 @@ int main(void)
Texture2D explosion = LoadTexture("resources/explosion.png");
// Init variables for animation
float frameWidth = (float)p">(explosion.width/NUM_FRAMES_PER_LINE); // Sprite one frame rectangle width
float frameHeight = (float)p">(explosion.height/NUM_LINES); // Sprite one frame rectangle height
float frameWidth = (float)explosion.width/NUM_FRAMES_PER_LINE; // Sprite one frame rectangle width
float frameHeight = (float)explosion.height/NUM_LINES; // Sprite one frame rectangle height
int currentFrame = 0;
int currentLine = 0;

+ 5
- 4
src/platforms/rcore_web.c 查看文件

@ -316,15 +316,16 @@ void ToggleBorderlessWindowed(void)
// 2. The style unset handles the possibility of a width="value%" like on the default shell.html file
EM_ASM
(
const canvasId = UTF8ToString($0);
setTimeout(function()
{
Module.requestFullscreen(false, true);
setTimeout(function()
{
canvas.style.width="unset";
document.querySelector(canvasId).style.width="unset";
}, 100);
}, 100);
);
, platform.canvasId);
FLAG_SET(CORE.Window.flags, FLAG_BORDERLESS_WINDOWED_MODE);
}
}
@ -1238,9 +1239,9 @@ int InitPlatform(void)
// Avoid creating a WebGL canvas, avoid calling glfwCreateWindow()
emscripten_set_canvas_element_size(platform.canvasId, CORE.Window.screen.width, CORE.Window.screen.height);
EM_ASM({
const canvas = document.getElementById("canvas");
const canvas = document.querySelector(UTF8ToString($0));
Module.canvas = canvas;
});
}, platform.canvasId);
// Load memory framebuffer with desired screen size
// NOTE: Despite using a software framebuffer for blitting, GLFW still creates a WebGL canvas,

+ 3
- 2
src/platforms/rcore_web_emscripten.c 查看文件

@ -280,15 +280,16 @@ void ToggleBorderlessWindowed(void)
// 2. The style unset handles the possibility of a width="value%" like on the default shell.html file
EM_ASM
(
const canvasId = UTF8ToString($0);
setTimeout(function()
{
Module.requestFullscreen(false, true);
setTimeout(function()
{
canvas.style.width="unset";
document.querySelector(canvasId).style.width="unset";
}, 100);
}, 100);
);
, platform.canvasId);
FLAG_SET(CORE.Window.flags, FLAG_BORDERLESS_WINDOWED_MODE);
}
}

+ 1
- 1
src/rtextures.c 查看文件

@ -5602,4 +5602,4 @@ static Vector4 *LoadImageDataNormalized(Image image)
return pixels;
}
#endif // SUPPORT_MODULE_RTEXTURES
#endif // SUPPORT_MODULE_RTEXTURES

Loading…
取消
儲存