Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
C and Raylib
Raylib is a simple library for creating games. I've tried it with Go, first, but using it with C is also extremely easy:

#include "raylib.h"

int main() {
   const int szerokosc = 900;
   const int wysokosc = 600;
   InitWindow(szerokosc, wysokosc, "C and Raylib example");
   while (!WindowShouldClose()) {
            DrawText("As easy as BASIC!", 300, 40, 30, DARKGRAY);
            DrawLine(50, 90, 850, 90, BLACK);
            DrawCircle(450, 350, 10, DARKBLUE);
            DrawCircleGradient(450, 350, 150, YELLOW, DARKGREEN);
            DrawCircleLines(450, 350, 200, BLACK);
            DrawRectangleLines(10, 10, 880, 580, RED);
            DrawRectangleGradientH(50, 100, 50, 50, MAROON, GOLD);
            DrawRectangle(50, 500, 50, 50, BROWN);
            DrawRectangle(800, 100, 50, 50, DARKGRAY);
            DrawRectangleGradientH(800, 500, 50, 50, PURPLE, DARKBLUE);
   return 0;

Pre-compiled binaries:
nice find tomek  Wink
it looks like very simple openGL wrapper.
I think that i would try it with o2 compiler...
also when i looking into supported languages i stop on ODIN ?
hmm interesting one...
There is also Euraylib for OpenEuphoria (it's been just released). You can use it with the interpreter or the translator. The only dependency needed is a single raylib.dll/ file. I can't understand how did we manage to miss it on - this is a perfect solution for retro stuff.

Here is an example in Euphoria

include std/machine.e
include std/convert.e
include Euraylib.ew

InitWindow(256, 256,"Basic Drawings")

while not WindowShouldClose()  do    
       ClearBackground(bytes_to_int({0, 0, 0, 255}))
       for x = 0 to 255 do
           for y = 0 to 255 do
               DrawPixel(x, y, bytes_to_int({255 - x, x,y, 255}))
           end for
       end for
end while


I think Cybermonkey should have a look at it, so he could stop "fighting" with Allegro and SDL and jumping from one to another. It should be easy to use Raylib with the interpreter he's using now. Let him know. I'm not a member there anymore.
I am not in games and i am not messenger
and i really doubt that he is interested for this one because he like is own way .
this euphoria lib..hmm mm
i am not sure about that ...
currently i am in something else very i will see...
I really don't know..
I will try it tonight with Oxygen basic
so i will see what is that..

hey rick
i download whole zip from github
but there is no any compiled binary in dll form
then i look into source , i tried to compile but compiler complain about C99
compatibility mode ..ohh gee such a crap.
i don't know you can try
#6 - pre-compiled binaries for Windows and Linux. I don't think you can use it with NaaLaa.

Aurel, one minute you seem to be interested, the next one you say you don't give a shit about it. At least I know why - you haven't been able to compile it from source or find pre-compiled libraries (really?). And no - you don't have to tell Cybermonkey anything. Don't take everything literally.
In a ziped file i download there is no raylib.dll
second i tried to compile from source to create that freakin dll but comiler complain
about C99 thing so i give up .
thanks Rick for dll ,,i will try this openGL wrapper.... Big Grin 
and what a heck is with all this care about Cyb ,,,ask someone else
Aurel, really? Instead of the source code, download the package with pre-compiled libraries included. Just for curiosity - what compiler did you use? On Linux, GCC compiles it without problems.
I really don't know what went wrong.
I download latst 2.5.0 version of raylib mingw32
and again whole bunch of errors with my version of mingw compiler.
i give up ...
maybe Rick have better luck with that and tell us more what is it.

you tomek really pissed me off with this crap
but ok
i download latest gccm tdm mingw compiler pack from sourceforge
so i will see tomorrow what a heck is with this openGL crap
Strange thing is that i can compile fine windows app examples with my current compiler ???
I managed to use Raylib with newLISP:

(import "./" "InitWindow")
(import "./" "SetTargetFPS")
(import "./" "ClearBackground")
(import "./" "WindowShouldClose")
(import "./" "BeginDrawing")
(import "./" "DrawText")
(import "./" "EndDrawing")
(import "./" "CloseWindow")

(define (color r g b a)
    (+ r (* 256 g) (* 256 256 b) (* 256 256 256 a)))

(InitWindow 900 600 "Test")
(SetTargetFPS 60)
(set 'x 10)
(set 'y 1)
(while (= 0 (WindowShouldClose))
    (if (> x 680)
        (set 'y -1))
    (if (< x 10)
        (set 'y 1))
    (inc x y)
    (println x)
    (ClearBackground (color 255 0 0 255))
    (DrawText "newLISP" (int x) 100 50 (color 0 255 0 255))

I can't believe how easy that was.  Smile

Forum Jump:

Users browsing this thread: 1 Guest(s)