Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
electric-field
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
repos.tanguy.cavagna
physics
electric-field
Commits
d05ad22f
Commit
d05ad22f
authored
3 years ago
by
tanguy.cavagna
Browse files
Options
Downloads
Patches
Plain Diff
Modification to do tests
parent
b68dc12b
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
makefile
+7
-5
7 additions, 5 deletions
makefile
test-draw.c
+63
-0
63 additions, 0 deletions
test-draw.c
with
70 additions
and
5 deletions
makefile
+
7
−
5
View file @
d05ad22f
...
...
@@ -7,18 +7,16 @@ LIBS = -lSDL2
TARGET
=
main
BIN
=
bin
SUBDIR
=
vector
RUN
=
./
$(
BIN
)
/
$(
TARGET
)
# Get source and object
SRCS
=
$(
wildcard
*
.c
*
/
*
.c
)
SRCS
=
$(
filter-out
test
%.c,
$(
wildcard
*
.c
*
/
*
.c
)
)
OBJS
=
$(
addprefix
$(
BIN
)
/,
$(
SRCS:.c
=
.o
))
PHONY
:=
$(
TARGET
)
# Create the target
$(TARGET)
:
$(OBJS)
$(
CC
)
$(
CFLAGS
)
-o
$(
BIN
)
/
$@
$(
OBJS
)
$(
LIBS
)
$(
LDFLAGS
)
$(
RUN
)
# Convert the source in object, but before all, run `$(BIN)` aka mkdir
$(BIN)/%.o
:
%.c
...
...
@@ -29,7 +27,6 @@ PHONY += help
# Echo the source and object values
help
:
@
echo
"src:
$(
SRCS
)
"
@
echo
"inc:
$(
INCS
)
"
@
echo
"obj:
$(
OBJS
)
"
PHONY
+=
run
...
...
@@ -39,6 +36,11 @@ run:
PHONY
+=
clean
clean
:
rm
-rf
bin
rm
-rf
$(
BIN
)
test-draw
:
test-draw.c
$(
CC
)
$(
CFLAGS
)
-o
$(
BIN
)
/
$@
.o
-c
$<
$(
LDFLAGS
)
$(
CC
)
$(
CFLAGS
)
-o
$(
BIN
)
/
$@
$(
BIN
)
/
$@
.o
$(
BIN
)
/draw.o
$(
BIN
)
/gfx/gfx.o
$(
BIN
)
/utils.o
$(
LIBS
)
$(
LDFLAGS
)
./
$(
BIN
)
/
$@
.PHONY
:
$(PHONY)
This diff is collapsed.
Click to expand it.
test-draw.c
0 → 100644
+
63
−
0
View file @
d05ad22f
/**
* @file test.c
* @author Tanguy Cavagna (tanguy.cavagna@etu.hesge.ch)
* @brief Test file for the draw functions
* @version 0.1
* @date 2021-07-12
*
* @copyright Copyright (c) 2021
*
*/
#include
<stdlib.h>
#include
"gfx/gfx.h"
#include
"utils.h"
#include
"draw.h"
int
main
(
void
)
{
const
int
WINDOW_WIDTH
=
100
;
const
int
WINDOW_HEIGHT
=
100
;
struct
gfx_context_t
*
ctxt
=
gfx_create
(
"draw"
,
WINDOW_WIDTH
,
WINDOW_HEIGHT
);
if
(
!
ctxt
)
{
fprintf
(
stderr
,
"Graphics initialization failed !
\n
"
);
return
EXIT_FAILURE
;
}
coordinates_t
p0
=
{
50
,
50
};
coordinates_t
p1
=
{
62
,
72
};
coordinates_t
p2
=
{
72
,
62
};
coordinates_t
p3
=
{
75
,
50
};
coordinates_t
p4
=
{
50
,
75
};
coordinates_t
p5
=
{
36
,
72
};
coordinates_t
p6
=
{
28
,
62
};
coordinates_t
p7
=
{
25
,
50
};
coordinates_t
p8
=
{
28
,
38
};
coordinates_t
p9
=
{
37
,
28
};
coordinates_t
p10
=
{
50
,
25
};
coordinates_t
p11
=
{
62
,
28
};
coordinates_t
p12
=
{
72
,
37
};
gfx_draw_line
(
ctxt
,
p0
,
p3
,
COLOR_WHITE
);
gfx_draw_line
(
ctxt
,
p0
,
p2
,
COLOR_WHITE
);
gfx_draw_line
(
ctxt
,
p0
,
p1
,
COLOR_WHITE
);
gfx_draw_line
(
ctxt
,
p0
,
p4
,
COLOR_WHITE
);
gfx_draw_line
(
ctxt
,
p0
,
p5
,
COLOR_WHITE
);
gfx_draw_line
(
ctxt
,
p0
,
p6
,
COLOR_WHITE
);
gfx_draw_line
(
ctxt
,
p0
,
p7
,
COLOR_WHITE
);
gfx_draw_line
(
ctxt
,
p0
,
p8
,
COLOR_WHITE
);
gfx_draw_line
(
ctxt
,
p0
,
p9
,
COLOR_WHITE
);
gfx_draw_line
(
ctxt
,
p0
,
p10
,
COLOR_WHITE
);
gfx_draw_line
(
ctxt
,
p0
,
p11
,
COLOR_WHITE
);
gfx_draw_line
(
ctxt
,
p0
,
p12
,
COLOR_WHITE
);
while
(
gfx_keypressed
()
!=
SDLK_ESCAPE
){
gfx_present
(
ctxt
);
}
gfx_destroy
(
ctxt
);
return
EXIT_SUCCESS
;
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment