<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ca">
	<id>http://wiki.joanillo.org/index.php?action=history&amp;feed=atom&amp;title=Llibreria_raylib_%28videojocs%29_a_la_Raspberry_Pi</id>
	<title>Llibreria raylib (videojocs) a la Raspberry Pi - Historial de revisió</title>
	<link rel="self" type="application/atom+xml" href="http://wiki.joanillo.org/index.php?action=history&amp;feed=atom&amp;title=Llibreria_raylib_%28videojocs%29_a_la_Raspberry_Pi"/>
	<link rel="alternate" type="text/html" href="http://wiki.joanillo.org/index.php?title=Llibreria_raylib_(videojocs)_a_la_Raspberry_Pi&amp;action=history"/>
	<updated>2026-04-20T11:53:03Z</updated>
	<subtitle>Historial de revisió per a aquesta pàgina del wiki</subtitle>
	<generator>MediaWiki 1.34.2</generator>
	<entry>
		<id>http://wiki.joanillo.org/index.php?title=Llibreria_raylib_(videojocs)_a_la_Raspberry_Pi&amp;diff=257284&amp;oldid=prev</id>
		<title>Joan: /* Instal.lació a Linux */</title>
		<link rel="alternate" type="text/html" href="http://wiki.joanillo.org/index.php?title=Llibreria_raylib_(videojocs)_a_la_Raspberry_Pi&amp;diff=257284&amp;oldid=prev"/>
		<updated>2018-05-22T18:55:10Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Instal.lació a Linux&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Pàgina nova&lt;/b&gt;&lt;/p&gt;&lt;div&gt;__TOC__&lt;br /&gt;
=Instal.lació=&lt;br /&gt;
He instal.lat la llibreria '''raylib''' en una Raspberry Pi 3 i he fet les primeres proves.&lt;br /&gt;
*http://www.raylib.com/index.html&lt;br /&gt;
*https://www.raspberrypi.org/forums/viewtopic.php?t=88182&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
git clone https://github.com/raysan5/raylib.git&lt;br /&gt;
sudo apt install libopenal1 libopenal-dev libglfw3&lt;br /&gt;
#maybe libglfw3 can be skipped since we are using GLES&lt;br /&gt;
cd raylib/src/&lt;br /&gt;
&lt;br /&gt;
make PLATFORM=PLATFORM_RPI&lt;br /&gt;
sudo make install&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Sense fer cap canvi en el Makefile compila bé, però després no troba una llibreria.&lt;br /&gt;
&lt;br /&gt;
O sigui que faig en el Makefile el canvi que es proposa:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Use cross-compiler for PLATFORM_RPI&lt;br /&gt;
ifeq ($(PLATFORM),PLATFORM_RPI)&lt;br /&gt;
    RPI_CROSS_COMPILE ?= NO&lt;br /&gt;
    RPI_TOOLCHAIN ?=&lt;br /&gt;
    RPI_TOOLCHAIN_SYSROOT ?=&lt;br /&gt;
