User Tools

Site Tools


4rpl:commands:setthemeoverlaypixels

Index

:!: Available in version 1.3 and later.

SetThemeOverlayPixels

SetThemeOverlayPixels(<-overlayNumber <-targetX <-targetZ <-blockWidth <-blockHeight <-pixelData)

Description

Sets a block of pixels in the theme overlay texture. The overlayNumber should be 0 or 1.
The targetX and targetZ parameters specify the location to apply the block of pixel data. The block will be applied starting at the lower leftof the block.
The blockWidth and blockHeight specify the width and height of the pixelData.
The pixelData is a list of color values. It's length should be blockWidth * blockHeight.
The colors in the pixelData are V4 values and the 4th field is treated as the transparency (alpha) value.

An alpha value of 0 is transparent, 1 is opaque. If the alpha value is higher than 1, this is interpreted as a special value meaning to not apply the pixel. This allows for pixel values within blocks that will not be applied to the overlay texture (the pixels in the overlay texture will remain undisturbed).

Examples

Overlay Test.4rpl
$pixelsPerCell:8 #The block size should match this
 
1000 0 do
	if (RandFloat 0.5 <)
		<-redBlock ->block
	else
		<-yellowBlock ->block
	endif
	SetThemeOverlayPixels(0 RandInt(0 <-textureWidth <-pixelsPerCell -) RandInt(0 <-textureHeight <-pixelsPerCell -) <-pixelsPerCell <-pixelsPerCell <-block)
loop
:once
	GetMapSize ->mapSizeZ ->mapSizeX	
 
	<-mapSizeX <-pixelsPerCell * ->textureWidth
	<-mapSizeZ <-pixelsPerCell * ->textureHeight
 
	CreateThemeOverlay(0 <-textureWidth <-textureHeight Vector0)
	SetThemeOverlayEnabled(0 true)
	SetThemeOverlayPointFilter(0 true)
 
 
	V4(0 0 0 2) ->T
	V4(1 0 0 1) ->R
	V4(1 1 0 1) ->Y
 
	<-T <-T <-R <-R <-R <-R <-T <-T
	<-T <-R <-R <-R <-R <-R <-R <-T
	<-R <-R <-R <-R <-R <-R <-R <-R
	<-R <-R <-R <-R <-R <-R <-R <-R
	<-R <-R <-R <-R <-R <-R <-R <-R
	<-R <-R <-R <-R <-R <-R <-R <-R
	<-T <-R <-R <-R <-R <-R <-R <-T
	<-T <-T <-R <-R <-R <-R <-T <-T List ->redBlock
 
	<-T <-T <-Y <-Y <-Y <-Y <-T <-T
	<-T <-Y <-Y <-Y <-Y <-Y <-Y <-T
	<-Y <-Y <-Y <-Y <-Y <-Y <-Y <-Y
	<-Y <-Y <-Y <-Y <-Y <-Y <-Y <-Y
	<-Y <-Y <-Y <-Y <-Y <-Y <-Y <-Y
	<-Y <-Y <-Y <-Y <-Y <-Y <-Y <-Y
	<-T <-Y <-Y <-Y <-Y <-Y <-Y <-T
	<-T <-T <-Y <-Y <-Y <-Y <-T <-T List ->yellowBlock

Index

4rpl/commands/setthemeoverlaypixels.txt · Last modified: 2022/06/09 13:10 by Karsten75