testing layout with chapter sidebar

This commit is contained in:
Dani The Skunk 2022-10-21 06:15:01 +00:00
parent 1429c2bf18
commit 567bed7a7c
2 changed files with 22 additions and 4 deletions

BIN
fonts/ega-16x28.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

View File

@ -4,6 +4,7 @@ import com.danitheskunk.skunkworks.BaseGame;
import com.danitheskunk.skunkworks.Vec2i; import com.danitheskunk.skunkworks.Vec2i;
import com.danitheskunk.skunkworks.gfx.Color; import com.danitheskunk.skunkworks.gfx.Color;
import com.danitheskunk.skunkworks.gfx.IRenderContext; import com.danitheskunk.skunkworks.gfx.IRenderContext;
import com.danitheskunk.skunkworks.gfx.font.Cp437;
import com.danitheskunk.skunkworks.gfx.vt.Terminal; import com.danitheskunk.skunkworks.gfx.vt.Terminal;
import java.util.ArrayList; import java.util.ArrayList;
@ -12,6 +13,8 @@ import java.util.List;
public class Skunkwrite extends BaseGame { public class Skunkwrite extends BaseGame {
final private Terminal term; final private Terminal term;
final private Color bgColor = new Color(0xF2, 0xEE, 0xCB);
final private Color fgColor = Color.DARK_GRAY;
final private List<String> lines; final private List<String> lines;
public Skunkwrite() { public Skunkwrite() {
@ -42,11 +45,22 @@ public class Skunkwrite extends BaseGame {
lines.add("Meatloaf turducken leberkas beef ribs drumstick fatback " + lines.add("Meatloaf turducken leberkas beef ribs drumstick fatback " +
"landjaeger ribeye ham hamburger. Boudin ground round beef ribs cow strip steak alcatra. Jerky tenderloin chuck biltong prosciutto, chislic kielbasa. Ham kielbasa cupim cow boudin pork jerky fatback chicken shoulder landjaeger tail strip steak. Cupim tail meatball sausage, shank biltong ham corned beef chuck pancetta boudin pork alcatra bresaola ribeye. Pancetta ball tip buffalo bacon picanha, frankfurter pastrami pork loin ham hock."); "landjaeger ribeye ham hamburger. Boudin ground round beef ribs cow strip steak alcatra. Jerky tenderloin chuck biltong prosciutto, chislic kielbasa. Ham kielbasa cupim cow boudin pork jerky fatback chicken shoulder landjaeger tail strip steak. Cupim tail meatball sausage, shank biltong ham corned beef chuck pancetta boudin pork alcatra bresaola ribeye. Pancetta ball tip buffalo bacon picanha, frankfurter pastrami pork loin ham hock.");
term = new Terminal( term = new Terminal(
new Vec2i(160, 51), new Vec2i(80, 25),
window.loadFontTileset("fonts/ega-8x14.png") window.loadFontTileset("fonts/ega-16x28.png")
); );
//term.drawHalfString(new Vec2i(0, 0), "Meow", Color.GREEN); //term.drawHalfString(new Vec2i(0, 0), "Meow", Color.GREEN);
term.clear(new Color(0xF2, 0xEE, 0xCB)); term.clear(bgColor);
term.drawString(new Vec2i(0, 0), "Chapter 1", fgColor);
//term.setChar(new Vec2i(0, 1), Cp437.BOX_SINGLE_TOP_RIGHT, fgColor);
term.drawString(new Vec2i(2, 1), "Bacon", bgColor, fgColor);
term.drawString(new Vec2i(2, 2), "Beef", fgColor);
term.drawString(new Vec2i(2, 3), "Pork", fgColor);
term.drawString(new Vec2i(2, 4), "Steak", fgColor);
term.drawString(new Vec2i(0, 5), "Chapter 2", fgColor);
term.drawString(new Vec2i(2, 6), "Ribs", fgColor);
term.drawString(new Vec2i(2, 7), "Hamburger", fgColor);
term.drawVerticalSingleLine(new Vec2i(19, 0), 25, fgColor);
drawEditor(); drawEditor();
} }
@ -83,12 +97,16 @@ public class Skunkwrite extends BaseGame {
private void drawEditor() { private void drawEditor() {
int lineLength = 60; int lineLength = 60;
int x = (term.getSize().getX() - lineLength)/2; int x = (term.getSize().getX() - lineLength)/2;
x = 20;
int y = 0; int y = 0;
for(int i = 0; i < lines.size(); ++i) { for(int i = 0; i < lines.size(); ++i) {
var l = splitIntoLines(lines.get(i), lineLength); var l = splitIntoLines(lines.get(i), lineLength);
for(int j = 0; j < l.size(); ++j) { for(int j = 0; j < l.size(); ++j) {
term.drawString(new Vec2i(x, y), l.get(j), Color.DARK_GRAY); term.drawString(new Vec2i(x, y), l.get(j), fgColor);
++y; ++y;
if(y == term.getSize().getY()) {
return;
}
} }
++y; ++y;
} }