Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @name DigiScreen
- @inputs S:wirelink
- # Digital Screen library made by georgeravenholm (STEAM_0:1:66236244)
- function number wirelink:getHeight()
- {
- # Eagle, some advanced highspeede gates have internal memory as if they have ram and sgit
- # we can use wirelink to directly read and write to it
- # the wiki page says that this adress corresponds to the resolution the screen has
- # you can either use this adress to set or get the resolution of the screen
- return This[1048572] # according to wiki this gets resolution
- }
- function number wirelink:getWidth()
- {
- return This[1048573]
- }
- # Col is like console screen
- function void wirelink:putPixel(X, Y, Col)
- {
- # oh fuck this is complicated
- local Size = This:getWidth()
- if ( X > Size || Y > Size ) {return} # This prevents drawing pixels outside of the screen
- # The digital screen allocates (512*3) ^ 2 cells of memory for image data
- # you draw to the screen by setting the colour of a cell number
- # the cell number just goes up and up and up like:
- # 3x3 screen
- # 1 2 3
- # 4 5 6
- # 7 8 9
- # so to draw to (2,2) you tell cell 5 to become 255, white if colour mode is 0
- This[Size * Y + X] = Col # Set colour of cell
- # The colour the cell becomes depends on the colour mode
- # read up on colour modes here: https://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/indexb8dd.html
- # if you want to use colour mode 1 (1 cell for r g and b) you have to modify this func
- }
- #kick the Clk
- function void wirelink:pauseScreen()
- {
- #turn off clk
- This[1048575]=0
- }
- function void wirelink:resumeScreen()
- {
- # "Clk" allows the screen to update
- # unless you dont want constant updating, preform resumeScreen() in the if first
- #turn on clk
- This[1048575]=1
- }
- function void wirelink:setColMode(Mode)
- {
- # just leave this at 0 .
- # col mode 0 means that 1 cell is a number from 0-255 representing white to black
- This[1048569] = Mode
- }
- function void wirelink:clearScreen()
- {
- # if you dont get what this does then yoyre anm idiot
- This[1048574]=1
- This[1048574]=0
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement