Skip to content
This repository was archived by the owner on Feb 7, 2024. It is now read-only.

Commit e310641

Browse files
committed
Initial slides
1 parent 093d77e commit e310641

File tree

9 files changed

+159
-13
lines changed

9 files changed

+159
-13
lines changed

demo/slides/basics.js

Lines changed: 63 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,75 @@
1-
/* eslint-disable react/jsx-key */
1+
/* eslint-disable react/jsx-key, max-len */
22
import React from 'react';
33

44
import Slide from './slide';
55

66
export default {
77
slides: [
88
<Slide>
9-
<h1>test</h1>
9+
<h1>I don't know anything about game dev.</h1>
1010
</Slide>,
1111
<Slide>
12-
<h1>test2</h1>
12+
<h1>Should you build a game with React?</h1>
13+
</Slide>,
14+
<Slide>
15+
<h1>Can <del>Should</del> you build a game with React?</h1>
16+
</Slide>,
17+
<Slide>
18+
<h1>You sure can!</h1>
19+
</Slide>,
20+
<Slide>
21+
<h1>Why would you build a game with React?</h1>
22+
</Slide>,
23+
<Slide>
24+
<ul>
25+
<li>The same game code can work on the web, iOS & Android</li>
26+
<li>You primarily write React code</li>
27+
<li>You dont feel like learning Unity</li>
28+
<li>Fun?</li>
29+
</ul>
30+
</Slide>,
31+
<Slide>
32+
<h1>Basic Concepts</h1>
33+
</Slide>,
34+
<Slide>
35+
<h2>Game Loop</h2>
36+
<p>A programmatic loop that gets input, updates game state and draws the game.</p>
37+
</Slide>,
38+
<Slide>
39+
<h2>Tick</h2>
40+
<p>Each step of the loop.</p>
41+
</Slide>,
42+
<Slide>
43+
<h2>Update Function</h2>
44+
<p>A function called on each tick where game logic is checked.</p>
45+
</Slide>,
46+
<Slide>
47+
<h2>Stage</h2>
48+
<p>The main game container to which game entities are added.</p>
49+
</Slide>,
50+
<Slide>
51+
<h2>Sprite</h2>
52+
<p>An often animated bitmap graphic derived from a larger tiled image of states and steps.</p>
53+
</Slide>,
54+
<Slide>
55+
<h2>TileMap</h2>
56+
<p>A large graphic created by rendering a matrix of position indexes derived from a smaller set of common tiles.</p>
57+
</Slide>,
58+
<Slide>
59+
<h2>Physics Engine</h2>
60+
<p>A class that simulates physical systems.</p>
61+
</Slide>,
62+
<Slide>
63+
<h2>Rigid Body Physics Engine</h2>
64+
<p>A physics engine that assumes that physical bodies are not elastic or fluid.</p>
65+
</Slide>,
66+
<Slide>
67+
<h2>Physics World</h2>
68+
<p>A class that provides a set of conditions that the simulation abides by.</p>
69+
</Slide>,
70+
<Slide>
71+
<h2>Physics Body</h2>
72+
<p>A class that acts as an entity inside the physics world.</p>
1373
</Slide>,
1474
],
1575
};

demo/slides/index.js

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,13 @@ import React, { Component, PropTypes } from 'react';
22
import Gamepad from 'html5-gamepad';
33

44
import Basics from './basics';
5+
import Loop from './loop';
6+
import Scaling from './scaling';
7+
import Sprites from './sprites';
8+
import TileMaps from './tilemaps';
9+
import Physics from './physics';
510

6-
const slides = [Basics];
11+
const slides = [Basics, Loop, Scaling, Sprites, TileMaps, Physics];
712

813
const gamepad = new Gamepad();
914

@@ -28,12 +33,12 @@ export default class Slides extends Component {
2833
}
2934

3035
if (gamepad.button(0, 'button 14')) {
31-
this.handlePrev();
36+
this.handlePrev(true);
3237
return;
3338
}
3439

3540
if (gamepad.button(0, 'button 15')) {
36-
this.handleNext();
41+
this.handleNext(true);
3742
return;
3843
}
3944

@@ -54,7 +59,7 @@ export default class Slides extends Component {
5459
}
5560
}
5661

57-
handleNext() {
62+
handleNext(restartLoop) {
5863
const { currentSlide } = this.state;
5964
const { index } = this.props;
6065

@@ -64,20 +69,28 @@ export default class Slides extends Component {
6469
this.setState({
6570
currentSlide: currentSlide + 1,
6671
}, () => {
67-
this.restartLoop();
72+
if (restartLoop) {
73+
this.restartLoop();
74+
}
6875
});
6976
}
7077
}
7178

72-
handlePrev() {
79+
handlePrev(restartLoop) {
7380
const { currentSlide } = this.state;
7481

7582
if (currentSlide !== 0) {
7683
this.setState({
7784
currentSlide: currentSlide - 1,
7885
}, () => {
79-
this.restartLoop();
86+
if (restartLoop) {
87+
this.restartLoop();
88+
}
8089
});
90+
} else {
91+
if (restartLoop) {
92+
this.restartLoop();
93+
}
8194
}
8295
}
8396

demo/slides/loop.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/* eslint-disable react/jsx-key, max-len */
2+
import React from 'react';
3+
4+
import Slide from './slide';
5+
6+
export default {
7+
slides: [
8+
<Slide>
9+
<h1>Placeholder</h1>
10+
</Slide>,
11+
],
12+
};

demo/slides/physics.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/* eslint-disable react/jsx-key, max-len */
2+
import React from 'react';
3+
4+
import Slide from './slide';
5+
6+
export default {
7+
slides: [
8+
<Slide>
9+
<h1>Placeholder</h1>
10+
</Slide>,
11+
],
12+
};

demo/slides/scaling.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/* eslint-disable react/jsx-key, max-len */
2+
import React from 'react';
3+
4+
import Slide from './slide';
5+
6+
export default {
7+
slides: [
8+
<Slide>
9+
<h1>Placeholder</h1>
10+
</Slide>,
11+
],
12+
};

demo/slides/slide.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,15 @@ const slideStyles = {
44
display: 'flex',
55
flex: '1 1 0',
66
alignItems: 'center',
7-
justifyContent: 'center',
7+
justifyContent: 'flex-start',
88
maxWidth: '166vh',
9-
background: 'red',
109
};
1110

1211
const Slide = (props) => (
1312
<div style={slideStyles}>
14-
{props.children}
13+
<div>
14+
{props.children}
15+
</div>
1516
</div>
1617
);
1718

demo/slides/sprites.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/* eslint-disable react/jsx-key, max-len */
2+
import React from 'react';
3+
4+
import Slide from './slide';
5+
6+
export default {
7+
slides: [
8+
<Slide>
9+
<h1>Placeholder</h1>
10+
</Slide>,
11+
],
12+
};

demo/slides/tilemaps.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/* eslint-disable react/jsx-key, max-len */
2+
import React from 'react';
3+
4+
import Slide from './slide';
5+
6+
export default {
7+
slides: [
8+
<Slide>
9+
<h1>Placeholder</h1>
10+
</Slide>,
11+
],
12+
};

public/index.css

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,18 @@ html, body, #root {
1515
margin: 0;
1616
padding: 0;
1717
color: white;
18+
font-family: 'Helvetica Neue';
19+
font-size: 1.5em;
20+
}
21+
22+
p {
23+
font-size: 1.2em;
24+
line-height: 1.5;
25+
}
26+
27+
li {
28+
font-size: 1.3em;
29+
line-height: 1.5;
1830
}
1931

2032
.intro {

0 commit comments

Comments
 (0)