Tilting Google Maps and MissileLauncher

Tatsuhiko Miyagawa
Tatsuhiko MiyagawaSoftware Engineer
傾斜  Google  地圖 & 火箭発射器 宮川達彦 [email_address] Six Apart, Ltd. /  渋谷  Perl  推廣組   osdc.tw  台北  2007/04/15
 
[object Object],[object Object]
[object Object],[object Object]
[object Object],[object Object]
[object Object],[object Object]
[object Object],[object Object]
 
[object Object],[object Object],[object Object]
C++ if( !DeviceIoControl( hFile, 0x733fc, NULL, 0, // via IOCTL(0x733fc) (void *)&AccelerometerData, 0x24, &ulRead, NULL)) throw "Failed to DeviceIoControl"; X = AccelerometerData.x0 + OffsetX; Y = AccelerometerData.y0 + OffsetY;
Ruby device = Device.new ' \\\\ . \\ ShockMgr' device.open values = device.io(command, result_size).unpack("x4s*") cx = values[3] cy = values[2]
Perl  移植 use Win32API::File; my $file = createFile("//./ShockMgr", "r ke") or die "Can't get ShockMgr device"; DeviceIoControl($file, 0x733fc, [], 0, my($buf), 0x24, my($bytes), []); my @data = unpack "x4s*", $buf;
tilt-missile.pl (1/3) use Time::HiRes qw(sleep); use Win32::API; use Win32API::File qw(:ALL); use Win32::OLE; sub get_pos { my $file = createFile("//./ShockMgr", "r ke")  or die "Can't get ShockMgr device"; DeviceIoControl($file, 0x733fc, [], 0, my($buf), 0x24,  my($bytes), []); my @data = unpack "x4s*", $buf; return @data; }
tilt-missile.pl (2/3) my @pos = get_pos; my($base_x, $base_y) = @pos[3, 2]; while (my @pos = get_pos) { my $ax = ($pos[1] - $base_x) / 30; my $ay = ($pos[0] - $base_y) / 30; my $command = detect_command($ax, $ay); system("ctlmissile $command") if $command; }
tilt-missile.pl (3/3) sub detect_command { my($ax, $ay) = @_; if (abs($ax) >= 180 || abs($ay) >= 180) { return "fire"; } elsif ($ax >= 80) { return "right"; } … }
[object Object]
[object Object]
[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object]
[object Object]
gmaps.html (1/2) <script  language=&quot;JavaScript&quot; > function load() { if (GBrowserIsCompatible()) { map = new GMap2(document.getElementById(&quot;map&quot;)); map.addControl(new GLargeMapControl()); map.addControl(new GMapTypeControl()); if (debug)  document.getElementById('log').style.visibility = 'visible'; GEvent.addListener(map, &quot;dragstart&quot;, function() { dragging = 1 }); GEvent.addListener(map, &quot;dragend&quot;, function() { var center = map.getCenter(); x = center.x; y = center.y; dragging = 0; }); … map.setCenter(new GLatLng(y, x), 14); base =  get_pos(1). split(/,/); </script>
gmaps.html (2/2) <script  language=&quot;PerlScript&quot; > use Win32API::File qw(:ALL); sub get_pos { my $base = shift; my $file = createFile(&quot;//./ShockMgr&quot;, &quot;r ke&quot;) or die &quot;Can't get ShockMgr device&quot;; DeviceIoControl($file, 0x733fc, [], 0,  my($buf), 0x24, my($bytes), []); my @data = unpack &quot;x4s*&quot;, $buf; return join &quot;,&quot;, ($base ? @data[3, 2] : @data[1, 0]); } </script>
[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object]
1 of 25

Recommended

Vcs23 by
Vcs23Vcs23
Vcs23Malikireddy Bramhananda Reddy
302 views15 slides
Dion Almaer & Ben Galbraith - Build Once, Deploy Everywhere by
Dion Almaer & Ben Galbraith - Build Once, Deploy EverywhereDion Almaer & Ben Galbraith - Build Once, Deploy Everywhere
Dion Almaer & Ben Galbraith - Build Once, Deploy EverywhereCarsonified Team
2.6K views43 slides
Drones, Flying robots and Javascript by
Drones, Flying robots and JavascriptDrones, Flying robots and Javascript
Drones, Flying robots and JavascriptLaurent Eschenauer
5.6K views26 slides
node.js and the AR.Drone: building a real-time dashboard using socket.io by
node.js and the AR.Drone: building a real-time dashboard using socket.ionode.js and the AR.Drone: building a real-time dashboard using socket.io
node.js and the AR.Drone: building a real-time dashboard using socket.ioSteven Beeckman
15.9K views26 slides
Advanced programming with #nodecopter by
Advanced programming with #nodecopterAdvanced programming with #nodecopter
Advanced programming with #nodecopterLaurent Eschenauer
19.8K views46 slides
Debugging JavaScript with Chrome by
Debugging JavaScript with ChromeDebugging JavaScript with Chrome
Debugging JavaScript with ChromeIgor Zalutsky
872 views14 slides

More Related Content

What's hot

Oops in c++ by
Oops in c++Oops in c++
Oops in c++DravidSh
49 views5 slides
Cpp by
Cpp Cpp
Cpp Ankit Dubey
44 views6 slides
openFrameworks、サウンド機能・音響合成、ofxMaxim, ofxOsc, ofxPd, ofxSuperCollider by
openFrameworks、サウンド機能・音響合成、ofxMaxim, ofxOsc, ofxPd, ofxSuperCollideropenFrameworks、サウンド機能・音響合成、ofxMaxim, ofxOsc, ofxPd, ofxSuperCollider
openFrameworks、サウンド機能・音響合成、ofxMaxim, ofxOsc, ofxPd, ofxSuperColliderAtsushi Tadokoro
11.2K views81 slides
JavaScript - Agora nervoso by
JavaScript - Agora nervosoJavaScript - Agora nervoso
JavaScript - Agora nervosoLuis Vendrame
114 views23 slides
Barcamp GoogleMaps - praktické ukázky kódu by
Barcamp GoogleMaps - praktické ukázky kóduBarcamp GoogleMaps - praktické ukázky kódu
Barcamp GoogleMaps - praktické ukázky kóduMilos Lenoch
686 views13 slides
Interactive Music II ProcessingとSuperColliderの連携 -2 by
Interactive Music II ProcessingとSuperColliderの連携 -2Interactive Music II ProcessingとSuperColliderの連携 -2
Interactive Music II ProcessingとSuperColliderの連携 -2Atsushi Tadokoro
4.5K views27 slides

What's hot(16)

Oops in c++ by DravidSh
Oops in c++Oops in c++
Oops in c++
DravidSh49 views
openFrameworks、サウンド機能・音響合成、ofxMaxim, ofxOsc, ofxPd, ofxSuperCollider by Atsushi Tadokoro
openFrameworks、サウンド機能・音響合成、ofxMaxim, ofxOsc, ofxPd, ofxSuperCollideropenFrameworks、サウンド機能・音響合成、ofxMaxim, ofxOsc, ofxPd, ofxSuperCollider
openFrameworks、サウンド機能・音響合成、ofxMaxim, ofxOsc, ofxPd, ofxSuperCollider
Atsushi Tadokoro11.2K views
JavaScript - Agora nervoso by Luis Vendrame
JavaScript - Agora nervosoJavaScript - Agora nervoso
JavaScript - Agora nervoso
Luis Vendrame114 views
Barcamp GoogleMaps - praktické ukázky kódu by Milos Lenoch
Barcamp GoogleMaps - praktické ukázky kóduBarcamp GoogleMaps - praktické ukázky kódu
Barcamp GoogleMaps - praktické ukázky kódu
Milos Lenoch686 views
Interactive Music II ProcessingとSuperColliderの連携 -2 by Atsushi Tadokoro
Interactive Music II ProcessingとSuperColliderの連携 -2Interactive Music II ProcessingとSuperColliderの連携 -2
Interactive Music II ProcessingとSuperColliderの連携 -2
Atsushi Tadokoro4.5K views
Seaborn graphing present by Yilin Zeng
Seaborn graphing presentSeaborn graphing present
Seaborn graphing present
Yilin Zeng229 views
What they don't tell you about JavaScript by Raphael Cruzeiro
What they don't tell you about JavaScriptWhat they don't tell you about JavaScript
What they don't tell you about JavaScript
Raphael Cruzeiro359 views
From Javascript To Haskell by ujihisa
From Javascript To HaskellFrom Javascript To Haskell
From Javascript To Haskell
ujihisa2.1K views
Star bed 2018.07.19 by Ruo Ando
Star bed 2018.07.19Star bed 2018.07.19
Star bed 2018.07.19
Ruo Ando189 views
Daniel Sikar: Hadoop MapReduce - 06/09/2010 by Skills Matter
Daniel Sikar: Hadoop MapReduce - 06/09/2010 Daniel Sikar: Hadoop MapReduce - 06/09/2010
Daniel Sikar: Hadoop MapReduce - 06/09/2010
Skills Matter1.3K views

Similar to Tilting Google Maps and MissileLauncher

Groovy by
GroovyGroovy
GroovyZen Urban
1.1K views35 slides
Html and i_phone_mobile-2 by
Html and i_phone_mobile-2Html and i_phone_mobile-2
Html and i_phone_mobile-2tonvanbart
610 views21 slides
Apache Commons - Don\'t re-invent the wheel by
Apache Commons - Don\'t re-invent the wheelApache Commons - Don\'t re-invent the wheel
Apache Commons - Don\'t re-invent the wheeltcurdt
3.9K views44 slides
JQuery Flot by
JQuery FlotJQuery Flot
JQuery FlotArshavski Alexander
4K views44 slides
Bti1022 lab sheet 8 by
Bti1022 lab sheet 8Bti1022 lab sheet 8
Bti1022 lab sheet 8alish sha
252 views4 slides
Bti1022 lab sheet 8 by
Bti1022 lab sheet 8Bti1022 lab sheet 8
Bti1022 lab sheet 8alish sha
319 views4 slides

Similar to Tilting Google Maps and MissileLauncher(20)

Groovy by Zen Urban
GroovyGroovy
Groovy
Zen Urban1.1K views
Html and i_phone_mobile-2 by tonvanbart
Html and i_phone_mobile-2Html and i_phone_mobile-2
Html and i_phone_mobile-2
tonvanbart610 views
Apache Commons - Don\'t re-invent the wheel by tcurdt
Apache Commons - Don\'t re-invent the wheelApache Commons - Don\'t re-invent the wheel
Apache Commons - Don\'t re-invent the wheel
tcurdt3.9K views
Bti1022 lab sheet 8 by alish sha
Bti1022 lab sheet 8Bti1022 lab sheet 8
Bti1022 lab sheet 8
alish sha252 views
Bti1022 lab sheet 8 by alish sha
Bti1022 lab sheet 8Bti1022 lab sheet 8
Bti1022 lab sheet 8
alish sha319 views
ISCA Final Presentaiton - Compilations by HSA Foundation
ISCA Final Presentaiton -  CompilationsISCA Final Presentaiton -  Compilations
ISCA Final Presentaiton - Compilations
HSA Foundation1.4K views
Building Complex GUI Apps The Right Way. With Ample SDK - SWDC2010 by Sergey Ilinsky
Building Complex GUI Apps The Right Way. With Ample SDK - SWDC2010Building Complex GUI Apps The Right Way. With Ample SDK - SWDC2010
Building Complex GUI Apps The Right Way. With Ample SDK - SWDC2010
Sergey Ilinsky1.5K views
[245] presto 내부구조 파헤치기 by NAVER D2
[245] presto 내부구조 파헤치기[245] presto 내부구조 파헤치기
[245] presto 내부구조 파헤치기
NAVER D210.1K views
Whats new in_csharp4 by Abed Bukhari
Whats new in_csharp4Whats new in_csharp4
Whats new in_csharp4
Abed Bukhari942 views
Arcgis 10中的python by fengdjhy
Arcgis 10中的pythonArcgis 10中的python
Arcgis 10中的python
fengdjhy679 views
Beyond Breakpoints: A Tour of Dynamic Analysis by Fastly
Beyond Breakpoints: A Tour of Dynamic AnalysisBeyond Breakpoints: A Tour of Dynamic Analysis
Beyond Breakpoints: A Tour of Dynamic Analysis
Fastly347 views
Assignment no39 by Jay Patel
Assignment no39Assignment no39
Assignment no39
Jay Patel576 views
A CTF Hackers Toolbox by Stefan
A CTF Hackers ToolboxA CTF Hackers Toolbox
A CTF Hackers Toolbox
Stefan 5.8K views
Python And GIS - Beyond Modelbuilder And Pythonwin by Chad Cooper
Python And GIS - Beyond Modelbuilder And PythonwinPython And GIS - Beyond Modelbuilder And Pythonwin
Python And GIS - Beyond Modelbuilder And Pythonwin
Chad Cooper648 views

More from Tatsuhiko Miyagawa

Carton CPAN dependency manager by
Carton CPAN dependency managerCarton CPAN dependency manager
Carton CPAN dependency managerTatsuhiko Miyagawa
4.1K views39 slides
Deploying Plack Web Applications: OSCON 2011 by
Deploying Plack Web Applications: OSCON 2011Deploying Plack Web Applications: OSCON 2011
Deploying Plack Web Applications: OSCON 2011Tatsuhiko Miyagawa
8.2K views143 slides
Plack at OSCON 2010 by
Plack at OSCON 2010Plack at OSCON 2010
Plack at OSCON 2010Tatsuhiko Miyagawa
42K views138 slides
cpanminus at YAPC::NA 2010 by
cpanminus at YAPC::NA 2010cpanminus at YAPC::NA 2010
cpanminus at YAPC::NA 2010Tatsuhiko Miyagawa
1.6K views31 slides
Plack at YAPC::NA 2010 by
Plack at YAPC::NA 2010Plack at YAPC::NA 2010
Plack at YAPC::NA 2010Tatsuhiko Miyagawa
3.7K views117 slides
PSGI/Plack OSDC.TW by
PSGI/Plack OSDC.TWPSGI/Plack OSDC.TW
PSGI/Plack OSDC.TWTatsuhiko Miyagawa
3.1K views118 slides

More from Tatsuhiko Miyagawa(20)

Deploying Plack Web Applications: OSCON 2011 by Tatsuhiko Miyagawa
Deploying Plack Web Applications: OSCON 2011Deploying Plack Web Applications: OSCON 2011
Deploying Plack Web Applications: OSCON 2011
Tatsuhiko Miyagawa8.2K views
Plack perl superglue for web frameworks and servers by Tatsuhiko Miyagawa
Plack perl superglue for web frameworks and serversPlack perl superglue for web frameworks and servers
Plack perl superglue for web frameworks and servers
Tatsuhiko Miyagawa6.7K views
Remedie: Building a desktop app with HTTP::Engine, SQLite and jQuery by Tatsuhiko Miyagawa
Remedie: Building a desktop app with HTTP::Engine, SQLite and jQueryRemedie: Building a desktop app with HTTP::Engine, SQLite and jQuery
Remedie: Building a desktop app with HTTP::Engine, SQLite and jQuery
Tatsuhiko Miyagawa39.1K views
Building a desktop app with HTTP::Engine, SQLite and jQuery by Tatsuhiko Miyagawa
Building a desktop app with HTTP::Engine, SQLite and jQueryBuilding a desktop app with HTTP::Engine, SQLite and jQuery
Building a desktop app with HTTP::Engine, SQLite and jQuery
Tatsuhiko Miyagawa4.2K views

Recently uploaded

20231123_Camunda Meetup Vienna.pdf by
20231123_Camunda Meetup Vienna.pdf20231123_Camunda Meetup Vienna.pdf
20231123_Camunda Meetup Vienna.pdfPhactum Softwareentwicklung GmbH
49 views73 slides
Confidence in CloudStack - Aron Wagner, Nathan Gleason - Americ by
Confidence in CloudStack - Aron Wagner, Nathan Gleason - AmericConfidence in CloudStack - Aron Wagner, Nathan Gleason - Americ
Confidence in CloudStack - Aron Wagner, Nathan Gleason - AmericShapeBlue
58 views9 slides
What’s New in CloudStack 4.19 - Abhishek Kumar - ShapeBlue by
What’s New in CloudStack 4.19 - Abhishek Kumar - ShapeBlueWhat’s New in CloudStack 4.19 - Abhishek Kumar - ShapeBlue
What’s New in CloudStack 4.19 - Abhishek Kumar - ShapeBlueShapeBlue
191 views23 slides
TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f... by
TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f...TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f...
TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f...TrustArc
130 views29 slides
CloudStack and GitOps at Enterprise Scale - Alex Dometrius, Rene Glover - AT&T by
CloudStack and GitOps at Enterprise Scale - Alex Dometrius, Rene Glover - AT&TCloudStack and GitOps at Enterprise Scale - Alex Dometrius, Rene Glover - AT&T
CloudStack and GitOps at Enterprise Scale - Alex Dometrius, Rene Glover - AT&TShapeBlue
81 views34 slides
Future of AR - Facebook Presentation by
Future of AR - Facebook PresentationFuture of AR - Facebook Presentation
Future of AR - Facebook PresentationRob McCarty
54 views27 slides

Recently uploaded(20)

Confidence in CloudStack - Aron Wagner, Nathan Gleason - Americ by ShapeBlue
Confidence in CloudStack - Aron Wagner, Nathan Gleason - AmericConfidence in CloudStack - Aron Wagner, Nathan Gleason - Americ
Confidence in CloudStack - Aron Wagner, Nathan Gleason - Americ
ShapeBlue58 views
What’s New in CloudStack 4.19 - Abhishek Kumar - ShapeBlue by ShapeBlue
What’s New in CloudStack 4.19 - Abhishek Kumar - ShapeBlueWhat’s New in CloudStack 4.19 - Abhishek Kumar - ShapeBlue
What’s New in CloudStack 4.19 - Abhishek Kumar - ShapeBlue
ShapeBlue191 views
TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f... by TrustArc
TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f...TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f...
TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f...
TrustArc130 views
CloudStack and GitOps at Enterprise Scale - Alex Dometrius, Rene Glover - AT&T by ShapeBlue
CloudStack and GitOps at Enterprise Scale - Alex Dometrius, Rene Glover - AT&TCloudStack and GitOps at Enterprise Scale - Alex Dometrius, Rene Glover - AT&T
CloudStack and GitOps at Enterprise Scale - Alex Dometrius, Rene Glover - AT&T
ShapeBlue81 views
Future of AR - Facebook Presentation by Rob McCarty
Future of AR - Facebook PresentationFuture of AR - Facebook Presentation
Future of AR - Facebook Presentation
Rob McCarty54 views
Webinar : Desperately Seeking Transformation - Part 2: Insights from leading... by The Digital Insurer
Webinar : Desperately Seeking Transformation - Part 2:  Insights from leading...Webinar : Desperately Seeking Transformation - Part 2:  Insights from leading...
Webinar : Desperately Seeking Transformation - Part 2: Insights from leading...
Igniting Next Level Productivity with AI-Infused Data Integration Workflows by Safe Software
Igniting Next Level Productivity with AI-Infused Data Integration Workflows Igniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration Workflows
Safe Software373 views
DRBD Deep Dive - Philipp Reisner - LINBIT by ShapeBlue
DRBD Deep Dive - Philipp Reisner - LINBITDRBD Deep Dive - Philipp Reisner - LINBIT
DRBD Deep Dive - Philipp Reisner - LINBIT
ShapeBlue110 views
KVM Security Groups Under the Hood - Wido den Hollander - Your.Online by ShapeBlue
KVM Security Groups Under the Hood - Wido den Hollander - Your.OnlineKVM Security Groups Under the Hood - Wido den Hollander - Your.Online
KVM Security Groups Under the Hood - Wido den Hollander - Your.Online
ShapeBlue154 views
Backroll, News and Demo - Pierre Charton, Matthias Dhellin, Ousmane Diarra - ... by ShapeBlue
Backroll, News and Demo - Pierre Charton, Matthias Dhellin, Ousmane Diarra - ...Backroll, News and Demo - Pierre Charton, Matthias Dhellin, Ousmane Diarra - ...
Backroll, News and Demo - Pierre Charton, Matthias Dhellin, Ousmane Diarra - ...
ShapeBlue121 views
Elevating Privacy and Security in CloudStack - Boris Stoyanov - ShapeBlue by ShapeBlue
Elevating Privacy and Security in CloudStack - Boris Stoyanov - ShapeBlueElevating Privacy and Security in CloudStack - Boris Stoyanov - ShapeBlue
Elevating Privacy and Security in CloudStack - Boris Stoyanov - ShapeBlue
ShapeBlue149 views
2FA and OAuth2 in CloudStack - Andrija Panić - ShapeBlue by ShapeBlue
2FA and OAuth2 in CloudStack - Andrija Panić - ShapeBlue2FA and OAuth2 in CloudStack - Andrija Panić - ShapeBlue
2FA and OAuth2 in CloudStack - Andrija Panić - ShapeBlue
ShapeBlue75 views
The Power of Heat Decarbonisation Plans in the Built Environment by IES VE
The Power of Heat Decarbonisation Plans in the Built EnvironmentThe Power of Heat Decarbonisation Plans in the Built Environment
The Power of Heat Decarbonisation Plans in the Built Environment
IES VE67 views
DRaaS using Snapshot copy and destination selection (DRaaS) - Alexandre Matti... by ShapeBlue
DRaaS using Snapshot copy and destination selection (DRaaS) - Alexandre Matti...DRaaS using Snapshot copy and destination selection (DRaaS) - Alexandre Matti...
DRaaS using Snapshot copy and destination selection (DRaaS) - Alexandre Matti...
ShapeBlue69 views
iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas... by Bernd Ruecker
iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas...iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas...
iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas...
Bernd Ruecker50 views
Centralized Logging Feature in CloudStack using ELK and Grafana - Kiran Chava... by ShapeBlue
Centralized Logging Feature in CloudStack using ELK and Grafana - Kiran Chava...Centralized Logging Feature in CloudStack using ELK and Grafana - Kiran Chava...
Centralized Logging Feature in CloudStack using ELK and Grafana - Kiran Chava...
ShapeBlue74 views
Automating a World-Class Technology Conference; Behind the Scenes of CiscoLive by Network Automation Forum
Automating a World-Class Technology Conference; Behind the Scenes of CiscoLiveAutomating a World-Class Technology Conference; Behind the Scenes of CiscoLive
Automating a World-Class Technology Conference; Behind the Scenes of CiscoLive

Tilting Google Maps and MissileLauncher

  • 1. 傾斜 Google 地圖 & 火箭発射器 宮川達彦 [email_address] Six Apart, Ltd. / 渋谷 Perl 推廣組 osdc.tw 台北 2007/04/15
  • 2.  
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.  
  • 9.
  • 10. C++ if( !DeviceIoControl( hFile, 0x733fc, NULL, 0, // via IOCTL(0x733fc) (void *)&AccelerometerData, 0x24, &ulRead, NULL)) throw &quot;Failed to DeviceIoControl&quot;; X = AccelerometerData.x0 + OffsetX; Y = AccelerometerData.y0 + OffsetY;
  • 11. Ruby device = Device.new ' \\\\ . \\ ShockMgr' device.open values = device.io(command, result_size).unpack(&quot;x4s*&quot;) cx = values[3] cy = values[2]
  • 12. Perl 移植 use Win32API::File; my $file = createFile(&quot;//./ShockMgr&quot;, &quot;r ke&quot;) or die &quot;Can't get ShockMgr device&quot;; DeviceIoControl($file, 0x733fc, [], 0, my($buf), 0x24, my($bytes), []); my @data = unpack &quot;x4s*&quot;, $buf;
  • 13. tilt-missile.pl (1/3) use Time::HiRes qw(sleep); use Win32::API; use Win32API::File qw(:ALL); use Win32::OLE; sub get_pos { my $file = createFile(&quot;//./ShockMgr&quot;, &quot;r ke&quot;) or die &quot;Can't get ShockMgr device&quot;; DeviceIoControl($file, 0x733fc, [], 0, my($buf), 0x24, my($bytes), []); my @data = unpack &quot;x4s*&quot;, $buf; return @data; }
  • 14. tilt-missile.pl (2/3) my @pos = get_pos; my($base_x, $base_y) = @pos[3, 2]; while (my @pos = get_pos) { my $ax = ($pos[1] - $base_x) / 30; my $ay = ($pos[0] - $base_y) / 30; my $command = detect_command($ax, $ay); system(&quot;ctlmissile $command&quot;) if $command; }
  • 15. tilt-missile.pl (3/3) sub detect_command { my($ax, $ay) = @_; if (abs($ax) >= 180 || abs($ay) >= 180) { return &quot;fire&quot;; } elsif ($ax >= 80) { return &quot;right&quot;; } … }
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21. gmaps.html (1/2) <script language=&quot;JavaScript&quot; > function load() { if (GBrowserIsCompatible()) { map = new GMap2(document.getElementById(&quot;map&quot;)); map.addControl(new GLargeMapControl()); map.addControl(new GMapTypeControl()); if (debug) document.getElementById('log').style.visibility = 'visible'; GEvent.addListener(map, &quot;dragstart&quot;, function() { dragging = 1 }); GEvent.addListener(map, &quot;dragend&quot;, function() { var center = map.getCenter(); x = center.x; y = center.y; dragging = 0; }); … map.setCenter(new GLatLng(y, x), 14); base = get_pos(1). split(/,/); </script>
  • 22. gmaps.html (2/2) <script language=&quot;PerlScript&quot; > use Win32API::File qw(:ALL); sub get_pos { my $base = shift; my $file = createFile(&quot;//./ShockMgr&quot;, &quot;r ke&quot;) or die &quot;Can't get ShockMgr device&quot;; DeviceIoControl($file, 0x733fc, [], 0, my($buf), 0x24, my($bytes), []); my @data = unpack &quot;x4s*&quot;, $buf; return join &quot;,&quot;, ($base ? @data[3, 2] : @data[1, 0]); } </script>
  • 23.
  • 24.
  • 25.