stylet 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +14 -0
- data/.travis.yml +4 -0
- data/.yardopts +2 -0
- data/Gemfile +16 -0
- data/README.org +19 -0
- data/Rakefile +17 -0
- data/bin/setup +63 -0
- data/bin/stylet +8 -0
- data/examples/.ruby-version +1 -0
- data/examples/00100_lib_hello_world.rb +8 -0
- data/examples/00110_lib_sge_check.rb +6 -0
- data/examples/00120_lib_/343/202/254/343/203/263/343/203/236/345/200/244/343/201/256/345/244/211/346/233/264.rb +22 -0
- data/examples/00130_lib_window_title.rb +8 -0
- data/examples/00140_lib_callbacks.rb +8 -0
- data/examples/00150_lib_vector.rb +5 -0
- data/examples/00160_lib_run.rb +4 -0
- data/examples/00170_lib_frame.rb +4 -0
- data/examples/00180_lib_config/347/242/272/350/252/215.rb +7 -0
- data/examples/00190_lib_/343/201/231/343/201/271/343/201/246/345/220/214/343/201/230/343/202/252/343/203/226/343/202/270/343/202/247/343/202/257/343/203/210.rb +10 -0
- data/examples/00200_lib_/343/203/254/343/202/267/343/203/274/343/203/220/343/203/274/343/202/222/347/234/201/347/225/245/343/201/231/343/202/213/346/226/271/346/263/225/343/201/256/343/203/206/343/202/271/343/203/210.rb +28 -0
- data/examples/00210_lib_delegators.rb +7 -0
- data/examples/00220_lib_template_method.rb +13 -0
- data/examples/00230_lib_/350/203/214/346/231/257/347/224/273/345/203/217/350/241/250/347/244/272.rb +9 -0
- data/examples/00240_lib_/350/203/214/346/231/257/347/224/273/345/203/217/343/202/222/346/232/227/343/201/2171_/351/273/222/343/201/256/344/270/212/343/201/253/350/203/214/346/231/257.rb +18 -0
- data/examples/00250_lib_/350/203/214/346/231/257/347/224/273/345/203/217/343/202/222/346/232/227/343/201/2172_/350/203/214/346/231/257/343/201/256/344/270/212/343/201/253/351/273/222.rb +17 -0
- data/examples/00260_lib_/350/203/214/346/231/257/347/224/273/345/203/217/343/202/222/346/232/227/343/201/2173_/350/203/214/346/231/257/343/201/256/344/270/212/343/201/253/351/273/222_/347/224/273/351/235/242/343/202/265/343/202/244/343/202/272/343/203/225/343/202/243/343/203/203/343/203/210_/351/207/215/343/201/204.rb +27 -0
- data/examples/00270_lib_/350/203/214/346/231/257/347/224/273/345/203/217/343/202/222/346/232/227/343/201/2173_/350/203/214/346/231/257/343/201/256/344/270/212/343/201/253/351/273/222_/347/224/273/351/235/242/343/202/265/343/202/244/343/202/272/343/203/225/343/202/243/343/203/203/343/203/210_/351/253/230/351/200/237/345/214/226.rb +44 -0
- data/examples/00280_lib_/347/211/271/345/256/232/343/201/256/343/202/250/343/203/252/343/202/242/343/201/240/343/201/221/345/276/220/343/200/205/343/201/253/346/266/210/343/201/231.rb +26 -0
- data/examples/00290_lib_/350/203/214/346/231/257/350/211/262/345/244/211/346/233/264.rb +5 -0
- data/examples/00300_lib_/343/202/255/343/203/243/343/203/251/343/202/257/343/202/277/347/224/273/345/203/217/343/202/222/350/241/250/347/244/272/343/201/231/343/202/213/344/276/213.rb +17 -0
- data/examples/00310_lib_/343/202/255/343/203/243/343/203/251/343/202/257/343/202/277/347/224/273/345/203/217/343/201/256/343/202/242/343/203/213/343/203/241/343/203/274/343/202/267/343/203/247/343/203/263.rb +18 -0
- data/examples/00320_lib_/343/202/255/343/203/243/343/203/251/343/202/257/343/202/277/346/213/241/345/244/247/347/270/256/345/260/217/345/233/236/350/273/242.rb +21 -0
- data/examples/00330_joystick.rb +5 -0
- data/examples/00340_joystick_PS3/343/202/242/343/203/212/343/203/255/343/202/260/343/203/254/343/203/220/343/203/274/343/201/256/345/213/225/343/201/215/343/201/214/345/206/205/351/203/250/343/201/247/343/201/257/345/233/233/350/247/222.rb +30 -0
- data/examples/00350_joystick_PS3/343/202/242/343/203/212/343/203/255/343/202/260/343/203/254/343/203/220/343/203/274/343/201/256/350/252/277/346/225/264/346/270/210/343/201/277/343/203/231/343/202/257/343/203/210/343/203/253.rb +12 -0
- data/examples/00360_lib_mouse.rb +5 -0
- data/examples/00370_lib_input.rb +29 -0
- data/examples/00380_lib_vputs_align.rb +8 -0
- data/examples/00390_/343/203/225/343/202/251/343/203/263/343/203/210/344/270/200/350/246/247.rb +15 -0
- data/examples/00400_lib_draw_circle.rb +8 -0
- data/examples/00410_SDL/343/201/256draw_rect/343/201/2571/343/203/224/343/202/257/343/202/273/343/203/253/344/275/231/345/210/206/343/201/253/346/217/217/347/224/273/343/201/225/343/202/214/343/202/213/343/201/256/343/201/247/346/263/250/346/204/217.rb +7 -0
- data/examples/00420_circle_on_circle.rb +10 -0
- data/examples/00430_rotate.rb +16 -0
- data/examples/00440_draw_triangle.rb +7 -0
- data/examples/00450_parabora_triangle.rb +37 -0
- data/examples/00460_ice_hockey.rb +88 -0
- data/examples/00470_collision_block_vs_block.rb +120 -0
- data/examples/00480_simple_circle_controll.rb +37 -0
- data/examples/00490_/347/255/211/351/200/237/347/247/273/345/213/225_uniform_velocity_rain.rb +51 -0
- data/examples/00500_/345/212/240/351/200/237/346/224/276/347/211/251/347/267/232_parabora_volcano.rb +94 -0
- data/examples/00510_3d.rb +53 -0
- data/examples/00520_/343/203/210/343/203/253/343/203/215/343/201/256/343/203/241/343/203/213/343/203/245/343/203/274/351/242/250/343/201/256/345/213/225/343/201/215.rb +77 -0
- data/examples/00530_curve_2/346/254/241/343/203/231/343/202/270/343/202/247/346/233/262/347/267/232/343/201/250/347/233/264/347/267/232/343/201/250/343/201/256/344/272/244/347/202/271.rb +43 -0
- data/examples/00540_curve_3/346/254/241/343/203/231/343/202/270/343/202/247/346/233/262/347/267/232.rb +40 -0
- data/examples/00550_curve_N/346/254/241/343/203/231/343/202/270/343/202/247/346/233/262/347/267/232.rb +92 -0
- data/examples/00560_curve_/343/202/271/343/203/227/343/203/251/343/202/244/343/203/263/346/233/262/347/267/232.rb +113 -0
- data/examples/00570_/345/206/206/351/201/213/345/213/225_circle_jet_coaster.rb +52 -0
- data/examples/00580_/345/206/206/343/202/222/346/212/274/343/201/231/343/201/262/343/201/243/343/201/261/343/202/213_collision_circle_vs_circle_push_or_pull.rb +56 -0
- data/examples/00590_/350/212/213/350/231/253/343/202/264/343/203/240/347/264/220/343/203/207/343/203/242_collision_demo_circle_worm.rb +104 -0
- data/examples/00600_/346/214/257/343/202/212/345/255/220_swing.rb +145 -0
- data/examples/00610_/345/206/205/347/251/215/343/201/250/345/244/226/347/251/215_inner_product.rb +36 -0
- data/examples/00620_/346/263/225/347/267/232/343/203/231/343/202/257/343/203/210/343/203/253.rb +23 -0
- data/examples/00630_/345/206/206/343/201/250/345/206/206/343/201/256/345/217/215/345/260/204_collision_reflect_circle_vs_circle.rb +222 -0
- data/examples/00640_/347/202/271/343/201/250/347/267/232/345/210/206/343/201/256/344/272/244/345/267/256/345/210/244/345/256/232_collision_ray_circle_vs_line.rb +261 -0
- data/examples/00650_/345/206/206/343/201/250/347/202/271/343/201/256/345/217/215/345/260/204_collision_circle_vs_dot.rb +36 -0
- data/examples/00660_/345/206/206/343/201/250/345/206/206/343/201/250/347/267/232/345/210/206/343/201/256/345/217/215/345/260/204/343/203/207/343/203/242_collision_demo.rb +305 -0
- data/examples/00670_/343/203/251/343/202/244/343/203/225/343/202/262/343/203/274/343/203/240.rb +86 -0
- data/examples/00680_2/347/202/271/343/202/222/351/200/232/343/202/213/347/233/264/347/267/232/343/201/256/346/226/271/347/250/213/345/274/217.rb +81 -0
- data/examples/00690_/343/203/222/343/203/253/343/203/231/343/203/253/343/203/210/346/233/262/347/267/232.rb +77 -0
- data/examples/00700_/343/202/263/343/203/203/343/203/233/346/233/262/347/267/232.rb +79 -0
- data/examples/00710_/343/202/267/343/202/260/343/203/242/343/202/244/343/203/211/346/233/262/347/267/232.rb +40 -0
- data/examples/00720_/343/202/267/343/203/200/346/244/215/347/211/251.rb +44 -0
- data/examples/00730_/343/202/257/343/203/252/343/203/225/343/202/251/343/203/274/343/203/211/343/202/242/343/203/210/343/203/251/343/202/257/343/202/277_/345/237/272/346/234/254.rb +29 -0
- data/examples/00740_/343/202/257/343/203/252/343/203/225/343/202/251/343/203/274/343/203/211/343/202/242/343/203/210/343/203/251/343/202/257/343/202/277_/346/224/271/350/211/257_/350/211/262/344/273/230/343/201/215.rb +68 -0
- data/examples/00750_/343/202/257/343/203/252/343/203/225/343/202/251/343/203/274/343/203/211/343/202/242/343/203/210/343/203/251/343/202/257/343/202/277_/343/203/211/343/203/274/343/203/212/343/203/204/345/236/213.rb +44 -0
- data/examples/00760_/347/201/253/350/212/261.rb +42 -0
- data/examples/00770_atan/343/201/247atan2/343/202/222/346/233/270/343/201/217.rb +26 -0
- data/examples/00780_/346/250/231/346/272/226/343/203/251/343/202/244/343/203/226/343/203/251/343/203/252/343/201/256atan2_sin_cos/343/202/222/344/275/277/343/201/206.rb +15 -0
- data/examples/00790_/350/247/222/345/272/246/343/201/250/343/203/251/343/202/270/343/202/242/343/203/263/343/201/256/347/233/270/344/272/222/345/244/211/346/217/233.rb +22 -0
- data/examples/00800_/347/220/203/343/201/214/347/233/264/347/267/232/347/232/204/343/201/253/345/213/225/343/201/204/343/201/246/343/201/204/343/202/213/343/201/240/343/201/221/343/201/247/345/233/236/350/273/242/343/201/227/343/201/246/343/201/204/343/202/213/343/202/210/343/201/206/343/201/253/350/246/213/343/201/210/343/202/213.rb +27 -0
- data/examples/00810_/343/202/267/343/203/237/343/203/245/343/203/254/343/203/274/343/202/267/343/203/247/343/203/263_/350/273/212.rb +75 -0
- data/examples/00820_/343/202/267/343/203/237/343/203/245/343/203/254/343/203/274/343/202/267/343/203/247/343/203/263_/346/210/246/350/273/212.rb +90 -0
- data/examples/00830_/350/247/222/345/272/246/345/267/256.rb +36 -0
- data/examples/00840_/346/224/276/347/211/251/347/267/232/343/201/247/347/213/231/346/222/203_/346/231/202/351/226/223/345/233/272/345/256/232.rb +61 -0
- data/examples/00850_/346/224/276/347/211/251/347/267/232/343/201/247/347/213/231/346/222/203_/350/247/222/345/272/246/345/233/272/345/256/232.rb +84 -0
- data/examples/00860_/346/224/276/347/211/251/347/267/232/343/201/247/347/213/231/346/222/203_/351/200/237/345/272/246/345/233/272/345/256/232.rb +66 -0
- data/examples/00870_/350/247/222/345/272/246/350/243/234/346/255/243_/345/212/240/351/200/237/343/203/237/343/202/265/343/202/244/343/203/253.rb +60 -0
- data/examples/00880_/345/210/235/351/200/237/343/201/214/351/200/237/343/201/204/343/203/237/343/202/265/343/202/244/343/203/253.rb +51 -0
- data/examples/00890_/346/255/243/350/246/217/344/271/261/346/225/260/343/201/250/346/250/231/346/272/226/345/201/217/345/267/256/343/201/256/345/217/257/350/246/226/345/214/226.rb +72 -0
- data/examples/00900_/345/220/221/345/277/203/345/212/233/343/201/247/345/233/236/350/273/242/343/200/220/350/247/222/345/272/2460/345/272/246/343/201/213/343/202/211/343/200/221.rb +23 -0
- data/examples/00910_/345/220/221/345/277/203/345/212/233/343/201/247/345/233/236/350/273/242/343/200/220/344/273/273/346/204/217/343/201/256/350/247/222/345/272/246/343/201/213/343/202/211/343/200/221.rb +33 -0
- data/examples/00920_/343/203/236/343/203/252/343/202/252/343/203/226/343/203/251/343/202/266/343/203/274/343/202/272/351/242/250/343/201/253/347/224/273/351/235/242/344/270/241/347/253/257/343/201/214/347/271/213/343/201/243/343/201/246/343/201/204/343/202/213/344/276/213.rb +29 -0
- data/examples/00930_/345/212/271/346/236/234/351/237/263.rb +17 -0
- data/examples/00940_/343/203/236/343/203/203/343/203/227/343/203/201/343/203/203/343/203/227/343/201/256/343/203/236/343/203/203/343/203/227/351/205/215/347/275/256.rb +71 -0
- data/examples/00950_/343/203/236/343/203/203/343/203/227/343/203/201/343/203/203/343/203/227/343/201/256/350/241/250/347/244/272/344/276/213.rb +28 -0
- data/examples/00960_/343/203/236/343/203/203/343/203/227/343/203/201/343/203/203/343/203/227/343/201/250/345/215/230/344/270/200/347/224/273/345/203/217/343/201/256/351/201/225/343/201/204/343/202/222/345/220/270/345/217/216/343/201/231/343/202/213/344/276/213.rb +47 -0
- data/examples/00970_observer_/343/201/235/343/201/2561_/347/233/264/346/216/245.rb +28 -0
- data/examples/00980_observer_/343/201/235/343/201/2562_/346/231/256/351/200/232/343/201/253Singleton/347/211/210.rb +30 -0
- data/examples/00990_observer_/343/201/235/343/201/2563_SimpleDelegator/347/211/210.rb +28 -0
- data/examples/01000_observer_/343/201/235/343/201/2564_/351/200/206/343/201/253/343/203/253/343/203/274/343/203/227/344/270/273/345/260/216.rb +28 -0
- data/examples/01010_observer_/343/201/235/343/201/2565_/343/201/204/343/202/215/343/202/223/343/201/252/346/211/200/343/201/213/343/202/211/345/221/274/343/202/223/343/201/247/343/201/204/343/202/213/343/201/221/343/201/251Singleton/343/201/252/343/201/256/343/201/247/345/256/211/345/205/250.rb +37 -0
- data/examples/01020_observer_/343/201/235/343/201/2566_/343/201/204/343/202/215/343/202/223/343/201/252/346/211/200/343/201/213/343/202/211/345/221/274/343/201/266/345/240/264/345/220/210callbacks/343/202/222/344/275/277/343/202/217/343/201/252/343/201/204/343/202/210/343/201/206/343/201/253.rb +30 -0
- data/examples/01030_observer_/343/201/235/343/201/2567_/343/202/250/343/203/225/343/202/247/343/202/257/343/203/210/343/202/277/343/202/271/343/202/257/343/202/222/345/233/236/343/201/231/344/276/213.rb +57 -0
- data/examples/01040_/343/203/236/343/202/246/343/202/271/343/201/256/344/275/215/347/275/256/343/201/253/343/203/224/343/202/257/343/202/273/343/203/253/343/202/222/346/211/223/343/201/244.rb +18 -0
- data/examples/01050_/343/203/224/343/202/257/343/202/273/343/203/253/345/205/250/344/275/223/343/202/222/346/233/270/343/201/215/350/276/274/343/202/200.rb +27 -0
- data/examples/01060_effect_/347/224/273/345/203/217/343/201/256/343/202/263/343/203/263/343/203/234/343/203/252/343/203/245/343/203/274/343/203/210/346/263/225/343/201/253/343/202/210/343/202/213/343/202/250/343/203/225/343/202/247/343/202/257/343/203/210/345/207/246/347/220/206.rb +116 -0
- data/examples/01070_effect_FF7/343/201/256/346/210/246/351/227/230/343/201/253/345/205/245/343/202/213/343/201/250/343/201/215/343/201/256/343/202/250/343/203/225/343/202/247/343/202/257/343/203/210.rb +33 -0
- data/examples/01080_effect_/350/203/214/346/231/257/343/202/222/347/267/251/343/201/217/346/266/210/343/201/227/343/201/246/343/201/204/343/201/217/343/201/250/343/202/271/343/203/240/343/203/274/343/202/272/343/201/253/343/201/252/343/202/213.rb +16 -0
- data/examples/01090_/347/224/273/345/203/217/343/201/256/343/202/257/343/203/255/343/202/271/343/203/225/343/202/247/343/203/274/343/203/211.rb +37 -0
- data/examples/01100_/343/202/271/343/202/257/343/203/252/343/203/274/343/203/263/346/203/205/345/240/261.rb +8 -0
- data/examples/01110_lib_contrib_menu.rb +19 -0
- data/examples/01120_/351/233/233/345/236/213_2P/345/257/276/346/210/246/351/242/250STG.rb +109 -0
- data/examples/01130_/351/233/233/345/236/213_/346/210/246/350/273/212/345/257/276/346/210/246.rb +396 -0
- data/examples/01140_/351/233/233/345/236/213_2P/345/257/276/346/210/246.rb +60 -0
- data/examples/01150_/351/233/233/345/236/213_/343/202/271/343/203/274/343/203/221/343/203/274/343/203/236/343/203/252/343/202/252/351/242/250/343/202/242/343/202/257/343/202/267/343/203/247/343/203/263.rb +1251 -0
- data/examples/01160_2D/343/202/242/343/203/225/343/202/243/343/203/263/345/244/211/346/217/233.rb +40 -0
- data/examples/01170_stackprof.rb +10 -0
- data/examples/01180_sdl_/343/202/242/343/203/253/343/203/225/343/202/241/343/203/226/343/203/254/343/203/263/343/203/207/343/202/243/343/203/263/343/202/260/343/201/247/351/207/215/343/201/255/345/220/210/343/201/233/345/241/227/343/202/212/346/275/260/343/201/227.rb +11 -0
- data/examples/01190_/343/203/221/343/203/274/343/203/206/343/202/243/343/202/257/343/203/253/345/220/214/345/243/253/343/201/247/344/270/255/345/244/256/343/201/253/345/220/221/343/201/213/343/201/206.rb +79 -0
- data/examples/01200_lib_OpenGL.rb +55 -0
- data/examples/bezier.rb +202 -0
- data/examples/cursor.rb +50 -0
- data/examples/helper.rb +38 -0
- data/examples/lifegame_patterns.rb +102 -0
- data/examples/movable_point.rb +64 -0
- data/examples/mtx33.rb +294 -0
- data/examples/setup.rb +5 -0
- data/examples/stage_infos.rb +1 -0
- data/examples/start.sh +2 -0
- data/examples/test_all.rb +5 -0
- data/examples/testgl.rb +228 -0
- data/examples/trash/__0060_shooting2.rb +37 -0
- data/examples/trash/__0090_collision_circle1.rb +50 -0
- data/examples/trash/__0125_circle_collision.rb +103 -0
- data/examples/trash/__0130_circle_collision2.rb +60 -0
- data/examples/trash/__0270_circle_cycle_shift.rb +29 -0
- data/examples/trash/__bullet_algos.rb +224 -0
- data/examples/trash/gunship.rb +39 -0
- data/examples//343/203/227/343/203/255/343/202/270/343/202/247/343/202/257/343/202/277/343/203/274/343/201/253/350/241/250/347/244/272/343/201/231/343/202/213/343/201/250/343/201/215.sh +2 -0
- data/lib/stylet.rb +1 -0
- data/lib/stylet/application_memory_record.rb +33 -0
- data/lib/stylet/audio.rb +455 -0
- data/lib/stylet/axis_support.rb +62 -0
- data/lib/stylet/base.rb +76 -0
- data/lib/stylet/callbacks.rb +62 -0
- data/lib/stylet/cli.rb +54 -0
- data/lib/stylet/collision_support.rb +56 -0
- data/lib/stylet/config.rb +39 -0
- data/lib/stylet/contrib/menu.rb +508 -0
- data/lib/stylet/contrib/shared_pad.rb +32 -0
- data/lib/stylet/contrib/sprity.rb +149 -0
- data/lib/stylet/core.rb +118 -0
- data/lib/stylet/cpu_stat.rb +58 -0
- data/lib/stylet/delegators.rb +54 -0
- data/lib/stylet/draw.rb +256 -0
- data/lib/stylet/draw_support/arrow.rb +56 -0
- data/lib/stylet/draw_support/circle.rb +63 -0
- data/lib/stylet/draw_support/polygon.rb +22 -0
- data/lib/stylet/font.rb +172 -0
- data/lib/stylet/fps_adjust.rb +23 -0
- data/lib/stylet/fps_stat.rb +41 -0
- data/lib/stylet/input.rb +8 -0
- data/lib/stylet/input/base.rb +105 -0
- data/lib/stylet/input/hardware_bindings.rb +65 -0
- data/lib/stylet/input/key_one.rb +162 -0
- data/lib/stylet/input/support.rb +72 -0
- data/lib/stylet/joystick.rb +31 -0
- data/lib/stylet/joystick_adapter.rb +130 -0
- data/lib/stylet/joystick_adapters/buffalo_snes_adapter.rb +47 -0
- data/lib/stylet/joystick_adapters/elecom_usb_pad_adapter.rb +30 -0
- data/lib/stylet/joystick_adapters/hori_rap_v3_sa_adapter.rb +46 -0
- data/lib/stylet/joystick_adapters/ps3_standard_adapter.rb +40 -0
- data/lib/stylet/joystick_adapters/unknown_adapter.rb +13 -0
- data/lib/stylet/keyboard.rb +15 -0
- data/lib/stylet/logger.rb +12 -0
- data/lib/stylet/mouse.rb +58 -0
- data/lib/stylet/palette.rb +17 -0
- data/lib/stylet/rect.rb +113 -0
- data/lib/stylet/shortcut.rb +8 -0
- data/lib/stylet/state.rb +87 -0
- data/lib/stylet/stylet.rb +44 -0
- data/lib/stylet/system_pause.rb +24 -0
- data/lib/stylet/version.rb +3 -0
- data/log/.gitkeep +0 -0
- data/stylet.gemspec +31 -0
- data/test/test_helper.rb +6 -0
- data/test/test_input_base.rb +12 -0
- data/test/test_input_key_one.rb +43 -0
- data/test/test_input_support.rb +47 -0
- data/test/test_sample.rb +13 -0
- data/test/test_state.rb +26 -0
- data/tips.org +16 -0
- metadata +391 -0
@@ -0,0 +1,26 @@
|
|
1
|
+
# 特定のエリアだけ徐々に消す
|
2
|
+
require_relative "helper"
|
3
|
+
|
4
|
+
class App < Stylet::Base
|
5
|
+
include Helper::Cursor
|
6
|
+
|
7
|
+
setup do
|
8
|
+
@area_rc = vec2[srect.w / 2, srect.h / 2] # 表示エリアの横縦幅
|
9
|
+
@image = SDL::Surface.load("assets/bg960x480_green_ruins.png").display_format
|
10
|
+
end
|
11
|
+
|
12
|
+
update do
|
13
|
+
draw_triangle(srect.center, :radius => 128, :angle => 1.0 / 256 * frame_counter)
|
14
|
+
end
|
15
|
+
|
16
|
+
def background_clear
|
17
|
+
area_xy = *(cursor.point - (@area_rc / 2)) # 表示エリアの左上を求める
|
18
|
+
surface = screen.copy_rect(*area_xy, *@area_rc) # 表示部分を切り取る
|
19
|
+
surface.draw_filled_rect_alpha(0, 0, surface.w, surface.h, [0, 0, 0], 8) # 切り取った部分を9割消す
|
20
|
+
screen.put(@image, 0, 0) # 背景消去(画像で背景全体描画)
|
21
|
+
screen.put(surface, *area_xy) # 切り取って加工した部分を戻す(上書きする)
|
22
|
+
surface.destroy # 作業用のサーフェスを消す(消さなくても動いた)
|
23
|
+
end
|
24
|
+
|
25
|
+
run
|
26
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require_relative "helper"
|
2
|
+
|
3
|
+
class App < Stylet::Base
|
4
|
+
include Helper::Cursor
|
5
|
+
|
6
|
+
setup do
|
7
|
+
s = SDL::Surface.load("assets/mario.png")
|
8
|
+
s.set_color_key(SDL::SRCCOLORKEY, 0)
|
9
|
+
@image = s.display_format
|
10
|
+
end
|
11
|
+
|
12
|
+
update do
|
13
|
+
screen.put(@image, *cursor.point)
|
14
|
+
end
|
15
|
+
|
16
|
+
run
|
17
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# 画像を切り替えるだけのアニメーション
|
2
|
+
require_relative "helper"
|
3
|
+
|
4
|
+
class App < Stylet::Base
|
5
|
+
include Helper::Cursor
|
6
|
+
|
7
|
+
setup do
|
8
|
+
s = SDL::Surface.load("assets/coin_anim_x4.png") # 16x16 x 横4
|
9
|
+
s.set_color_key(SDL::SRCCOLORKEY, 0)
|
10
|
+
@image = s.display_format
|
11
|
+
end
|
12
|
+
|
13
|
+
update do
|
14
|
+
SDL::Surface.blit(@image, (frame_counter / 8).modulo(4) * 16, 0, 16, 16, screen, *srect.center)
|
15
|
+
end
|
16
|
+
|
17
|
+
run
|
18
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require_relative "helper"
|
2
|
+
|
3
|
+
class App < Stylet::Base
|
4
|
+
include Helper::Cursor
|
5
|
+
|
6
|
+
setup do
|
7
|
+
s = SDL::Surface.load("assets/mario.png")
|
8
|
+
s.set_color_key(SDL::SRCCOLORKEY, 0)
|
9
|
+
@image = s.display_format
|
10
|
+
end
|
11
|
+
|
12
|
+
update do
|
13
|
+
SDL::Surface.transform_blit(@image, screen,
|
14
|
+
Stylet::Magic.rsin(1.0 / 256 * frame_counter) * 180,
|
15
|
+
Stylet::Magic.rsin(1.0 / 256 * frame_counter * 7 / 5) * 24,
|
16
|
+
Stylet::Magic.rsin(1.0 / 256 * frame_counter * 8 / 5) * 24,
|
17
|
+
@image.w / 2, @image.h / 2, *cursor.point, 0)
|
18
|
+
end
|
19
|
+
|
20
|
+
run
|
21
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# PS3のコントローラーはアナログレバーは見た目は円だけど内部では四角なことの確認
|
2
|
+
require "./setup"
|
3
|
+
|
4
|
+
ANALOG_LEVER_MAX = 32767
|
5
|
+
ANALOG_LEVER_MAGNITUDE_MAX = Math.sqrt(ANALOG_LEVER_MAX**2 + ANALOG_LEVER_MAX**2)
|
6
|
+
|
7
|
+
Stylet.run do
|
8
|
+
joys.each do |joy|
|
9
|
+
joy.available_analog_levers.each do |key, state|
|
10
|
+
v = vec2[*state]
|
11
|
+
vputs [joy.name, key, v.magnitude]
|
12
|
+
|
13
|
+
# 取得した値をそのまま使うと斜めのベクトルが強くなりすぎる
|
14
|
+
# たんなる方向を示したいときはこれで問題ない
|
15
|
+
m = v.magnitude
|
16
|
+
rate = m.to_f / ANALOG_LEVER_MAGNITUDE_MAX
|
17
|
+
draw_vector(v.normalize * (rate * (srect.height / 2)), :origin => srect.center, :label => m.round)
|
18
|
+
|
19
|
+
# 斜めのベクトルが強くなりすぎないように制限を加えた例
|
20
|
+
m = v.magnitude
|
21
|
+
if m >= ANALOG_LEVER_MAX
|
22
|
+
m = ANALOG_LEVER_MAX
|
23
|
+
end
|
24
|
+
rate = m.to_f / ANALOG_LEVER_MAX
|
25
|
+
draw_vector(v.normalize * (rate * (srect.height / 2)), :origin => srect.center, :label => m.round)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
draw_circle(srect.center, :vertex => 64, :radius => srect.height / 2)
|
30
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# PS3のコントローラーはアナログレバーは見た目は円だけど内部では四角
|
2
|
+
require "./setup"
|
3
|
+
|
4
|
+
Stylet.run do
|
5
|
+
joys.each do |joy|
|
6
|
+
joy.adjusted_analog_levers.each do |key, vector|
|
7
|
+
vputs [key, vector]
|
8
|
+
draw_vector(vector * (srect.height / 2), :origin => srect.center, :label => vector.round(2))
|
9
|
+
end
|
10
|
+
end
|
11
|
+
draw_circle(srect.center, :vertex => 64, :radius => srect.height / 2)
|
12
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# キーボードの入力チェック
|
2
|
+
require "./setup"
|
3
|
+
|
4
|
+
class Player
|
5
|
+
include Stylet::Input::Base
|
6
|
+
include Stylet::Input::StandardKeybordBind
|
7
|
+
|
8
|
+
def update
|
9
|
+
raise if defined? super
|
10
|
+
key_bit_update_all
|
11
|
+
key_counter_update_all
|
12
|
+
Stylet.context.vputs(to_s)
|
13
|
+
Stylet.context.vputs(axis_angle_index.to_s)
|
14
|
+
Stylet.context.vputs(axis_angle.to_s)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
class App < Stylet::Base
|
19
|
+
setup do
|
20
|
+
self.title = "キーボードの入力チェック"
|
21
|
+
@player = Player.new
|
22
|
+
end
|
23
|
+
|
24
|
+
update do
|
25
|
+
@player.update
|
26
|
+
end
|
27
|
+
|
28
|
+
run
|
29
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
# フォント関連
|
2
|
+
require "./setup"
|
3
|
+
|
4
|
+
Stylet.run do
|
5
|
+
vputs "left", :vector => srect.center + [0, system_font.line_skip * 0], :align => :left
|
6
|
+
vputs "center", :vector => srect.center + [0, system_font.line_skip * 1], :align => :center
|
7
|
+
vputs "right", :vector => srect.center + [0, system_font.line_skip * 2], :align => :right
|
8
|
+
end
|
data/examples/00390_/343/203/225/343/202/251/343/203/263/343/203/210/344/270/200/350/246/247.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
require "./setup"
|
2
|
+
|
3
|
+
Stylet::FontList.send(:memory_record_reset, Stylet.config.font_list + [
|
4
|
+
{:key => :font_small, :path => "LiberationMono-Bold.ttf", :bold => true, :font_size => 12},
|
5
|
+
{:key => :font_midium, :path => "LiberationMono-Bold.ttf", :bold => true, :font_size => 16},
|
6
|
+
{:key => :font_large, :path => "LiberationMono-Bold.ttf", :bold => true, :font_size => 24},
|
7
|
+
{:key => :coda, :path => "Coda-Regular.ttf", :bold => false, :font_size => 14},
|
8
|
+
])
|
9
|
+
|
10
|
+
Stylet.run do
|
11
|
+
Stylet::FontList.each {|e| vputs [e.key, "Aa12KIA_漢;:"].join(" "), :font => e }
|
12
|
+
|
13
|
+
vputs "bold true", :bold => true
|
14
|
+
vputs "bold false", :bold => false
|
15
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
#
|
2
|
+
# Vector#rotate の確認
|
3
|
+
#
|
4
|
+
require "./setup"
|
5
|
+
|
6
|
+
pos1 = Stylet::Vector.new(100, 0)
|
7
|
+
pos2 = Stylet::Vector.new(100, 0)
|
8
|
+
Stylet.run(:title => "Vector#rotate系の二つのメソッドの確認") do
|
9
|
+
pos1 = pos1.rotate(1.0 / 256)
|
10
|
+
pos2 = pos2.rotate2(1.0 / 256)
|
11
|
+
vputs(pos1 == pos2)
|
12
|
+
vputs "1: #{pos1}"
|
13
|
+
vputs "2: #{pos2}"
|
14
|
+
draw_triangle(srect.center + pos1, :radius => 64, :angle => pos1.angle)
|
15
|
+
draw_triangle(srect.center + pos2, :radius => 64, :angle => pos2.angle)
|
16
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
#
|
2
|
+
# マウスの位置からZボタンで放物線を描く三角を表示
|
3
|
+
#
|
4
|
+
require_relative "helper"
|
5
|
+
|
6
|
+
class Ball
|
7
|
+
include Stylet::Delegators
|
8
|
+
|
9
|
+
def initialize(p0, speed, friction)
|
10
|
+
@p0 = p0
|
11
|
+
@speed = speed
|
12
|
+
@friction = friction
|
13
|
+
@radius = 16
|
14
|
+
end
|
15
|
+
|
16
|
+
def update
|
17
|
+
@speed += @friction
|
18
|
+
@p0 += @speed
|
19
|
+
draw_triangle(@p0, :radius => @radius, :angle => 1.0 / 64 * frame_counter)
|
20
|
+
end
|
21
|
+
|
22
|
+
def screen_out?
|
23
|
+
@speed.y > 0 && @p0.y > (srect.max_y + @radius)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
class App < Stylet::Base
|
28
|
+
include Helper::CursorWithObjectCollection
|
29
|
+
|
30
|
+
update do
|
31
|
+
if button.btA.counter.modulo(4) == 1
|
32
|
+
@objects << Ball.new(cursor.point.clone, vec2[0, -12], vec2[0, 0.2])
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
run
|
37
|
+
end
|
@@ -0,0 +1,88 @@
|
|
1
|
+
#
|
2
|
+
# マウスで円をアイスホッケーの球のように動かすアルゴリズム
|
3
|
+
#
|
4
|
+
require_relative "helper"
|
5
|
+
|
6
|
+
#
|
7
|
+
# 円の中心
|
8
|
+
# p0 (見えない)
|
9
|
+
# \
|
10
|
+
# \ radius
|
11
|
+
# \
|
12
|
+
# 座標 pos (見える)
|
13
|
+
# 方向 dir
|
14
|
+
#
|
15
|
+
class IceHockey < Stylet::Base
|
16
|
+
include Helper::CursorWithObjectCollection
|
17
|
+
|
18
|
+
setup do
|
19
|
+
cursor.display = false
|
20
|
+
|
21
|
+
@p0 = srect.center.clone # 物体の中心点
|
22
|
+
@pos = @p0.clone # 物体の位置
|
23
|
+
@speed = 0 # 速度
|
24
|
+
@radius = 0 # 中心からの移動量
|
25
|
+
@dir = 0 # 中心からの移動角度
|
26
|
+
@lock = false
|
27
|
+
|
28
|
+
@body_radius = 64 # 物体の大きさ
|
29
|
+
@speed_max = 16 # 速度最大
|
30
|
+
@friction = 0.3 # 摩擦
|
31
|
+
end
|
32
|
+
|
33
|
+
update do
|
34
|
+
# ボタンをクリックした瞬間に、
|
35
|
+
if button.btA.trigger?
|
36
|
+
# 自分の円のなかにカーソルがあればロックする
|
37
|
+
if @pos.distance_to(mouse.point) < @body_radius
|
38
|
+
@lock = true
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
# ロックしているときに、ボタンが押されっぱなしなら
|
43
|
+
if @lock && button.btA.press?
|
44
|
+
@p0 = mouse.point.clone # 円の座標をマウスと同じにする
|
45
|
+
@power = mouse.vector.magnitude # マウスの直前からの移動距離を速度と考える
|
46
|
+
@speed = 0 # 速度を0とする
|
47
|
+
@radius = 0 # 半径を0とする
|
48
|
+
end
|
49
|
+
|
50
|
+
# ボタンが離された瞬間
|
51
|
+
if button.btA.free_trigger?
|
52
|
+
# ロックを解除する
|
53
|
+
@lock = false
|
54
|
+
# 速度が設定されていれば
|
55
|
+
if @power
|
56
|
+
@speed = @power # 速度を円に反映し、
|
57
|
+
@dir = mouse.vector.angle # 円の方向にマウスが移動した方向を合わせる
|
58
|
+
@power = nil # 球が動いているときにボタンを連打すると @dir が再設定されてしまうので nil にしておく
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
# 摩擦によって速度が落ちる
|
63
|
+
@speed -= @friction
|
64
|
+
|
65
|
+
# 速度調整
|
66
|
+
@speed = Stylet::Chore.clamp(@speed, (0..@speed_max))
|
67
|
+
|
68
|
+
# 速度反映
|
69
|
+
@radius += @speed
|
70
|
+
|
71
|
+
# 進んだ位置を計算
|
72
|
+
_p = @p0 + vec2.angle_at(@dir) * @radius
|
73
|
+
|
74
|
+
# 画面内なら更新
|
75
|
+
if Stylet::CollisionSupport.rect_in?(srect, _p)
|
76
|
+
@pos = _p
|
77
|
+
end
|
78
|
+
|
79
|
+
draw_circle(@pos, :radius => @body_radius, :vertex => 32)
|
80
|
+
draw_line(@p0, @pos)
|
81
|
+
vputs @power
|
82
|
+
vputs @pos.distance_to(mouse.point)
|
83
|
+
vputs @speed
|
84
|
+
vputs @radius
|
85
|
+
end
|
86
|
+
|
87
|
+
run
|
88
|
+
end
|
@@ -0,0 +1,120 @@
|
|
1
|
+
#
|
2
|
+
# ブロックとブロックの当たり判定
|
3
|
+
#
|
4
|
+
require_relative "helper"
|
5
|
+
|
6
|
+
class App < Stylet::Base
|
7
|
+
include Helper::CursorWithObjectCollection
|
8
|
+
|
9
|
+
setup do
|
10
|
+
self.title = "ブロックとブロックの当たり判定"
|
11
|
+
|
12
|
+
# A
|
13
|
+
@pA = srect.center.clone # 点
|
14
|
+
@rA = Stylet::Rect4.centered_create(40, 40) # 大きさ
|
15
|
+
@sA = vec2.angle_at(Stylet::Magic.degree(180 + 90)) # 速度
|
16
|
+
|
17
|
+
# B
|
18
|
+
@pB = srect.center.clone # 点
|
19
|
+
@rB = Stylet::Rect4.centered_create(100, 60) # 大きさ
|
20
|
+
@sB = vec2.angle_at(Stylet::Magic.degree(45)) # 速度
|
21
|
+
|
22
|
+
@speed = 100 # 速度ベクトル 1.0 を画面上では何ドットで表わすか?
|
23
|
+
@max_length = 1 # どれだけめり込んだら当たったとみなすか?
|
24
|
+
|
25
|
+
cursor.vertex = 3
|
26
|
+
end
|
27
|
+
|
28
|
+
update do
|
29
|
+
# 操作
|
30
|
+
begin
|
31
|
+
# AとBで速度ベクトルの反映
|
32
|
+
@pA += @sA.scale(button.btA.repeat_0or1) + @sA.scale(-button.btB.repeat_0or1)
|
33
|
+
@pB += @sB.scale(button.btA.repeat_0or1) + @sB.scale(-button.btB.repeat_0or1)
|
34
|
+
|
35
|
+
# Cボタンおしっぱなし + マウスで自機位置移動
|
36
|
+
if button.btC.press?
|
37
|
+
@pA = cursor.point.clone
|
38
|
+
end
|
39
|
+
|
40
|
+
# Dボタンおしっぱなし + マウスで自機角度変更
|
41
|
+
if button.btD.press?
|
42
|
+
if cursor.point != @pA
|
43
|
+
@sA = (cursor.point - @pA).normalize * @sA.magnitude
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
# それぞれを実座標に変換
|
49
|
+
@tA = @rA.vector_add(@pA)
|
50
|
+
@tB = @rB.vector_add(@pB)
|
51
|
+
|
52
|
+
# めりこみサイズを4辺について調べる
|
53
|
+
_l = @tA.max_xi - @tB.min_xi # A|B
|
54
|
+
_r = @tB.max_xi - @tA.min_xi # B|A
|
55
|
+
_u = @tA.max_yi - @tB.min_yi # A/B
|
56
|
+
_d = @tB.max_yi - @tA.min_yi # B/A
|
57
|
+
|
58
|
+
# 当たり判定
|
59
|
+
@collision = false
|
60
|
+
if true &&
|
61
|
+
_l >= @max_length && # A|B
|
62
|
+
_r >= @max_length && # B|A
|
63
|
+
_u >= @max_length && # A/B
|
64
|
+
_d >= @max_length && # B/A
|
65
|
+
true
|
66
|
+
|
67
|
+
# __fill_rect2(@tA)
|
68
|
+
|
69
|
+
faces = {_l => :l, _r => :r, _u => :u, _d => :d}
|
70
|
+
vputs faces.sort.inspect
|
71
|
+
|
72
|
+
face = faces.sort.first.last
|
73
|
+
diff = case face
|
74
|
+
when :r then vec2[_r + 1, 0]
|
75
|
+
when :d then vec2[0, _d + 1]
|
76
|
+
when :u then vec2[0, -(_u + 1)]
|
77
|
+
when :l then vec2[-(_l + 1), 0]
|
78
|
+
end
|
79
|
+
|
80
|
+
@collision = true
|
81
|
+
@pA += diff
|
82
|
+
|
83
|
+
# これも一旦ずらして、反射を入れる
|
84
|
+
|
85
|
+
# 両方はねかえる
|
86
|
+
# @pA += diff / 2
|
87
|
+
# @pB -= diff / 2
|
88
|
+
|
89
|
+
# @tA = @tA.vector_add(diff.scale(0.99))
|
90
|
+
# @pB -= diff.scale(0.01)
|
91
|
+
|
92
|
+
# # 実座標から大きさベクトルを引くと中心点になる
|
93
|
+
# @pA = @tA.to_vector - @rA.to_vector
|
94
|
+
|
95
|
+
@tA = @rA.vector_add(@pA)
|
96
|
+
@tB = @rB.vector_add(@pB)
|
97
|
+
end
|
98
|
+
|
99
|
+
# screen.fill_rect(10, 10, 0, 0, [255, 255, 255])
|
100
|
+
# draw_rect(@tA, :fill => @collision)
|
101
|
+
|
102
|
+
draw_rect(@tA, :fill => @collision)
|
103
|
+
|
104
|
+
if button.btC.press? && @collision
|
105
|
+
# ゴーストの表示
|
106
|
+
draw_rect(@rA.vector_add(cursor.point))
|
107
|
+
end
|
108
|
+
|
109
|
+
vputs "A", :vector => @pA
|
110
|
+
vputs "A: #{@tA}"
|
111
|
+
draw_vector(@sA.scale(@speed), :origin => @pA, :label => @sA.magnitude)
|
112
|
+
|
113
|
+
draw_rect(@rB.vector_add(@pB))
|
114
|
+
vputs "B", :vector => @pB
|
115
|
+
vputs "B: #{@rB}"
|
116
|
+
draw_vector(@sB.scale(@speed), :origin => @pB, :label => @sB.magnitude)
|
117
|
+
end
|
118
|
+
|
119
|
+
run
|
120
|
+
end
|