Pārlūkot izejas kodu

More function bindings, debugging stuff...

master
Ognjen Milan Robovic pirms 2 mēnešiem
vecāks
revīzija
c9066c44cf
3 mainītis faili ar 193 papildinājumiem un 83 dzēšanām
  1. +157
    -82
      raylib.ads
  2. Binārs
      texture.png
  3. +36
    -1
      window.adb

+ 157
- 82
raylib.ads Parādīt failu

@@ -668,12 +668,21 @@ package Raylib is

No_Image : Image;

--~type Texture is record
--~Id : Natural := 0;
--~Width : Integer := 0;
--~Height : Integer := 0;
--~Mipmaps : Integer := 1;
--~Format : Pixel_Format := Pixel_Format_None;
--~end record with Convention => C_Pass_By_Copy;

type Texture is record
Id : Natural := 0;
Width : Integer := 0;
Height : Integer := 0;
Mipmaps : Integer := 1;
Format : Pixel_Format := Pixel_Format_None;
Id : Natural;
Width : Integer;
Height : Integer;
Mipmaps : Integer;
--~Format : Pixel_Format;
Format : Integer;
end record with Convention => C_Pass_By_Copy;

No_Texture : Texture;
@@ -712,6 +721,8 @@ package Raylib is
Glyphs : access Glyph_Info := null;
end record with Convention => C_Pass_By_Copy;

No_Font : Font;

type Camera_3D is record
Position : Vector_3D := (0.0, 0.0, 0.0);
Target : Vector_3D := (0.0, 0.0, 0.0);
@@ -1508,10 +1519,12 @@ package Raylib is
--~Convention => C,
--~External_Name => "";

--~procedure SetTargetFPS (int fps) with
--~Import => True,
--~Convention => C,
--~External_Name => "";
procedure Set_Target_FPS (
FPS : Integer := 60
) with
Import => True,
Convention => C,
External_Name => "SetTargetFPS";

--~function float GetFrameTime (void) with
--~Import => True,
@@ -1823,45 +1836,57 @@ package Raylib is
--~Convention => C,
--~External_Name => "";

--~function bool IsKeyPressed (int key) with
--~Import => True,
--~Convention => C,
--~External_Name => "";
function Is_Key_Pressed (
Key : Keyboard_Key := Key_Null
) return Logical with
Import => True,
Convention => C,
External_Name => "IsKeyPressed";

--~function bool IsKeyPressedRepeat (int key) with
--~Import => True,
--~Convention => C,
--~External_Name => "";
function Is_Key_Pressed_Repeat (
Key : Keyboard_Key := Key_Null
) return Logical with
Import => True,
Convention => C,
External_Name => "IsKeyPressedRepeat";

--~function bool IsKeyDown (int key) with
--~Import => True,
--~Convention => C,
--~External_Name => "";
function Is_Key_Down (
Key : Keyboard_Key := Key_Null
) return Logical with
Import => True,
Convention => C,
External_Name => "IsKeyDown";

--~function bool IsKeyReleased (int key) with
--~Import => True,
--~Convention => C,
--~External_Name => "";
function Is_Key_Released (
Key : Keyboard_Key := Key_Null
) return Logical with
Import => True,
Convention => C,
External_Name => "IsKeyReleased";

--~function bool IsKeyUp (int key) with
--~Import => True,
--~Convention => C,
--~External_Name => "";
function Is_Key_Up (
Key : Keyboard_Key := Key_Null
) return Logical with
Import => True,
Convention => C,
External_Name => "IsKeyUp";

--~function int GetKeyPressed (void) with
--~Import => True,
--~Convention => C,
--~External_Name => "";
function Get_Key_Pressed return Keyboard_Key with
Import => True,
Convention => C,
External_Name => "GetKeyPressed";

--~function int GetCharPressed (void) with
--~Import => True,
--~Convention => C,
--~External_Name => "";
function Get_Character_Pressed return Character with
Import => True,
Convention => C,
External_Name => "GetCharPressed";

--~procedure SetExitKey (int key) with
--~Import => True,
--~Convention => C,
--~External_Name => "";
procedure Set_Exit_Key (
Key : Keyboard_Key := Key_Escape
) with
Import => True,
Convention => C,
External_Name => "SetExitKey";

