Sha256: 887107daa4008b78574ebcc2cde2f78b91dc6e54281da2b981a4d34dcf1327c7

Contents?: true

Size: 1016 Bytes

Versions: 4

Compression:

Stored size: 1016 Bytes

Contents

#!/usr/bin/env ruby

$: << File.expand_path(File.join(File.dirname(__FILE__),'..','lib'))
require 'fileutils'
require 'hardware_adapter'
require 'hardware'
require 'gui'

simulator = Hardware::Simulator.new
simulator.assemble_hardware

simulator_gui = Gui::SimulatorGui.new(simulator)
simulator_gui.show

simulator.on_boot do
  simulator.drawer(0).fill(Hardware::Can.cola, 2, 0)
  simulator.drawer(1).fill(Hardware::Can.fanta, 2, 0)
  simulator.drawer(2).fill(Hardware::Can.sprite, 2, 0)
  simulator.drawer(3).fill(Hardware::Can.sisi, 2, 0)

  simulator.cash_register.fill(Hardware::Coin.two_euro, 3, 0)
  simulator.cash_register.fill(Hardware::Coin.one_euro, 3, 0)
  simulator.cash_register.fill(Hardware::Coin.fifty_cents, 3, 0)
end

FileUtils.cd(File.expand_path('~/.vendingmachine/control')) do
  $: << 'lib'
  load 'main.rb'
  Control.main if defined?(Control.main)
end

simulator.boot

while !simulator_gui.stopped? do
  Gtk.main_iteration while Gtk.events_pending?
end
puts "vending machine going home drunk"

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
vmsim-1.0.1 bin/vmsim
vmsim-1.0.0 bin/vmsim
vmsim-0.2.4 bin/vmsim
vmsim-0.2.3 bin/vmsim