-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Another blob commit. This one is just about alpha.
Signed-off-by: Ken Hoover <[email protected]>
- Loading branch information
Ken Hoover
committed
Jun 19, 2013
1 parent
62941a1
commit 7e65188
Showing
28 changed files
with
1,251 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
/com | ||
/com | ||
/.gitignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.kandl.ropgame.ingredients; | ||
|
||
import com.badlogic.gdx.graphics.Pixmap; | ||
import com.badlogic.gdx.graphics.g2d.Sprite; | ||
import com.badlogic.gdx.scenes.scene2d.ui.Image; | ||
import com.badlogic.gdx.utils.Array; | ||
import com.kandl.ropgame.model.Recipe.CookState; | ||
|
||
public abstract class Bread extends Ingredient { | ||
|
||
private static Array<Class<? extends Bread>> subclasses = new Array<Class<? extends Bread>>(false, 6); | ||
|
||
public static void addSubclass (Class<? extends Bread> clazz) { | ||
subclasses.add(clazz); | ||
} | ||
|
||
public static Class<? extends Bread> getRandomIngredient() { | ||
return subclasses.random(); | ||
} | ||
|
||
public abstract Image getTopView(CookState state); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package com.kandl.ropgame.ingredients; | ||
|
||
import com.badlogic.gdx.graphics.g2d.Sprite; | ||
import com.badlogic.gdx.graphics.g2d.TextureAtlas; | ||
import com.badlogic.gdx.scenes.scene2d.ui.Image; | ||
import com.badlogic.gdx.scenes.scene2d.utils.SpriteDrawable; | ||
import com.badlogic.gdx.utils.Array; | ||
|
||
public class Chicken extends Ingredient { | ||
public static void initialize(Array<Ingredient> ingredients) { | ||
Ingredient.addSubclass(Chicken.class); | ||
ingredients.add(new Chicken()); | ||
} | ||
|
||
@Override | ||
public Image getSideView() { | ||
// TODO Auto-generated method stub | ||
return new Image(new SpriteDrawable(assets.get("img/food/food.atlas", TextureAtlas.class).createSprite("icons/chicken"))); | ||
} | ||
|
||
@Override | ||
public Sprite getIcon() { | ||
return assets.get("img/food/food.atlas", TextureAtlas.class).createSprite("icons/chicken"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,38 @@ | ||
package com.kandl.ropgame.ingredients; | ||
|
||
public abstract class Ingredient { | ||
import com.badlogic.gdx.assets.AssetManager; | ||
import com.badlogic.gdx.graphics.g2d.Sprite; | ||
import com.badlogic.gdx.graphics.g2d.TextureAtlas; | ||
import com.badlogic.gdx.scenes.scene2d.ui.Image; | ||
import com.badlogic.gdx.utils.Array; | ||
|
||
// Every subclass must have a section where it declares itself to ingredient. | ||
public abstract class Ingredient{ | ||
|
||
// Subclasses should load PIXMAP assets through here. Textures will be created in the Atlas. | ||
protected static AssetManager assets = new AssetManager(); | ||
static { | ||
assets.load("img/food/food.atlas", TextureAtlas.class); | ||
} | ||
|
||
public static void loadAll() { | ||
assets.finishLoading(); | ||
} | ||
|
||
public static void dispose() { | ||
assets.dispose(); | ||
} | ||
|
||
private static Array<Class<? extends Ingredient>> subclasses = new Array<Class<? extends Ingredient>>(false, 6); | ||
|
||
public static void addSubclass (Class<? extends Ingredient> clazz) { | ||
subclasses.add(clazz); | ||
} | ||
|
||
public static Class<? extends Ingredient> getRandomIngredient() { | ||
return subclasses.random(); | ||
} | ||
|
||
public abstract Image getSideView(); | ||
public abstract Sprite getIcon(); | ||
} |
Oops, something went wrong.