Difference between revisions of "CCLights2"

From ComputerCraft Wiki
Jump to: navigation, search
(Halfway finished rewriting this page.)
 
(18 intermediate revisions by 2 users not shown)
Line 1: Line 1:
[http://www.computercraft.info/forums2/index.php?/topic/10216-wip-cclights2-opensource-now-on-github/ CCLights2] is an Open Source Minecraft mod that adds a GPU peripheral, and monitors to suit your need. Unlike CCGPU, this mod does not use OpenGL, but it is Multiplayer Compatible.
+
[http://www.computercraft.info/forums2/index.php?/topic/10216-wip-cclights2-opensource-now-on-github/ CCLights2] is an Open Source Minecraft mod that adds a GPU peripheral, and monitors to suit your need. Unlike [[CCGPU]], this mod does not use OpenGL, but it is Multiplayer Compatible.
  
 +
Please note; this documentation will always try to stay up to date with the github repo, so it might not fit your build :P
 
<table style="width: 100%; border: solid 1px black; margin: 2px; border-spacing: 0px;">
 
<table style="width: 100%; border: solid 1px black; margin: 2px; border-spacing: 0px;">
 
<tr>
 
<tr>
Line 16: Line 17:
 
The GPU Peripheral needs to be placed next to a computer. It will autoconnect with the first monitor that connects with it, and will auto disconnect when the monitor detaches.
 
The GPU Peripheral needs to be placed next to a computer. It will autoconnect with the first monitor that connects with it, and will auto disconnect when the monitor detaches.
  
{{Crafting grid
+
{{Crafting
 
  |A1=iron ingot |B1=iron ingot          |C1=iron ingot
 
  |A1=iron ingot |B1=iron ingot          |C1=iron ingot
 
  |A2=Redstone |B2=Gold Ingot        |C2=Redstone
 
  |A2=Redstone |B2=Gold Ingot        |C2=Redstone
 
  |A3=Gold Ingot |B3=Gold Ingot      |C3=Gold Ingot
 
  |A3=Gold Ingot |B3=Gold Ingot      |C3=Gold Ingot
 
  |Output=CCLights2 GPU
 
  |Output=CCLights2 GPU
  |Output-image=Grid_CCLights2_GPU.gif
+
  |Output-image=Grid_CCLights2_GPU.png
 
  |Output-link=CCLights2
 
  |Output-link=CCLights2
}}
+
}}
 
</td>
 
</td>
 
</tr>
 
</tr>
  
 
<tr>
 
<tr>
<td colspan="2" style="font-weight: bold; font-size: large; padding-bottom: .3em; border-bottom: solid #C9C9C9 1px; background: #D3FFC2; line-height:28px;">[[File:Grid_disk.png|24px]]&nbsp;&nbsp;CCLights2 Monitors</td>
+
<td colspan="2" style="font-weight: bold; font-size: large; padding-bottom: .3em; border-bottom: solid #C9C9C9 1px; background: #D3FFC2; line-height:28px;">[[File:Grid_disk.png|24px]]&nbsp;&nbsp;CCLights2 Monitors and ram</td>
 
</tr>
 
</tr>
  
Line 42: Line 43:
 
The basic Monitor. It sports an elegant resolution of 256x144.
 
The basic Monitor. It sports an elegant resolution of 256x144.
  
{{Crafting grid
+
{{Crafting
 
  |A1=iron ingot |B1=iron ingot          |C1=iron ingot
 
  |A1=iron ingot |B1=iron ingot          |C1=iron ingot
 
  |A2=Redstone |B2=glass pane        |C2=Redstone
 
  |A2=Redstone |B2=glass pane        |C2=Redstone
Line 48: Line 49:
 
  |Output=CCLights2 Monitor
 
  |Output=CCLights2 Monitor
 
  |Output-link=CCLights2
 
  |Output-link=CCLights2
}}
+
}}
 
</td>
 
</td>
 
</tr>
 
</tr>
Line 56: Line 57:
 
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">
 
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">
  
An external Monitor. It suports a resolution up to 512x288.
+
An external Monitor. It supports a resolution up to 512x288.
  
{{Crafting grid
+
{{Crafting
 
  |A1=glass pane |B1=glass pane          |C1=glass pane
 
  |A1=glass pane |B1=glass pane          |C1=glass pane
 
  |A2=glass pane |B2=CCLights2 Monitor        |C2=glass pane
 
  |A2=glass pane |B2=CCLights2 Monitor        |C2=glass pane
Line 65: Line 66:
 
  |Output-link=CCLights2
 
  |Output-link=CCLights2
 
  |B2-link=CCLights2
 
  |B2-link=CCLights2
}}
+
}}
 
</td>
 
</td>
 
</tr>
 
</tr>
 +
<tr style="background-color: #E8E8E8;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">TabletTransciever</td>
 +
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">
  
<tr style="background-color: #E8E8E8;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">RAM</td>
+
The basestation for the tablet,  CONNECT YOUR TABLETS HERE!
 +
 
 +
{{Crafting
 +
|B1=Redstone
 +
|A2=Redstone |B2=CCLights2 Monitor |C2=Redstone
 +
|B3=Redstone
 +
|Output=CCLights2 TabletTransciever
 +
|Output-link=CCLights2
 +
|B2-link=CCLights2
 +
}}
 +
</td>
 +
</tr>
 +
 
 +
<tr style="background-color: #FFFFFF;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">RAM</td>
 
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">
 
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">
  
 
Yep. You can craft more Ram.
 
Yep. You can craft more Ram.
  
{{Crafting grid
+
{{Crafting
 
  |A1=iron ingot |B1=iron ingot          |C1=iron ingot
 
  |A1=iron ingot |B1=iron ingot          |C1=iron ingot
 
  |A2=Redstone        |C2=Redstone
 
  |A2=Redstone        |C2=Redstone
Line 80: Line 96:
 
  |Output=CCLights2 Ram
 
  |Output=CCLights2 Ram
 
  |Output-link=CCLights2
 
  |Output-link=CCLights2
  }}
+
}}
 +
</td>
 +
</tr>
 +
        <tr style="background-color: #E8E8E8;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">RAM</td>
 +
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">
 +
 
 +
Yep. You can craft more Ram... with ram! (double the capacity up to a maximum of 8k!)
 +
 
 +
{{Crafting
 +
  |A1=CCLights2 Ram |B1=CCLights2 Ram
 +
|Output=CCLights2 Ram
 +
|Output-link=CCLights2
 +
}}
 
</td>
 
</td>
 
</tr>
 
</tr>
Line 89: Line 117:
 
Hold it in your hand! Go caving! Watch your life leech away as you stare into this tablet! NOTE: Watch out for Creepers.
 
Hold it in your hand! Go caving! Watch your life leech away as you stare into this tablet! NOTE: Watch out for Creepers.
  
{{Crafting grid
+
{{Crafting
 
  |A1=Gold Ingot |B1=iron ingot          |C1=Gold Ingot
 
  |A1=Gold Ingot |B1=iron ingot          |C1=Gold Ingot
 
  |A2=Redstone |B2=CCLights2 External Monitor        |C2=Redstone
 
  |A2=Redstone |B2=CCLights2 External Monitor        |C2=Redstone
Line 96: Line 124:
 
  |Output-link=CCLights2
 
  |Output-link=CCLights2
 
  |B2-link=CCLights2
 
  |B2-link=CCLights2
}}
+
}}
 
</td>
 
</td>
 
</tr>
 
</tr>
Line 112: Line 140:
 
</tr>
 
</tr>
  
<tr style="background-color: #FFFFFF;">
 
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">{{type|nil}}</td>
 
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">gpu.setColor({{type|number}} red, {{type|number}} green, {{type|number}} blue[, {{type|number}} alpha])</td>
 
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">Sets the GPU's current drawing color</td>
 
</tr>
 
 
<tr style="background-color: #FFFFFF;">
 
<tr style="background-color: #FFFFFF;">
 
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">{{type|nil}}</td>
 
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">{{type|nil}}</td>
 
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">gpu.fill()</td>
 
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">gpu.fill()</td>
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">Fills the current binded texture with the GPU color. NOTE: This method will fully replace the contents of the texture.</td>
+
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">Fills the current binded texture with the GPU color. NOTE: This method will fully replace the contents of the texture.</td></tr>
</tr>
+
       
<tr style="background-color: #FFFFFF;">
+
        <tr style="background-color: #FFFFFF;">
 
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">{{type|number}} textureid</td>
 
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">{{type|number}} textureid</td>
 
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">gpu.createTexture({{type|number}} width, {{type|number}} height)</td>
 
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">gpu.createTexture({{type|number}} width, {{type|number}} height)</td>
 
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">Creates a texture and returns the texture id. This function will error if there is no more room for the texture.</td>
 
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">Creates a texture and returns the texture id. This function will error if there is no more room for the texture.</td>
 
</tr>
 
</tr>
<tr style="background-color: #FFFFFF;">
+
        <tr style="background-color: #FFFFFF;">
 
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">{{type|number}} freememory</td>
 
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">{{type|number}} freememory</td>
 
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">gpu.getFreeMemory()</td>
 
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">gpu.getFreeMemory()</td>
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">Returns the amount of free memory that the GPU has to use. This can be expanded by right clicking the GPU with RAM.</td>
+
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">Returns the amount of free memory that the GPU has to use. This can be expanded by right clicking the GPU with RAM.       </td>
 
</tr>
 
</tr>
 
<tr style="background-color: #FFFFFF;">
 
<tr style="background-color: #FFFFFF;">
Line 142: Line 165:
 
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">Returns the amount of memory that the GPU is using. This value is changed by allocating textures with gpu.createTexture and freeing textures with gpu.freeTexture.</td>
 
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">Returns the amount of memory that the GPU is using. This value is changed by allocating textures with gpu.createTexture and freeing textures with gpu.freeTexture.</td>
 
</tr>
 
</tr>
<tr style="background-color: #FFFFFF;">
+
        <tr style="background-color: #FFFFFF;">
 
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">{{type|nil}}</td>
 
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">{{type|nil}}</td>
 
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">gpu.bindTexture({{type|number}} textureid)</td>
 
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">gpu.bindTexture({{type|number}} textureid)</td>
 
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">Bind the texture at textureid, this method will error if invalid values are used. Texture 0 is the screen.</td>
 
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">Bind the texture at textureid, this method will error if invalid values are used. Texture 0 is the screen.</td>
 
</tr>
 
</tr>
<tr style="background-color: #FFFFFF;">
+
        <tr style="background-color: #FFFFFF;">
 
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">{{type|nil}}</td>
 
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">{{type|nil}}</td>
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">gpu.setColorRGB({{type|number}} x, {{type|number}} y) and gpu.plot({{type|number}} x, {{type|number}} y)</td>
+
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">gpu.plot({{type|number}} x, {{type|number}} y)</td>
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">Sets the pixel at x and y to the the GPU's current color. (Remember, all drawing command work on the current binded texture)</td>
+
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">Sets the pixel on x,y to the the GPU's current color. (Remember, all drawing command work on the current binded texture)</td>
 +
 
 
</tr>
 
</tr>
 
<tr style="background-color: #FFFFFF;">
 
<tr style="background-color: #FFFFFF;">
Line 169: Line 193:
 
<tr style="background-color: #FFFFFF;">
 
<tr style="background-color: #FFFFFF;">
 
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">{{type|number}} width, {{type|number}} height</td>
 
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">{{type|number}} width, {{type|number}} height</td>
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">(gpu.getSize and gpu.getTextureSize)([ {{type|number}} textureid])</td>
+
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">gpu.getSize([ {{type|number}} textureid])</td>
 
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">Returns the texture size of <var>textureid</var> or the current binded texture. Using texture 0 will give you the screen size.</td>
 
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">Returns the texture size of <var>textureid</var> or the current binded texture. Using texture 0 will give you the screen size.</td>
</tr>
 
<tr style="background-color: #FFFFFF;">
 
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">{{type|nil}}</td>
 
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">gpu.setTransparent()</td>
 
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">This method is depreciated. Any attempt to use it will result in an error.</td>
 
</tr>
 
<tr style="background-color: #FFFFFF;">
 
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">{{type|nil}}</td>
 
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">gpu.setTransparencyColor()</td>
 
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">This method is depreciated. Any attempt to use it will result in an error.</td>
 
 
</tr>
 
</tr>
 
<tr style="background-color: #FFFFFF;">
 
<tr style="background-color: #FFFFFF;">
 
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">{{type|number}} red, {{type|number}} green, {{type|number}} blue, {{type|number}} alpha</td>
 
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">{{type|number}} red, {{type|number}} green, {{type|number}} blue, {{type|number}} alpha</td>
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">gpu.getColorRGB({{type|number}} x, {{type|number}} y) and gpu.getPixel({{type|number}} x, {{type|number}} y)</td>
+
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">gpu.getPixels({{type|number}} x, {{type|number}} y)</td>
 
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">Returns the color of the pixel in the currently binded texture. Out of bound pixels have an undefined side effect.</td>
 
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">Returns the color of the pixel in the currently binded texture. Out of bound pixels have an undefined side effect.</td>
 
</tr>
 
</tr>
Line 197: Line 211:
 
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">Draws a filled rectangle from x, y to x+width, y+height.</td>
 
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">Draws a filled rectangle from x, y to x+width, y+height.</td>
 
</tr>
 
</tr>
 
+
        <tr style="background-color: #FFFFFF;">
 +
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">{{type|nil}}</td>
 +
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">gpu.setColor({{type|number}} red, {{type|number}} green, {{type|number}} blue[, {{type|number}} alpha])</td>
 +
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">Sets the GPU's current drawing color</td>
 +
</tr>
 +
        <tr style="background-color: #FFFFFF;">
 +
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">{{type|number}} slot</td>
 +
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">gpu.getBindedTexture()</td>
 +
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">Gets the GPU's currently binded texture</td>
 +
</tr>
 +
            <tr style="background-color: #FFFFFF;">
 +
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">{{type|nil}}</td>
 +
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">gpu.setPixels({{type|number}} width, {{type|number}} height, {{type|number}} x, {{type|number}} y,{{type|number}} red,{{type|number}} green,{{type|number}} blue,...)</td>
 +
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">takes an array and writes each pixel to the image. this method is accelerated by java and is faster than multiple gpu.plot calls.</td>
 +
</tr>
 +
        <tr style="background-color: #FFFFFF;">
 +
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">{{type|nil}}</td>
 +
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">gpu.flipTextureV()</td>
 +
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">flips the texture vertically</td>
 +
</tr>
 +
        <tr style="background-color: #FFFFFF;">
 +
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">{{type|number}}TextureID, {{type|number}}Width, {{type|number}}Height</td>
 +
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">gpu.import({{type|string}} imagestoredinCC)</td>
 +
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">decodes an imagefile and makes it ready for texture binding.</td>
 +
</tr>
 +
        <tr style="background-color: #FFFFFF;">
 +
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">{{type|string}} filedata</td>
 +
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">gpu.export({{type|number}} textureid, {{type|string}} file format)</td>
 +
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">encodes an imagefile and makes it ready for saving.</td>
 +
</tr>
 +
        <tr style="background-color: #FFFFFF;">
 +
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">{{type|nil}}</td>
 +
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">gpu.drawText({{type|string}} text to  write, {{type|number}} x,{{type|number}} y)</td>
 +
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">writes text from pixel x,y</td>
 +
</tr>
 +
        <tr style="background-color: #FFFFFF;">
 +
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">{{type|number}} textWidth</td>
 +
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">gpu.getTextWidth()</td>
 +
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">Gets Text width</td>
 +
</tr>
 +
        <tr style="background-color: #FFFFFF;">
 +
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">{{type|nil}}</td>
 +
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">gpu.setColor({{type|number}} red,{{type|number}} green,{{type|number}} blue, optional; {{type|number}} alpha)</td>
 +
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">Sets the GPU's current color</td>
 +
</tr>
 +
        <tr style="background-color: #FFFFFF;">
 +
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">{{type|number}} red, {{type|number}} green, {{type|number}} blue, {{type|number}} alpha</td>
 +
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">gpu.getColor()</td>
 +
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">Gets the GPU's current color</td>
 +
</tr>
 +
        <tr style="background-color: #FFFFFF;">
 +
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">{{type|nil}}</td>
 +
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">gpu.translate({{type|number}} x,{{type|number}} y)</td>
 +
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">translates the texture in two dimensions</td>
 +
</tr>
 +
        <tr style="background-color: #FFFFFF;">
 +
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">{{type|nil}}</td>
 +
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">gpu.rotate({{type|number}} degrees)</td>
 +
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">rotates the texture in two dimensions</td>
 +
</tr>
 +
        <tr style="background-color: #FFFFFF;">
 +
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">{{type|nil}}</td>
 +
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">gpu.rotateAround({{type|number}} degrees,{{type|number}} x,{{type|number}} y)</td>
 +
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">rotates the texture around pixel x,y</td>
 +
</tr>
 +
        <tr style="background-color: #FFFFFF;">
 +
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">{{type|nil}}</td>
 +
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">gpu.scale({{type|number}} x-axis size,{{type|number}} y-axis size)</td>
 +
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">scales the texture to specs</td>
 +
</tr>
 +
        <tr style="background-color: #FFFFFF;">
 +
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">{{type|nil}}</td>
 +
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">gpu.push()</td>
 +
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">store transformation commands from here on and push them to the storestack</td>
 +
</tr>
 +
        <tr style="background-color: #FFFFFF;">
 +
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">{{type|nil}}</td>
 +
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">gpu.pop()</td>
 +
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">process stored transformation input</td>
 +
</tr>
 +
        <tr style="background-color: #FFFFFF;">
 +
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">{{type|table}}</td>
 +
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">gpu.getMonitor().getResolution()</td>
 +
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">Get the monitor resolution w/h</td>
 +
</tr>
 +
        <tr style="background-color: #FFFFFF;">
 +
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">{{type|nil}}</td>
 +
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">gpu.blur({{type|number}} blur amount)</td>
 +
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">makes the texture blurry</td>
 +
</tr>
 +
        <tr style="background-color: #FFFFFF;">
 +
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">{{type|nil}}</td>
 +
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">gpu.startFrame()</td>
 +
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">Starts a new frame (use this if you plan to draw large amounts of data)</td>
 +
</tr>
 +
        <tr style="background-color: #FFFFFF;">
 +
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">{{type|nil}}</td>
 +
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">gpu.endFrame()</td>
 +
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">ends the frame (ends the frame and sends the data, use this if you plan to draw large amounts of data)</td>
 +
</tr>
 +
        <tr style="background-color: #FFFFFF;">
 +
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">{{type|nil}}</td>
 +
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">gpu.clearRect({{type|number}} x, {{type|number}} y, {{type|number}} width, {{type|number}} height)</td>
 +
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">Clear rectangle entirely to alpha 255</td>
 +
</tr>
 +
        <tr style="background-color: #FFFFFF;">
 +
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">{{type|nil}}</td>
 +
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">gpu.origin()</td>
 +
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">Reset RenderPoint with affline transform</td>
 +
</tr>
 +
</table>
 +
<table style="width: 100%; border: solid 1px black; margin: 2px; border-spacing: 0px;">
 +
<tr>
 +
<td colspan="3" style="font-weight: bold; font-size: large; padding-bottom: .3em; border-bottom: solid #C9C9C9 1px; background: #D3FFC2; line-height:28px;">[[File:Grid_disk.png|24px]]&nbsp;&nbsp;Events</td>
 +
</tr>
 +
<tr>
 +
<td style="width: 100px; background: #E0E0E0; padding: .4em; font-weight:bold;">Returns</td>
 +
<td style="width: 350px; background: #E0E0E0; padding: .4em; font-weight:bold;">EventName</td>
 +
<td style="background: #E0E0E0; padding: .4em; font-weight:bold;">Description</td>
 +
</tr>
 +
<tr style="background-color: #FFFFFF;">
 +
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">button,x,y, player</td>
 +
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">monitor_move</td>
 +
                <td style="border-top: solid #C9C9C9 1px; padding: .4em;">The player dragged the mouse while holding in a button</td>
 +
</tr>
 +
<tr style="background-color: #FFFFFF;">
 +
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">button,x,y,player</td>
 +
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">monitor_down</td>
 +
                <td style="border-top: solid #C9C9C9 1px; padding: .4em;">The player began a click on the monitor</td>
 +
</tr>
 +
<tr style="background-color: #FFFFFF;">
 +
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">button,x,y,player</td>
 +
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">monitor_up</td>
 +
                <td style="border-top: solid #C9C9C9 1px; padding: .4em;">The player stopped a click on the monitor</td>
 +
</tr>
 +
<tr style="background-color: #FFFFFF;">
 +
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">button,x,y,player</td>
 +
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">monitor_down</td>
 +
                <td style="border-top: solid #C9C9C9 1px; padding: .4em;">The player began a click on the monitor</td>
 +
</tr>
 +
<tr style="background-color: #FFFFFF;">
 +
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">{{type|string}} char</td>
 +
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">char</td>
 +
                <td style="border-top: solid #C9C9C9 1px; padding: .4em;">The player typed a character</td>
 +
</tr>
 +
<tr style="background-color: #FFFFFF;">
 +
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">{{type|string}} key</td>
 +
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">key</td>
 +
                <td style="border-top: solid #C9C9C9 1px; padding: .4em;">The player mashed the keyboard</td>
 +
</tr>
 +
<tr style="background-color: #FFFFFF;">
 +
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">table of imagedata, importable</td>
 +
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">tablet_image</td>
 +
                <td style="border-top: solid #C9C9C9 1px; padding: .4em;">The player took a picture with the tablet</td>
 +
</tr>
 
</table>
 
</table>
 
[[Category:User Created Peripherals]]
 
[[Category:User Created Peripherals]]

Latest revision as of 06:15, 4 August 2020

CCLights2 is an Open Source Minecraft mod that adds a GPU peripheral, and monitors to suit your need. Unlike CCGPU, this mod does not use OpenGL, but it is Multiplayer Compatible.

Please note; this documentation will always try to stay up to date with the github repo, so it might not fit your build :P

Grid disk.png  CCLights2 Peripherals
Name Description
GPU Peripheral

The GPU Peripheral needs to be placed next to a computer. It will autoconnect with the first monitor that connects with it, and will auto disconnect when the monitor detaches.

Empty-crafting-table.png
Grid iron ingot.png
Grid iron ingot.png
Grid iron ingot.png
Grid Redstone.png
Grid Gold Ingot.png
Grid Redstone.png
Grid CCLights2 GPU.png
Grid Gold Ingot.png
Grid Gold Ingot.png
Grid Gold Ingot.png
Grid disk.png  CCLights2 Monitors and ram
Name Description
Normal Monitor

The basic Monitor. It sports an elegant resolution of 256x144.

Empty-crafting-table.png
Grid iron ingot.png
Grid iron ingot.png
Grid iron ingot.png
Grid Redstone.png
Grid glass pane.png
Grid Redstone.png
Grid CCLights2 Monitor.png
Grid Gold Ingot.png
Grid Gold Ingot.png
Grid Gold Ingot.png
External Monitor

An external Monitor. It supports a resolution up to 512x288.

Empty-crafting-table.png
Grid glass pane.png
Grid glass pane.png
Grid glass pane.png
Grid glass pane.png
Grid CCLights2 Monitor.png
Grid glass pane.png
Grid CCLights2 External Monitor.png
Grid glass pane.png
Grid glass pane.png
Grid glass pane.png
TabletTransciever

The basestation for the tablet, CONNECT YOUR TABLETS HERE!

Empty-crafting-table.png
Grid Redstone.png
Grid Redstone.png
Grid CCLights2 Monitor.png
Grid Redstone.png
Grid CCLights2 TabletTransciever.png
Grid Redstone.png
RAM

Yep. You can craft more Ram.

Empty-crafting-table.png
Grid iron ingot.png
Grid iron ingot.png
Grid iron ingot.png
Grid Redstone.png
Grid Redstone.png
Grid CCLights2 Ram.png
Grid Gold Ingot.png
Grid Gold Ingot.png
Grid Gold Ingot.png
RAM

Yep. You can craft more Ram... with ram! (double the capacity up to a maximum of 8k!)

Empty-crafting-table.png
Grid CCLights2 Ram.png
Grid CCLights2 Ram.png
Grid CCLights2 Ram.png
Tablet

Hold it in your hand! Go caving! Watch your life leech away as you stare into this tablet! NOTE: Watch out for Creepers.

Empty-crafting-table.png
Grid Gold Ingot.png
Grid iron ingot.png
Grid Gold Ingot.png
Grid Redstone.png
Grid CCLights2 External Monitor.png
Grid Redstone.png
Grid CCLights2 Tablet.png
Grid Gold Ingot.png
Grid iron ingot.png
Grid Gold Ingot.png
Grid disk.png  GPU Methods
Returns Method Name Description
nil gpu.fill() Fills the current binded texture with the GPU color. NOTE: This method will fully replace the contents of the texture.
number textureid gpu.createTexture(number width, number height) Creates a texture and returns the texture id. This function will error if there is no more room for the texture.
number freememory gpu.getFreeMemory() Returns the amount of free memory that the GPU has to use. This can be expanded by right clicking the GPU with RAM.
number totalmemory gpu.getTotalMemory() Returns the amount of memory that the GPU has. This can be expanded by right clicking the GPU with RAM.
number usedmemory gpu.getUsedMemory() Returns the amount of memory that the GPU is using. This value is changed by allocating textures with gpu.createTexture and freeing textures with gpu.freeTexture.
nil gpu.bindTexture(number textureid) Bind the texture at textureid, this method will error if invalid values are used. Texture 0 is the screen.
nil gpu.plot(number x, number y) Sets the pixel on x,y to the the GPU's current color. (Remember, all drawing command work on the current binded texture)
nil gpu.drawTexture(number textureid, number x, number y[, number startX, number startY, number width, number height]) Draws the texture textureid to x and y, and if startX, startY, width, and height is defined, it will render only that area of the texture. (Remember: You can render the texture to itself)
nil gpu.freeTexture(number textureid) Frees the texture defined by textureid
nil gpu.line(number x0, number y0, number x1, number y1) Draws a line from x0 and y0 to x1 and y1.
number width, number height gpu.getSize([ number textureid]) Returns the texture size of textureid or the current binded texture. Using texture 0 will give you the screen size.
number red, number green, number blue, number alpha gpu.getPixels(number x, number y) Returns the color of the pixel in the currently binded texture. Out of bound pixels have an undefined side effect.
nil gpu.rectangle(number x, number y, number width, number height) Draws the outline of a rectangle from x, y to x+width, y+height.
nil gpu.filledRectangle(number x, number y, number width, number height) Draws a filled rectangle from x, y to x+width, y+height.
nil gpu.setColor(number red, number green, number blue[, number alpha]) Sets the GPU's current drawing color
number slot gpu.getBindedTexture() Gets the GPU's currently binded texture
nil gpu.setPixels(number width, number height, number x, number y,number red,number green,number blue,...) takes an array and writes each pixel to the image. this method is accelerated by java and is faster than multiple gpu.plot calls.
nil gpu.flipTextureV() flips the texture vertically
numberTextureID, numberWidth, numberHeight gpu.import(string imagestoredinCC) decodes an imagefile and makes it ready for texture binding.
string filedata gpu.export(number textureid, string file format) encodes an imagefile and makes it ready for saving.
nil gpu.drawText(string text to write, number x,number y) writes text from pixel x,y
number textWidth gpu.getTextWidth() Gets Text width
nil gpu.setColor(number red,number green,number blue, optional; number alpha) Sets the GPU's current color
number red, number green, number blue, number alpha gpu.getColor() Gets the GPU's current color
nil gpu.translate(number x,number y) translates the texture in two dimensions
nil gpu.rotate(number degrees) rotates the texture in two dimensions
nil gpu.rotateAround(number degrees,number x,number y) rotates the texture around pixel x,y
nil gpu.scale(number x-axis size,number y-axis size) scales the texture to specs
nil gpu.push() store transformation commands from here on and push them to the storestack
nil gpu.pop() process stored transformation input
table gpu.getMonitor().getResolution() Get the monitor resolution w/h
nil gpu.blur(number blur amount) makes the texture blurry
nil gpu.startFrame() Starts a new frame (use this if you plan to draw large amounts of data)
nil gpu.endFrame() ends the frame (ends the frame and sends the data, use this if you plan to draw large amounts of data)
nil gpu.clearRect(number x, number y, number width, number height) Clear rectangle entirely to alpha 255
nil gpu.origin() Reset RenderPoint with affline transform
Grid disk.png  Events
Returns EventName Description
button,x,y, player monitor_move The player dragged the mouse while holding in a button
button,x,y,player monitor_down The player began a click on the monitor
button,x,y,player monitor_up The player stopped a click on the monitor
button,x,y,player monitor_down The player began a click on the monitor
string char char The player typed a character
string key key The player mashed the keyboard
table of imagedata, importable tablet_image The player took a picture with the tablet