We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rendering the image normally without attempting to resize, with image(img, 10,20) I get this:
image(img, 10,20)
However when trying to dynamically resize the width to half its size I get the image below
from p5 import * from components.shuffler import Shuffler from components.debugger import Debugger from game_logic.constants import ITEMS # Intellisense can't find these on its own for some reason global mouse_is_pressed, mouse_x, mouse_y global shuffler, debugger global width, height SHUFFLED_ITEMS = list(ITEMS.keys()) img = None img_width = None img_height = None def start(): """ Start the UI. This function takes over the main thread (never returns)! """ run(renderer="skia", sketch_draw=draw, sketch_setup=setup) def setup(): size(1024, 600) #touchscreen size background(200) global shuffler, debugger, img, img_width, img_height shuffler = Shuffler() debugger = Debugger() img = loadImage("kart_ui/images/no-item.png") print("original size", img.width(), img.height()) img_width = int(img.width()/2) img_height = int(img.height()/2) # no_tint() def draw(): background(255) fill(255) # print(type(img)) # print(img_width, img_height) image(img, 10,20, img_width, img_height) def mouse_pressed(): if mouse_x < width/2: shuffler.shuffle(SHUFFLED_ITEMS[int(random_uniform(0, len(SHUFFLED_ITEMS)))]) else: shuffler.use_item() if __name__ == "__main__": start()
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Rendering the image normally without attempting to resize, with
image(img, 10,20)
I get this:
However when trying to dynamically resize the width to half its size I get the image below
The text was updated successfully, but these errors were encountered: