Screen Module
Добавить в игру через Steam
Нажмите «Подписаться»
На странице Steam войдите в аккаунт, если потребуется.
Подписаться
О материале
«Screen Module» — материал мастерской Scrap Mechanic. Постройки, новые блоки, детали и игровые режимы. Данные Steam, описание автора и ссылка для установки через подписку. Совместимость редакцией не проверена.
Описание автора
This mod is an extention module of the Programmable Processor. It allows to paint on a 96x54 pixel display. Currently it supports uppercase text, drawing and filling ovals and rectagles. Please keep in mind that it is still work in progress and things might change later in development. In case somebody wants to know the current technical interface to do stuff feel free to get in touch :D If you encounter any bugs let me know :) Have fun!
SMPL API
getScreens
drawString this text x y color
drawRect this x y w h color
drawOval this x y w h color
fillRect this x y w h color
fillOval this x y w h color
getResolution this
getSize this
setResolution this width height
setSize this width height
equal this other
unequal this other
with
- this, other being screen objects
- x, y, w, h being numbers
- text being a string
- color being a tuple of r, g, b
HLL API
[b]get_screens[/b]
parameters: [ ]
description:
returns a list of all screens that the
computer is connected to.
[b]set_screen_resolution[/b]
parameters: [ screen, width, height ]
description:
sets the amount of pixels of the screen.
be careful using this function because it
will recreate all pixels when calling the
function and can potentially cause lag.
the default resolution is 96x54.
[b]set_screen_size[/b]
parameters: [ screen, width, height ]
description:
scales the screen to fit into the desired
width and height. the resolution / ratio
of the screen stays the same -> the screen
might get distorted.
[b]draw_str[/b]
parameters: [ screen, text, x, y, color ]
description:
draws the string in the specified color on
the screen with the left upper corner of the
string as a reference. it currently only knows
uppercase input text which i will fix.
[b]draw[/b] and [b]fill[/b]
parameters: [ screen, shape, x, y, width, height, color]
description:
draws a shape in the desired color on the screen.
it can draw rectangles ('rectangle' as shape parameter)
where x, y specifies the left upper corner and w, h
specify the width and height of the rectangle.
it also draws ovals ('oval' as shape parameter) in which
cases x, y is the center point and w, h specify the
dimensions of the oval.
The color parameter is a list with 3 numbers from 0.0 to 1.0.
SMPL Example
import Screen
import Camera
import Math
II.setClockSpeed(10000)
width = 16 * 2
height = 9 * 2
screen = Screen.getScreens()[0]
screen.setResolution(width, height)
screen.setSize(16 * 3, 9 * 3)
range = 100
camera = Camera.getCameras()[0]
camera.setCastsPerTick(1000)
camera.setResolution(width, height)
camera.setFov(160, 90)
camera.setRange(range)
camera.setMode('ALL')
(screenWidth, screenHeight) = screen.getResolution()
screen.fillRect(0, 0, screenWidth, screenHeight, (0, 0, 0))
while true
camera.capture()
while camera.isCapturing()
II.interrupt()
end
for y = 0, y < height, y += 1
for x = 0, x < width, x += 1
entry = camera.getData(x, y)
color = entry[3]
if entry[2] == 'terrainSurfaceSand'
color = (1, 1, 0)
end
if entry[0]
v = 1.0 - entry[1] / range
(r, g, b) = color
screen.fillRect(width - x - 1, y, 1, 1, (r * v, g * v, b * v))
else
screen.fillRect(width - x - 1, y, 1, 1, (0.3, 0.3, 1))
end
end
end
end
Как установить и запустить
Откройте оригинальную страницу в Steam Workshop, проверьте версию игры, зависимости и порядок загрузки в описании автора. Нажмите «Подписаться» и дождитесь загрузки Steam. Включите материал в меню модификаций или контента игры, если это требуется. Совместимость и запуск редакцией не проверены.