Acknowledgments



Download 0,89 Mb.
Pdf ko'rish
bet16/27
Sana30.10.2022
Hajmi0,89 Mb.
#858584
1   ...   12   13   14   15   16   17   18   19   ...   27
Bog'liq
HTML5 Games Creating Fun with HTML5 CSS3 and WebGL - PDF Books-1

Listing 1-1 
Drawing shapes with the canvas API


The code produces the drawing shown in Figure 1-1.
Figure 1-1: 
This simple canvas drawing was created with JavaScript.
Listing 1-1 
continued


C H A P T E R 1
G A M I N G O N T H E W E B
11
I revisit the 
canvas
element in Chapter 6 and explore it in detail when I use it to create game 
graphics and special effects.
Audio
The new 
audio
element is just as welcome to a web game developers’ toolbox as the 
canvas
element. Finally, you have native audio capabilities in the browser without resorting to plug-
ins. Not too long ago, if a website had audio, some form of Flash was involved. Libraries like 
the SoundManager 2 project (
www.schillmania.com/projects/soundmanager2

provide full JavaScript access to most of the audio features of Flash. But even if such a bridge 
allows your own code to stay on the JavaScript side, your users still need to install the plug-
in. The HTML5 
audio
element solves this problem, making access to audio available in 
browsers out of the box using only plain old HTML and JavaScript.
The 
audio
element still has a few unresolved issues, however. The major browser vendors all 
seem to agree on the importance of the element and have all adopted the specification, but 
so far they’ve failed to agree on which audio codecs should be supported. So, while the theory 
of the 
audio
element is good, reality has left developers with no other option than to pro-
vide audio files in multiple formats to appease all the browser vendors.
The 
audio
element can be defined in the mark-up or created dynamically with JavaScript. 
(The latter option is of more interest to you as an application and game developer.) Listing 
1-2 shows a basic music player with multiple source files, native user interface (UI) controls, 
and a few keyboard hotkeys that use the JavaScript API.

Download 0,89 Mb.

Do'stlaringiz bilan baham:
1   ...   12   13   14   15   16   17   18   19   ...   27




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish