Skip to content

Commit

Permalink
Finish merge of dev
Browse files Browse the repository at this point in the history
  • Loading branch information
StavWasPlayZ committed Jul 20, 2023
1 parent 70474a3 commit e3af2a0
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
import java.util.List;

import com.cstav.genshinstrument.client.config.ModClientConfigs;
import com.mojang.blaze3d.vertex.PoseStack;

import net.minecraft.ChatFormatting;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.gui.components.Button;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.client.gui.screens.multiplayer.WarningScreen;
Expand Down Expand Up @@ -92,8 +92,8 @@ protected void init() {
}

@Override
protected void renderTitle(GuiGraphics gui) {
gui.drawCenteredString(font, title, width/2, 30, Color.WHITE.getRGB());
protected void renderTitle(PoseStack poseStack) {
drawCenteredString(poseStack, font, title, width/2, 30, Color.WHITE.getRGB());
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ protected void renderAccidentals(final PoseStack poseStack) {
}

protected void renderAccidental(final PoseStack poseStack, int index) {
renderAccidental(pos, index, 0, 0);
renderAccidental(poseStack, index, 0, 0);
}
protected void renderAccidental(PoseStack poseStack, int index, int offsetX, int offsetY) {
final int textureWidth = (int)(width * FLAT_TEXTURE_WIDTH_MULTIPLIER * (
Expand All @@ -303,7 +303,10 @@ protected void renderAccidental(PoseStack poseStack, int index, int offsetX, int

final int spritePartHeight = textureHeight/3;

gui.blit(accidentalsLocation,

ClientUtil.displaySprite(accidentalsLocation);

blit(poseStack,
getX() - 9 + offsetX, getY() - 6 + offsetY,
// Handle sharp imperfections
isPlaying() ? textureWidth/2 : 0, (spritePartHeight) * index - index,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,9 @@ public AbstractWidget initNoteGridWidget(final float vertAlignment, final int sc
final RowHelper rowHelper = grid.createRowHelper(rows);
forEach(rowHelper::addChild);

grid.arrangeElements();
FrameLayout.alignInRectangle(grid, 0, 0, screenWidth, screenHeight, 0.5f, vertAlignment);
grid.arrangeElements();
grid.pack();
FrameWidget.alignInRectangle(grid, 0, 0, screenWidth, screenHeight, 0.5f, vertAlignment);
grid.pack();

// Initialize all the notes
forEach(NoteButton::init);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,13 @@ protected void init() {


initOptionsGrid(grid, rowHelper);

grid.pack();

FrameLayout.alignInRectangle(grid, 0, 0, width, height, 0.5f, 0);
grid.visitWidgets(this::addRenderableWidget);

grid.arrangeElements();
FrameWidget.alignInRectangle(grid, 0, 0, width, height, 0.5f, 0);
grid.setY(40);

grid.pack();
addRenderableWidget(grid);


final Button doneBtn = Button.builder(CommonComponents.GUI_DONE, (btn) -> onClose())
Expand All @@ -150,7 +150,7 @@ protected void init() {
}


protected void initAudioSection(final GridLayout grid, final RowHelper rowHelper) {
protected void initAudioSection(final GridWidget grid, final RowHelper rowHelper) {
final CycleButton<InstrumentChannelType> instrumentChannel = CycleButton.<InstrumentChannelType>builder((soundType) ->
Component.translatable(SOUND_CHANNEL_KEY +"."+ soundType.toString().toLowerCase())
)
Expand Down Expand Up @@ -211,7 +211,7 @@ private static double divisibleBy5(double number) {
rowHelper.addChild(stopMusic);
}

protected void initVisualsSection(final GridLayout grid, final RowHelper rowHelper) {
protected void initVisualsSection(final GridWidget grid, final RowHelper rowHelper) {

final CycleButton<Boolean> emitRing = CycleButton.booleanBuilder(CommonComponents.OPTION_ON, CommonComponents.OPTION_OFF)
.withInitialValue(ModClientConfigs.EMIT_RING_ANIMATION.get())
Expand Down Expand Up @@ -258,10 +258,10 @@ protected void initVisualsSection(final GridLayout grid, final RowHelper rowHelp
* @param grid The settings grid to add the widgets to
* @param rowHelper A row helper for the specified {@code grid}
*/
protected void initOptionsGrid(final GridLayout grid, final RowHelper rowHelper) {
protected void initOptionsGrid(final GridWidget grid, final RowHelper rowHelper) {
initAudioSection(grid, rowHelper);

rowHelper.addChild(SpacerElement.height(15), 2);
rowHelper.addChild(SpacerWidget.height(15), 2);

initVisualsSection(grid, rowHelper);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import java.util.List;
import java.util.function.Consumer;

import com.cstav.genshinstrument.GInstrumentMod;
import com.cstav.genshinstrument.networking.buttonidentifier.DrumNoteIdentifier;
import com.cstav.genshinstrument.networking.buttonidentifier.NoteButtonIdentifier;
import com.cstav.genshinstrument.networking.buttonidentifier.NoteGridButtonIdentifier;
Expand Down

0 comments on commit e3af2a0

Please sign in to comment.