endif&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
compila bé el Make, però quan vull fer ''sudo make install'' busca la llibreria estàtica a /home/pi/raylib/release/libs/linux en comptes de /home/pi/raylib/release/libs/rpi, que és on realment està. Per tant, la copio allà on es pensa que està, i ja funcionarà tot:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ cp /home/pi/raylib/release/libs/rpi/libraylib.a /home/pi/raylib/release/libs/linux&lt;br /&gt;
sudo make install&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This installs the static library and headerfiles in /usr/local/lib and /usr/local/include.&lt;br /&gt;
&lt;br /&gt;
So to test the installation I just copied out one of the examples and checked what options was needed to compile it.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ gcc core_basic_window.c -L/opt/vc/lib/ -lraylib -lbrcmGLESv2 -lbrcmEGL -lpthread -lrt -lm -lbcm_host -lopenal&lt;br /&gt;
&lt;br /&gt;
this created the file a.out which I ran with &amp;quot;./a.out&amp;quot;&lt;br /&gt;
&lt;br /&gt;
PS: Some examples also need the &amp;quot;-std=c99&amp;quot; option.&lt;br /&gt;
PPS: Older versions of raspbian can probably remove the &amp;quot;brcm&amp;quot; letters from the library names, I think they came in Stretch. Check your &amp;quot;/opt/vc/lib&amp;quot; directory.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
(ha funcionat)&lt;br /&gt;
&lt;br /&gt;
Enllaç directe de descàrrega del codi:&lt;br /&gt;
*https://github.com/raysan5/raylib/blob/master/examples/core/core_basic_window.c&lt;br /&gt;
&lt;br /&gt;
També compila l'exemple bàsic amb C++:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ g++ core_basic_window.cpp -L/opt/vc/lib/ -lraylib -lbrcmGLESv2 -lbrcmEGL -lpthread -lrt -lm -lbcm_host -lopenal -o core_basic_window&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
I també he provat i han funcionat els exemples:&lt;br /&gt;
*core_input_mouse.c&lt;br /&gt;
*master/examples/models/models_box_collisions.c&lt;br /&gt;
&lt;br /&gt;
=Exemple bàsic: core_basic_window.c=&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/*******************************************************************************************&lt;br /&gt;
*&lt;br /&gt;
*   raylib [core] example - Basic window&lt;br /&gt;
*&lt;br /&gt;
*   Welcome to raylib!&lt;br /&gt;
*&lt;br /&gt;
*   To test examples, just press F6 and execute raylib_compile_execute script&lt;br /&gt;
*   Note that compiled executable is placed in the same folder as .c file&lt;br /&gt;
*&lt;br /&gt;
*   You can find all basic examples on C:\raylib\raylib\examples folder or&lt;br /&gt;
*   raylib official webpage: www.raylib.com&lt;br /&gt;
*&lt;br /&gt;
*   Enjoy using raylib. :)&lt;br /&gt;
*&lt;br /&gt;
*   This example has been created using raylib 1.0 (www.raylib.com)&lt;br /&gt;
*   raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)&lt;br /&gt;
*&lt;br /&gt;
*   Copyright (c) 2013-2016 Ramon Santamaria (@raysan5)&lt;br /&gt;
*&lt;br /&gt;
********************************************************************************************/&lt;br /&gt;
&lt;br /&gt;
#include &amp;quot;raylib.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
int main()&lt;br /&gt;
{&lt;br /&gt;
    // Initialization&lt;br /&gt;
    //--------------------------------------------------------------------------------------&lt;br /&gt;
    int screenWidth = 800;&lt;br /&gt;
    int screenHeight = 450;&lt;br /&gt;
&lt;br /&gt;
    InitWindow(screenWidth, screenHeight, &amp;quot;raylib [core] example - basic window&amp;quot;);&lt;br /&gt;
    &lt;br /&gt;
    SetTargetFPS(60);&lt;br /&gt;
    //--------------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
    // Main game loop&lt;br /&gt;
    while (!WindowShouldClose())    // Detect window close button or ESC key&lt;br /&gt;
    {&lt;br /&gt;
        // Update&lt;br /&gt;
        //----------------------------------------------------------------------------------&lt;br /&gt;
        // TODO: Update your variables here&lt;br /&gt;
        //----------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
        // Draw&lt;br /&gt;
        //----------------------------------------------------------------------------------&lt;br /&gt;
        BeginDrawing();&lt;br /&gt;
&lt;br /&gt;
            ClearBackground(RAYWHITE);&lt;br /&gt;
&lt;br /&gt;
            DrawText(&amp;quot;Congrats! You created your first window!&amp;quot;, 190, 200, 20, LIGHTGRAY);&lt;br /&gt;
&lt;br /&gt;
        EndDrawing();&lt;br /&gt;
        //----------------------------------------------------------------------------------&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    // De-Initialization&lt;br /&gt;
    //--------------------------------------------------------------------------------------   &lt;br /&gt;
    CloseWindow();        // Close window and OpenGL context&lt;br /&gt;
    //--------------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
    return 0;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
=Instal.lació a Linux=&lt;br /&gt;
*https://github.com/raysan5/raylib/wiki/Working-on-GNU-Linux&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ sudo apt install build-essential git&lt;br /&gt;
&lt;br /&gt;
$ sudo apt install libasound2-dev mesa-common-dev libx11-dev libxrandr-dev libxi-dev xorg-dev libgl1-mesa-dev libglu1-mesa-dev&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
You can compile three different types of raylib library:&lt;br /&gt;
*The static library (default method)&lt;br /&gt;
*The dynamic shared library (often used on Linux)&lt;br /&gt;
*The web library&lt;br /&gt;
Nosaltres fem l'opció estàndar, que és la ''dynamic shared library''.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ git clone https://github.com/raysan5/raylib.git raylib&lt;br /&gt;
$ cd raylib/src/&lt;br /&gt;
$ make PLATFORM=PLATFORM_DESKTOP RAYLIB_LIBTYPE=SHARED # To make the dynamic shared version. - Recommended&lt;br /&gt;
$ sudo make install RAYLIB_LIBTYPE=SHARED # Dynamic shared version&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Per muntar tots els exemples que estan dins la carpeta ''examples/'':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ cd raylib/examples&lt;br /&gt;
$ make PLATFORM=PLATFORM_DESKTOP RAYLIB_LIBTYPE=SHARED&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
i es compilen tots els exemples (es poden fer coses xules).&lt;br /&gt;
&lt;br /&gt;
A more detailed command for the OpenGL ES GRAPHICS variant on Ubuntu 16.04 is:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ make  PLATFORM=PLATFORM_DESKTOP  GRAPHICS=GRAPHICS_API_OPENGLES_20 RAYLIB_LIBTYPE=SHARED USE_EXTERNAL_GLFW=TRUE \&lt;br /&gt;
    CFLAGS=&amp;quot;-fPIC -I/usr/include/GL&amp;quot; LDFLAGS='-L/usr/local/lib/raysan5 -lGLESv2 -lglfw3'&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
To compile just one specific example, add flags as needed:&lt;br /&gt;
&lt;br /&gt;
make core/core_basic_window PLATFORM=PLATFORM_DESKTOP&lt;br /&gt;
&lt;br /&gt;
To force recompile one example:&lt;br /&gt;
&lt;br /&gt;
make core/core_basic_window PLATFORM=PLATFORM_DESKTOP -B&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
I també compilo tots els jocs:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ cd raylib/games&lt;br /&gt;
$ make PLATFORM=PLATFORM_DESKTOP RAYLIB_LIBTYPE=SHARED&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Per compilar un exemple concret, per exemple el tetris:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ gcc -o tetris tetris.c -O1 -s -Wall -std=c99 -D_DEFAULT_SOURCE -Wno-missing-braces -D_DEFAULT_SOURCE -I. -I../release/include -I../src -I../src/external -L. -L../release/libs/linux -L../src  -lraylib -lGL -lm -lpthread -ldl -lrt -lX11 -DPLATFORM_DESKTOP&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==Fullscreen==&lt;br /&gt;
''src/core.c'', a la línia 285:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
static bool fullscreen = true;             // Fullscreen mode (useful only for PLATFORM_DESKTOP)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Hem de tornar a compilar tots els projectes, i ara per defecte, a Linux/Ubuntu, tots els exemples i games ja funcionen a fullscreen. (A la RPi, per defecte ja tots els exemples estaven a fullscreen).&lt;br /&gt;
&lt;br /&gt;
{{Autor}}, maig 2018&lt;/div&gt;</summary>
		<author><name>Joan</name></author>
		
	</entry>
</feed>