Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WARNING: rcore module split per-platform **BIG CHANGE** #3388

Merged
merged 15 commits into from
Oct 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ xcschememanagement.plist
xcuserdata/
DerivedData/

# VSCode project
.vscode

# Jetbrains project
.idea/
cmake-build-*/
Expand Down
1 change: 1 addition & 0 deletions examples/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
endif
endif
ifeq ($(PLATFORM),PLATFORM_DRM)
INCLUDE_PATHS += -I$(RAYLIB_INCLUDE_PATH)
INCLUDE_PATHS += -I/usr/include/libdrm
endif

Expand Down
26 changes: 9 additions & 17 deletions examples/core/core_input_gestures_web.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ void Update(void)
}
}
}

int fillLog = 0; // Gate variable to be used to allow or not the gesture log to be filled
if (currentGesture !=0)
{
Expand All @@ -156,16 +156,16 @@ void Update(void)
fillLog = 1;
}
}

if (fillLog) // If one of the conditions from logMode was met, fill the gesture log
{
previousGesture = currentGesture;
gestureColor = GetGestureColor(currentGesture);
if (gestureLogIndex <= 0) gestureLogIndex = GESTURE_LOG_SIZE;
gestureLogIndex--;

// Copy the gesture respective name to the gesture log array
TextCopy(gestureLog[gestureLogIndex], GetGestureName(currentGesture));
TextCopy(gestureLog[gestureLogIndex], GetGestureName(currentGesture));
}

// Handle protractor
Expand All @@ -182,14 +182,14 @@ void Update(void)
{
currentAngleDegrees = 0.0f;
}

float currentAngleRadians = ((currentAngleDegrees +90.0f)*PI/180); // Convert the current angle to Radians
finalVector = (Vector2){ (angleLength*sinf(currentAngleRadians)) + protractorPosition.x, (angleLength*cosf(currentAngleRadians)) + protractorPosition.y }; // Calculate the final vector for display

// Handle touch and mouse pointer points
//--------------------------------------------------------------------------------------
#define MAX_TOUCH_COUNT 32

Vector2 touchPosition[MAX_TOUCH_COUNT] = { 0 };
Vector2 mousePosition = {0, 0};
if (currentGesture != GESTURE_NONE)
Expand All @@ -204,7 +204,7 @@ void Update(void)
// Draw
//--------------------------------------------------------------------------------------
BeginDrawing();

ClearBackground(RAYWHITE);

// Draw common
Expand Down Expand Up @@ -235,7 +235,7 @@ void Update(void)
// Draw gesture log
//--------------------------------------------------------------------------------------
DrawText("Log", gestureLogPosition.x, gestureLogPosition.y, 20, BLACK);

// Loop in both directions to print the gesture log array in the inverted order (and looping around if the index started somewhere in the middle)
for (i = 0, ii = gestureLogIndex; i < GESTURE_LOG_SIZE; i++, ii = (ii + 1) % GESTURE_LOG_SIZE) DrawText(gestureLog[ii], gestureLogPosition.x, gestureLogPosition.y + 410 - i*20, 20, (i == 0 ? gestureColor : LIGHTGRAY));
Color logButton1Color, logButton2Color;
Expand Down Expand Up @@ -286,7 +286,7 @@ void Update(void)
DrawCircleV(touchPosition[i], 50.0f, Fade(gestureColor, 0.5f));
DrawCircleV(touchPosition[i], 5.0f, gestureColor);
}

if (touchCount == 2) DrawLineEx(touchPosition[0], touchPosition[1], ((currentGesture == 512)? 8 : 12), gestureColor);
}
else
Expand All @@ -308,14 +308,6 @@ int main(void)
{
// Initialization
//--------------------------------------------------------------------------------------
#if defined( PLATFORM_WEB )
// Using Emscripten EM_ASM_INT macro, get the page canvas width
const int canvasWidth = EM_ASM_INT( return document.getElementById('canvas').getBoundingClientRect().width; );

if (canvasWidth > 400) screenWidth = canvasWidth;
else screenWidth = 400; // Set a minimum width for the screen
#endif

InitWindow(screenWidth, screenHeight, "raylib [core] example - input gestures web");
//--------------------------------------------------------------------------------------

Expand Down
1 change: 1 addition & 0 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,7 @@ ifeq ($(PLATFORM),PLATFORM_DRM)
# without EGL_NO_X11 eglplatform.h tears Xlib.h in which tears X.h in
# which contains a conflicting type Font
CFLAGS += -DEGL_NO_X11
CFLAGS += -Werror=implicit-function-declaration
endif
# Use Wayland display on Linux desktop
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
Expand Down
Loading