Jump to content

Recommended Posts

Posted

I want to make a GUI like the achievement screen where there are boxes and lines and you can scroll through it and stuff, but I'm not sure how to do it. I mostly get the boxes, but I'm not sure how to make the lines that connect them, and I'm not sure how to make the window scrollable.

 

How would I do these things?

Creator of the MyFit, MagiCraft, Tesseract gun, and Papa's Wingeria mod.

Posted

Yeah I have. What I'm mostly confused about now is how the scrolling works and how it cuts off the background where the GUI foreground is. How does this work?

Creator of the MyFit, MagiCraft, Tesseract gun, and Papa's Wingeria mod.

Posted

In simple words:

On screen you make a "border" from some left-right and top-bottom.

Background is creatd by bunch of textures that use some "random" blocks and you start drawing them on this "bordered" area using repeating pattern. (Not qute what I would call it - it actually uses some of Biome mechanics, I don't really remember right now).

You render as many background blocks as possible and those which are standing out of bordered area you cover with .png frame-like image.

 

Rest is simple dragging-coordinate system you can find in most scrollable guis.

 

As to understanding it - you can't without taking a piece of whatever gives you power to imagine and compute (paper, paint, brain maybe) and thinking the idea thorough. Seriosuly, I could understand anyone not being able to write it themselves, but you have a code - LOOK at it, analyse it. And I am not being rude, that is a simple and useful truth.

1.7.10 is no longer supported by forge, you are on your own.

Posted

You're not being rude at all. But the code is a little hard to understand at first glance because most of the variables still have names like field12345_A. So I will have to go a little further into analyzing it. Thanks for the instruction!

Creator of the MyFit, MagiCraft, Tesseract gun, and Papa's Wingeria mod.

Posted

VSWE did a tutorial series for 1.6.4 about interfaces, among others. Even though it is outdated, the concepts still hold true, and if you are struggling with understanding how something like a scrollbar works, I think you may find that series helpful.

 

As for scroll bars, at its most basic it is simply storing the current x or y position of the scroll bar and rendering things on the background based on that. Think if you have a 1000 x 500 canvas, but can only show 200x100 at a time.

 

Determining which part of your screen to render can be figured by calculating the scrollbar's position on a scale of 0 to 1. In this example, the scrollbar can be anywhere from pixel 0 up to "screen width or height minus scrollbar size in pixels" (for its top- or left-most position), so (current position / max position) is the current ratio which you then use to determine where to start rendering from.

 

E.g. for a vertical scrollbar that is 10 pixels tall on our screen that is 100 pixels high, if it is currently at y position 45, then our ratio is (45 / 100-10) or 0.5F. Multiply that by our canvas sizes and you get 500 for the starting x position and 250 for the starting y position, so you will render from 500 to 700 on the x and 250 to 350 on the y.

 

It may seem complicated at first, but it's really not. I highly recommend that tutorial series as it will introduce you to a lot of these concepts.

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...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • I tried do download the essential mod to my mod pack but i didnt work. I paly on 1.21 and it should work. I use neoforge for my modding. The weird things is my friend somehow added the mod to his modpack and many others that I somehow can´t. Is there anything i can do? 
    • Thanks, I've now installed a slightly newer version and the server is at least starting up now.
    • i have the same issue. Found 1 Create mod class dependency(ies) in createdeco-1.3.3-1.19.2.jar, which are missing from the current create-1.19.2-0.5.1.i.jar Found 11 Create mod class dependency(ies) in createaddition-fabric+1.19.2-20230723a.jar, which are missing from the current create-1.19.2-0.5.1.i.jar Detailed walkthrough of mods which rely on missing Create mod classes: Mod: createaddition-fabric+1.19.2-20230723a.jar Missing classes of create: com/simibubi/create/compat/jei/category/sequencedAssembly/JeiSequencedAssemblySubCategory com/simibubi/create/compat/recipeViewerCommon/SequencedAssemblySubCategoryType com/simibubi/create/compat/rei/CreateREI com/simibubi/create/compat/rei/EmptyBackground com/simibubi/create/compat/rei/ItemIcon com/simibubi/create/compat/rei/category/CreateRecipeCategory com/simibubi/create/compat/rei/category/WidgetUtil com/simibubi/create/compat/rei/category/animations/AnimatedBlazeBurner com/simibubi/create/compat/rei/category/animations/AnimatedKinetics com/simibubi/create/compat/rei/category/sequencedAssembly/ReiSequencedAssemblySubCategory com/simibubi/create/compat/rei/display/CreateDisplay Mod: createdeco-1.3.3-1.19.2.jar Missing classes of create: com/simibubi/create/content/kinetics/fan/SplashingRecipe
    • The crash points to moonlight lib - try other builds or make a test without this mod and the mods requiring it
    • Do you have shaders enabled? There is an issue with the mod simpleclouds - remove this mod or disable shaders, if enabled  
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

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