support for led.plotBrightness (#494)
* support for led.plotBrightness * fixing c++ build * fixed blockid
This commit is contained in:
		
				
					committed by
					
						
						Sam El-Husseini
					
				
			
			
				
	
			
			
			
						parent
						
							e1764567c5
						
					
				
				
					commit
					e7c1915076
				
			@@ -273,7 +273,16 @@ namespace pxsim.basic {
 | 
			
		||||
 | 
			
		||||
namespace pxsim.led {
 | 
			
		||||
    export function plot(x: number, y: number) {
 | 
			
		||||
        board().ledMatrixState.image.set(x, y, 255);
 | 
			
		||||
        board().ledMatrixState.image.set(x, y, 0xff);
 | 
			
		||||
        runtime.queueDisplayUpdate()
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    export function plotBrightness(x: number, y: number, brightness: number) {
 | 
			
		||||
        const state = board().ledMatrixState;
 | 
			
		||||
        brightness = Math.max(0, Math.min(0xff, brightness));
 | 
			
		||||
        if (brightness != 0 && brightness != 0xff && state.displayMode != DisplayMode.greyscale)
 | 
			
		||||
                state.displayMode = DisplayMode.greyscale;
 | 
			
		||||
        state.image.set(x, y, brightness);
 | 
			
		||||
        runtime.queueDisplayUpdate()
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user