aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorRay San <raysan5@gmail.com>2016-02-18 14:05:48 +0100
committerRay San <raysan5@gmail.com>2016-02-18 14:05:48 +0100
commit8aab52aeda47ce283d1446be27a7e2e20f027434 (patch)
tree0f0489a64df98dd9e815c2f22c0728b53df1aaad /examples
parentafd2ffb74a84bf48b9129c613e1673ceae0bd46b (diff)
downloadraylib-8aab52aeda47ce283d1446be27a7e2e20f027434.tar.gz
raylib-8aab52aeda47ce283d1446be27a7e2e20f027434.zip
Redesigned RPI input system -IN PROGRESS-
Diffstat (limited to 'examples')
-rw-r--r--examples/core_input_mouse.c14
-rw-r--r--examples/makefile10
2 files changed, 13 insertions, 11 deletions
diff --git a/examples/core_input_mouse.c b/examples/core_input_mouse.c
index 358b5fd6..24d2dfcd 100644
--- a/examples/core_input_mouse.c
+++ b/examples/core_input_mouse.c
@@ -21,6 +21,7 @@ int main()
InitWindow(screenWidth, screenHeight, "raylib [core] example - mouse input");
Vector2 ballPosition = { -100.0f, -100.0f };
+ Color ballColor = DARKBLUE;
SetTargetFPS(60);
//---------------------------------------------------------------------------------------
@@ -30,10 +31,11 @@ int main()
{
// Update
//----------------------------------------------------------------------------------
- if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON))
- {
- ballPosition = GetMousePosition();
- }
+ ballPosition = GetMousePosition();
+
+ if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) ballColor = MAROON;
+ else if (IsMouseButtonPressed(MOUSE_MIDDLE_BUTTON)) ballColor = LIME;
+ else if (IsMouseButtonPressed(MOUSE_RIGHT_BUTTON)) ballColor = DARKBLUE;
//----------------------------------------------------------------------------------
// Draw
@@ -42,9 +44,9 @@ int main()
ClearBackground(RAYWHITE);
- DrawCircleV(ballPosition, 40, GOLD);
+ DrawCircleV(ballPosition, 40, ballColor);
- DrawText("mouse click to draw the ball", 10, 10, 20, DARKGRAY);
+ DrawText("move ball with mouse and click mouse button to change color", 10, 10, 20, DARKGRAY);
EndDrawing();
//----------------------------------------------------------------------------------
diff --git a/examples/makefile b/examples/makefile
index 62428155..2a9e88ba 100644
--- a/examples/makefile
+++ b/examples/makefile
@@ -227,10 +227,10 @@ core_mouse_wheel: core_mouse_wheel.c
# compile [core] example - gamepad input
core_input_gamepad: core_input_gamepad.c
-ifeq ($(PLATFORM),PLATFORM_DESKTOP)
+ifeq ($(PLATFORM), $(filter $(PLATFORM),PLATFORM_DESKTOP PLATFORM_RPI))
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
else
- @echo core_input_gamepad: Only supported on desktop platform
+ @echo core_input_gamepad: Example not supported on PLATFORM_ANDROID or PLATFORM_WEB
endif
# compile [core] example - generate random values
@@ -246,15 +246,15 @@ core_drop_files: core_drop_files.c
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
else
- @echo core_drop_files: Only supported on desktop platform
+ @echo core_drop_files: Example not supported on PLATFORM_ANDROID or PLATFORM_WEB or PLATFORM_RPI
endif
# compile [core] example - storage values
core_storage_values: core_storage_values.c
-ifeq ($(PLATFORM),PLATFORM_DESKTOP)
+ifeq ($(PLATFORM), $(filter $(PLATFORM),PLATFORM_DESKTOP PLATFORM_RPI))
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
else
- @echo core_storage_values: Only supported on desktop platform
+ @echo core_storage_values: Example not supported on PLATFORM_ANDROID or PLATFORM_WEB
endif
# compile [core] example - gestures detection