Commit 33105467 authored by guillaume's avatar guillaume

all doubles

parent 11ea00ca
...@@ -12,7 +12,8 @@ Dans un terminal: ...@@ -12,7 +12,8 @@ Dans un terminal:
```bash ```bash
sudo apt update sudo apt update
sudo apt install gcc CMake sudo apt install build-essential git cmake
sudo apt install libasound2-dev mesa-common-dev libx11-dev libxrandr-dev libxi-dev xorg-dev libgl1-mesa-dev libglu1-mesa-dev
``` ```
Installer Raylib sur la version 3.0.0 sous linux [[cf. raylib-wiki](https://github.com/raysan5/raylib/wiki/Working-on-GNU-Linux)] en suivant le 'Build raylib using CMake' un peut modifie suivant: Installer Raylib sur la version 3.0.0 sous linux [[cf. raylib-wiki](https://github.com/raysan5/raylib/wiki/Working-on-GNU-Linux)] en suivant le 'Build raylib using CMake' un peut modifie suivant:
...@@ -20,7 +21,7 @@ Installer Raylib sur la version 3.0.0 sous linux [[cf. raylib-wiki](https://gith ...@@ -20,7 +21,7 @@ Installer Raylib sur la version 3.0.0 sous linux [[cf. raylib-wiki](https://gith
```bash ```bash
git clone https://github.com/raysan5/raylib.git raylib git clone https://github.com/raysan5/raylib.git raylib
cd raylib cd raylib
git checkout 3.0.0 git checkout '3.0.0'
mkdir build && cd build mkdir build && cd build
cmake -DSHARED=ON -DSTATIC=ON .. cmake -DSHARED=ON -DSTATIC=ON ..
make make
......
#!/bin/bash
# Dependencies:
sudo apt update
sudo apt install -y build-essential git cmake
sudo apt install -y libasound2-dev mesa-common-dev \
libx11-dev libxrandr-dev libxi-dev xorg-dev \
libgl1-mesa-dev libglu1-mesa-dev
# Raylib:
git clone https://github.com/raysan5/raylib.git raylib
cd raylib
git checkout '3.0.0'
mkdir build && cd build
cmake -DSHARED=ON -DSTATIC=ON ..
make
sudo make install
cd ..
\ No newline at end of file
...@@ -25,11 +25,6 @@ bool game_end; ...@@ -25,11 +25,6 @@ bool game_end;
int main(int nbArg, char ** arg) int main(int nbArg, char ** arg)
{ {
// Raylib Initialization
//----------------------
InitWindow(screenWidth, screenHeight, "NetWorld basic viewer");
SetTargetFPS(targetFPS);
// Game Initialization // Game Initialization
//-------------------- //--------------------
game_end= false; game_end= false;
...@@ -38,6 +33,17 @@ int main(int nbArg, char ** arg) ...@@ -38,6 +33,17 @@ int main(int nbArg, char ** arg)
NetWorld_initNodePosition( world, 1, 110.4, 52.8 ); NetWorld_initNodePosition( world, 1, 110.4, 52.8 );
NetWorld_initNodePosition( world, 2, 384.5, 422.2 ); NetWorld_initNodePosition( world, 2, 384.5, 422.2 );
// Raylib Initialization
//----------------------
InitWindow(screenWidth, screenHeight, "NetWorld basic viewer");
SetTargetFPS(targetFPS);
// Some verificcations
//--------------------
puts("world variable:");
NetWorld_print(world);
puts("world expected:\n[10.4, 12.8]\n[110.4, 52.8]\n[384.5, 422.2]");
// Main game loop // Main game loop
while (!game_end && !WindowShouldClose()) // Detect window close button or ESC key while (!game_end && !WindowShouldClose()) // Detect window close button or ESC key
{ {
...@@ -61,16 +67,11 @@ void game_update(NetWorld * world) ...@@ -61,16 +67,11 @@ void game_update(NetWorld * world)
void game_draw(NetWorld * world) void game_draw(NetWorld * world)
{ {
BeginDrawing(); BeginDrawing();
puts("Draw...\n");
ClearBackground(RAYWHITE); ClearBackground(RAYWHITE);
for(int i= 0 ; i < world->size ; ++i ) for(int i= 0 ; i < world->size ; ++i )
{ {
Vector2 nodePosition= { world->nodes[i].x, world->nodes[i].y }; Vector2 nodePosition= { world->nodes[i].x, world->nodes[i].y };
printf("[%f, %f]\n", world->nodes[i].x, world->nodes[i].y); DrawCircleV(nodePosition, 24, MAROON);
DrawCircleV(nodePosition, 50, MAROON);
} }
EndDrawing(); EndDrawing();
} }
\ No newline at end of file
...@@ -20,8 +20,15 @@ void NetWorld_delete(NetWorld * self) ...@@ -20,8 +20,15 @@ void NetWorld_delete(NetWorld * self)
// Initialization // Initialization
void NetWorld_initNodePosition( void NetWorld_initNodePosition(
NetWorld * self, int iNode, NetWorld * self, int iNode,
float x, float y) double x, double y)
{ {
self->nodes[iNode].x= x; self->nodes[iNode].x= x;
self->nodes[iNode].y= y; self->nodes[iNode].y= y;
} }
// To String
void NetWorld_print(NetWorld * self)
{
for(int i= 0 ; i < self->size ; ++i )
printf("[%lf, %lf]\n", self->nodes[i].x, self->nodes[i].y);
}
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
#define NETWORLD_H #define NETWORLD_H
struct Str_Node { struct Str_Node {
float x, y; double x, y;
}; };
typedef struct Str_Node Node; typedef struct Str_Node Node;
...@@ -19,4 +19,7 @@ void NetWorld_delete(NetWorld * aWorld); ...@@ -19,4 +19,7 @@ void NetWorld_delete(NetWorld * aWorld);
// Initialization // Initialization
void NetWorld_initPosition(NetWorld * self, float ** position); // position must be an float[size][2] array... void NetWorld_initPosition(NetWorld * self, float ** position); // position must be an float[size][2] array...
// To String
void NetWorld_print(NetWorld * self);
#endif //NETWORLD_H #endif //NETWORLD_H
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment