Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

resize the screen #222

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions develop/rendering/gui/custom-screens.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,30 @@
new CustomScreen(Text.empty(), currentScreen)
);
```

## Resize the screen {#resize-the-screen}

Check failure on line 66 in develop/rendering/gui/custom-screens.md

View workflow job for this annotation

GitHub Actions / markdownlint

Titlecase rule

develop/rendering/gui/custom-screens.md:66:1 titlecase-rule Titlecase rule [Title Case: 'Expected ## Resize the Screen , found ## Resize the screen ']

If you want to change the size of the screen, by default, the screen is 176 (width) and 166 (height)

```java
public class CustomScreen extends Screen {
private static final int TEXTURE_WIDTH = 195;
private static final int TEXTURE_HEIGHT = 136;

public CustomScreen(Text title) {

Check failure on line 75 in develop/rendering/gui/custom-screens.md

View workflow job for this annotation

GitHub Actions / markdownlint

Hard tabs

develop/rendering/gui/custom-screens.md:75:1 MD010/no-hard-tabs Hard tabs [Column: 1] https://github.com/DavidAnson/markdownlint/blob/v0.34.0/doc/md010.md
super(title);

Check failure on line 76 in develop/rendering/gui/custom-screens.md

View workflow job for this annotation

GitHub Actions / markdownlint

Hard tabs

develop/rendering/gui/custom-screens.md:76:1 MD010/no-hard-tabs Hard tabs [Column: 1] https://github.com/DavidAnson/markdownlint/blob/v0.34.0/doc/md010.md

this.backgroundWidth = TEXTURE_WIDTH;

Check failure on line 78 in develop/rendering/gui/custom-screens.md

View workflow job for this annotation

GitHub Actions / markdownlint

Hard tabs

develop/rendering/gui/custom-screens.md:78:1 MD010/no-hard-tabs Hard tabs [Column: 1] https://github.com/DavidAnson/markdownlint/blob/v0.34.0/doc/md010.md
this.backgroundHeight = TEXTURE_HEIGHT;

Check failure on line 79 in develop/rendering/gui/custom-screens.md

View workflow job for this annotation

GitHub Actions / markdownlint

Hard tabs

develop/rendering/gui/custom-screens.md:79:1 MD010/no-hard-tabs Hard tabs [Column: 1] https://github.com/DavidAnson/markdownlint/blob/v0.34.0/doc/md010.md
}

Check failure on line 80 in develop/rendering/gui/custom-screens.md

View workflow job for this annotation

GitHub Actions / markdownlint

Hard tabs

develop/rendering/gui/custom-screens.md:80:1 MD010/no-hard-tabs Hard tabs [Column: 1] https://github.com/DavidAnson/markdownlint/blob/v0.34.0/doc/md010.md

@Override

Check failure on line 82 in develop/rendering/gui/custom-screens.md

View workflow job for this annotation

GitHub Actions / markdownlint

Hard tabs

develop/rendering/gui/custom-screens.md:82:1 MD010/no-hard-tabs Hard tabs [Column: 1] https://github.com/DavidAnson/markdownlint/blob/v0.34.0/doc/md010.md
protected void drawBackground(DrawContext context, float delta, int mouseX, int mouseY) {

Check failure on line 83 in develop/rendering/gui/custom-screens.md

View workflow job for this annotation

GitHub Actions / markdownlint

Hard tabs

develop/rendering/gui/custom-screens.md:83:1 MD010/no-hard-tabs Hard tabs [Column: 1] https://github.com/DavidAnson/markdownlint/blob/v0.34.0/doc/md010.md
this.renderBackground(context);

Check failure on line 84 in develop/rendering/gui/custom-screens.md

View workflow job for this annotation

GitHub Actions / markdownlint

Hard tabs

develop/rendering/gui/custom-screens.md:84:1 MD010/no-hard-tabs Hard tabs [Column: 1] https://github.com/DavidAnson/markdownlint/blob/v0.34.0/doc/md010.md
int i = this.x;

Check failure on line 85 in develop/rendering/gui/custom-screens.md

View workflow job for this annotation

GitHub Actions / markdownlint

Hard tabs

develop/rendering/gui/custom-screens.md:85:1 MD010/no-hard-tabs Hard tabs [Column: 1] https://github.com/DavidAnson/markdownlint/blob/v0.34.0/doc/md010.md
int j = this.y;
context.drawTexture(TEXTURE, i, j, 0, 0, this.backgroundWidth, this.backgroundHeight);
}
...
}
```