Skip to content
Snippets Groups Projects
Commit b12cd843 authored by q3k's avatar q3k Committed by q3k
Browse files

sim, ci: take a screenshot

parent 55086900
No related branches found
No related tags found
1 merge request!49sim, ci: take a screenshot
......@@ -70,6 +70,15 @@ build-p6:
paths: ['build/flow3r.elf']
expire_in: 5 hours
simulate:
stage: build
script:
- python3 sim/run.py screenshot
artifacts:
expose_as: 'Smulator Screenshot'
paths: ['flow3r.png']
expire_in: 5 hours
pages:
stage: deploy
only:
......
......@@ -2,6 +2,7 @@ import math
import os
import time
import itertools
import sys
import pygame
......@@ -15,6 +16,10 @@ bgpath = os.path.join(simpath, "background.png")
background = pygame.image.load(bgpath)
SCREENSHOT = False
SCREENSHOT_DELAY = 5
class Input:
"""
Input implements an input overlay (for petals or buttons) that can be
......@@ -466,6 +471,16 @@ def display_update(subctx):
_sim.render_display(fb)
_sim.render_gui_now()
global SCREENSHOT
global SCREENSHOT_DELAY
if SCREENSHOT:
SCREENSHOT_DELAY -= 1
if SCREENSHOT_DELAY <= 0:
path = os.curdir + "/flow3r.png"
pygame.image.save(screen, path)
print("Saved screenshot to ", path)
sys.exit(0)
fbm.put(fbp, c)
......
......@@ -107,4 +107,9 @@ def _stat(path):
os.stat = _stat
if len(sys.argv) >= 2 and sys.argv[1] == "screenshot":
import hardware
hardware.SCREENSHOT = True
import main
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment