Search in sources :

Example 1 with Window

use of com.mojang.blaze3d.platform.Window in project MinecraftForge by MinecraftForge.

the class ForgeHooksClient method onScreenMouseScrollPre.

public static boolean onScreenMouseScrollPre(MouseHandler mouseHelper, Screen guiScreen, double scrollDelta) {
    Window mainWindow = guiScreen.getMinecraft().getWindow();
    double mouseX = mouseHelper.xpos() * (double) mainWindow.getGuiScaledWidth() / (double) mainWindow.getScreenWidth();
    double mouseY = mouseHelper.ypos() * (double) mainWindow.getGuiScaledHeight() / (double) mainWindow.getScreenHeight();
    Event event = new ScreenEvent.MouseScrollEvent.Pre(guiScreen, mouseX, mouseY, scrollDelta);
    return MinecraftForge.EVENT_BUS.post(event);
}
Also used : Window(com.mojang.blaze3d.platform.Window) SubscribeEvent(net.minecraftforge.eventbus.api.SubscribeEvent) LerpingBossEvent(net.minecraft.client.gui.components.LerpingBossEvent) Event(net.minecraftforge.eventbus.api.Event) PlaySoundEvent(net.minecraftforge.client.event.sound.PlaySoundEvent)

Example 2 with Window

use of com.mojang.blaze3d.platform.Window in project MinecraftForge by MinecraftForge.

the class ForgeHooksClient method onScreenMouseScrollPost.

public static boolean onScreenMouseScrollPost(MouseHandler mouseHelper, Screen guiScreen, double scrollDelta) {
    Window mainWindow = guiScreen.getMinecraft().getWindow();
    double mouseX = mouseHelper.xpos() * (double) mainWindow.getGuiScaledWidth() / (double) mainWindow.getScreenWidth();
    double mouseY = mouseHelper.ypos() * (double) mainWindow.getGuiScaledHeight() / (double) mainWindow.getScreenHeight();
    Event event = new ScreenEvent.MouseScrollEvent.Post(guiScreen, mouseX, mouseY, scrollDelta);
    return MinecraftForge.EVENT_BUS.post(event);
}
Also used : Window(com.mojang.blaze3d.platform.Window) SubscribeEvent(net.minecraftforge.eventbus.api.SubscribeEvent) LerpingBossEvent(net.minecraft.client.gui.components.LerpingBossEvent) Event(net.minecraftforge.eventbus.api.Event) PlaySoundEvent(net.minecraftforge.client.event.sound.PlaySoundEvent)

Aggregations

Window (com.mojang.blaze3d.platform.Window)2 LerpingBossEvent (net.minecraft.client.gui.components.LerpingBossEvent)2 PlaySoundEvent (net.minecraftforge.client.event.sound.PlaySoundEvent)2 Event (net.minecraftforge.eventbus.api.Event)2 SubscribeEvent (net.minecraftforge.eventbus.api.SubscribeEvent)2