This file contains hidden or 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
describe RenderArea do | |
define_helper :build_render_area do |args| | |
# Size of DR default render area (1280x720) | |
# This area is centered inside the allscreen area | |
args.grid.w ||= 1280 | |
args.grid.h ||= 720 | |
# logical pixel size of the whole screen (i.e. size of the render canvas in DR) | |
args.grid.allscreen_w ||= args.grid.w | |
args.grid.allscreen_h ||= args.grid.h | |
# actual pixel size of the whole screen |
This file contains hidden or 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) | |
args.state.grid ||= initial_grid | |
unless args.state.game_setup_complete | |
setup_game(args) | |
return | |
end | |
args.outputs.background_color = [0, 0, 0] | |
tiles = build_tiles(args.state.grid) |
This file contains hidden or 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) | |
args.state.grid ||= initial_grid | |
setup_game(args) unless args.state.game_setup_complete | |
tiles = build_tiles(args.state.grid) | |
tiles.each do |tile| | |
handle_animation(args, tile) | |
color = COLORS[tile[:number] - 1] |
This file contains hidden or 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
(defvar init-file-location "~/.emacs.d/init.el") | |
(defun find-init-file () | |
(interactive) | |
(find-file init-file-location)) | |
(defun reload-init-file () | |
(interactive) | |
(load-file init-file-location)) |
This file contains hidden or 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 MyTile | |
def initialize(x, y, r, g, b) | |
@x = x * 16 | |
@y = y * 16 | |
@w = 16 | |
@h = 16 | |
@path = 'tile' | |
@a = 255 | |
@r = r | |
@g = g |