Open Source Your Knowledge, Become a Contributor

Technology knowledge has to be shared and made accessible for free. Join the movement.

Create Content

ViewportModule

This module allows you to create a viewport where you can zoom with mousewheel, and click/drag to move.

Import

⚠ This module requires the GraphicEntityModule to work.

Add this dependency in the pom.xml of your project:

<dependency>
  <groupId>com.codingame.gameengine</groupId>
  <artifactId>module-viewport</artifactId>
  <version>${gamengine.version}</version>
    <!-- The version must be > 3.7.0 -->
</dependency>

And load the module in your config.js:

import { GraphicEntityModule } from './entity-module/GraphicEntityModule.js';
import { ViewportModule } from './viewport-module/ViewportModule.js';

export const modules = [
  GraphicEntityModule,
  ViewportModule
];

Usage

In your Referee.java:

@Inject private GraphicEntityModule gem;
@Inject ViewportModule viewportModule;

@Override
public void init() {
  Group group = gem.createGroup();

  // group.add(your entities)

  viewportModule.createViewport(group);
}
Open Source Your Knowledge: become a Contributor and help others learn. Create New Content