diff options
author | pacien | 2018-01-07 22:05:58 +0100 |
---|---|---|
committer | pacien | 2018-01-07 22:05:58 +0100 |
commit | f5820af2788db92dd48ea2f0f7e81ed78deb3e72 (patch) | |
tree | 409f22754b2b26efd74dba7976835e79d07b29c2 | |
parent | 90e8447ee5596cc93461105c52c3c6713310ef56 (diff) | |
download | wallj-f5820af2788db92dd48ea2f0f7e81ed78deb3e72.tar.gz |
Add class diagram draft
Signed-off-by: pacien <pacien.trangirard@pacien.net>
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | src/docs/class.puml | 187 |
2 files changed, 188 insertions, 0 deletions
@@ -10,3 +10,4 @@ | |||
10 | !*.txt | 10 | !*.txt |
11 | !*.md | 11 | !*.md |
12 | !*.tex | 12 | !*.tex |
13 | !*.puml | ||
diff --git a/src/docs/class.puml b/src/docs/class.puml new file mode 100644 index 0000000..1381c85 --- /dev/null +++ b/src/docs/class.puml | |||
@@ -0,0 +1,187 @@ | |||
1 | @startuml | ||
2 | |||
3 | skinparam linetype ortho | ||
4 | |||
5 | package utils { | ||
6 | class PathFinder { | ||
7 | static List<Vec2> findPath(Board, TileVec2, TileVec2) | ||
8 | } | ||
9 | |||
10 | class TileVec2 { | ||
11 | static final int TILE_DIM | ||
12 | |||
13 | Vec2 | ||
14 | TileVec2(Vec2) | ||
15 | Vec2 toPixelPos() | ||
16 | static TileVec2 fromPixelPos(Vec2) | ||
17 | } | ||
18 | } | ||
19 | |||
20 | package viewer { | ||
21 | class Viewer { | ||
22 | Game | ||
23 | void main(String[]) | ||
24 | void eventLoop(ApplicationContext) | ||
25 | void renderFrame(Graphics2D) | ||
26 | } | ||
27 | } | ||
28 | |||
29 | package context { | ||
30 | class Context { | ||
31 | final Stage | ||
32 | final List<Event> | ||
33 | final GraphicsContext | ||
34 | } | ||
35 | |||
36 | class GraphicsContext { | ||
37 | Graphics2D | ||
38 | ScreenInfo | ||
39 | paintCircle(Color, Vec2, int) | ||
40 | paintSquare(Color, Vec2, int) | ||
41 | } | ||
42 | |||
43 | class InputHandler | ||
44 | |||
45 | class ScreenManager { | ||
46 | private clearScreen() | ||
47 | } | ||
48 | |||
49 | class Game { | ||
50 | GameController | ||
51 | Stage | ||
52 | Game(List<Board>) | ||
53 | } | ||
54 | } | ||
55 | |||
56 | package event { | ||
57 | interface Event | ||
58 | |||
59 | class DropBombEvent implements Event { | ||
60 | DropBombEvent(TileVec2) | ||
61 | } | ||
62 | |||
63 | class MoveRobotEvent implements Event { | ||
64 | MoveRobotEvent(TileVec2) | ||
65 | } | ||
66 | |||
67 | class ConfirmEvent implements Event | ||
68 | } | ||
69 | |||
70 | package board { | ||
71 | class Board { | ||
72 | BlockType[][] | ||
73 | } | ||
74 | |||
75 | class BoardParser { | ||
76 | static Board parse(File) | ||
77 | } | ||
78 | |||
79 | class BoardValidator { | ||
80 | static bool validate(Board) | ||
81 | } | ||
82 | |||
83 | class BoardConverter { | ||
84 | static Board worldToBoard(List<Block>) | ||
85 | static List<Block> boardToWorld(Board) | ||
86 | } | ||
87 | } | ||
88 | |||
89 | package model { | ||
90 | enum BlockType { | ||
91 | Wall | ||
92 | Trash | ||
93 | Garbage | ||
94 | Robot | ||
95 | Bomb | ||
96 | } | ||
97 | |||
98 | class BlockFactory { | ||
99 | Block build(BlockType, Vec2) | ||
100 | } | ||
101 | |||
102 | abstract class Block { | ||
103 | List<Controller> | ||
104 | |||
105 | Block(Vec2) | ||
106 | Vec2 getPosition() | ||
107 | void setPosition(Vec2) | ||
108 | void update(Context) | ||
109 | } | ||
110 | |||
111 | abstract class StaticBlock extends Block | ||
112 | class WallBlock extends StaticBlock | ||
113 | class TrashBlock extends StaticBlock | ||
114 | class BombBlock extends StaticBlock | ||
115 | |||
116 | class GarbageBlock extends Block | ||
117 | class RobotBlock extends Block | ||
118 | |||
119 | class Stage { | ||
120 | StageController | ||
121 | List<Block> | ||
122 | Stage(Board) | ||
123 | List<Block> getBlocks() | ||
124 | void update(Context) | ||
125 | bool isCleared() | ||
126 | } | ||
127 | } | ||
128 | |||
129 | package controller { | ||
130 | interface Controller { | ||
131 | void update(Context) | ||
132 | } | ||
133 | |||
134 | abstract class BlockController implements Controller { | ||
135 | Block | ||
136 | Controller(Block) | ||
137 | Block getBlock() | ||
138 | void update(Context) | ||
139 | } | ||
140 | |||
141 | class BlockControllerFactory { | ||
142 | BlockController build(Block) | ||
143 | } | ||
144 | |||
145 | class GameController implements Controller | ||
146 | class StageController implements Controller | ||
147 | |||
148 | abstract class PhysicsController extends BlockController | ||
149 | abstract class DisplayController extends BlockController | ||
150 | |||
151 | class WallPhysicsController extends PhysicsController | ||
152 | class WallDisplayController extends DisplayController | ||
153 | |||
154 | class TrashPhysicsController extends PhysicsController | ||
155 | class TrashDisplayController extends DisplayController | ||
156 | |||
157 | class GarbagePhysicsController extends PhysicsController | ||
158 | class GarbageDisplayController extends DisplayController | ||
159 | |||
160 | class RobotPhysicsController extends PhysicsController { | ||
161 | List<TileVec2> path | ||
162 | } | ||
163 | |||
164 | class RobotDisplayController extends DisplayController | ||
165 | |||
166 | class BombPhysicsController extends PhysicsController | ||
167 | class BombDisplayController extends DisplayController | ||
168 | } | ||
169 | |||
170 | RobotPhysicsController --> PathFinder | ||
171 | RobotPhysicsController --> BoardConverter | ||
172 | |||
173 | Stage --> BoardConverter | ||
174 | |||
175 | PhysicsController --() JBox2D | ||
176 | Zen5 ()-- Viewer | ||
177 | |||
178 | viewer --> context | ||
179 | viewer --> model | ||
180 | |||
181 | context --> event | ||
182 | |||
183 | model --> controller | ||
184 | |||
185 | board --> model | ||
186 | |||
187 | @enduml | ||