Back
Close

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>3.7.0</version>
</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);
}
Create your playground on Tech.io
This playground was created on Tech.io, our hands-on, knowledge-sharing platform for developers.
Go to tech.io
codingame x discord
Join the CodinGame community on Discord to chat about puzzle contributions, challenges, streams, blog articles - all that good stuff!
JOIN US ON DISCORD
Online Participants