--~function bool IsGamepadAvailable (int gamepad) with
--~Import => True,
@@ -2073,10 +2098,16 @@ package Raylib is
--~Convention => C,
--~External_Name => "";

--~procedure DrawLine (int startPosX, int startPosY, int endPosX, int endPosY, Color color) with
--~Import => True,
--~Convention => C,
--~External_Name => "";
procedure Draw_Line (
X0 : Integer := 0;
Y0 : Integer := 0;
X1 : Integer := 0;
Y1 : Integer := 0;
Tint : Color := Black
) with
Import => True,
Convention => C,
External_Name => "DrawLine";

--~procedure DrawLineV (Vector2 startPos, Vector2 endPos, Color color) with
--~Import => True,
@@ -2153,10 +2184,16 @@ package Raylib is
--~Convention => C,
--~External_Name => "";

--~procedure DrawRectangle (int posX, int posY, int width, int height, Color color) with
--~Import => True,
--~Convention => C,
--~External_Name => "";
procedure Draw_Rectangle (
X : Integer := 0;
Y : Integer := 0;
Width : Integer := 0;
Height : Integer := 0;
Tint : Color := Black
) with
Import => True,
Convention => C,
External_Name => "DrawRectangle";

--~procedure DrawRectangleV (Vector2 position, Vector2 size, Color color) with
--~Import => True,
@@ -2728,10 +2765,12 @@ package Raylib is
--~Convention => C,
--~External_Name => "";

--~function Texture2D LoadTexture (const char *fileName) with
--~Import => True,
--~Convention => C,
--~External_Name => "";
function Load_Texture (
File_Path : String := ""
) return Texture with
Import => True,
Convention => C,
External_Name => "LoadTexture";

--~function Texture2D LoadTextureFromImage (Image image) with
--~Import => True,
@@ -2753,10 +2792,12 @@ package Raylib is
--~Convention => C,
--~External_Name => "";

--~procedure UnloadTexture (Texture2D texture) with
--~Import => True,
--~Convention => C,
--~External_Name => "";
procedure Unload_Texture (
Data : Texture := No_Texture
) with
Import => True,
Convention => C,
External_Name => "UnloadTexture";

--~function bool IsRenderTextureReady (RenderTexture2D target) with
--~Import => True,
@@ -2793,10 +2834,15 @@ package Raylib is
--~Convention => C,
--~External_Name => "";

--~procedure DrawTexture (Texture2D texture, int posX, int posY, Color tint) with
--~Import => True,
--~Convention => C,
--~External_Name => "";
procedure Draw_Texture (
Data : Texture := No_Texture;
X : Integer := 0;
Y : Integer := 0;
Tint : Color := White
) with
Import => True,
Convention => C,
External_Name => "DrawTexture";

--~procedure DrawTextureV (Texture2D texture, Vector2 position, Color tint) with
--~Import => True,
@@ -2813,10 +2859,17 @@ package Raylib is
--~Convention => C,
--~External_Name => "";

--~procedure DrawTexturePro (Texture2D texture, Rectangle source, Rectangle dest, Vector2 origin, float rotation, Color tint) with
--~Import => True,
--~Convention => C,
--~External_Name => "";
procedure Draw_Texture_Pro (
Data : Texture := No_Texture;
Source : Rectangle := No_Rectangle;
Destination : Rectangle := No_Rectangle;
Origin : Vector_2D := (0.0, 0.0);
Rotation : Float := 0.0;
Tint : Color := White
) with
Import => True,
Convention => C,
External_Name => "DrawTexturePro";

--~procedure DrawTextureNPatch (Texture2D texture, NPatchInfo nPatchInfo, Rectangle dest, Vector2 origin, float rotation, Color tint) with
--~Import => True,
@@ -2898,10 +2951,10 @@ package Raylib is
--~Convention => C,
--~External_Name => "";

--~function Font GetFontDefault (void) with
--~Import => True,
--~Convention => C,
--~External_Name => "";
function Get_Font_Default return Font with
Import => True,
Convention => C,
External_Name => "GetFontDefault";

--~function Font LoadFont (const char *fileName) with
--~Import => True,
@@ -2953,25 +3006,47 @@ package Raylib is
--~Convention => C,
--~External_Name => "";

