burn 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Burn - a handy toolkit to make .nes application from a single text file written in Ruby DSL
1
+ # Burn - a handy toolkit to make .nes application from Ruby DSL
2
2
 
3
3
  Burn is a free and open source framework that allows you to create 8-bit flavored application(.nes) using Ruby DSL.
4
4
 
@@ -81,12 +81,12 @@ Please visit [our project page](http://k.swd.cc/burn/) for more example.
81
81
  * [Getting Started](#getting-started)
82
82
  * [Installation](#installation)
83
83
  * [Quick Start](#quick-start)
84
- * [Burning Sample Fuel DSL](#burning-sample-fuel-dsl)
84
+ * [More Examples](#more-examples)
85
85
  * [Fuel DSL Methods](#fuel-dsl-methods)
86
86
  * [Scene](#scene)
87
- * [Sound](#sound)
88
- * [Music](#music)
89
87
  * [Declare](#declare)
88
+ * [Music](#music)
89
+ * [Sound](#sound)
90
90
  * [Burning Fuel DSL In Action](#burning-fuel-dsl-in-action)
91
91
  * [Programming With .rrb(Restricted Ruby) Syntax](#programming-with-rrbrestricted-ruby-syntax)
92
92
  * [Notes](#notes)
@@ -125,23 +125,30 @@ Internally, burn contains cc65 executables inside its gemfile and calls them to
125
125
 
126
126
  ### Quick Start
127
127
 
128
+ `burn -p` command use Firefox primarily. If you'd like to use chrome, type `burn -p -c` instead.
129
+
128
130
  echo "scene {label 'hello world'}" > main.rb
129
131
  burn -p
130
132
  ls tmp/burn/ | grep main.nes
131
133
 
132
- `burn -p` command use Firefox primarily. If you'd like to use chrome, type `burn -p -c` instead.
134
+ ### More Examples
133
135
 
134
- ### More Example
136
+ Customize example/shooting/main.rb and play with it if you please.
135
137
 
136
138
  git clone https://github.com/remore/burn.git
137
139
  cd burn/example/shooting
138
140
  burn -p -c
141
+
142
+ # if you'd like to make executable, simply remove -p option or type burn make
143
+ burn
144
+ burn make
145
+
146
+ # you can boot the emulator up whenever you want(without burning Fuel DSL)
147
+ burn play
139
148
 
140
- `vi main.rb` and customize this simple shooting game if you please.
141
-
142
- ## Fuel DSL Methods
149
+ ## Fuel DSL
143
150
 
144
- Currently following DSL Methods are available. If you are newbie here, kindly visit [project page](http://k.swd.cc/burn/) first to see what you can do with Burn and Fuel DSL.
151
+ Currently following 4 resources are available. Let's take a quick look how we can make 8-bit flavored application without hassle.
145
152
 
146
153
  * [Scene](#scene)
147
154
  * [Sound](#sound)
@@ -150,6 +157,8 @@ Currently following DSL Methods are available. If you are newbie here, kindly vi
150
157
 
151
158
  ### Scene
152
159
 
160
+ Scene resource is a key concept to make any kind of application. This is where you design screen transition, controller event binding and game balance design etc etc..
161
+
153
162
  #### label(string, x=0, y=1)
154
163
 
155
164
  The label method can be used in a scene to display static string.
@@ -170,6 +179,8 @@ scene do
170
179
  end
171
180
  ```
172
181
 
182
+ ![label pic](http://k.swd.cc/burn/resource/screenshot/label.png)
183
+
173
184
  #### fade_in, fade_out
174
185
 
175
186
  These methods can be used in a scene to fade in or out.
@@ -287,10 +298,12 @@ The color method can be used in a scene to pick a color and set it to specific p
287
298
  ```ruby
288
299
  scene do
289
300
  label "Hello, World!"
290
- color :text, :pink, :darker
301
+ color :text, :green, :lighter
291
302
  end
292
303
  ```
293
304
 
305
+ ![color pic](http://k.swd.cc/burn/resource/screenshot/color.png)
306
+
294
307
  #### wait(interval)
295
308
 
296
309
  The wait method can be used in a scene to pause for certain period of time.
@@ -441,18 +454,152 @@ scene "title" do
441
454
  end
442
455
  ```
443
456
 
457
+ ### Declare
458
+
459
+ Declare resource is essential part of programming with using Scene#main_loop.
460
+
461
+ If you give Number as shown below, then method name like #frame or #color_flag becomes variable in Scene#main_loop process.
462
+
463
+ ```ruby
464
+ declare do
465
+ frame 0
466
+ color_flag 0
467
+ end
468
+ ```
469
+
470
+ If you give String conststs of 8x8 character block just like following example code, then left left-hand member becomes sprite object in Scene#main_loop process.
471
+
472
+ ```ruby
473
+ declare do
474
+ tile <<-EOH
475
+ 11111111
476
+ 11222211
477
+ 11233211
478
+ 11233211
479
+ 11233211
480
+ 11233211
481
+ 11222211
482
+ 11111111
483
+ EOH
484
+ end
485
+ ```
486
+
487
+ ### Music
488
+
489
+ This is where burn rubygem compose music for you. The only requirement for you to start to compose music is your favorite text editor.
490
+
491
+ Music resource can accept only two methods so far, #tempo and #channel.
492
+
493
+ #### tempo(speed)
494
+
495
+ The tempo method in a music can be used to set a tempo of a song.
496
+
497
+ <dl>
498
+ <dt>speed Symbol</dt>
499
+ <dd>song speed symbol to set.
500
+ <table>
501
+ <tr>
502
+ <th>Song Speed</th>
503
+ </tr>
504
+ <tr><td>:presto</td></tr>
505
+ <tr><td>:allegro</td></tr>
506
+ <tr><td>:moderato</td></tr>
507
+ <tr><td>:andante</td></tr>
508
+ <tr><td>:adagio</td></tr>
509
+ <tr><td>:largo</td></tr>
510
+ </table>
511
+ </dd>
512
+ </dl>
513
+
514
+ ```ruby
515
+ music "fanfare" do
516
+ tempo :allegro
517
+ channel ...
518
+ end
519
+ ```
520
+
521
+ #### channel(instrument)
522
+
523
+ The channel method in a music can be used to set a channel of the song. Maximum three channels per music can be set.
524
+
525
+ <dl>
526
+ <dt>instrument String</dt>
527
+ <dd>instrument to play.
528
+ <table>
529
+ <tr>
530
+ <th>Instrument</th>
531
+ </tr>
532
+ <tr><td>"bass"</td></tr>
533
+ <tr><td>"piano"</td></tr>
534
+ <tr><td>"string"</td></tr>
535
+ <tr><td>"arpeggio"</td></tr>
536
+ <tr><td>"step"</td></tr>
537
+ <tr><td>"bell"</td></tr>
538
+ <tr><td>"acoustic"</td></tr>
539
+ <tr><td>"guitar"</td></tr>
540
+ <tr><td>"theremin"</td></tr>
541
+ </table>
542
+ </dd>
543
+ </dl>
544
+
545
+ Notes of the music are described as shown below.
546
+
547
+ - Total 61 notes(5 octaves + rest) notes are available.
548
+ - For instance, available methods are, `#c0`(0 stands for octave), `#ds0`(s stands for flat), `#d0`, `#es0`...
549
+ - `#segno` and `#dal_segno` are available too
550
+ - This way you can repeat song
551
+ - Each note can take length as their parameter. Here is list of length available
552
+ - `:sixteenth`, `:eighth`, `:quarter`, `:half`
553
+ - `:dotted_sixteenth`, `:dotted_eighth`, `:dotted_quarter`, `:dotted_half`
554
+ - `:triplet_sixteenth`, `:triplet_eighth`, `:triplet_quarter`, `:triplet_half`
555
+ - Each note can take expression parameter as well
556
+ - `:tenuto`
557
+ - `:accent`
558
+ - `:staccato`
559
+
560
+ With these basic understanding how you can compose song, here is an example of music.
561
+
562
+ ```ruby
563
+ music "sarabande" do
564
+ tempo :allegro
565
+ channel "string" do
566
+ segno
567
+ d2 :eighth
568
+ rest :eighth
569
+ e2 :eighth
570
+ rest :eighth
571
+ dal_segno
572
+ end
573
+ channel "piano" do
574
+ segno
575
+ a3 :dotted_eighth
576
+ rest :sixteenth
577
+ g3 :triplet_eighth
578
+ g3 :triplet_eighth
579
+ g3 :triplet_eighth
580
+ dal_segno
581
+ end
582
+ end
583
+ ```
584
+
444
585
  ### Sound
445
586
 
446
- #### duty_cycle(ratio)
587
+ Sound resource can accept only #effect method as of now. Available methods for #effect are shown below.
588
+
589
+ #### effect
590
+
591
+ with this block, you can call following method to configure sound setting.
592
+
593
+ ####
447
594
 
448
595
  The duty_cycle method in a sound can be used to set duty cycle type.
449
596
 
450
597
  <dl>
451
- <dt>ratio Symbol</dt>
452
- <dd>duty cycle type to set.
598
+ <dt>duty_cycle(ratio)</dt>
599
+ <dd>duty cycle symbol to set. It takes :higher by default.
453
600
  <table>
454
601
  <tr>
455
- <th>duty cycle type</th>
602
+ <th>Duty Cycle Type</th>
456
603
  <th>Value</th>
457
604
  </tr>
458
605
  <tr>
@@ -473,21 +620,29 @@ The duty_cycle method in a sound can be used to set duty cycle type.
473
620
  </tr>
474
621
  </table>
475
622
  </dd>
623
+ <dt>velocity(level)</dt>
624
+ <dd>Volume level number of the sound, between 0 and 15. It takes 7 by default.</dd>
625
+ <dt>envelope_decay(flag), envelope_decay_loop(flag), length_counter_clock(flag)</dt>
626
+ <dd>It takes either :enable or :disable flag symbol. Disabled by default.</dd>
627
+ <dt>length(size)</dt>
628
+ <dd>Length number of the sound effect, between 1 and 254. It takes 16 by default.</dd>
629
+ <dt>pitch(control)</dt>
630
+ <dd>Control number of the sound effect, between 0 and 254. (This value is stil uncontrollable so far. Need to improve)</dd>
476
631
  </dl>
477
632
 
478
- #### velocity(level)
479
-
480
- The velocity method in a sound can be used to set volume level of the sound.
481
-
482
- TBD
483
-
484
- ### Music
485
-
486
- TBD
487
-
488
- ### Declare
489
-
490
- TBD
633
+ ```ruby
634
+ sound "attack" do
635
+ effect do
636
+ duty_cycle
637
+ velocity 15
638
+ envelope_decay :disable
639
+ length 10
640
+ pitch 200
641
+ envelope_decay_loop :disable
642
+ length_counter_clock :disable
643
+ end
644
+ end
645
+ ```
491
646
 
492
647
  ## Burning Fuel DSL In Action
493
648
 
data/lib/burn/cli.rb CHANGED
@@ -49,7 +49,7 @@ module Burn
49
49
  [ERROR] you are not ready to burn, most probably you haven't execute burn init command yet.
50
50
  to fix this, try the following command:
51
51
 
52
- sudo burn init
52
+ #{"sudo " if !env.is_win?}burn init
53
53
 
54
54
  EOS
55
55
 
@@ -101,6 +101,9 @@ EOS
101
101
  "#{@workspace_root}/tmp/burn/release/js/emulator.html",
102
102
  File.read("#{@workspace_root}/tmp/burn/release/js/emulator.html")
103
103
  .gsub(/__@__TITLE__@__/, mainfile)
104
+ .gsub(/__@__AUTHOR__@__/, "anonymous")
105
+ .gsub(/__@__CREATED__@__/, Time.new.to_s)
106
+ .gsub(/__@__ROM__@__/, mainfile)
104
107
  .gsub(/__@__ROMDATA__@__/,
105
108
  Base64::strict_encode64(
106
109
  File.binread("#{@workspace_root}/tmp/burn/main.nes")
data/lib/burn/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Burn
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: burn
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-03-27 00:00:00.000000000 Z
12
+ date: 2014-04-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor
@@ -136,4 +136,3 @@ specification_version: 3
136
136
  summary: Burn is a free and open source framework that allows you to create 8-bit
137
137
  flavored application using Ruby DSL.
138
138
  test_files: []
139
- has_rdoc: