Pre-makefile
parent
adaa5142c2
commit
afa9d79731
@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"name": "Linux",
|
||||||
|
"includePath": [
|
||||||
|
"${workspaceFolder}/**",
|
||||||
|
"/usr/include/c++/8",
|
||||||
|
"/usr/include/x86_64-linux-gnu/c++/9"
|
||||||
|
],
|
||||||
|
"defines": [],
|
||||||
|
"compilerPath": "/usr/bin/gcc",
|
||||||
|
"cStandard": "gnu18",
|
||||||
|
"cppStandard": "gnu++14",
|
||||||
|
"intelliSenseMode": "gcc-x64"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"version": 4
|
||||||
|
}
|
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"files.associations": {
|
||||||
|
"exception": "c"
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
{
|
||||||
|
"version": "2.0.0",
|
||||||
|
"tasks": [
|
||||||
|
{
|
||||||
|
"type": "shell",
|
||||||
|
"label": "C/C++: gcc build active file + SLD2",
|
||||||
|
"command": "/usr/bin/gcc",
|
||||||
|
"args": [
|
||||||
|
"-g",
|
||||||
|
"${file}",
|
||||||
|
"-o",
|
||||||
|
"${fileDirname}/${fileBasenameNoExtension}",
|
||||||
|
"-lSDL2",
|
||||||
|
"-lSDL2main"
|
||||||
|
],
|
||||||
|
"options": {
|
||||||
|
"cwd": "${workspaceFolder}"
|
||||||
|
},
|
||||||
|
"problemMatcher": ["$gcc"],
|
||||||
|
"group": "build"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
Binary file not shown.
After Width: | Height: | Size: 9.7 KiB |
Binary file not shown.
After Width: | Height: | Size: 44 KiB |
Binary file not shown.
After Width: | Height: | Size: 44 KiB |
@ -0,0 +1,59 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include <sys/time.h>
|
||||||
|
#include "SDL2/SDL.h"
|
||||||
|
|
||||||
|
struct timeval tv;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
float x;
|
||||||
|
float y;
|
||||||
|
float theta;
|
||||||
|
} Vecteur;
|
||||||
|
// typedef struct {Vecteur position; Vecteur vitesse; char[25] nom} Robot;
|
||||||
|
void print_nl()
|
||||||
|
{
|
||||||
|
printf("\n");
|
||||||
|
}
|
||||||
|
void print_vecteur(Vecteur vec)
|
||||||
|
{
|
||||||
|
printf("(%f;%f;%f)", vec.x, vec.y, vec.theta);
|
||||||
|
}
|
||||||
|
|
||||||
|
Vecteur addition_vecteur(Vecteur vect1, Vecteur vect2)
|
||||||
|
{
|
||||||
|
Vecteur vecteur_somme = {vect1.x + vect2.y, vect1.y + vect2.y, vect1.theta + vect2.theta};
|
||||||
|
return vecteur_somme;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char **argv)
|
||||||
|
{
|
||||||
|
Vecteur A = {1, 2, 3};
|
||||||
|
Vecteur B = {1, 0, 3};
|
||||||
|
Vecteur C;
|
||||||
|
C = addition_vecteur(A, B);
|
||||||
|
/*int i = 0;
|
||||||
|
unsigned long long last_tic = 0;
|
||||||
|
while (i <= 1000)
|
||||||
|
{
|
||||||
|
gettimeofday(&tv, NULL);
|
||||||
|
unsigned long long millisecondsSinceEpoch = (unsigned long long)(tv.tv_sec) * 1000 + (unsigned long long)(tv.tv_usec) / 1000;
|
||||||
|
if ((millisecondsSinceEpoch - last_tic) >= 10)
|
||||||
|
{
|
||||||
|
printf("%llu\n", millisecondsSinceEpoch);
|
||||||
|
last_tic = millisecondsSinceEpoch;
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
|
||||||
|
print_vecteur(A);
|
||||||
|
print_nl();
|
||||||
|
print_vecteur(B);
|
||||||
|
print_nl();
|
||||||
|
print_vecteur(C);
|
||||||
|
print_nl();
|
||||||
|
C.x = -10;
|
||||||
|
print_vecteur(C);
|
||||||
|
print_nl();
|
||||||
|
return 0;
|
||||||
|
}
|
Binary file not shown.
After Width: | Height: | Size: 1.2 MiB |
Binary file not shown.
After Width: | Height: | Size: 1.2 MiB |
Loading…
Reference in New Issue