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
#include <dragonruby.h> | |
#include <mruby.h> | |
#include <mruby/array.h> | |
#include <mruby/hash.h> | |
#include <time.h> | |
#include <stdlib.h> | |
#undef mrb_float | |
#undef Data_Wrap_Struct | |
#undef Data_Make_Struct |
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
#include <dragonruby.h> | |
#include <mruby.h> | |
#include <mruby/array.h> | |
#include <mruby/hash.h> | |
#include <time.h> | |
#include <stdlib.h> | |
#undef mrb_float | |
#undef Data_Wrap_Struct | |
#undef Data_Make_Struct |
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
def tick args | |
# initalize a variable called ball within the game state | |
args.state.ball ||= { | |
x: 640 - 25, | |
y: 670, | |
w: 50, | |
h: 50, | |
path: "sprites/circle/blue.png", | |
dy: 0, | |
dx: 0 |
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
import sys, pygame | |
import random | |
pygame.init() | |
size = width, height = 1280, 720 | |
black = 0, 0, 0 | |
screen = pygame.display.set_mode(size) | |
star_texture = pygame.image.load("tiny-star.png") | |
clock = pygame.time.Clock() |
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
module GTK | |
class Runtime | |
module AsyncRequire | |
def async_require_init | |
@reload_list = [] | |
# schema for reload_list_history | |
# { PATH: { current: { path: PATH, | |
# global_at: Fixnum, | |
# event: (:reload_queued|:processing|reload_completed) }, |
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
# game concept from: https://youtu.be/Tz-AinJGDIM | |
# This class encapsulates the logic of a button that pulses when clicked. | |
# It is used in the StartScene and GameOverScene classes. | |
class PulseButton | |
# a block is passed into the constructor and is called when the button is clicked, | |
# and after the pulse animation is complete | |
def initialize rect, text, &on_click | |
@rect = rect | |
@text = text |
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
class Game | |
attr_gtk | |
def tick | |
defaults | |
render | |
input | |
calc | |
end |
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
class Game | |
attr_gtk | |
def tick | |
outputs.background_color = [237, 237, 237] | |
init_game | |
tick_start_scene | |
tick_game_scene | |
tick_game_over_scene | |
tick_next_scene |
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
class Game | |
def calc_player_physics player, should_play_sound: true | |
return if !state.death_animation_completed_at | |
return if state.level.game_mode != :play | |
player.dx = player.dx.clamp(-10, 10) | |
player.dy = player.dy.clamp(-10, 10) | |
if player.on_floor | |
player.dx *= 0.8 |
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
(use-package quelpa) | |
(use-package quelpa-use-package) | |
(use-package copilot | |
:quelpa (copilot.el :fetcher github | |
:repo "zerolfx/copilot.el" | |
:branch "main" | |
:files ("dist" "*.el"))) |