2 Single: RingRayLib の用法; はじめに
8 この章では RingRayLib 拡張機能の用法を学びます。
12 pair: RingRayLib の用法; はじめに
17 RingRayLib は RayLib ゲームプログラミングライブラリ用の拡張機能です。
23 pair: RingRayLib の用法; 基本ウィンドウ
35 InitWindow(screenWidth, screenHeight, "raylib [core] example - basic window")
39 while !WindowShouldClose()
42 DrawText("Congrats! You created your first window!", 190, 200, 20, WHITE)
50 .. image:: raylib_basicwindow.png
54 pair: RingRayLib の用法; キー入力
66 InitWindow(screenWidth, screenHeight, "raylib [core] example - keyboard input")
67 ballPosition = Vector2(screenWidth/2, screenHeight/2)
70 while !WindowShouldClose()
71 if IsKeyDown(KEY_RIGHT) ballPosition.x += 2 ok
72 if IsKeyDown(KEY_LEFT) ballPosition.x -= 2 ok
73 if IsKeyDown(KEY_UP) ballPosition.y -= 2 ok
74 if IsKeyDown(KEY_DOWN) ballPosition.y += 2 ok
76 ClearBackground(RAYWHITE)
77 DrawText("move the ball with arrow keys", 10, 10, 20, DARKGRAY)
78 DrawCircleV(ballPosition, 50, MAROON)
86 .. image:: raylib_inputkeys.png
91 pair: RingRayLib の用法; マウス入力
103 InitWindow(screenWidth, screenHeight, "raylib [core] example - mouse input")
105 ballPosition = Vector2(100, 100)
110 while ! WindowShouldClose()
112 ballPosition = GetMousePosition()
114 if IsMouseButtonPressed(MOUSE_LEFT_BUTTON)
116 but IsMouseButtonPressed(MOUSE_MIDDLE_BUTTON)
118 but IsMouseButtonPressed(MOUSE_RIGHT_BUTTON)
123 ClearBackground(BLACK)
124 DrawCircleV(ballPosition, 40, ballColor)
125 DrawText("move ball with mouse and click mouse button to change color",
135 .. image:: raylib_inputmouse.png
139 pair: RingRayLib の用法; 3Dカメラ
151 InitWindow(screenWidth, screenHeight, "raylib [core] example - 3d camera mode")
155 0, 0, 0 , // カメラの視点位置
156 0, 1, 0, // カメラの上方向 (対象に向かい合って回転)
158 CAMERA_PERSPECTIVE) // カメラモードの型
160 cubePosition = Vector3(0, 0, 0)
164 while !WindowShouldClose()
168 ClearBackground(RAYWHITE)
172 DrawCube(cubePosition, 2, 2, 2, RED)
173 DrawCubeWires(cubePosition, 2, 2, 2, MAROON)
179 DrawText("Welcome to the third dimension!", 10, 40, 20, DARKGRAY)
192 .. image:: raylib_3dcamera.png
196 pair: RingRayLib の用法; 3D自由視点カメラ
208 InitWindow(screenWidth, screenHeight, "raylib [core] example - 3d camera free")
211 10, 10, 10, // カメラの位置
212 0, 0, 0 , // カメラの視点位置
213 0, 1, 0, // カメラの上方向 (対象に向かい合って回転)
215 CAMERA_PERSPECTIVE) // カメラモードの型
217 cubePosition = Vector3(0, 0, 0)
219 SetCameraMode(camera, CAMERA_FREE) // カメラモードを自由視点へ設定
223 while !WindowShouldClose()
227 if IsKeyDown("Z") camera.target = Vector3( 0, 0, 0) ok
231 ClearBackground(RAYWHITE)
235 DrawCube(cubePosition, 2, 2, 2, RED)
236 DrawCubeWires(cubePosition, 2, 2, 2, MAROON)
242 DrawRectangle( 10, 10, 320, 133, Fade(SKYBLUE, 0.5))
243 DrawRectangleLines( 10, 10, 320, 133, BLUE)
245 DrawText("Free camera default controls:", 20, 20, 10, BLACK)
246 DrawText("- Mouse Wheel to Zoom in-out", 40, 40, 10, DARKGRAY)
247 DrawText("- Mouse Wheel Pressed to Pan", 40, 60, 10, DARKGRAY)
248 DrawText("- Alt + Mouse Wheel Pressed to Rotate", 40, 80, 10, DARKGRAY)
249 DrawText("- Alt + Ctrl + Mouse Wheel Pressed for Smooth Zoom",
250 40, 100, 10, DARKGRAY)
251 DrawText("- Z to zoom to (0, 0, 0)", 40, 120, 10, DARKGRAY)
261 .. image:: raylib_3dcamerafree.png
265 pair: RingRayLib の用法; マウスホイール
277 InitWindow(screenWidth, screenHeight, "raylib [core] example - input mouse wheel")
279 boxPositionY = screenHeight/2 - 40
284 while !WindowShouldClose()
285 boxPositionY -= (GetMouseWheelMove()*scrollSpeed)
289 ClearBackground(RAYWHITE)
291 DrawRectangle(screenWidth/2 - 40, boxPositionY, 80, 80, MAROON)
293 DrawText("Use mouse wheel to move the cube up and down!", 10, 10, 20, GRAY)
294 DrawText("Box position Y: "+boxPositionY, 10, 40, 20, LIGHTGRAY)
304 .. image:: raylib_mousewheel.png
308 pair: RingRayLib の用法; マルチタッチ入力
320 InitWindow(screenWidth, screenHeight, "raylib [core] example - input multitouch")
322 ballPosition = Vector2(-100, -100)
326 touchPosition = vector2(0,0)
332 while !WindowShouldClose()
334 ballPosition = GetMousePosition()
338 if IsMouseButtonDown(MOUSE_LEFT_BUTTON) ballColor = MAROON ok
339 if IsMouseButtonDown(MOUSE_MIDDLE_BUTTON) ballColor = LIME ok
340 if IsMouseButtonDown(MOUSE_RIGHT_BUTTON) ballColor = DARKBLUE ok
342 if IsMouseButtonPressed(MOUSE_LEFT_BUTTON) touchCounter = 10 ok
343 if IsMouseButtonPressed(MOUSE_MIDDLE_BUTTON) touchCounter = 10 ok
344 if IsMouseButtonPressed(MOUSE_RIGHT_BUTTON) touchCounter = 10 ok
346 if touchCounter > 0 touchCounter-- ok
350 ClearBackground(RAYWHITE)
352 for i = 0 to MAX_TOUCH_POINTS-1
353 touchPosition = GetTouchPosition(i)
355 if touchPosition.x >= 0 && touchPosition.y >= 0
356 DrawCircleV(touchPosition, 34, ORANGE)
357 DrawText(""+ i, touchPosition.x - 10,
358 touchPosition.y - 70, 40, BLACK)
362 DrawCircleV(ballPosition, 30 + (touchCounter*3), ballColor)
364 DrawText("move ball with mouse and click mouse button to change color",
365 10, 10, 20, DARKGRAY)
366 DrawText("touch the screen at multiple locations to get multiple balls",
367 10, 30, 20, DARKGRAY)
377 .. image:: raylib_inputmt.png
381 pair: RingRayLib の用法; ファーストパーソンカメラ
384 ========================
395 InitWindow(screenWidth, screenHeight, "raylib [core] example - 3d camera first person")
405 heights = list(MAX_COLUMNS)
406 positions = list(MAX_COLUMNS)
407 for item in positions item = vector3(0,0,0) next
408 colors = list(MAX_COLUMNS)
409 for item in colors item = BLACK next
411 for i = 1 to MAX_COLUMNS
412 heights[i] = GetRandomValue(1, 12)
413 positions[i] = Vector3(GetRandomValue(-15, 15),
414 heights[i]/2, GetRandomValue(-15, 15) )
415 colors[i] = RAYLibColor(GetRandomValue(20, 255),
416 GetRandomValue(10, 55), 30, 255 )
419 SetCameraMode(camera, CAMERA_FIRST_PERSON)
423 while !WindowShouldClose()
428 ClearBackground(RAYWHITE)
432 DrawPlane(Vector3( 0, 0, 0 ), Vector2(32, 32 ), LIGHTGRAY) // 地面の描画
433 DrawCube(Vector3( -16, 2.5, 0 ), 1, 5, 32, BLUE) // 青壁の描画
434 DrawCube(Vector3( 16, 2.5, 0 ), 1, 5, 32, LIME) // 緑壁の描画
435 DrawCube(Vector3( 0, 2.5, 16 ), 32, 5, 1, GOLD) // 黄壁の描画
437 for i = 1 to MAX_COLUMNS
438 DrawCube(positions[i], 2, heights[i], 2, colors[i])
439 DrawCubeWires(positions[i], 2, heights[i], 2, MAROON)
444 DrawRectangle( 10, 10, 220, 70, Fade(SKYBLUE, 0.5f))
445 DrawRectangleLines( 10, 10, 220, 70, BLUE)
447 DrawText("First person camera default controls:", 20, 20, 10, BLACK)
448 DrawText("- Move with keys: W, A, S, D", 40, 40, 10, DARKGRAY)
449 DrawText("- Mouse move to look around", 40, 60, 10, DARKGRAY)
458 .. image:: raylib_camerafirstperson.png
462 pair: RingRayLib の用法; 3Dピッキング
474 InitWindow(screenWidth, screenHeight, "raylib [core] example - 3d picking")
484 cubePosition = Vector3( 0, 1, 0 )
485 cubeSize = Vector3( 2, 2, 2 )
487 ray = Ray(0,0,0,0,0,0)
491 SetCameraMode(camera, CAMERA_FREE)
495 while !WindowShouldClose()
499 if IsMouseButtonPressed(MOUSE_LEFT_BUTTON)
501 ray = GetMouseRay(GetMousePosition(), camera)
502 collision = CheckCollisionRayBox(ray,
503 BoundingBox( cubePosition.x - cubeSize.x/2,
504 cubePosition.y - cubeSize.y/2, cubePosition.z - cubeSize.z/2,
505 cubePosition.x + cubeSize.x/2, cubePosition.y + cubeSize.y/2,
506 cubePosition.z + cubeSize.z/2 ) )
507 else collision = false
513 ClearBackground(RAYWHITE)
518 DrawCube(cubePosition, cubeSize.x, cubeSize.y, cubeSize.z, RED)
519 DrawCubeWires(cubePosition, cubeSize.x, cubeSize.y, cubeSize.z, MAROON)
521 DrawCubeWires(cubePosition, cubeSize.x + 0.2f,
522 cubeSize.y + 0.2f, cubeSize.z + 0.2f, GREEN)
524 DrawCube(cubePosition, cubeSize.x, cubeSize.y, cubeSize.z, GRAY)
525 DrawCubeWires(cubePosition, cubeSize.x, cubeSize.y, cubeSize.z, DARKGRAY)
533 DrawText("Try selecting the box with mouse!", 240, 10, 20, DARKGRAY)
535 if collision DrawText("BOX SELECTED",
536 (screenWidth - MeasureText("BOX SELECTED", 30)) / 2,
537 screenHeight * 0.1f, 30, GREEN) ok
548 .. image:: raylib_3dpicking.png
552 pair: RingRayLib の用法; 全画面表示
564 InitWindow(screenWidth, screenHeight, "Full Screen")
569 while !WindowShouldClose()
571 ClearBackground(DARKBLUE)
572 DrawText("Count from 1 to 10", 190, 200, 20, Yellow)
574 DrawText("Number: " + t, 190, 200+(30*t), 20, WHITE)
583 .. image:: raylib_fullscreen.png
587 pair: RingRayLib の用法; 二個の立方体
598 InitWindow(screenWidth, screenHeight, "raylib [core] example - Two Cubes")
608 cubePosition1 = Vector3( 0, 1, 4 )
609 cubePosition2 = Vector3( 0, 1, -4 )
610 cubeSize = Vector3( 2, 2, 2 )
612 ray = Ray(0,0,0,0,0,0)
617 SetCameraMode(camera, CAMERA_FREE)
621 while !WindowShouldClose()
625 if IsMouseButtonPressed(MOUSE_LEFT_BUTTON)
627 ray = GetMouseRay(GetMousePosition(), camera)
629 collision1 = CheckCollisionRayBox(ray,
630 BoundingBox( cubePosition1.x -
631 cubeSize.x/2, cubePosition1.y - cubeSize.y/2,
632 cubePosition1.z - cubeSize.z/2,
633 cubePosition1.x + cubeSize.x/2,
634 cubePosition1.y + cubeSize.y/2,
635 cubePosition1.z + cubeSize.z/2 ) )
640 ray = GetMouseRay(GetMousePosition(), camera)
642 collision2 = CheckCollisionRayBox(ray,
643 BoundingBox( cubePosition2.x -
644 cubeSize.x/2, cubePosition2.y - cubeSize.y/2,
645 cubePosition2.z - cubeSize.z/2,
646 cubePosition2.x + cubeSize.x/2,
647 cubePosition2.y + cubeSize.y/2,
648 cubePosition2.z + cubeSize.z/2 ) )
656 ClearBackground(RAYWHITE)
661 DrawCube(cubePosition1, cubeSize.x,
662 cubeSize.y, cubeSize.z, RED)
663 DrawCubeWires(cubePosition1, cubeSize.x,
664 cubeSize.y, cubeSize.z, MAROON)
666 DrawCubeWires(cubePosition1, cubeSize.x +
667 0.2f, cubeSize.y + 0.2f,
668 cubeSize.z + 0.2f, GREEN)
671 DrawCube(cubePosition1, cubeSize.x,
672 cubeSize.y, cubeSize.z, GRAY)
673 DrawCubeWires(cubePosition1, cubeSize.x,
674 cubeSize.y, cubeSize.z, DARKGRAY)
679 DrawCube(cubePosition2, cubeSize.x,
680 cubeSize.y, cubeSize.z, RED)
681 DrawCubeWires(cubePosition2, cubeSize.x,
682 cubeSize.y, cubeSize.z, MAROON)
684 DrawCubeWires(cubePosition2, cubeSize.x +
685 0.2f, cubeSize.y + 0.2f,
686 cubeSize.z + 0.2f, GREEN)
689 DrawCube(cubePosition2, cubeSize.x,
690 cubeSize.y, cubeSize.z, GRAY)
691 DrawCubeWires(cubePosition2, cubeSize.x,
692 cubeSize.y, cubeSize.z, DARKGRAY)
702 DrawText("Try selecting the box with mouse!", 240, 10,
705 if collision1 or collision2
706 DrawText("BOX SELECTED",
707 (screenWidth - MeasureText("BOX SELECTED", 30)) / 2,
708 screenHeight * 0.1f, 30, GREEN)
720 .. image:: raylib_twocubes.png
724 pair: RingRayLib の用法; 基本図形
736 InitWindow(screenWidth, screenHeight, "raylib [shapes] example - basic shapes drawing")
740 while !WindowShouldClose()
744 ClearBackground(RAYWHITE)
746 DrawText("some basic shapes available on raylib", 20, 20, 20, DARKGRAY)
748 DrawCircle(screenWidth/4, 120, 35, DARKBLUE)
750 DrawRectangle(screenWidth/4*2 - 60, 100, 120, 60, RED)
751 DrawRectangleLines(screenWidth/4*2 - 40, 320, 80, 60, ORANGE)
752 DrawRectangleGradientH(screenWidth/4*2 - 90, 170, 180, 130, MAROON, GOLD)
754 DrawTriangle(Vector2(screenWidth/4*3, 80),
755 Vector2(screenWidth/4*3 - 60, 150),
756 Vector2(screenWidth/4*3 + 60, 150), VIOLET)
758 DrawPoly(Vector2(screenWidth/4*3, 320), 6, 80, 0, BROWN)
760 DrawCircleGradient(screenWidth/4, 220, 60, GREEN, SKYBLUE)
762 DrawLine(18, 42, screenWidth - 18, 42, BLACK)
763 DrawCircleLines(screenWidth/4, 340, 80, DARKBLUE)
764 DrawTriangleLines(Vector2(screenWidth/4*3, 160),
765 Vector2(screenWidth/4*3 - 20, 230),
766 Vector2(screenWidth/4*3 + 20, 230), DARKBLUE)
775 .. image:: raylib_basicshapes.png
779 pair: RingRayLib の用法; Ring の描画
788 screenWidth = 800 screenHeight = 450
790 InitWindow(screenWidth, screenHeight, "raylib [shapes] example - draw ring")
792 center = Vector2((GetScreenWidth() - 300)/2, GetScreenHeight()/2 )
794 innerRadius = 80 outerRadius = 190
795 startAngle = 0 endAngle = 360 segments = 0
796 drawRing = true drawRingLines = false drawCircleLines = false
800 while !WindowShouldClose()
804 ClearBackground(RAYWHITE)
806 DrawLine(500, 0, 500, GetScreenHeight(), Fade(LIGHTGRAY, 0.6))
807 DrawRectangle(500, 0, GetScreenWidth() - 500,
808 GetScreenHeight(), Fade(LIGHTGRAY, 0.3))
810 if drawRing DrawRing(center, innerRadius, outerRadius,
811 startAngle, endAngle, segments, Fade(MAROON, 0.3)) ok
812 if drawRingLines DrawRingLines(center, innerRadius,
813 outerRadius, startAngle, endAngle,
814 segments, Fade(BLACK, 0.4)) ok
815 if drawCircleLines DrawCircleSectorLines(center, outerRadius,
816 startAngle, endAngle, segments, Fade(BLACK, 0.4)) ok
818 startAngle = GuiSliderBar(Rectangle( 600, 40, 120, 20 ),
819 "StartAngle", startAngle, -450, 450, true)
820 endAngle = GuiSliderBar(Rectangle( 600, 70, 120, 20 ),
821 "EndAngle", endAngle, -450, 450, true)
823 innerRadius = GuiSliderBar(Rectangle( 600, 140, 120, 20 ),
824 "InnerRadius", innerRadius, 0, 100, true)
825 outerRadius = GuiSliderBar(Rectangle( 600, 170, 120, 20 ),
826 "OuterRadius", outerRadius, 0, 200, true)
828 segments = GuiSliderBar(Rectangle( 600, 240, 120, 20 ),
829 "Segments", segments, 0, 100, true)
831 drawRing = GuiCheckBox(Rectangle( 600, 320, 20, 20 ),
832 "Draw Ring", drawRing)
833 drawRingLines = GuiCheckBox(Rectangle( 600, 350, 20, 20 ),
834 "Draw RingLines", drawRingLines)
835 drawCircleLines = GuiCheckBox(Rectangle( 600, 380, 20, 20 ),
836 "Draw CircleLines", drawCircleLines)
839 DrawText("MODE: MANUAL", 600, 270, 10, MAROON)
841 DrawText("MODE: AUTO", 600, 270, 10, DARKGRAY)
853 .. image:: raylib_drawring.png
858 .. image:: raylib_drawring2.png
862 pair: RingRayLib の用法; ベジェ曲線
874 SetConfigFlags(FLAG_MSAA_4X_HINT)
875 InitWindow(screenWidth, screenHeight, "raylib [shapes] example - cubic-bezier lines")
878 endvec = Vector2(screenWidth,screenHeight)
882 while (!WindowShouldClose())
884 if (IsMouseButtonDown(MOUSE_LEFT_BUTTON))
885 start = GetMousePosition()
886 else (IsMouseButtonDown(MOUSE_RIGHT_BUTTON))
887 endvec = GetMousePosition()
893 ClearBackground(RAYWHITE)
894 DrawText("USE MOUSE LEFT-RIGHT CLICK to DEFINE LINE START and END POINTS",
896 DrawLineBezier(start, endvec, 2.0, RED)
906 .. image:: raylib_bezierlines.png
910 pair: RingRayLib の用法; 当たり判定の領域
922 InitWindow(screenWidth, screenHeight, "raylib [shapes] example - collision area")
925 boxA = Rectangle( 10, GetScreenHeight()/2 - 50, 200, 100 )
928 // ボックス B: マウスで移動したボックス
929 boxB = Rectangle( GetScreenWidth()/2 - 30, GetScreenHeight()/2 - 30, 60, 60 )
931 boxCollision = GetCollisionRec(boxA, boxB)
933 boxCollision = Rectangle( 0,0,0,0 ) // 長方形の当たり判定
935 screenUpperLimit = 40 // トップメニューの制限
937 pause = false // 移動の一時停止
938 collision = false // 当たり判定の検出
942 while !WindowShouldClose()
944 // 一時停止中でなければボックスを移動します
945 if (not pause) boxA.x += boxASpeedX ok
947 // 画面制限における X 方向のバウンスボックス
948 if (((boxA.x + boxA.width) >= GetScreenWidth()) or (boxA.x <= 0))
949 boxASpeedX = boxASpeedX*(-1) ok
951 // プレイヤー操作のボックスを更新 (box02)
952 boxB.x = GetMouseX() - boxB.width/2
953 boxB.y = GetMouseY() - boxB.height/2
955 // ボックス B が制限領域内から出られないようにします
956 if ((boxB.x + boxB.width) >= GetScreenWidth())
957 boxB.x = GetScreenWidth() - boxB.width
958 else (boxB.x <= 0) boxB.x = 0 ok
960 if ((boxB.y + boxB.height) >= GetScreenHeight())
961 boxB.y = GetScreenHeight() - boxB.height
962 else (boxB.y <= screenUpperLimit) boxB.y = screenUpperLimit ok
965 collision = CheckCollisionRecs(boxA, boxB)
967 // 長方形の当たり判定を取得 (当たり判定のみ)
968 if (collision) boxCollision = GetCollisionRec(boxA, boxB) ok
971 if (IsKeyPressed(KEY_SPACE)) pause = not pause ok
975 ClearBackground(RAYWHITE)
982 DrawRectangle(0, 0, screenWidth, screenUpperLimit, color)
983 DrawRectangleRec(boxA, GOLD)
985 boxB.x = GetMouseX() - boxB.width/2
986 boxB.y = GetMouseY() - boxB.height/2
987 collision = CheckCollisionRecs(boxA, boxB)
988 DrawRectangleRec(boxB, BLUE)
989 boxCollision = GetCollisionRec(boxA, boxB)
991 if (collision) = true
994 DrawRectangleRec(boxCollision, LIME)
997 DrawText("COLLISION!", GetScreenWidth()/2 -
998 MeasureText("COLLISION!", 20)/2,
999 screenUpperLimit/2 - 10, 20, BLACK)
1002 DrawText("Collision Area: " +
1003 string(boxCollision.width*boxCollision.height),
1004 GetScreenWidth()/2 - 100,
1005 screenUpperLimit + 10, 20, BLACK)
1019 .. image:: raylib_collisionarea.png
1023 pair: RingRayLib の用法; 視線追従
1028 .. code-block:: ring
1035 InitWindow(screenWidth, screenHeight, "raylib [shapes] example - following eyes")
1037 scleraLeftPosition = Vector2( GetScreenWidth()/2 - 100, GetScreenHeight()/2 )
1038 scleraRightPosition = Vector2( GetScreenWidth()/2 + 100, GetScreenHeight()/2 )
1041 irisLeftPosition = Vector2( GetScreenWidth()/2 - 100, GetScreenHeight()/2 )
1042 irisRightPosition = Vector2( GetScreenWidth()/2 + 100, GetScreenHeight()/2 )
1046 dx = 0.0 dy = 0.0 dxx = 0.0 dyy = 0.0
1050 while !WindowShouldClose()
1052 irisLeftPosition = GetMousePosition()
1053 irisRightPosition = GetMousePosition()
1056 if !CheckCollisionPointCircle(irisLeftPosition,
1057 scleraLeftPosition, scleraRadius - 20)
1058 dx = irisLeftPosition.x - scleraLeftPosition.x
1059 dy = irisLeftPosition.y - scleraLeftPosition.y
1061 angle = atan2(dy, dx)
1063 dxx = (scleraRadius - irisRadius)*cos(angle)
1064 dyy = (scleraRadius - irisRadius)*sin(angle)
1066 irisLeftPosition.x = scleraLeftPosition.x + dxx
1067 irisLeftPosition.y = scleraLeftPosition.y + dyy
1071 if !CheckCollisionPointCircle(irisRightPosition,
1072 scleraRightPosition, scleraRadius - 20)
1073 dx = irisRightPosition.x - scleraRightPosition.x
1074 dy = irisRightPosition.y - scleraRightPosition.y
1076 angle = atan2(dy, dx)
1078 dxx = (scleraRadius - irisRadius)*cos(angle)
1079 dyy = (scleraRadius - irisRadius)*sin(angle)
1081 irisRightPosition.x = scleraRightPosition.x + dxx
1082 irisRightPosition.y = scleraRightPosition.y + dyy
1087 ClearBackground(RAYWHITE)
1089 DrawCircleV(scleraLeftPosition, scleraRadius, LIGHTGRAY)
1090 DrawCircleV(irisLeftPosition, irisRadius, BROWN)
1091 DrawCircleV(irisLeftPosition, 10, BLACK)
1093 DrawCircleV(scleraRightPosition, scleraRadius, LIGHTGRAY)
1094 DrawCircleV(irisRightPosition, irisRadius, DARKGREEN)
1095 DrawCircleV(irisRightPosition, 10, BLACK)
1107 .. image:: raylib_followingeyes.png
1111 pair: RingRayLib の用法; カラーパレット
1116 .. code-block:: ring
1120 MAX_COLORS_COUNT = 21 // 利用できる色値数
1124 colors = list(MAX_COLORS_COUNT)
1125 colorNames = list(MAX_COLORS_COUNT)
1126 colorsRecs = list(MAX_COLORS_COUNT)
1127 colorState = list(MAX_COLORS_COUNT)
1129 InitWindow(screenWidth, screenHeight, "raylib [shapes] example - colors palette")
1132 DARKGRAY, MAROON, ORANGE, DARKGREEN, DARKBLUE, DARKPURPLE, DARKBROWN,
1133 GRAY, RED, GOLD, LIME, BLUE, VIOLET, BROWN, LIGHTGRAY, PINK, YELLOW,
1134 GREEN, SKYBLUE, PURPLE, BEIGE ]
1137 "DARKGRAY", "MAROON", "ORANGE", "DARKGREEN", "DARKBLUE", "DARKPURPLE",
1138 "DARKBROWN", "GRAY", "RED", "GOLD", "LIME", "BLUE", "VIOLET", "BROWN",
1139 "LIGHTGRAY", "PINK", "YELLOW", "GREEN", "SKYBLUE", "PURPLE", "BEIGE" ]
1141 for i = 1 to MAX_COLORS_COUNT
1142 colorsRecs[i] = new Rectangle(0,0,0,0)
1145 for i = 1 to MAX_COLORS_COUNT
1150 // colorsRecs データで塗りつぶします (長方形ごとに)
1151 for i = 1 to MAX_COLORS_COUNT
1152 colorsRecs[i].x = 20 + 100*((i-1)%7) + 10*((i-1)%7)
1153 colorsRecs[i].y = 80 + 100*floor((i-1)/7) + 10*floor((i-1)/7)
1154 colorsRecs[i].width = 100
1155 colorsRecs[i].height = 100
1158 mousePoint = Vector2( 0.0, 0.0 )
1163 while !WindowShouldClose()
1165 mousePoint = GetMousePosition()
1167 for i = 1 to MAX_COLORS_COUNT
1168 if (CheckCollisionPointRec(mousePoint,
1169 colorsRecs[i])) colorState[i] = 1
1170 else colorState[i] = 0 ok
1175 ClearBackground(RAYWHITE)
1177 DrawText("raylib colors palette", 28, 42, 20, BLACK)
1178 DrawText("press SPACE to see all colors",
1179 GetScreenWidth() - 180,
1180 GetScreenHeight() - 40, 10, GRAY)
1182 for i = 1 to MAX_COLORS_COUNT // 長方形の描画
1189 DrawRectangleRec(colorsRecs[i], Fade(colors[i], cstate))
1191 if (IsKeyDown(KEY_SPACE) || colorState[i])
1192 DrawRectangle(colorsRecs[i].x,
1193 colorsRecs[i].y + colorsRecs[i].height - 26,
1194 colorsRecs[i].width, 20, BLACK)
1195 DrawRectangleLinesEx(colorsRecs[i], 6,
1197 DrawText(colorNames[i], colorsRecs[i].x +
1198 colorsRecs[i].width - MeasureText(colorNames[i],
1199 10) - 12, colorsRecs[i].y +
1200 colorsRecs[i].height - 20, 10, colors[i])
1213 .. image:: raylib_colorspalette.png
1217 pair: RingRayLib の用法; 長方形の拡縮
1222 .. code-block:: ring
1226 MOUSE_SCALE_MARK_SIZE = 12
1231 InitWindow(screenWidth, screenHeight,
1232 "raylib [shapes] example - rectangle scaling mouse")
1234 rec = Rectangle( 100, 100, 200, 80 )
1236 mousePosition = Vector2( 0,0 )
1238 mouseScaleReady = false
1239 mouseScaleMode = false
1243 while !WindowShouldClose()
1245 mousePosition = GetMousePosition()
1247 if (CheckCollisionPointRec(mousePosition, rec) and
1248 CheckCollisionPointRec(mousePosition,
1249 Rectangle(rec.x + rec.width - MOUSE_SCALE_MARK_SIZE,
1250 rec.y + rec.height - MOUSE_SCALE_MARK_SIZE,
1251 MOUSE_SCALE_MARK_SIZE, MOUSE_SCALE_MARK_SIZE )))
1252 mouseScaleReady = true
1253 if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON))
1254 mouseScaleMode = true ok
1255 else mouseScaleReady = false ok
1259 mouseScaleReady = true
1261 rec.width = (mousePosition.x - rec.x)
1262 rec.height = (mousePosition.y - rec.y)
1264 if (rec.width < MOUSE_SCALE_MARK_SIZE)
1265 rec.width = MOUSE_SCALE_MARK_SIZE ok
1266 if (rec.height < MOUSE_SCALE_MARK_SIZE)
1267 rec.height = MOUSE_SCALE_MARK_SIZE ok
1269 if (IsMouseButtonReleased(MOUSE_LEFT_BUTTON))
1270 mouseScaleMode = false ok
1275 ClearBackground(RAYWHITE)
1277 DrawText("Scale rectangle dragging from bottom-right corner!",
1280 DrawRectangleRec(rec, Fade(GREEN, 0.5f))
1282 if (mouseScaleReady)
1284 DrawRectangleLinesEx(rec, 1, RED)
1285 DrawTriangle(Vector2( rec.x + rec.width -
1286 MOUSE_SCALE_MARK_SIZE, rec.y + rec.height ),
1287 Vector2( rec.x + rec.width, rec.y + rec.height ),
1288 Vector2( rec.x + rec.width, rec.y + rec.height -
1289 MOUSE_SCALE_MARK_SIZE ), RED)
1301 .. image:: raylib_rectanglescaling.png
1305 pair: RingRayLib の用法; 音楽のストリーミング再生
1308 ========================
1310 .. code-block:: ring
1317 InitWindow(screenWidth, screenHeight,
1318 "raylib [audio] example - music playing (streaming)")
1322 music = LoadMusicStream("guitar_noodling.ogg")
1324 PlayMusicStream(music)
1332 while !WindowShouldClose()
1334 UpdateMusicStream(music)
1336 if IsKeyPressed(KEY_SPACE)
1337 StopMusicStream(music)
1338 PlayMusicStream(music)
1341 if IsKeyPressed(KEY_P)
1345 PauseMusicStream(music)
1347 ResumeMusicStream(music)
1351 timePlayed = GetMusicTimePlayed(music) / GetMusicTimeLength(music) *400
1354 StopMusicStream(music)
1359 ClearBackground(RAYWHITE)
1361 DrawText("MUSIC SHOULD BE PLAYING!", 255, 150, 20, LIGHTGRAY)
1363 DrawRectangle(200, 200, 400, 12, LIGHTGRAY)
1364 DrawRectangle(200, 200, timePlayed, 12, MAROON)
1365 DrawRectangleLines(200, 200, 400, 12, GRAY)
1367 DrawText("PRESS SPACE TO RESTART MUSIC", 215, 250, 20, LIGHTGRAY)
1368 DrawText("PRESS P TO PAUSE/RESUME MUSIC", 208, 280, 20, LIGHTGRAY)
1374 UnloadMusicStream(music)
1382 .. image:: raylib_musicplaying.png
1386 pair: RingRayLib の用法; 音声の読み込みと再生
1389 ====================
1391 .. code-block:: ring
1398 InitWindow(screenWidth, screenHeight,
1399 "raylib [audio] example - sound loading and playing")
1403 fxWav = LoadSound("sound.wav")
1404 fxOgg = LoadSound("tanatana.ogg")
1409 while !WindowShouldClose()
1411 if IsKeyPressed(KEY_SPACE) PlaySound(fxWav) ok
1412 if IsKeyPressed(KEY_ENTER) PlaySound(fxOgg) ok
1416 ClearBackground(RAYWHITE)
1418 DrawText("Press SPACE to PLAY the WAV sound!", 200, 180, 20, LIGHTGRAY)
1419 DrawText("Press ENTER to PLAY the OGG sound!", 200, 220, 20, LIGHTGRAY)
1434 .. image:: raylib_soundloading.png
1439 pair: RingRayLib の用法; 画像の描画
1444 .. code-block:: ring
1451 InitWindow(screenWidth, screenHeight,
1452 "raylib [textures] example - image drawing")
1454 cat = LoadImage("cat.png")
1456 ImageCrop( cat, Rectangle( 100, 10, 280, 380 ))
1457 ImageFlipHorizontal( cat)
1458 ImageResize( cat, 150, 200)
1460 parrots = LoadImage("parrots.png")
1462 ImageDraw( parrots, cat, Rectangle( 0, 0, cat.width, cat.height ),
1463 Rectangle( 30, 40, cat.width*1.5, cat.height*1.5 ))
1464 ImageCrop( parrots, Rectangle( 0, 50, parrots.width, parrots.height - 100 ))
1468 font = LoadFont("custom_jupiter_crash.png")
1470 ImageDrawTextEx(parrots, Vector2( 300, 230 ), font,
1471 "PARROTS & CAT", font.baseSize, -2, WHITE)
1474 texture = LoadTextureFromImage(parrots)
1476 UnloadImage(parrots)
1480 while !WindowShouldClose()
1483 ClearBackground(RAYWHITE)
1485 DrawTexture(texture, screenWidth/2 - texture.width/2,
1486 screenHeight/2 - texture.height/2 - 40, WHITE)
1487 DrawRectangleLines(screenWidth/2 - texture.width/2,
1488 screenHeight/2 - texture.height/2 - 40,
1489 texture.width, texture.height, DARKGRAY)
1491 DrawText("We are drawing only one texture from various images composed!",
1492 240, 350, 10, DARKGRAY)
1493 DrawText("Source images have been cropped, scaled,"+
1494 " flipped and copied one over the other.",
1495 190, 370, 10, DARKGRAY)
1500 UnloadTexture(texture)
1506 .. image:: raylib_imagedrawing.png
1511 pair: RingRayLib の用法; 画像生成
1516 .. code-block:: ring
1526 InitWindow(screenWidth, screenHeight,
1527 "raylib [textures] example - procedural images generation")
1529 verticalGradient = GenImageGradientV(screenWidth, screenHeight, RED, BLUE)
1530 horizontalGradient = GenImageGradientH(screenWidth, screenHeight, RED, BLUE)
1531 radialGradient = GenImageGradientRadial(screenWidth,
1532 screenHeight, 0.0, WHITE, BLACK)
1533 checked = GenImageChecked(screenWidth, screenHeight,
1535 whiteNoise = GenImageWhiteNoise(screenWidth, screenHeight, 0.5)
1536 perlinNoise = GenImagePerlinNoise(screenWidth, screenHeight, 50, 50, 4.0)
1537 cellular = GenImageCellular(screenWidth, screenHeight, 32)
1539 textures[NUM_TEXTURES] = 0
1541 textures[1] = LoadTextureFromImage(verticalGradient)
1542 textures[2] = LoadTextureFromImage(horizontalGradient)
1543 textures[3] = LoadTextureFromImage(radialGradient)
1544 textures[4] = LoadTextureFromImage(checked)
1545 textures[5] = LoadTextureFromImage(whiteNoise)
1546 textures[6] = LoadTextureFromImage(perlinNoise)
1547 textures[7] = LoadTextureFromImage(cellular)
1549 UnloadImage(verticalGradient)
1550 UnloadImage(horizontalGradient)
1551 UnloadImage(radialGradient)
1552 UnloadImage(checked)
1553 UnloadImage(whiteNoise)
1554 UnloadImage(perlinNoise)
1555 UnloadImage(cellular)
1561 while !WindowShouldClose()
1563 if IsMouseButtonPressed(MOUSE_LEFT_BUTTON) || IsKeyPressed(KEY_RIGHT)
1565 if currentTexture > NUM_TEXTURES currentTexture = 1 ok
1570 ClearBackground(RAYWHITE)
1572 DrawTexture(textures[currentTexture], 0, 0, WHITE)
1574 DrawRectangle(30, 400, 325, 30, Fade(SKYBLUE, 0.5))
1575 DrawRectangleLines(30, 400, 325, 30, Fade(WHITE, 0.5))
1576 DrawText("MOUSE LEFT BUTTON to CYCLE PROCEDURAL TEXTURES",
1579 switch(currentTexture)
1580 on 1 DrawText("VERTICAL GRADIENT", 560, 10, 20, RAYWHITE)
1581 on 2 DrawText("HORIZONTAL GRADIENT", 540, 10, 20, RAYWHITE)
1582 on 3 DrawText("RADIAL GRADIENT", 580, 10, 20, LIGHTGRAY)
1583 on 4 DrawText("CHECKED", 680, 10, 20, RAYWHITE)
1584 on 5 DrawText("WHITE NOISE", 640, 10, 20, RED)
1585 on 6 DrawText("PERLIN NOISE", 630, 10, 20, RAYWHITE)
1586 on 7 DrawText("CELLULAR", 670, 10, 20, RAYWHITE)
1593 for i = 1 to NUM_TEXTURES
1594 UnloadTexture( textures[i] )
1602 .. image:: raylib_imagegeneration.png
1607 pair: RingRayLib の用法; テクスチャの入力
1612 .. code-block:: ring
1619 InitWindow(screenWidth, screenHeight,
1620 "raylib [textures] examples - texture source and destination rectangles")
1622 // 注意: テクスチャの読み込みは必ずウィンドウの初期化後に行ってください
1623 // (OpenGL コンテキストが必要です)
1625 scarfy = LoadTexture("RingLogo.png") // テクスチャの読み込み
1627 frameWidth = scarfy.width
1628 frameHeight = scarfy.height
1630 // 入力元となる長方形 (描画で使うテクスチャ部品です)
1631 sourceRec = Rectangle( 0.0, 0.0, frameWidth, frameHeight )
1633 // 出力先の長方形 (テクスチャ部品は画面へ長方形として描画されます)
1634 destRec = Rectangle( screenWidth/2, screenHeight/2, frameWidth*2, frameHeight*2 )
1636 // オリジナルのテクスチャ (回転/点の拡縮)
1637 // つまり、出力先の長方形の相対的寸法です
1638 origin = Vector2( frameWidth, frameHeight )
1644 while !WindowShouldClose()
1646 rotation = rotation+1
1650 ClearBackground(RAYWHITE)
1652 DrawTexturePro(scarfy, sourceRec, destRec,
1653 origin, rotation, WHITE)
1655 DrawLine(destRec.x, 0, destRec.x, screenHeight, GRAY)
1656 DrawLine(0, destRec.y, screenWidth, destRec.y, GRAY)
1658 DrawText("(c) Scarfy sprite by Eiden Marsal",
1659 screenWidth - 200, screenHeight - 20, 10, GRAY)
1665 UnloadTexture(scarfy) // テクスチャの解放
1672 .. image:: raylib_texturesource.png
1677 pair: RingRayLib の用法; 幾何学的図形
1682 .. code-block:: ring
1686 FOVY_PERSPECTIVE = 45.0
1687 WIDTH_ORTHOGRAPHIC = 10.0
1692 InitWindow(screenWidth, screenHeight,
1693 "raylib [models] example - geometric shapes")
1695 camera = Camera3D( 0.0, 10.0, 10.0,
1698 FOVY_PERSPECTIVE, CAMERA_PERSPECTIVE
1703 while !WindowShouldClose()
1705 if IsKeyPressed(KEY_SPACE)
1707 if camera.type = CAMERA_PERSPECTIVE
1709 camera.fovy = WIDTH_ORTHOGRAPHIC
1710 camera.type = CAMERA_ORTHOGRAPHIC
1714 camera.fovy = FOVY_PERSPECTIVE
1715 camera.type = CAMERA_PERSPECTIVE
1721 ClearBackground(RAYWHITE)
1725 DrawCube(Vector3(-4.0, 0.0, 2.0), 2.0, 5.0, 2.0, RED)
1726 DrawCubeWires(Vector3(-4.0, 0.0, 2.0), 2.0, 5.0, 2.0, GOLD)
1727 DrawCubeWires(Vector3(-4.0, 0.0, -2.0), 3.0, 6.0, 2.0, MAROON)
1729 DrawSphere(Vector3(-1.0, 0.0, -2.0), 1.0, GREEN)
1730 DrawSphereWires(Vector3( 1.0, 0.0, 2.0), 2.0, 16, 16, LIME)
1732 DrawCylinder(Vector3(4.0, 0.0, -2.0), 1.0, 2.0, 3.0, 4, SKYBLUE)
1733 DrawCylinderWires(Vector3(4.0, 0.0, -2.0), 1.0, 2.0, 3.0, 4, DARKBLUE)
1734 DrawCylinderWires(Vector3(4.5, -1.0, 2.0), 1.0, 1.0, 2.0, 6, BROWN)
1736 DrawCylinder(Vector3(1.0, 0.0, -4.0), 0.0, 1.5, 3.0, 8, GOLD)
1737 DrawCylinderWires(Vector3(1.0, 0.0, -4.0), 0.0, 1.5, 3.0, 8, PINK)
1743 DrawText("Press Spacebar to switch camera type", 10,
1744 GetScreenHeight() - 30, 20, DARKGRAY)
1746 if camera.type = CAMERA_ORTHOGRAPHIC
1747 DrawText("ORTHOGRAPHIC", 10, 40, 20, BLACK)
1749 if camera.type = CAMERA_PERSPECTIVE
1750 DrawText("PERSPECTIVE", 10, 40, 20, BLACK)
1764 .. image:: raylib_geometricshapes.png
1769 pair: RingRayLib の用法; キュービックマップ
1774 .. code-block:: ring
1781 InitWindow(screenWidth, screenHeight,
1782 "raylib [models] example - cubesmap loading and drawing")
1784 camera = Camera3D( 16.0, 14.0, 16.0,
1789 image = LoadImage("cubicmap.png")
1790 cubicmap = LoadTextureFromImage(image)
1792 mesh = GenMeshCubicmap(image, Vector3( 1.0, 1.0, 1.0 ))
1793 model = LoadModelFromMesh(mesh)
1795 texture = LoadTexture("cubicmap_atlas.png")
1797 setmodelmaterialtexture(model,0,MAP_DIFFUSE,texture)
1799 mapPosition = Vector3( -16.0, 0.0, -8.0 )
1802 SetCameraMode(camera, CAMERA_ORBITAL)
1805 while !WindowShouldClose()
1807 UpdateCamera(camera)
1811 ClearBackground(RAYWHITE)
1813 DrawModel(model, mapPosition, 1.0, WHITE)
1816 DrawTextureEx(cubicmap, Vector2( screenWidth -
1817 cubicmap.width*4 - 20, 20 ),
1819 DrawRectangleLines(screenWidth - cubicmap.width*4 -
1820 20, 20, cubicmap.width*4,
1821 cubicmap.height*4, GREEN)
1823 DrawText("cubicmap image used to", 658, 90, 10, GRAY)
1824 DrawText("generate map 3d model", 658, 104, 10, GRAY)
1831 UnloadTexture(cubicmap)
1832 UnloadTexture(texture)
1839 .. image:: raylib_cubicmap.png
1844 pair: RingRayLib の用法; 関数
1849 .. code-block:: none
1851 void InitWindow(int width, int height, const char *title)
1852 bool WindowShouldClose(void)
1853 void CloseWindow(void)
1854 bool IsWindowReady(void)
1855 bool IsWindowMinimized(void)
1856 bool IsWindowResized(void)
1857 bool IsWindowHidden(void)
1858 void ToggleFullscreen(void)
1859 void UnhideWindow(void)
1860 void HideWindow(void)
1861 void SetWindowIcon(Image image)
1862 void SetWindowTitle(const char *title)
1863 void SetWindowPosition(int x, int y)
1864 void SetWindowMonitor(int monitor)
1865 void SetWindowMinSize(int width, int height)
1866 void SetWindowSize(int width, int height)
1867 void *GetWindowHandle(void)
1868 int GetScreenWidth(void)
1869 int GetScreenHeight(void)
1870 int GetMonitorCount(void)
1871 int GetMonitorWidth(int monitor)
1872 int GetMonitorHeight(int monitor)
1873 int GetMonitorPhysicalWidth(int monitor)
1874 int GetMonitorPhysicalHeight(int monitor)
1875 const char *GetMonitorName(int monitor)
1876 const char *GetClipboardText(void)
1877 void SetClipboardText(const char *text)
1878 void ShowCursor(void)
1879 void HideCursor(void)
1880 bool IsCursorHidden(void)
1881 void EnableCursor(void)
1882 void DisableCursor(void)
1883 void ClearBackground(Color color)
1884 void BeginDrawing(void)
1885 void EndDrawing(void)
1886 void BeginMode2D(Camera2D camera)
1887 void EndMode2D(void)
1888 void BeginMode3D(Camera3D camera)
1889 void EndMode3D(void)
1890 void BeginTextureMode(RenderTexture2D target)
1891 void EndTextureMode(void)
1892 Ray GetMouseRay(Vector2 mousePosition, Camera3D camera)
1893 Vector2 GetWorldToScreen(Vector3 position, Camera3D camera)
1894 Matrix GetCameraMatrix(Camera3D camera)
1895 void SetTargetFPS(int fps)
1897 float GetFrameTime(void)
1898 double GetTime(void)
1899 int ColorToInt(Color color)
1900 Vector4 ColorNormalize(Color color)
1901 Vector3 ColorToHSV(Color color)
1902 Color ColorFromHSV(Vector3 hsv)
1903 Color GetColor(int hexValue)
1904 Color Fade(Color color, float alpha)
1905 void SetConfigFlags(unsigned char flags)
1906 void SetTraceLogLevel(int logType)
1907 void SetTraceLogExit(int logType)
1908 void SetTraceLogCallback(TraceLogCallback callback)
1909 void TraceLog(int logType, const char *text)
1910 void TakeScreenshot(const char *fileName)
1911 int GetRandomValue(int min, int max)
1912 bool FileExists(const char *fileName)
1913 bool IsFileExtension(const char *fileName, const char *ext)
1914 const char *GetExtension(const char *fileName)
1915 const char *GetFileName(const char *filePath)
1916 const char *GetFileNameWithoutExt(const char *filePath)
1917 const char *GetDirectoryPath(const char *fileName)
1918 const char *GetWorkingDirectory(void)
1919 char **GetDirectoryFiles(const char *dirPath, int *count)
1920 void ClearDirectoryFiles(void)
1921 bool ChangeDirectory(const char *dir)
1922 bool IsFileDropped(void)
1923 char **GetDroppedFiles(int *count)
1924 void ClearDroppedFiles(void)
1925 long GetFileModTime(const char *fileName)
1926 void StorageSaveValue(int position, int value)
1927 int StorageLoadValue(int position)
1928 void OpenURL(const char *url)
1929 bool IsKeyPressed(int key)
1930 bool IsKeyDown(int key)
1931 bool IsKeyReleased(int key)
1932 bool IsKeyUp(int key)
1933 int GetKeyPressed(void)
1934 void SetExitKey(int key)
1935 bool IsGamepadAvailable(int gamepad)
1936 bool IsGamepadName(int gamepad, const char *name)
1937 const char *GetGamepadName(int gamepad)
1938 bool IsGamepadButtonPressed(int gamepad, int button)
1939 bool IsGamepadButtonDown(int gamepad, int button)
1940 bool IsGamepadButtonReleased(int gamepad, int button)
1941 bool IsGamepadButtonUp(int gamepad, int button)
1942 int GetGamepadButtonPressed(void)
1943 int GetGamepadAxisCount(int gamepad)
1944 float GetGamepadAxisMovement(int gamepad, int axis)
1945 bool IsMouseButtonPressed(int button)
1946 bool IsMouseButtonDown(int button)
1947 bool IsMouseButtonReleased(int button)
1948 bool IsMouseButtonUp(int button)
1951 Vector2 GetMousePosition(void)
1952 void SetMousePosition(int x, int y)
1953 void SetMouseOffset(int offsetX, int offsetY)
1954 void SetMouseScale(float scaleX, float scaleY)
1955 int GetMouseWheelMove(void)
1958 Vector2 GetTouchPosition(int index)
1959 void SetGesturesEnabled(unsigned int gestureFlags)
1960 bool IsGestureDetected(int gesture)
1961 int GetGestureDetected(void)
1962 int GetTouchPointsCount(void)
1963 float GetGestureHoldDuration(void)
1964 Vector2 GetGestureDragVector(void)
1965 float GetGestureDragAngle(void)
1966 Vector2 GetGesturePinchVector(void)
1967 float GetGesturePinchAngle(void)
1968 void SetCameraMode(Camera3D camera, int mode)
1969 void UpdateCamera(Camera3D *camera)
1970 void SetCameraPanControl(int panKey)
1971 void SetCameraAltControl(int altKey)
1972 void SetCameraSmoothZoomControl(int szKey)
1973 void SetCameraMoveControls(int frontKey, int backKey, int rightKey, int leftKey,
1974 int upKey, int downKey)
1975 void DrawPixel(int posX, int posY, Color color)
1976 void DrawPixelV(Vector2 position, Color color)
1977 void DrawLine(int startPosX, int startPosY, int endPosX, int endPosY, Color color)
1978 void DrawLineV(Vector2 startPos, Vector2 endPos, Color color)
1979 void DrawLineEx(Vector2 startPos, Vector2 endPos, float thick, Color color)
1980 void DrawLineBezier(Vector2 startPos, Vector2 endPos, float thick, Color color)
1981 void DrawLineStrip(Vector2 *points, int numPoints, Color color)
1982 void DrawCircle(int centerX, int centerY, float radius, Color color)
1983 void DrawCircleSector(Vector2 center, float radius, int startAngle, int endAngle,
1984 int segments, Color color)
1985 void DrawCircleSectorLines(Vector2 center, float radius, int startAngle,
1986 int endAngle, int segments, Color color)
1987 void DrawCircleGradient(int centerX, int centerY, float radius,
1988 Color color1, Color color2)
1989 void DrawCircleV(Vector2 center, float radius, Color color)
1990 void DrawCircleLines(int centerX, int centerY, float radius, Color color)
1991 void DrawRing(Vector2 center, float innerRadius, float outerRadius,
1992 int startAngle, int endAngle, int segments, Color color)
1993 void DrawRingLines(Vector2 center, float innerRadius, float outerRadius,
1994 int startAngle, int endAngle, int segments, Color color)
1995 void DrawRectangle(int posX, int posY, int width, int height, Color color)
1996 void DrawRectangleV(Vector2 position, Vector2 size, Color color)
1997 void DrawRectangleRec(Rectangle rec, Color color)
1998 void DrawRectanglePro(Rectangle rec, Vector2 origin,
1999 float rotation, Color color)
2000 void DrawRectangleGradientV(int posX, int posY, int width,
2001 int height, Color color1, Color color2)
2002 void DrawRectangleGradientH(int posX, int posY, int width,
2003 int height, Color color1, Color color2)
2004 void DrawRectangleGradientEx(Rectangle rec, Color col1,
2005 Color col2, Color col3, Color col4)
2006 void DrawRectangleLines(int posX, int posY, int width,
2007 int height, Color color)
2008 void DrawRectangleLinesEx(Rectangle rec, int lineThick, Color color)
2009 void DrawRectangleRounded(Rectangle rec, float roundness,
2010 int segments, Color color)
2011 void DrawRectangleRoundedLines(Rectangle rec, float roundness,
2012 int segments, int lineThick, Color color)
2013 void DrawTriangle(Vector2 v1, Vector2 v2, Vector2 v3, Color color)
2014 void DrawTriangleLines(Vector2 v1, Vector2 v2, Vector2 v3, Color color)
2015 void DrawTriangleFan(Vector2 *points, int numPoints, Color color)
2016 void DrawPoly(Vector2 center, int sides, float radius,
2017 float rotation, Color color)
2018 void SetShapesTexture(Texture2D texture, Rectangle source)
2019 bool CheckCollisionRecs(Rectangle rec1, Rectangle rec2)
2020 bool CheckCollisionCircles(Vector2 center1, float radius1,
2021 Vector2 center2, float radius2)
2022 bool CheckCollisionCircleRec(Vector2 center, float radius,
2024 Rectangle GetCollisionRec(Rectangle rec1, Rectangle rec2)
2025 bool CheckCollisionPointRec(Vector2 point, Rectangle rec)
2026 bool CheckCollisionPointCircle(Vector2 point, Vector2 center, float radius)
2027 bool CheckCollisionPointTriangle(Vector2 point, Vector2 p1,
2028 Vector2 p2, Vector2 p3)
2029 Image LoadImage(const char *fileName)
2030 Image LoadImageEx(Color *pixels, int width, int height)
2031 Image LoadImagePro(void *data, int width, int height, int format)
2032 Image LoadImageRaw(const char *fileName, int width, int height,
2033 int format, int headerSize)
2034 void ExportImage(Image image, const char *fileName)
2035 void ExportImageAsCode(Image image, const char *fileName)
2036 Texture2D LoadTexture(const char *fileName)
2037 Texture2D LoadTextureFromImage(Image image)
2038 TextureCubemap LoadTextureCubemap(Image image, int layoutType)
2039 RenderTexture2D LoadRenderTexture(int width, int height)
2040 void UnloadImage(Image image)
2041 void UnloadTexture(Texture2D texture)
2042 void UnloadRenderTexture(RenderTexture2D target)
2043 Color *GetImageData(Image image)
2044 Vector4 *GetImageDataNormalized(Image image)
2045 int GetPixelDataSize(int width, int height, int format)
2046 Image GetTextureData(Texture2D texture)
2047 Image GetScreenData(void)
2048 void UpdateTexture(Texture2D texture, const void *pixels)
2049 Image ImageCopy(Image image)
2050 void ImageToPOT(Image *image, Color fillColor)
2051 void ImageFormat(Image *image, int newFormat)
2052 void ImageAlphaMask(Image *image, Image alphaMask)
2053 void ImageAlphaClear(Image *image, Color color, float threshold)
2054 void ImageAlphaCrop(Image *image, float threshold)
2055 void ImageAlphaPremultiply(Image *image)
2056 void ImageCrop(Image *image, Rectangle crop)
2057 void ImageResize(Image *image, int newWidth, int newHeight)
2058 void ImageResizeNN(Image *image, int newWidth,int newHeight)
2059 void ImageResizeCanvas(Image *image, int newWidth, int newHeight,
2060 int offsetX, int offsetY, Color color)
2061 void ImageMipmaps(Image *image)
2062 void ImageDither(Image *image, int rBpp, int gBpp, int bBpp, int aBpp)
2063 Color *ImageExtractPalette(Image image, int maxPaletteSize, int *extractCount)
2064 Image ImageText(const char *text, int fontSize, Color color)
2065 Image ImageTextEx(Font font, const char *text, float fontSize,
2066 float spacing, Color tint)
2067 void ImageDraw(Image *dst, Image src, Rectangle srcRec, Rectangle dstRec)
2068 void ImageDrawRectangle(Image *dst, Rectangle rec, Color color)
2069 void ImageDrawRectangleLines(Image *dst, Rectangle rec, int thick, Color color)
2070 void ImageDrawText(Image *dst, Vector2 position, const char *text,
2071 int fontSize, Color color)
2072 void ImageDrawTextEx(Image *dst, Vector2 position, Font font,
2073 const char *text, float fontSize, float spacing, Color color)
2074 void ImageFlipVertical(Image *image)
2075 void ImageFlipHorizontal(Image *image)
2076 void ImageRotateCW(Image *image)
2077 void ImageRotateCCW(Image *image)
2078 void ImageColorTint(Image *image, Color color)
2079 void ImageColorInvert(Image *image)
2080 void ImageColorGrayscale(Image *image)
2081 void ImageColorContrast(Image *image, float contrast)
2082 void ImageColorBrightness(Image *image, int brightness)
2083 void ImageColorReplace(Image *image, Color color, Color replace)
2084 Image GenImageColor(int width, int height, Color color)
2085 Image GenImageGradientV(int width, int height, Color top, Color bottom)
2086 Image GenImageGradientH(int width, int height, Color left, Color right)
2087 Image GenImageGradientRadial(int width, int height, float density,
2088 Color inner, Color outer)
2089 Image GenImageChecked(int width, int height, int checksX, int checksY,
2090 Color col1, Color col2)
2091 Image GenImageWhiteNoise(int width, int height, float factor)
2092 Image GenImagePerlinNoise(int width, int height, int offsetX,
2093 int offsetY, float scale)
2094 Image GenImageCellular(int width, int height, int tileSize)
2095 void GenTextureMipmaps(Texture2D *texture)
2096 void SetTextureFilter(Texture2D texture, int filterMode)
2097 void SetTextureWrap(Texture2D texture, int wrapMode)
2098 void DrawTexture(Texture2D texture, int posX, int posY, Color tint)
2099 void DrawTextureV(Texture2D texture, Vector2 position, Color tint)
2100 void DrawTextureEx(Texture2D texture, Vector2 position,
2101 float rotation, float scale, Color tint)
2102 void DrawTextureRec(Texture2D texture, Rectangle sourceRec,
2103 Vector2 position, Color tint)
2104 void DrawTextureQuad(Texture2D texture, Vector2 tiling, Vector2 offset,
2105 Rectangle quad, Color tint)
2106 void DrawTexturePro(Texture2D texture, Rectangle sourceRec,
2107 Rectangle destRec, Vector2 origin, float rotation, Color tint)
2108 void DrawTextureNPatch(Texture2D texture, NPatchInfo nPatchInfo,
2109 Rectangle destRec, Vector2 origin, float rotation, Color tint)
2110 Font GetFontDefault(void)
2111 Font LoadFont(const char *fileName)
2112 Font LoadFontEx(const char *fileName, int fontSize,
2113 int *fontChars, int charsCount)
2114 Font LoadFontFromImage(Image image, Color key, int firstChar)
2115 CharInfo *LoadFontData(const char *fileName, int fontSize,
2116 int *fontChars, int charsCount, int type)
2117 Image GenImageFontAtlas(CharInfo *chars, int charsCount,
2118 int fontSize, int padding, int packMethod)
2119 void UnloadFont(Font font)
2120 void DrawFPS(int posX, int posY)
2121 void DrawText(const char *text, int posX, int posY, int fontSize, Color color)
2122 void DrawTextEx(Font font, const char *text, Vector2 position,
2123 float fontSize, float spacing, Color tint)
2124 void DrawTextRec(Font font, const char *text, Rectangle rec,
2125 float fontSize, float spacing, bool wordWrap, Color tint)
2126 void DrawTextRecEx(Font font, const char *text, Rectangle rec,
2127 float fontSize, float spacing, bool wordWrap, Color tint,
2128 int selectStart, int selectLength, Color selectText, Color selectBack)
2129 int MeasureText(const char *text, int fontSize)
2130 Vector2 MeasureTextEx(Font font, const char *text,
2131 float fontSize, float spacing)
2132 int GetGlyphIndex(Font font, int character)
2133 int GetNextCodepoint(const char *text, int *count)
2134 bool TextIsEqual(const char *text1, const char *text2)
2135 unsigned int TextLength(const char *text)
2136 unsigned int TextCountCodepoints(const char *text)
2137 const char *TextFormat(const char *text)
2138 const char *TextSubtext(const char *text, int position, int length)
2139 const char *TextReplace(char *text, const char *replace, const char *by)
2140 const char *TextInsert(const char *text, const char *insert, int position)
2141 const char *TextJoin(const char **textList, int count, const char *delimiter)
2142 const char **TextSplit(const char *text, char delimiter, int *count)
2143 void TextAppend(char *text, const char *append, int *position)
2144 int TextFindIndex(const char *text, const char *find)
2145 const char *TextToUpper(const char *text)
2146 const char *TextToLower(const char *text)
2147 const char *TextToPascal(const char *text)
2148 int TextToInteger(const char *text)
2149 void DrawLine3D(Vector3 startPos, Vector3 endPos, Color color)
2150 void DrawCircle3D(Vector3 center, float radius, Vector3 rotationAxis,
2151 float rotationAngle, Color color)
2152 void DrawCube(Vector3 position, float width, float height, float length, Color color)
2153 void DrawCubeV(Vector3 position, Vector3 size, Color color)
2154 void DrawCubeWires(Vector3 position, float width, float height,
2155 float length, Color color)
2156 void DrawCubeWiresV(Vector3 position, Vector3 size, Color color)
2157 void DrawCubeTexture(Texture2D texture, Vector3 position,
2158 float width, float height, float length, Color color)
2159 void DrawSphere(Vector3 centerPos, float radius, Color color)
2160 void DrawSphereEx(Vector3 centerPos, float radius, int rings,
2161 int slices, Color color)
2162 void DrawSphereWires(Vector3 centerPos, float radius, int rings,
2163 int slices, Color color)
2164 void DrawCylinder(Vector3 position, float radiusTop, float radiusBottom,
2165 float height, int slices, Color color)
2166 void DrawCylinderWires(Vector3 position, float radiusTop,
2167 float radiusBottom, float height, int slices, Color color)
2168 void DrawPlane(Vector3 centerPos, Vector2 size, Color color)
2169 void DrawRay(Ray ray, Color color)
2170 void DrawGrid(int slices, float spacing)
2171 void DrawGizmo(Vector3 position)
2172 Model LoadModel(const char *fileName)
2173 Model LoadModelFromMesh(Mesh mesh)
2174 void UnloadModel(Model model)
2175 Mesh *LoadMeshes(const char *fileName, int *meshCount)
2176 void ExportMesh(Mesh mesh, const char *fileName)
2177 void UnloadMesh(Mesh *mesh)
2178 Material *LoadMaterials(const char *fileName, int *materialCount)
2179 Material LoadMaterialDefault(void)
2180 void UnloadMaterial(Material material)
2181 void SetMaterialTexture(Material *material, int mapType, Texture2D texture)
2182 void SetModelMeshMaterial(Model *model, int meshId, int materialId)
2183 ModelAnimation *LoadModelAnimations(const char *fileName, int *animsCount)
2184 void UpdateModelAnimation(Model model, ModelAnimation anim, int frame)
2185 void UnloadModelAnimation(ModelAnimation anim)
2186 bool IsModelAnimationValid(Model model, ModelAnimation anim)
2187 Mesh GenMeshPoly(int sides, float radius)
2188 Mesh GenMeshPlane(float width, float length, int resX, int resZ)
2189 Mesh GenMeshCube(float width, float height, float length)
2190 Mesh GenMeshSphere(float radius, int rings, int slices)
2191 Mesh GenMeshHemiSphere(float radius, int rings, int slices)
2192 Mesh GenMeshCylinder(float radius, float height, int slices)
2193 Mesh GenMeshTorus(float radius, float size, int radSeg, int sides)
2194 Mesh GenMeshKnot(float radius, float size, int radSeg, int sides)
2195 Mesh GenMeshHeightmap(Image heightmap, Vector3 size)
2196 Mesh GenMeshCubicmap(Image cubicmap, Vector3 cubeSize)
2197 BoundingBox MeshBoundingBox(Mesh mesh)
2198 void MeshTangents(Mesh *mesh)
2199 void MeshBinormals(Mesh *mesh)
2200 void DrawModel(Model model, Vector3 position, float scale, Color tint)
2201 void DrawModelEx(Model model, Vector3 position, Vector3 rotationAxis,
2202 float rotationAngle, Vector3 scale, Color tint)
2203 void DrawModelWires(Model model, Vector3 position, float scale, Color tint)
2204 void DrawModelWiresEx(Model model, Vector3 position,
2205 Vector3 rotationAxis, float rotationAngle, Vector3 scale, Color tint)
2206 void DrawBoundingBox(BoundingBox box, Color color)
2207 void DrawBillboard(Camera3D camera, Texture2D texture,
2208 Vector3 center, float size, Color tint)
2209 void DrawBillboardRec(Camera3D camera, Texture2D texture,
2210 Rectangle sourceRec, Vector3 center, float size, Color tint)
2211 bool CheckCollisionSpheres(Vector3 centerA, float radiusA,
2212 Vector3 centerB, float radiusB)
2213 bool CheckCollisionBoxes(BoundingBox box1, BoundingBox box2)
2214 bool CheckCollisionBoxSphere(BoundingBox box, Vector3 centerSphere, float radiusSphere)
2215 bool CheckCollisionRaySphere(Ray ray, Vector3 spherePosition, float sphereRadius)
2216 bool CheckCollisionRaySphereEx(Ray ray, Vector3 spherePosition,
2217 float sphereRadius, Vector3 *collisionPoint)
2218 bool CheckCollisionRayBox(Ray ray, BoundingBox box)
2219 RayHitInfo GetCollisionRayModel(Ray ray, Model *model)
2220 RayHitInfo GetCollisionRayTriangle(Ray ray, Vector3 p1, Vector3 p2, Vector3 p3)
2221 RayHitInfo GetCollisionRayGround(Ray ray, float groundHeight)
2222 char *LoadText(const char *fileName)
2223 Shader LoadShader(const char *vsFileName, const char *fsFileName)
2224 Shader LoadShaderCode(char *vsCode, char *fsCode)
2225 void UnloadShader(Shader shader)
2226 Shader GetShaderDefault(void)
2227 Texture2D GetTextureDefault(void)
2228 int GetShaderLocation(Shader shader, const char *uniformName)
2229 void SetShaderValue(Shader shader, int uniformLoc,
2230 const void *value, int uniformType)
2231 void SetShaderValueV(Shader shader, int uniformLoc,
2232 const void *value, int uniformType, int count)
2233 void SetShaderValueMatrix(Shader shader, int uniformLoc, Matrix mat)
2234 void SetShaderValueTexture(Shader shader, int uniformLoc, Texture2D texture)
2235 void SetMatrixProjection(Matrix proj)
2236 void SetMatrixModelview(Matrix view)
2237 Matrix GetMatrixModelview(void)
2238 Texture2D GenTextureCubemap(Shader shader, Texture2D skyHDR, int size)
2239 Texture2D GenTextureIrradiance(Shader shader, Texture2D cubemap, int size)
2240 Texture2D GenTexturePrefilter(Shader shader, Texture2D cubemap, int size)
2241 Texture2D GenTextureBRDF(Shader shader, int size)
2242 void BeginShaderMode(Shader shader)
2243 void EndShaderMode(void)
2244 void BeginBlendMode(int mode)
2245 void EndBlendMode(void)
2246 void BeginScissorMode(int x, int y, int width, int height)
2247 void EndScissorMode(void)
2248 void InitVrSimulator(void)
2249 void CloseVrSimulator(void)
2250 void UpdateVrTracking(Camera3D *camera)
2251 void SetVrConfiguration(VrDeviceInfo info, Shader distortion)
2252 bool IsVrSimulatorReady(void)
2253 void ToggleVrMode(void)
2254 void BeginVrDrawing(void)
2255 void EndVrDrawing(void)
2256 void InitAudioDevice(void)
2257 void CloseAudioDevice(void)
2258 bool IsAudioDeviceReady(void)
2259 void SetMasterVolume(float volume)
2260 Wave LoadWave(const char *fileName)
2261 Wave LoadWaveEx(void *data, int sampleCount, int sampleRate,
2262 int sampleSize, int channels)
2263 Sound LoadSound(const char *fileName)
2264 Sound LoadSoundFromWave(Wave wave)
2265 void UpdateSound(Sound sound, const void *data, int samplesCount)
2266 void UnloadWave(Wave wave)
2267 void UnloadSound(Sound sound)
2268 void ExportWave(Wave wave, const char *fileName)
2269 void ExportWaveAsCode(Wave wave, const char *fileName)
2270 void PlaySound(Sound sound)
2271 void PauseSound(Sound sound)
2272 void ResumeSound(Sound sound)
2273 void StopSound(Sound sound)
2274 bool IsSoundPlaying(Sound sound)
2275 void SetSoundVolume(Sound sound, float volume)
2276 void SetSoundPitch(Sound sound, float pitch)
2277 void WaveFormat(Wave *wave, int sampleRate, int sampleSize, int channels)
2278 Wave WaveCopy(Wave wave)
2279 void WaveCrop(Wave *wave, int initSample, int finalSample)
2280 float *GetWaveData(Wave wave)
2281 Music LoadMusicStream(const char *fileName)
2282 void UnloadMusicStream(Music music)
2283 void PlayMusicStream(Music music)
2284 void UpdateMusicStream(Music music)
2285 void StopMusicStream(Music music)
2286 void PauseMusicStream(Music music)
2287 void ResumeMusicStream(Music music)
2288 bool IsMusicPlaying(Music music)
2289 void SetMusicVolume(Music music, float volume)
2290 void SetMusicPitch(Music music, float pitch)
2291 void SetMusicLoopCount(Music music, int count)
2292 float GetMusicTimeLength(Music music)
2293 float GetMusicTimePlayed(Music music)
2294 AudioStream InitAudioStream(unsigned int sampleRate,
2295 unsigned int sampleSize, unsigned int channels)
2296 void UpdateAudioStream(AudioStream stream, const void *data, int samplesCount)
2297 void CloseAudioStream(AudioStream stream)
2298 bool IsAudioBufferProcessed(AudioStream stream)
2299 void PlayAudioStream(AudioStream stream)
2300 void PauseAudioStream(AudioStream stream)
2301 void ResumeAudioStream(AudioStream stream)
2302 bool IsAudioStreamPlaying(AudioStream stream)
2303 void StopAudioStream(AudioStream stream)
2304 void SetAudioStreamVolume(AudioStream stream, float volume)
2305 void SetAudioStreamPitch(AudioStream stream, float pitch)
2306 void GuiEnable(void)
2307 void GuiDisable(void)
2309 void GuiUnlock(void)
2310 void GuiState(int state)
2311 void GuiFont(Font font)
2312 void GuiFade(float alpha)
2313 void GuiSetStyle(int control, int property, int value)
2314 int GuiGetStyle(int control, int property)
2315 bool GuiWindowBox(Rectangle bounds, const char *text)
2316 void GuiGroupBox(Rectangle bounds, const char *text)
2317 void GuiLine(Rectangle bounds, const char *text)
2318 void GuiPanel(Rectangle bounds)
2319 Rectangle GuiScrollPanel(Rectangle bounds, Rectangle content, Vector2 *scroll)
2320 void GuiLabel(Rectangle bounds, const char *text)
2321 bool GuiButton(Rectangle bounds, const char *text)
2322 bool GuiLabelButton(Rectangle bounds, const char *text)
2323 bool GuiImageButton(Rectangle bounds, Texture2D texture)
2324 bool GuiImageButtonEx(Rectangle bounds, Texture2D texture,
2325 Rectangle texSource, const char *text)
2326 bool GuiToggle(Rectangle bounds, const char *text, bool active)
2327 int GuiToggleGroup(Rectangle bounds, const char *text, int active)
2328 bool GuiCheckBox(Rectangle bounds, const char *text, bool checked)
2329 int GuiComboBox(Rectangle bounds, const char *text, int active)=
2330 bool GuiDropdownBox(Rectangle bounds, const char *text,
2331 int *active, bool editMode)
2332 bool GuiSpinner(Rectangle bounds, int *value, int minValue,
2333 int maxValue, bool editMode)
2334 bool GuiValueBox(Rectangle bounds, int *value, int minValue,
2335 int maxValue, bool editMode)
2336 bool GuiTextBox(Rectangle bounds, char *text, int textSize, bool editMode)
2337 bool GuiTextBoxMulti(Rectangle bounds, char *text, int textSize, bool editMode)
2338 float GuiSlider(Rectangle bounds, const char *text, float value,
2339 float minValue, float maxValue, bool showValue)
2340 float GuiSliderBar(Rectangle bounds, const char *text, float value,
2341 float minValue, float maxValue, bool showValue)
2342 float GuiProgressBar(Rectangle bounds, const char *text, float value,
2343 float minValue, float maxValue, bool showValue)
2344 void GuiStatusBar(Rectangle bounds, const char *text)
2345 void GuiDummyRec(Rectangle bounds, const char *text)
2346 int GuiScrollBar(Rectangle bounds, int value, int minValue, int maxValue)
2347 Vector2 GuiGrid(Rectangle bounds, float spacing, int subdivs)
2348 bool GuiListView(Rectangle bounds, const char *text, int *active,
2349 int *scrollIndex, bool editMode)
2350 bool GuiListViewEx(Rectangle bounds, const char **text, int count,
2351 int *enabled, int *active, int *focus, int *scrollIndex, bool editMode)
2352 int GuiMessageBox(Rectangle bounds, const char *windowTitle,
2353 const char *message, const char *buttons)
2354 int GuiTextInputBox(Rectangle bounds, const char *windowTitle,
2355 const char *message, char *text, const char *buttons)
2356 Color GuiColorPicker(Rectangle bounds, Color color)
2357 void GuiLoadStyle(const char *fileName)
2358 void GuiLoadStyleProps(const int *props, int count)
2359 void GuiLoadStyleDefault(void)
2360 void GuiUpdateStyleComplete(void)
2361 const char *GuiIconText(int iconId, const char *text)