16d94666e9f6ac7b2250654e5d63a0c398b03ac8
[sdlgit/SDL-Site.git] / pages / SDL-Tutorial-Tetris.html-inc
1 <div class="pod">
2 <!-- INDEX START -->
3 <h3 id="TOP">Index</h3>
4
5 <ul><li><a href="#NAME">NAME</a>
6 <ul><li><a href="#CATEGORY">CATEGORY</a></li>
7 <li><a href="#The_Overall_view">The Overall view</a>
8 <ul><li><a href="#The_Game_Loop">The Game Loop</a></li>
9 <li><a href="#The_Game_Logic">The Game Logic</a>
10 </li>
11 </ul>
12 </li>
13 </ul>
14 </li>
15 </ul><hr />
16 <!-- INDEX END -->
17
18 <h1 id="NAME">NAME</h1><p><a href="#TOP" class="toplink">Top</a></p>
19 <div id="NAME_CONTENT">
20 <p>SDL::Tutorial::Tetris -- Let's Make Tetris</p>
21
22 </div>
23 <h2 id="CATEGORY">CATEGORY</h2>
24 <div id="CATEGORY_CONTENT">
25 <p>Tutorials</p>
26
27 </div>
28 <h2 id="The_Overall_view">The Overall view</h2>
29 <div id="The_Overall_view_CONTENT">
30 <p>All games are a while loop. So we will have something like this.</p>
31
32 </div>
33 <h3 id="The_Game_Loop">The Game Loop</h3>
34 <div id="The_Game_Loop_CONTENT">
35 <pre> package Tetris;
36
37  sub run_game_fun_times
38  {
39   while(1)
40   {
41    #game logic here
42   }
43  }      
44
45 </pre>
46 <p>You need more code you say? Ok well, a game does two things more. </p>
47
48 </div>
49 <h3 id="The_Game_Logic">The Game Logic</h3>
50 <div id="The_Game_Logic_CONTENT">
51 <dl>
52         <dt>Input Events</dt>
53         <dd>
54                 <p>A game essentially move objects (boxes, monsters so on) in time.</p>
55                 <p>
56                         <dl>
57                                 <dt>Time</dt>
58                                 <dd>
59                                         <p>In SDL time is measured in ticks.</p>
60                                 </dd>
61                                 <dt>User Input</dt>
62                         </dl>
63                 </p>
64         </dd>
65         <dt>Draw Everything</dt>
66 </dl>
67 <p>--Kartik
68 </p>
69
70 </div>
71 </div>