--~procedure DrawFPS (int posX, int posY) with
--~Import => True,
--~Convention => C,
--~External_Name => "";

--~procedure DrawText (const char *text, int posX, int posY, int fontSize, Color color) with
--~Import => True,
--~Convention => C,
--~External_Name => "";
procedure Draw_FPS (
X : Integer := 0;
Y : Integer := 0
) with
Import => True,
Convention => C,
External_Name => "DrawFPS";
--~################################################################
--~################################################################
--~################################################################
procedure Draw_Text (
Text : String := "";
--~Text : access String := null;
--~Text : String := "";
X : Integer := 0;
Y : Integer := 0;
Size : Integer := 32;
Tint : Color := Dark_Gray
) with
Import => True,
Convention => C,
External_Name => "DrawText";

--~procedure DrawTextEx (Font font, const char *text, Vector2 position, float fontSize, float spacing, Color tint) with
--~Import => True,
--~Convention => C,
--~External_Name => "";

--~procedure DrawTextPro (Font font, const char *text, Vector2 position, Vector2 origin, float rotation, float fontSize, float spacing, Color tint) with
--~Import => True,
--~Convention => C,
--~External_Name => "";
procedure Draw_Text_Pro (
Data : Font := Get_Font_Default;
Text : String := "NOOO";
Position : Vector_2D := (0.0, 0.0);
Origin : Vector_2D := (0.0, 0.0);
Rotation : Float := 0.0;
Font_Size : Float := 0.0;
Spacing : Float := 0.0;
Tint : Color := Dark_Gray
) with
Import => True,
Convention => C,
External_Name => "DrawTextPro";

--~procedure DrawTextCodepoint (Font font, int codepoint, Vector2 position, float fontSize, Color tint) with
--~Import => True,


Binārs
texture.png Parādīt failu

Pirms Pēc
Platums: 420  |  Augstums: 420  |  Izmērs: 212KB

+ 36
- 1
window.adb Parādīt failu

@@ -3,20 +3,55 @@ use Raylib;

procedure Window is

Text : String := "Heyo world!" & Character'Val (0);

Dragdown : Texture;

X : Integer := 120;
Y : Integer := 120;

begin

Open_Window (720, 360, "Heyo Raylib!" & Character'Val (0));

Set_Exit_Key (Key_Q); -- Default is Key_Escape
Set_Target_FPS (72); -- Default is 60

Dragdown := Load_Texture ("./texture.png" & Character'Val (0));

Main_Loop: loop
exit when Window_Should_Close;
--
Begin_Drawing;
--
Clear_Background (Blue);
Clear_Background (Sky_Blue);
--
Draw_Texture (Dragdown, (Get_Screen_Width - Dragdown.Width) / 2, (Get_Screen_Height - Dragdown.Height) / 2);
Draw_Texture (Dragdown, 100, 100, White);
Draw_Texture_Pro (Dragdown, (0.0, 0.0, 420.0, 420.0), (200.0, 0.0, 420.0, 420.0));
--~Data : Texture := No_Texture;
--~Source : Rectangle := No_Rectangle;
--~Destination : Rectangle := No_Rectangle;
--~Origin : Vector_2D := (0.0, 0.0);
--~Rotation : Float := 0.0;
--~Tint : Color := White
Draw_Text ("Heyo world!" & Character'Val (0), 30, 30, 32, Light_Gray);
Draw_Text (Text, 30, 30, 32, Black);
Draw_Text_Pro (Get_Font_Default, Text, (90.0, 90.0), (9.0, 9.0), 0.0, 32.0, 4.0, Red);
Draw_FPS (60, 60);
Draw_Line (0, 0, 300, 300, Red);
Draw_Rectangle (120, 120, 30, 60, Green);
Draw_FPS (X, Y);
if Is_Key_Pressed (Key_W) then Y := Y - 10; end if;
if Is_Key_Pressed (Key_S) then Y := Y + 10; end if;
if Is_Key_Pressed (Key_A) then X := X - 10; end if;
if Is_Key_Pressed (Key_D) then X := X + 10; end if;
--
End_Drawing;
end loop Main_Loop;

Unload_Texture (Dragdown);

Close_Window;

end Window;

Notiek ielāde…
Atcelt
Saglabāt