def update_answer(): """Functions for drawing the right answer""" x = (buckets[3].coordx[0] - buckets[1].coordx[0]) / 2 + buckets[1].coordx[0] y = headline_y - 3 * font_example if right_examples: color = right_examples[-1].color else: color = colors[0] answer_text = Text_to_print(font_example, [x, y], 0, str(results[-1]), color) answer_text.draw_text("center")
def update_score(): """Function for drawing the current score state""" x = (buckets[3].coordx[0] - buckets[1].coordx[0]) / 2 + buckets[1].coordx[0] y = headline_y - 3 * font_example if right_examples: color = right_examples[-1].color else: color = colors[0] points = Text_to_print(font_example, [width - x, y], 0, str(score[0]), color) points.draw_text("center")
def on_draw(): """ Window push handler Function for drawing all objects. They are divided according to in which part of the game they should be drawn """ if main: window.clear() for text in main_texts: text.draw_text("center") for question in main_questions: question.draw_text("right") for possibility in possibilities: possibility.draw_text("left") if name: user_name() name_user[-1].draw_text("left") if difficulty: chosen = Text_to_print(font_example, [350, 2 * height / 3 - 8 * font_example], 0, str(difficulty[-1]), colors[0]) chosen.draw_text("left") if not main: window.clear() elif game_over: window.clear() for text in end_texts: text.draw_text("center") else: gl.glClear(gl.GL_COLOR_BUFFER_BIT) for i in range(len(objects)): objects[i].draw_text("left") del buckets[12:16] update_starter() for j in range(len(headlines)): headlines[j].draw_text("center") for k in range(len(buckets)): buckets[k].draw_bucket() for l in range(len(rectangles)): rectangles[l].draw_rectangle() update_score() if results: update_answer()