How to use the accelerate.fluid.fluid-gui.FluidQuit function in accelerate

To help you get started, we’ve selected a few accelerate examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github diku-dk / futhark-benchmarks / accelerate / fluid / fluid-gui.py View on Github external
def react(self):
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                raise FluidQuit()
            elif event.type == pygame.MOUSEBUTTONDOWN:
                if pygame.mouse.get_pressed()[0]:
                    self.making_forces = True
                    self.making_densities = False
                elif pygame.mouse.get_pressed()[2]:
                    self.making_densities = True
                    self.making_forces = False
            elif event.type == pygame.MOUSEBUTTONUP:
                self.making_forces = False
                self.making_densities = False
            elif event.type == pygame.KEYDOWN:
                if event.key == pygame.K_c:
                    self.clear()
                if event.key == pygame.K_q:
                    self.diffusion_rate += 0.00001
                if event.key == pygame.K_a:
github diku-dk / futhark-benchmarks / accelerate / fluid / fluid-gui.py View on Github external
def run(self):
        self.clear()
        self.futhark = futhark_object()

        pygame.init()
        pygame.display.set_caption('Fluid Simulation GUI!')
        size = (self.grid_resolution, self.grid_resolution)
        self.screen = pygame.display.set_mode(size)
        self.surface = pygame.Surface(size)
        self.font = pygame.font.Font(None, 26)

        try:
            self.loop()
        except FluidQuit:
            return

accelerate

Accelerate

Apache-2.0
Latest version published 11 days ago

Package Health Score

100 / 100
Full package analysis