Skip to content

Commit

Permalink
Use new IgeBaseScene
Browse files Browse the repository at this point in the history
  • Loading branch information
Irrelon committed Oct 5, 2013
1 parent a1cc8b2 commit 75e28dd
Show file tree
Hide file tree
Showing 15 changed files with 77 additions and 11 deletions.
2 changes: 1 addition & 1 deletion blank_game_multiplayer/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ var Client = IgeClass.extend({
});

// Load the base scene data
ige.addGraph('BaseScene');
ige.addGraph('IgeBaseScene');
});
}
});
Expand Down
7 changes: 7 additions & 0 deletions blank_game_multiplayer/gameClasses/ExampleEntity.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
var ExampleEntity = IgeEntity.extend({
classId: 'ExampleEntity',

init: function () {
IgeEntity.prototype.init.call(this);
}
});
11 changes: 11 additions & 0 deletions blank_game_multiplayer/levels/ExampleGraph.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
var ExampleGraph = IgeSceneGraph.extend({
classId: 'ExampleGraph',

addGraph: function () {

},

removeGraph: function () {

}
});
2 changes: 1 addition & 1 deletion blank_game_multiplayer/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ var Server = IgeClass.extend({
ige.network.acceptConnections(true);

// Load the base scene data
ige.addGraph('BaseScene');
ige.addGraph('IgeBaseScene');
}
});
});
Expand Down
1 change: 1 addition & 0 deletions engine/CoreConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ var igeCoreConfig = {
['csap', 'IgeUiStyleExtension', 'extensions/IgeUiStyleExtension.js'],
/* Main Engine Classes */
['csap', 'IgeSceneGraph', 'core/IgeSceneGraph.js'],
['csap', 'IgeBaseScene', 'core/IgeBaseScene.js'],
['csap', 'IgeDummyCanvas', 'core/IgeDummyCanvas.js'],
['csap', 'IgeDummyContext', 'core/IgeDummyContext.js'],
['csap', 'IgePathNode', 'core/IgePathNode.js'],
Expand Down
47 changes: 47 additions & 0 deletions engine/core/IgeBaseScene.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/**
* When loaded into memory using ige.addGraph('IgeBaseScene') will create
* the scene "baseScene" and the viewport "vp1" that are used in almost all
* examples and can be used as the base for your scenegraph as well.
*/
var IgeBaseScene = IgeSceneGraph.extend({
classId: 'IgeBaseScene',

init: function () {},

/**
* Called when loading the graph data via ige.addGraph().
* @param options
*/
addGraph: function (options) {
// Clear existing graph data
if (ige.$('baseScene')) {
this.destroyGraph();
}

// Create the scene
var baseScene = new IgeScene2d()
.id('baseScene');

// Create the main viewport to look at "baseScene"
new IgeViewport()
.id('vp1')
.autoSize(true)
.scene(baseScene)
.drawBounds(false)
.mount(ige);
},

/**
* The method called when the graph items are to be removed from the
* active graph.
*/
removeGraph: function () {
// Destroy the viewport
ige.$('vp1').destroy();

// Destroy the baseScene
ige.$('baseScene').destroy();
}
});

if (typeof(module) !== 'undefined' && typeof(module.exports) !== 'undefined') { module.exports = IgeBaseScene; }
2 changes: 1 addition & 1 deletion examples/0.0-load-graph/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ var Client = IgeClass.extend({
// Check if the engine started successfully
if (success) {
// Load the base scene data
ige.addGraph('BaseScene');
ige.addGraph('IgeBaseScene');

// Add all the items in Scene1 to the scenegraph
// (see gameClasses/Scene1.js :: addGraph() to see
Expand Down
2 changes: 1 addition & 1 deletion examples/1.1.0-startup/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ var Client = IgeClass.extend({
// Check if the engine started successfully
if (success) {
// Load the base scene data
ige.addGraph('BaseScene');
ige.addGraph('IgeBaseScene');

// Create an entity and mount it to the scene
self.obj[0] = new Rotator(0.1)
Expand Down
2 changes: 1 addition & 1 deletion examples/1.1.1-startup-own-canvas/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ var Client = IgeClass.extend({
// Check if the engine started successfully
if (success) {
// Load the base scene data
ige.addGraph('BaseScene');
ige.addGraph('IgeBaseScene');

// Create an entity and mount it to the scene
self.obj[0] = new Rotator()
Expand Down
2 changes: 1 addition & 1 deletion examples/1.1.2-startup-offset-canvas/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ var Client = IgeClass.extend({
// Check if the engine started successfully
if (success) {
// Load the base scene data
ige.addGraph('BaseScene');
ige.addGraph('IgeBaseScene');

// Create an entity that will follow the mouse
self.mouseEnt = new IgeEntity()
Expand Down
2 changes: 1 addition & 1 deletion examples/1.3-cell-sheets/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ var Client = IgeClass.extend({
// Check if the engine started successfully
if (success) {
// Load the base scene data
ige.addGraph('BaseScene');
ige.addGraph('IgeBaseScene');

// Create an entity and mount it to the scene
self.obj[0] = new IgeEntity()
Expand Down
2 changes: 1 addition & 1 deletion examples/1.4-sprite-sheets/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ var Client = IgeClass.extend({
// Check if the engine started successfully
if (success) {
// Load the base scene data
ige.addGraph('BaseScene');
ige.addGraph('IgeBaseScene');

// Create an entity and mount it to the scene
self.obj[0] = new IgeEntity()
Expand Down
2 changes: 1 addition & 1 deletion examples/1.5-filters/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ var Client = IgeClass.extend({
var yStart = -300;

// Load the base scene data
ige.addGraph('BaseScene');
ige.addGraph('IgeBaseScene');

// Create an entity and mount it to the scene
self.obj[0] = new IgeEntity()
Expand Down
2 changes: 1 addition & 1 deletion examples/1.8-point-at-mouse/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ var Client = IgeClass.extend({
// Check if the engine started successfully
if (success) {
// Load the base scene data
ige.addGraph('BaseScene');
ige.addGraph('IgeBaseScene');

self.vp1.camera.translateTo(200, 200, 0);

Expand Down
2 changes: 1 addition & 1 deletion examples/2.1-viewports/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ var Client = IgeClass.extend({
ige.viewportDepth(true);

// Load the base scene data
ige.addGraph('BaseScene');
ige.addGraph('IgeBaseScene');

// Make a load of viewports
for (i = 0; i < vpCount; i++) {
Expand Down

0 comments on commit 75e28dd

Please sign in to comment.