-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from TiPaNiMo/UI
UI
- Loading branch information
Showing
8 changed files
with
514 additions
and
77 deletions.
There are no files selected for viewing
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
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,28 @@ | ||
package de.game.ui; | ||
|
||
import org.newdawn.slick.GameContainer; | ||
import org.newdawn.slick.Graphics; | ||
import org.newdawn.slick.SlickException; | ||
|
||
public interface UI_Base { | ||
|
||
/** | ||
* Update the game logic here. No rendering should take place in this method | ||
* though it won't do any harm. | ||
* | ||
* @param container The container holing this game | ||
* @param delta The amount of time thats passed since last update in milliseconds | ||
* @throws SlickException Throw to indicate an internal error | ||
*/ | ||
public void update(GameContainer container, int delta) throws SlickException; | ||
|
||
/** | ||
* Render the game's screen here. | ||
* | ||
* @param container The container holing this game | ||
* @param g The graphics context that can be used to render. However, normal rendering | ||
* routines can also be used. | ||
* @throws SlickException Throw to indicate a internal error | ||
*/ | ||
public void render(GameContainer container, Graphics g) throws SlickException; | ||
} |
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,70 @@ | ||
package de.game.ui; | ||
|
||
import org.newdawn.slick.Color; | ||
import org.newdawn.slick.GameContainer; | ||
import org.newdawn.slick.Graphics; | ||
import org.newdawn.slick.Input; | ||
import org.newdawn.slick.SlickException; | ||
import org.newdawn.slick.geom.Rectangle; | ||
|
||
public abstract class UI_Button extends UI_Element { | ||
|
||
/** Text Element */ | ||
protected UI_Text text; | ||
|
||
/** Button Shape */ | ||
protected Rectangle ui_button; | ||
|
||
/** Button Color */ | ||
protected Color ui_color = Color.white; | ||
|
||
/** Clicked */ | ||
public boolean clicked = false; | ||
|
||
/** Rectangle show */ | ||
protected boolean ui_show = true; | ||
|
||
public UI_Button(float x, float y, Input input, UI_Text text, Rectangle rectangle) { | ||
super(x, y, input); | ||
this.setText(text); | ||
this.text = text; | ||
this.ui_button = rectangle; | ||
} | ||
|
||
@Override | ||
public void update(GameContainer container, int delta) throws SlickException { | ||
} | ||
|
||
@Override | ||
public void render(GameContainer container, Graphics g) throws SlickException { | ||
|
||
this.text.render(container, g); | ||
|
||
g.setColor(this.ui_color); | ||
if (ui_show) g.fill(this.ui_button); | ||
} | ||
|
||
public Rectangle getUi_button() { | ||
return ui_button; | ||
} | ||
|
||
protected void setUi_button(Rectangle ui_button) { | ||
this.ui_button = ui_button; | ||
} | ||
|
||
protected UI_Text getText() { | ||
return text; | ||
} | ||
|
||
protected void setText(UI_Text text) { | ||
this.text = text; | ||
} | ||
|
||
protected boolean isUi_show() { | ||
return ui_show; | ||
} | ||
|
||
protected void setUi_show(boolean ui_show) { | ||
this.ui_show = ui_show; | ||
} | ||
} |
Oops, something went wrong.