Skip to content

Commit 0880079

Browse files
author
Valentin Vetter
committed
docs(viewport): add viewport-module documentation
1 parent 0c7946f commit 0880079

File tree

2 files changed

+49
-0
lines changed

2 files changed

+49
-0
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# ViewportModule
2+
3+
This module allows you to create a viewport where you can zoom with mousewheel, and click/drag to move.
4+
5+
## Import
6+
7+
⚠ This module requires the [GraphicEntityModule](https://github.com/CodinGame/codingame-game-engine/tree/master/engine/modules/entities) to work.
8+
9+
Add this dependency in the `pom.xml` of your project:
10+
11+
```xml
12+
<dependency>
13+
<groupId>com.codingame.gameengine</groupId>
14+
<artifactId>module-viewport</artifactId>
15+
<version>3.7.0</version>
16+
</dependency>
17+
```
18+
19+
And load the module in your `config.js`:
20+
21+
```javascript
22+
import { GraphicEntityModule } from './entity-module/GraphicEntityModule.js';
23+
import { ViewportModule } from './viewport-module/ViewportModule.js';
24+
25+
export const modules = [
26+
GraphicEntityModule,
27+
ViewportModule
28+
];
29+
```
30+
31+
## Usage
32+
33+
In your `Referee.java`:
34+
35+
```java
36+
@Inject private GraphicEntityModule gem;
37+
@Inject ViewportModule viewportModule;
38+
39+
@Override
40+
public void init() {
41+
Group group = gem.createGroup();
42+
43+
// group.add(your entities)
44+
45+
viewportModule.createViewport(group);
46+
}
47+
```

techio.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ plan:
4949
statement: playground/extensions/extensions-toggle.md
5050
- title: Anim Module
5151
statement: playground/extensions/extensions-5-animmodule.md
52+
- title: Viewport Module
53+
statement: playground/extensions/extensions-6-viewport.md
5254
- title: Create your own modules
5355
statement: playground/extensions/extensions-2-tutorial.md
5456
- title: One more thing

0 commit comments

Comments
 (0)