Skip to content

Instantly share code, notes, and snippets.

@olivatooo
Created June 7, 2018 11:49
Show Gist options
  • Save olivatooo/cb8f8fa5613cd49731e5296994b13867 to your computer and use it in GitHub Desktop.
Save olivatooo/cb8f8fa5613cd49731e5296994b13867 to your computer and use it in GitHub Desktop.
#
#
# Created by Olivato :D
#
#
import pygame, sys
from pygame.locals import *
n = 32
m = 24
matrix = [0] * n
for i in range(n):
matrix[i] = [0] * m
file = open("videofile.dat","w")
def main():
pygame.init()
DISPLAY=pygame.display.set_mode((640,480),0,32)
pygame.display.set_caption('Mips Paint Pre-Alpha Tech Demo v0.1')
yellow=(255,255,0)
blue=(0,0,255)
DISPLAY.fill(blue)
while True:
for event in pygame.event.get():
if event.type==QUIT:
#Faz a transposta por motivos de gambiarra
rez = [[matrix[j][i] for j in range(len(matrix))] for i in range(len(matrix[0]))]
for row in rez:
binary = ''.join(str(e) for e in row)
output = hex(int(binary, 2)).replace("0x", "").zfill(8)
print(output)
file.write(output + "\n")
pygame.quit()
sys.exit()
if event.type == pygame.MOUSEBUTTONUP:
pos = pygame.mouse.get_pos()
if matrix[int(pos[0]/20)][int(pos[1]/20)] == 1:
matrix[int(pos[0] / 20)][int(pos[1] / 20)] = 0
else:
matrix[int(pos[0] / 20)][int(pos[1] / 20)] = 1
# Redesenha tudo
for i in range(n):
for j in range(m):
if matrix[i][j] == 0:
pygame.draw.rect(DISPLAY, blue, (i*20, j*20, 32, 24))
if matrix[i][j] == 1:
pygame.draw.rect(DISPLAY, yellow, (i*20, j*20, 32, 24))
pygame.display.update()
main()
@sugayaa
Copy link

sugayaa commented Jun 7, 2018

se deixasse segurar o mouse seria top!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment