Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

I'm thinking about adding a popup window in one of my container screens. would I need to have a screen within a screen, and if so how?

It's pretty much up to you. There are a couple different approaches to take.

 

Either you could have another gui class and offload more functions from the main window into the popup one, or you could create something yourself to handle the instructions from the main window that wouldn't be as complicated or sophisticated as a new gui (for example, something that simply drew an image when told to, held its x & y, etc).

 

After doing either of those things, you could have the popup window be contained and controlled by the primary window, which would just involve having them as fields within that class and doing whatever needs to be done to them through that class.

Or you could keep the handling of the popup window external, doing things to it alongside the main window. That would leak a little more gui handling into the outside world though.

Fancy 3D Graphing Calculator mod, with many different coordinate systems.

Lightweight 3D/2D position/vector transformations library, also with support for different coordinate systems.

  • Author
On 10/10/2019 at 12:34 AM, SerpentDagger said:

It's pretty much up to you. There are a couple different approaches to take.

 

Either you could have another gui class and offload more functions from the main window into the popup one, or you could create something yourself to handle the instructions from the main window that wouldn't be as complicated or sophisticated as a new gui (for example, something that simply drew an image when told to, held its x & y, etc).

 

After doing either of those things, you could have the popup window be contained and controlled by the primary window, which would just involve having them as fields within that class and doing whatever needs to be done to them through that class.

Or you could keep the handling of the popup window external, doing things to it alongside the main window. That would leak a little more gui handling into the outside world though.

 

I created my own popup window class that extends "Screen", but it seems to replace the original screen that spawns it. is it possible to have the popup on top of the original screen? I could do what you said about just drawing the popup over the main screen, but then I would have to find a way to disable all mouse click events on the main screen, and that seems tedious.

Edited by andGarrett

15 minutes ago, andGarrett said:

can there only be one active "screen" at any given time?

Sorry, looking over the code it seems that the method that opens a GUI also closes the current one, and an instance of Minecraft has a single currentScreen field, which is changed when a new screen is opened.

However, you can still accomplish the same thing by, instead of calling the opening method of Minecraft, having an instance of your popup window stored in the main one, and calling its key methods through the main window. For example, when the button or trigger activates this popup window, call its initGui()* method, and toggle a boolean that allows its drawScreen()* method to be run during each call of your main window's drawScreen()*.

 

*I think the names of methods may have changed between 1.12 and 1.14, but according to the 1.13/1.14 update primer, the underlying substance hasn't. Let me know if I'm sorely mistaken.

Fancy 3D Graphing Calculator mod, with many different coordinate systems.

Lightweight 3D/2D position/vector transformations library, also with support for different coordinate systems.

  • Author
21 minutes ago, SerpentDagger said:

Sorry, looking over the code it seems that the method that opens a GUI also closes the current one, and an instance of Minecraft has a single currentScreen field, which is changed when a new screen is opened.

However, you can still accomplish the same thing by, instead of calling the opening method of Minecraft, having an instance of your popup window stored in the main one, and calling its key methods through the main window. For example, when the button or trigger activates this popup window, call its initGui()* method, and toggle a boolean that allows its drawScreen()* method to be run during each call of your main window's drawScreen()*.

 

*I think the names of methods may have changed between 1.12 and 1.14, but according to the 1.13/1.14 update primer, the underlying substance hasn't. Let me know if I'm sorely mistaken.

Thanks, I decided to write an inner class that does what you described in your first reply. I figured out a few things that make it much easier than I had originally thought.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.