mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-14 17:56:34 -04:00
Tried to improve and stabilize masking logic for manual content a bit.
This commit is contained in:
parent
5c2464f43d
commit
2d9764da8c
@ -4,4 +4,4 @@
|
||||
|
||||
A bunch of [Chaemlium](../item/chamelium.md) slapped together, this can be nice to decorate parts of your base, if you want a clean, monochrome block. Can be dyed to take any one of the 16 common Minecraft colors.
|
||||
|
||||
Another use is to pick its texture and use that in your [3D prints](print.m3d), if you want something clean white to apply a tint to.
|
||||
Another use is to pick its texture and use that in your [3D prints](print.md), if you want something clean white to apply a tint to.
|
||||
|
@ -111,7 +111,7 @@ object Manual extends ManualAPI {
|
||||
|
||||
def reset(): Unit = {
|
||||
history.clear()
|
||||
history.push(new History(s"doc/$LanguageKey/index.md"))
|
||||
history.push(new History(s"$LanguageKey/index.md"))
|
||||
}
|
||||
|
||||
override def navigate(path: String): Unit = {
|
||||
|
@ -35,30 +35,27 @@ object Document {
|
||||
def render(document: Iterable[Segment], x: Int, y: Int, maxWidth: Int, maxHeight: Int, yOffset: Int, renderer: FontRenderer, mouseX: Int, mouseY: Int): Option[InteractiveSegment] = {
|
||||
val mc = Minecraft.getMinecraft
|
||||
|
||||
// Create a flat, inset area in the depth buffer.
|
||||
// Clear depth mask, then create masks in foreground above and below scroll area.
|
||||
GL11.glColor4f(1, 1, 1, 1)
|
||||
GL11.glPushMatrix()
|
||||
GL11.glTranslatef(0, 0, 300)
|
||||
GL11.glDepthFunc(GL11.GL_ALWAYS)
|
||||
GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT)
|
||||
GL11.glEnable(GL11.GL_DEPTH_TEST)
|
||||
GL11.glDepthFunc(GL11.GL_LEQUAL)
|
||||
GL11.glDepthMask(true)
|
||||
GL11.glColorMask(false, false, false, false)
|
||||
|
||||
GL11.glPushMatrix()
|
||||
GL11.glTranslatef(0, 0, 300)
|
||||
GL11.glBegin(GL11.GL_QUADS)
|
||||
GL11.glVertex2f(0, mc.displayHeight)
|
||||
GL11.glVertex2f(mc.displayWidth, mc.displayHeight)
|
||||
GL11.glVertex2f(0, y)
|
||||
GL11.glVertex2f(mc.displayWidth, y)
|
||||
GL11.glVertex2f(mc.displayWidth, 0)
|
||||
GL11.glVertex2f(0, 0)
|
||||
GL11.glVertex2f(0, mc.displayHeight)
|
||||
GL11.glVertex2f(mc.displayWidth, mc.displayHeight)
|
||||
GL11.glVertex2f(mc.displayWidth, y + maxHeight)
|
||||
GL11.glVertex2f(0, y + maxHeight)
|
||||
GL11.glEnd()
|
||||
|
||||
GL11.glPopMatrix()
|
||||
GL11.glBegin(GL11.GL_QUADS)
|
||||
GL11.glVertex2f(x - 1, y - 1)
|
||||
GL11.glVertex2f(x - 1, y + 1 + maxHeight)
|
||||
GL11.glVertex2f(x + 1 + maxWidth, y + 1 + maxHeight)
|
||||
GL11.glVertex2f(x + 1 + maxWidth, y - 1)
|
||||
GL11.glEnd()
|
||||
|
||||
// Use that flat area to mask the output area.
|
||||
GL11.glDepthFunc(GL11.GL_LEQUAL)
|
||||
GL11.glColorMask(true, true, true, true)
|
||||
|
||||
// Actual rendering.
|
||||
|
@ -202,14 +202,14 @@ object ModOpenComputers extends ModProxy {
|
||||
}
|
||||
|
||||
api.Manual.addProvider(DefinitionPathProvider)
|
||||
api.Manual.addProvider(new ResourceContentProvider(Settings.resourceDomain))
|
||||
api.Manual.addProvider(new ResourceContentProvider(Settings.resourceDomain, "doc/"))
|
||||
api.Manual.addProvider("", TextureImageProvider)
|
||||
api.Manual.addProvider("item", ItemImageProvider)
|
||||
api.Manual.addProvider("block", BlockImageProvider)
|
||||
api.Manual.addProvider("oredict", OreDictImageProvider)
|
||||
|
||||
api.Manual.addTab(new ItemStackTabIconRenderer(api.Items.get("case1").createItemStack(1)), "oc:gui.Manual.Blocks", "doc/%LANGUAGE%/block/index.md")
|
||||
api.Manual.addTab(new ItemStackTabIconRenderer(api.Items.get("chip1").createItemStack(1)), "oc:gui.Manual.Items", "doc/%LANGUAGE%/item/index.md")
|
||||
api.Manual.addTab(new ItemStackTabIconRenderer(api.Items.get("case1").createItemStack(1)), "oc:gui.Manual.Blocks", "%LANGUAGE%/block/index.md")
|
||||
api.Manual.addTab(new ItemStackTabIconRenderer(api.Items.get("chip1").createItemStack(1)), "oc:gui.Manual.Items", "%LANGUAGE%/item/index.md")
|
||||
}
|
||||
|
||||
private def blacklistHost(host: Class[_], itemNames: String*) {
|
||||
@ -239,8 +239,8 @@ object ModOpenComputers extends ModProxy {
|
||||
|
||||
private def checkBlacklisted(info: ItemInfo): String =
|
||||
if (info == null || Blacklist.contains(info.name)) null
|
||||
else if (info.block != null) "doc/%LANGUAGE%/block/" + info.name + ".md"
|
||||
else "doc/%LANGUAGE%/item/" + info.name + ".md"
|
||||
else if (info.block != null) "%LANGUAGE%/block/" + info.name + ".md"
|
||||
else "%LANGUAGE%/item/" + info.name + ".md"
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user