Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
NetWorld
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Fatus
NetWorld
Commits
159ce2ba
Commit
159ce2ba
authored
Oct 14, 2020
by
guillaume
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
initialization ControlPanel
parent
3aac5b13
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
64 additions
and
3 deletions
+64
-3
CMakeLists.txt
CMakeLists.txt
+1
-1
controlpanel.c
src/controlpanel.c
+30
-0
controlpanel.h
src/controlpanel.h
+24
-0
main-viewer.c
src/main-viewer.c
+9
-2
No files found.
CMakeLists.txt
View file @
159ce2ba
...
@@ -17,7 +17,7 @@ find_package(raylib 3.0 REQUIRED)
...
@@ -17,7 +17,7 @@ find_package(raylib 3.0 REQUIRED)
add_executable
(
nw-hello src/main-hello.c
)
add_executable
(
nw-hello src/main-hello.c
)
target_link_libraries
(
nw-hello raylib
)
target_link_libraries
(
nw-hello raylib
)
add_executable
(
nw-viewer src/main-viewer.c src/networld.c
)
add_executable
(
nw-viewer src/main-viewer.c src/networld.c
src/controlpanel.c
)
target_link_libraries
(
nw-viewer raylib
)
target_link_libraries
(
nw-viewer raylib
)
#without cmake package...
#without cmake package...
...
...
src/controlpanel.c
0 → 100644
View file @
159ce2ba
#include "controlpanel.h"
#include <stdio.h>
#include <stdlib.h>
// Constructor / Destructor
Panel
*
Panel_new
()
{
Panel
*
p
=
malloc
(
sizeof
(
Panel
)
);
return
p
;
}
void
Panel_delete
(
Panel
*
self
)
{
free
(
self
);
}
// Initialization
void
Panel_initialize
(
Panel
*
self
,
NetWorld
*
world
)
{
self
->
world
=
world
;
self
->
camerax
=
0
;
self
->
cameray
=
0
;
self
->
scale
=
1
;
}
// To String
void
Panel_print
(
Panel
*
self
)
{
printf
(
"Panel camera(x-%f, y-%f, scale-%f)
\n
"
,
self
->
camerax
,
self
->
cameray
,
self
->
scale
);
}
src/controlpanel.h
0 → 100644
View file @
159ce2ba
#ifndef CONTROLPANEL_H
#define CONTROLPANEL_H
#include "networld.h"
struct
Str_Panel
{
double
camerax
,
cameray
;
double
scale
;
NetWorld
*
world
;
};
typedef
struct
Str_Panel
Panel
;
// Constructor / Destructor
Panel
*
Panel_new
();
void
Panel_delete
(
Panel
*
self
);
// Initialization
void
Panel_initialize
(
Panel
*
self
,
NetWorld
*
world
);
// To String
void
Panel_print
(
Panel
*
self
);
#endif //CONTROLPANEL_H
\ No newline at end of file
src/main-viewer.c
View file @
159ce2ba
...
@@ -5,11 +5,14 @@
...
@@ -5,11 +5,14 @@
*
*
********************************************************************************************/
********************************************************************************************/
#include "networld.h"
#include "raylib.h"
#include "raylib.h"
#include <stdlib.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdio.h>
#include "networld.h"
#include "controlpanel.h"
// Program attributes
// Program attributes
//-------------------
//-------------------
const
int
screenWidth
=
800
;
const
int
screenWidth
=
800
;
...
@@ -33,6 +36,9 @@ int main(int nbArg, char ** arg)
...
@@ -33,6 +36,9 @@ 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
);
Panel
*
panel
=
Panel_new
();
Panel_initialize
(
panel
,
world
);
// Raylib Initialization
// Raylib Initialization
//----------------------
//----------------------
InitWindow
(
screenWidth
,
screenHeight
,
"NetWorld basic viewer"
);
InitWindow
(
screenWidth
,
screenHeight
,
"NetWorld basic viewer"
);
...
@@ -43,7 +49,8 @@ int main(int nbArg, char ** arg)
...
@@ -43,7 +49,8 @@ int main(int nbArg, char ** arg)
puts
(
"world variable:"
);
puts
(
"world variable:"
);
NetWorld_print
(
world
);
NetWorld_print
(
world
);
puts
(
"world expected:
\n
[10.4, 12.8]
\n
[110.4, 52.8]
\n
[384.5, 422.2]"
);
puts
(
"world expected:
\n
[10.4, 12.8]
\n
[110.4, 52.8]
\n
[384.5, 422.2]"
);
Panel_print
(
panel
);
// 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
{
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment