This repository has been archived by the owner on Jun 7, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from Basket-GO/docs/revole-conflict-readme
docs: create readme
- Loading branch information
Showing
17 changed files
with
209 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,34 @@ | ||
import pygame | ||
|
||
#button class | ||
class Button(): | ||
def __init__(self, x, y, image, scale): | ||
width = image.get_width() | ||
height = image.get_height() | ||
self.image = pygame.transform.scale(image, (int(width * scale), int(height * scale))) | ||
self.rect = self.image.get_rect() | ||
self.rect.topleft = (x, y) | ||
self.clicked = False | ||
|
||
def draw(self, surface): | ||
action = False | ||
#get mouse position | ||
pos = pygame.mouse.get_pos() | ||
|
||
#check mouseover and clicked conditions | ||
if self.rect.collidepoint(pos): | ||
if pygame.mouse.get_pressed()[0] == 1 and self.clicked == False: | ||
self.clicked = True | ||
action = True | ||
|
||
if pygame.mouse.get_pressed()[0] == 0: | ||
self.clicked = False | ||
|
||
#draw button on screen | ||
surface.blit(self.image, (self.rect.x, self.rect.y)) | ||
|
||
return action | ||
import pygame | ||
|
||
#button class | ||
class Button(): | ||
def __init__(self, x, y, image, image2, scale): | ||
width = image.get_width() | ||
height = image.get_height() | ||
self.image = pygame.transform.scale(image, (int(width * scale), int(height * scale))) | ||
self.image2 = pygame.transform.scale(image2, (int(width * scale), int(height * scale))) | ||
self.rect = self.image.get_rect() | ||
self.rect.topleft = (x, y) | ||
self.clicked = False | ||
|
||
def draw_and_clicked(self, surface): | ||
""" write button and return action""" | ||
press_up_or_down = True | ||
action = False | ||
#get mouse position | ||
pos = pygame.mouse.get_pos() | ||
image = self.image | ||
#check mouseover and clicked conditions | ||
if self.rect.collidepoint(pos) : | ||
image = self.image2 | ||
if pygame.mouse.get_pressed()[0] == 1 and self.clicked == False: | ||
self.clicked = True | ||
action = True | ||
|
||
if pygame.mouse.get_pressed()[0] == 0: | ||
self.clicked = False | ||
|
||
#draw button on screen | ||
surface.blit(image, (self.rect.x, self.rect.y)) | ||
|
||
return action |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Oops, something went wrong.