Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
2d54c76bc6
@ -206,6 +206,11 @@ public class Engine {
|
|||||||
this.uiElements.add(uiElement);
|
this.uiElements.add(uiElement);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void remove_uiElement(UIDummy uiElement) {
|
||||||
|
this.uiElements.remove(uiElement);
|
||||||
|
uiElement.delete();
|
||||||
|
}
|
||||||
|
|
||||||
public void setUIElementZoomFactor(float scaleFactor){
|
public void setUIElementZoomFactor(float scaleFactor){
|
||||||
for (UIDummy uiElement : this.uiElements){
|
for (UIDummy uiElement : this.uiElements){
|
||||||
uiElement.updateScalingFactor(scaleFactor);
|
uiElement.updateScalingFactor(scaleFactor);
|
||||||
|
@ -18,6 +18,9 @@ public abstract class UIDummy {
|
|||||||
public void init(){
|
public void init(){
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void delete(){
|
||||||
|
}
|
||||||
|
|
||||||
protected void getObjInPosition(){
|
protected void getObjInPosition(){
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,6 +37,10 @@ public class UIElement extends UIDummy{
|
|||||||
this.engine.add_objectGl(obj);
|
this.engine.add_objectGl(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void delete(){
|
||||||
|
this.engine.remove_objectGl(obj);
|
||||||
|
}
|
||||||
|
|
||||||
protected void getObjInPosition(){
|
protected void getObjInPosition(){
|
||||||
obj.resetTransform();
|
obj.resetTransform();
|
||||||
obj.scale(new Vector3f(this.scalingFactor, this.scalingFactor, 1.0f));
|
obj.scale(new Vector3f(this.scalingFactor, this.scalingFactor, 1.0f));
|
||||||
|
@ -53,6 +53,15 @@ public class UIElementText extends UIDummy{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void delete(){
|
||||||
|
for (ObjectGl obj : this.txt.getCharList()){ //Cast en ObjectGl
|
||||||
|
this.engine.remove_objectGl(obj);
|
||||||
|
}
|
||||||
|
if (background != null){
|
||||||
|
this.engine.remove_objectGl(background);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Modifier le texte
|
* Modifier le texte
|
||||||
* @param txt le nouveau texte
|
* @param txt le nouveau texte
|
||||||
|
@ -5,10 +5,8 @@ import engine.loader.ControllerPromptTextureLoader;
|
|||||||
import engine.math.Vector3f;
|
import engine.math.Vector3f;
|
||||||
import engine.object.ObjectGl;
|
import engine.object.ObjectGl;
|
||||||
import gameplay.input.InputBuffer;
|
import gameplay.input.InputBuffer;
|
||||||
import gameplay.input.Inputs;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class UIInputList extends UIDummy{
|
public class UIInputList extends UIDummy{
|
||||||
@ -39,6 +37,12 @@ public class UIInputList extends UIDummy{
|
|||||||
this.listIcon = new ArrayList<>();
|
this.listIcon = new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void delete(){
|
||||||
|
for (ObjectGl obj : this.listIcon){ //Cast en ObjectGl
|
||||||
|
this.engine.remove_objectGl(obj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected void getObjInPosition(){
|
protected void getObjInPosition(){
|
||||||
int index = 0;
|
int index = 0;
|
||||||
for (ObjectGl obj : listIcon){
|
for (ObjectGl obj : listIcon){
|
||||||
|
@ -746,6 +746,267 @@ public class BlueBaseFrames {
|
|||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static Frame KnockedDown1() {
|
||||||
|
//movement data
|
||||||
|
double moveX = -6.0;
|
||||||
|
double moveY = 0.0;
|
||||||
|
|
||||||
|
//cancelData
|
||||||
|
boolean normalC = false;
|
||||||
|
boolean specialC = false;
|
||||||
|
boolean jumpC = false;
|
||||||
|
boolean moveC = false;
|
||||||
|
boolean dashC = false;
|
||||||
|
|
||||||
|
//hitbox lists
|
||||||
|
ArrayList<Active_HitBox> ahb = new ArrayList<Active_HitBox>();
|
||||||
|
ArrayList<Active_throw_Hitbox> athb = new ArrayList<Active_throw_Hitbox>();
|
||||||
|
ArrayList<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||||
|
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||||
|
|
||||||
|
//generate hitboxes here and then use ArrayList add method to add them to the correct list
|
||||||
|
Push_HitBox pB1 = new Push_HitBox(200,-150,160,400);
|
||||||
|
|
||||||
|
Frame f = new Frame(moveY,moveX,phb,ahb,pthb,athb,pB1,normalC,specialC,jumpC,moveC,dashC);
|
||||||
|
|
||||||
|
//set sprite data on sheet
|
||||||
|
f.setSpriteWrap(0,(138*6),138,138);
|
||||||
|
return f;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Frame KnockedDown2() {
|
||||||
|
//movement data
|
||||||
|
double moveX = -6.0;
|
||||||
|
double moveY = 0.0;
|
||||||
|
|
||||||
|
//cancelData
|
||||||
|
boolean normalC = false;
|
||||||
|
boolean specialC = false;
|
||||||
|
boolean jumpC = false;
|
||||||
|
boolean moveC = false;
|
||||||
|
boolean dashC = false;
|
||||||
|
|
||||||
|
//hitbox lists
|
||||||
|
ArrayList<Active_HitBox> ahb = new ArrayList<Active_HitBox>();
|
||||||
|
ArrayList<Active_throw_Hitbox> athb = new ArrayList<Active_throw_Hitbox>();
|
||||||
|
ArrayList<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||||
|
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||||
|
|
||||||
|
//generate hitboxes here and then use ArrayList add method to add them to the correct list
|
||||||
|
Push_HitBox pB1 = new Push_HitBox(200,-150,160,400);
|
||||||
|
|
||||||
|
Frame f = new Frame(moveY,moveX,phb,ahb,pthb,athb,pB1,normalC,specialC,jumpC,moveC,dashC);
|
||||||
|
|
||||||
|
//set sprite data on sheet
|
||||||
|
f.setSpriteWrap(138,(138*6),138,138);
|
||||||
|
return f;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Frame KnockedDown3() {
|
||||||
|
//movement data
|
||||||
|
double moveX = -6.0;
|
||||||
|
double moveY = 0.0;
|
||||||
|
|
||||||
|
//cancelData
|
||||||
|
boolean normalC = false;
|
||||||
|
boolean specialC = false;
|
||||||
|
boolean jumpC = false;
|
||||||
|
boolean moveC = false;
|
||||||
|
boolean dashC = false;
|
||||||
|
|
||||||
|
//hitbox lists
|
||||||
|
ArrayList<Active_HitBox> ahb = new ArrayList<Active_HitBox>();
|
||||||
|
ArrayList<Active_throw_Hitbox> athb = new ArrayList<Active_throw_Hitbox>();
|
||||||
|
ArrayList<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||||
|
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||||
|
|
||||||
|
//generate hitboxes here and then use ArrayList add method to add them to the correct list
|
||||||
|
Push_HitBox pB1 = new Push_HitBox(200,-150,160,400);
|
||||||
|
|
||||||
|
Frame f = new Frame(moveY,moveX,phb,ahb,pthb,athb,pB1,normalC,specialC,jumpC,moveC,dashC);
|
||||||
|
|
||||||
|
//set sprite data on sheet
|
||||||
|
f.setSpriteWrap((138*2),(138*6),138,138);
|
||||||
|
return f;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Frame KnockedDown4() {
|
||||||
|
//movement data
|
||||||
|
double moveX = 0.0;
|
||||||
|
double moveY = 0.0;
|
||||||
|
|
||||||
|
//cancelData
|
||||||
|
boolean normalC = false;
|
||||||
|
boolean specialC = false;
|
||||||
|
boolean jumpC = false;
|
||||||
|
boolean moveC = false;
|
||||||
|
boolean dashC = false;
|
||||||
|
|
||||||
|
//hitbox lists
|
||||||
|
ArrayList<Active_HitBox> ahb = new ArrayList<Active_HitBox>();
|
||||||
|
ArrayList<Active_throw_Hitbox> athb = new ArrayList<Active_throw_Hitbox>();
|
||||||
|
ArrayList<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||||
|
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||||
|
|
||||||
|
//generate hitboxes here and then use ArrayList add method to add them to the correct list
|
||||||
|
Push_HitBox pB1 = new Push_HitBox(200,-150,160,400);
|
||||||
|
|
||||||
|
Frame f = new Frame(moveY,moveX,phb,ahb,pthb,athb,pB1,normalC,specialC,jumpC,moveC,dashC);
|
||||||
|
|
||||||
|
//set sprite data on sheet
|
||||||
|
f.setSpriteWrap((138*3),(138*6),138,138);
|
||||||
|
return f;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Frame KnockedDown5() {
|
||||||
|
//movement data
|
||||||
|
double moveX = 0.0;
|
||||||
|
double moveY = 0.0;
|
||||||
|
|
||||||
|
//cancelData
|
||||||
|
boolean normalC = false;
|
||||||
|
boolean specialC = false;
|
||||||
|
boolean jumpC = false;
|
||||||
|
boolean moveC = false;
|
||||||
|
boolean dashC = false;
|
||||||
|
|
||||||
|
//hitbox lists
|
||||||
|
ArrayList<Active_HitBox> ahb = new ArrayList<Active_HitBox>();
|
||||||
|
ArrayList<Active_throw_Hitbox> athb = new ArrayList<Active_throw_Hitbox>();
|
||||||
|
ArrayList<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||||
|
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||||
|
|
||||||
|
//generate hitboxes here and then use ArrayList add method to add them to the correct list
|
||||||
|
Push_HitBox pB1 = new Push_HitBox(200,-150,160,400);
|
||||||
|
|
||||||
|
Frame f = new Frame(moveY,moveX,phb,ahb,pthb,athb,pB1,normalC,specialC,jumpC,moveC,dashC);
|
||||||
|
|
||||||
|
//set sprite data on sheet
|
||||||
|
f.setSpriteWrap((138*4),(138*6),138,138);
|
||||||
|
return f;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Frame KnockedDown6() {
|
||||||
|
//movement data
|
||||||
|
double moveX = -6.0;
|
||||||
|
double moveY = 0.0;
|
||||||
|
|
||||||
|
//cancelData
|
||||||
|
boolean normalC = false;
|
||||||
|
boolean specialC = false;
|
||||||
|
boolean jumpC = false;
|
||||||
|
boolean moveC = false;
|
||||||
|
boolean dashC = false;
|
||||||
|
|
||||||
|
//hitbox lists
|
||||||
|
ArrayList<Active_HitBox> ahb = new ArrayList<Active_HitBox>();
|
||||||
|
ArrayList<Active_throw_Hitbox> athb = new ArrayList<Active_throw_Hitbox>();
|
||||||
|
ArrayList<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||||
|
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||||
|
|
||||||
|
//generate hitboxes here and then use ArrayList add method to add them to the correct list
|
||||||
|
Push_HitBox pB1 = new Push_HitBox(200,-150,160,400);
|
||||||
|
|
||||||
|
Frame f = new Frame(moveY,moveX,phb,ahb,pthb,athb,pB1,normalC,specialC,jumpC,moveC,dashC);
|
||||||
|
|
||||||
|
//set sprite data on sheet
|
||||||
|
f.setSpriteWrap((138*5),(138*6),138,138);
|
||||||
|
return f;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Frame KnockedDown7() {
|
||||||
|
//movement data
|
||||||
|
double moveX = -6.0;
|
||||||
|
double moveY = 0.0;
|
||||||
|
|
||||||
|
//cancelData
|
||||||
|
boolean normalC = false;
|
||||||
|
boolean specialC = false;
|
||||||
|
boolean jumpC = false;
|
||||||
|
boolean moveC = false;
|
||||||
|
boolean dashC = false;
|
||||||
|
|
||||||
|
//hitbox lists
|
||||||
|
ArrayList<Active_HitBox> ahb = new ArrayList<Active_HitBox>();
|
||||||
|
ArrayList<Active_throw_Hitbox> athb = new ArrayList<Active_throw_Hitbox>();
|
||||||
|
ArrayList<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||||
|
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||||
|
|
||||||
|
//generate hitboxes here and then use ArrayList add method to add them to the correct list
|
||||||
|
Push_HitBox pB1 = new Push_HitBox(200,-150,160,400);
|
||||||
|
|
||||||
|
Frame f = new Frame(moveY,moveX,phb,ahb,pthb,athb,pB1,normalC,specialC,jumpC,moveC,dashC);
|
||||||
|
|
||||||
|
//set sprite data on sheet
|
||||||
|
f.setSpriteWrap((138*6),(138*6),138,138);
|
||||||
|
return f;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Frame KnockedDown8() {
|
||||||
|
//movement data
|
||||||
|
double moveX = -6.0;
|
||||||
|
double moveY = 0.0;
|
||||||
|
|
||||||
|
//cancelData
|
||||||
|
boolean normalC = false;
|
||||||
|
boolean specialC = false;
|
||||||
|
boolean jumpC = false;
|
||||||
|
boolean moveC = false;
|
||||||
|
boolean dashC = false;
|
||||||
|
|
||||||
|
//hitbox lists
|
||||||
|
ArrayList<Active_HitBox> ahb = new ArrayList<Active_HitBox>();
|
||||||
|
ArrayList<Active_throw_Hitbox> athb = new ArrayList<Active_throw_Hitbox>();
|
||||||
|
ArrayList<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||||
|
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||||
|
|
||||||
|
//generate hitboxes here and then use ArrayList add method to add them to the correct list
|
||||||
|
Push_HitBox pB1 = new Push_HitBox(200,-150,160,400);
|
||||||
|
|
||||||
|
Frame f = new Frame(moveY,moveX,phb,ahb,pthb,athb,pB1,normalC,specialC,jumpC,moveC,dashC);
|
||||||
|
|
||||||
|
//set sprite data on sheet
|
||||||
|
f.setSpriteWrap((138*7),(138*6),138,138);
|
||||||
|
return f;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static Frame[] knockedDown() {
|
||||||
|
Frame[] f = new Frame[50];
|
||||||
|
int i=0;
|
||||||
|
while(i < 5) {
|
||||||
|
f[i] = KnockedDown1();
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
while(i < 10) {
|
||||||
|
f[i] = KnockedDown2();
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
while(i < 15) {
|
||||||
|
f[i] = KnockedDown3();
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
while(i < 30) {
|
||||||
|
f[i] = KnockedDown4();
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
while(i < 35) {
|
||||||
|
f[i] = KnockedDown5();
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
while(i < 40) {
|
||||||
|
f[i] = KnockedDown6();
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
while(i < 45) {
|
||||||
|
f[i] = KnockedDown7();
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
while(i < f.length) {
|
||||||
|
f[i] = KnockedDown8();
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
return f;
|
||||||
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
Engine engine = new Engine(640, 480, false, new Vector3f(4.0f, 3.0f));
|
Engine engine = new Engine(640, 480, false, new Vector3f(4.0f, 3.0f));
|
||||||
|
@ -58,11 +58,13 @@ public class CharacterBlue {
|
|||||||
|
|
||||||
Frame[] fallingFs = new Frame[0];
|
Frame[] fallingFs = new Frame[0];
|
||||||
|
|
||||||
|
Frame[] knDwn = BlueBaseFrames.knockedDown();
|
||||||
|
|
||||||
Frame f = new Frame();
|
Frame f = new Frame();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Character c = new Character(0,0,standF[0],1000,atks,fJ,nJ,bJ,fDash,bDash,th,standF,crouchF,fWalkF,bWalkF,f,f,fallingFs,sbf,cbf,shf,chf);
|
Character c = new Character(0,0,standF[0],1000,atks,fJ,nJ,bJ,fDash,bDash,th,standF,crouchF,fWalkF,bWalkF,f,f,knDwn,sbf,cbf,shf,chf);
|
||||||
|
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
@ -84,7 +84,7 @@ public class match {
|
|||||||
private static UIInputList inputListP1;
|
private static UIInputList inputListP1;
|
||||||
|
|
||||||
// Debug
|
// Debug
|
||||||
public static boolean showP1Hitbox = false; // TODO modifier pour le rendre activable
|
public static boolean showP1Hitbox = false;
|
||||||
public static boolean showP2Hitbox = false;
|
public static boolean showP2Hitbox = false;
|
||||||
private static List<Hitbox> listHitboxObj = new ArrayList<>();
|
private static List<Hitbox> listHitboxObj = new ArrayList<>();
|
||||||
private static float slowFactor = 1f;
|
private static float slowFactor = 1f;
|
||||||
@ -178,18 +178,47 @@ public class match {
|
|||||||
boolean Joystick1Present = glfwJoystickPresent(GLFW_JOYSTICK_1);
|
boolean Joystick1Present = glfwJoystickPresent(GLFW_JOYSTICK_1);
|
||||||
boolean Joystick2Present = glfwJoystickPresent(GLFW_JOYSTICK_2);
|
boolean Joystick2Present = glfwJoystickPresent(GLFW_JOYSTICK_2);
|
||||||
|
|
||||||
String path = "textures/Sprite_sans_grille_9comp.png";
|
String pathToBG = "";
|
||||||
String pathToBG = "textures/arena1.png";
|
switch (stage) {
|
||||||
|
case "arena1":
|
||||||
|
pathToBG = "textures/arena1.png";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
pathToBG = "textures/arena1.png";
|
||||||
|
}
|
||||||
|
|
||||||
ObjectGl background = new ObjectGl(0f,1f,1f,2.5f, pathToBG, null);
|
ObjectGl background = new ObjectGl(0f,1f,1f,2.5f, pathToBG, null);
|
||||||
background.setTextureWrap(0, 0, 1914f, 701f);
|
background.setTextureWrap(0, 0, 1914f, 701f);
|
||||||
background.translate(new Vector3f(-1350f, 1000f, 0f));
|
background.translate(new Vector3f(-1350f, 1000f, 0f));
|
||||||
engine.add_objectGl(background);
|
engine.add_objectGl(background);
|
||||||
|
|
||||||
|
String pathp1 = "";
|
||||||
|
String pathp2 = "";
|
||||||
|
|
||||||
|
switch (character1) {
|
||||||
|
case "blue":
|
||||||
p1 = CharacterBlue.generateCharBlue();
|
p1 = CharacterBlue.generateCharBlue();
|
||||||
|
pathp1 = "textures/Sprite_sans_grille_9comp.png";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
p1 = CharacterBlue.generateCharBlue();
|
||||||
|
pathp1 = "textures/Sprite_sans_grille_9comp.png";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (character2) {
|
||||||
|
case "blue":
|
||||||
p2 = CharacterBlue.generateCharBlue();
|
p2 = CharacterBlue.generateCharBlue();
|
||||||
objP1 = new Sprite(14f, 5f, path, null);
|
pathp2 = "textures/Sprite_sans_grille_9comp.png";
|
||||||
objP2 = new Sprite(15f, 5f, path, new Vector3f(1.0f,0.0f,1.0f));
|
break;
|
||||||
|
default:
|
||||||
|
p2 = CharacterBlue.generateCharBlue();
|
||||||
|
pathp2 = "textures/Sprite_sans_grille_9comp.png";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
objP1 = new Sprite(14f, 5f, pathp1, null);
|
||||||
|
objP2 = new Sprite(15f, 5f, pathp2, new Vector3f(1.0f,0.0f,1.0f));
|
||||||
engine.add_objectGl(objP1);
|
engine.add_objectGl(objP1);
|
||||||
engine.add_objectGl(objP2);
|
engine.add_objectGl(objP2);
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ import org.json.simple.parser.*;
|
|||||||
public class Config {
|
public class Config {
|
||||||
|
|
||||||
public int width, height, rounds;
|
public int width, height, rounds;
|
||||||
public boolean fullscreen;
|
public boolean fullscreen, hitboxes;
|
||||||
public String stage;
|
public String stage;
|
||||||
public String p1, p2;
|
public String p1, p2;
|
||||||
|
|
||||||
@ -37,9 +37,8 @@ public class Config {
|
|||||||
// print a case of this element
|
// print a case of this element
|
||||||
stage = (String) settings.get("stage");
|
stage = (String) settings.get("stage");
|
||||||
|
|
||||||
// nb players selection
|
// rounds
|
||||||
/* JSONArray nb_players = (JSONArray) jsonO.get("nb_players");
|
rounds = Integer.parseInt((String) settings.get("rounds"));
|
||||||
System.out.println("nb_player : " + nb_players.get(1)); */
|
|
||||||
|
|
||||||
// character selection
|
// character selection
|
||||||
p1 = (String) settings.get("character1");
|
p1 = (String) settings.get("character1");
|
||||||
@ -54,6 +53,12 @@ public class Config {
|
|||||||
fullscreen = true;
|
fullscreen = true;
|
||||||
} else fullscreen = false;
|
} else fullscreen = false;
|
||||||
|
|
||||||
|
String hb = (String) settings.get("hitboxes");
|
||||||
|
if (hb == null) hb = "false";
|
||||||
|
if (hb.equals("true")) {
|
||||||
|
hitboxes = true;
|
||||||
|
} else hitboxes = false;
|
||||||
|
|
||||||
// rounds
|
// rounds
|
||||||
String temprounds = (String) settings.get("rounds");
|
String temprounds = (String) settings.get("rounds");
|
||||||
switch (temprounds) {
|
switch (temprounds) {
|
||||||
@ -63,13 +68,6 @@ public class Config {
|
|||||||
default: rounds = 1;
|
default: rounds = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// button selection
|
|
||||||
/* JSONArray allButton = (JSONArray) jsonO.get("button");
|
|
||||||
System.out.println(allButton);
|
|
||||||
|
|
||||||
String up = (String) allButton.get(0);
|
|
||||||
System.out.println("button for up is : " + up); */
|
|
||||||
|
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
File f = new File("game.set");
|
File f = new File("game.set");
|
||||||
try {
|
try {
|
||||||
@ -88,7 +86,7 @@ public class Config {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public void write(int width, int height, int rounds, boolean fullscreen, String character1, String character2, String stage) throws Exception {
|
public void write(int width, int height, int rounds, boolean fullscreen, boolean hitboxes, String character1, String character2, String stage) throws Exception {
|
||||||
|
|
||||||
JSONObject metafile = new JSONObject();
|
JSONObject metafile = new JSONObject();
|
||||||
JSONArray array = new JSONArray();
|
JSONArray array = new JSONArray();
|
||||||
@ -98,6 +96,7 @@ public class Config {
|
|||||||
set.put("height", Integer.toString(height));
|
set.put("height", Integer.toString(height));
|
||||||
set.put("rounds", Integer.toString(rounds));
|
set.put("rounds", Integer.toString(rounds));
|
||||||
set.put("fullscreen", Boolean.toString(fullscreen));
|
set.put("fullscreen", Boolean.toString(fullscreen));
|
||||||
|
set.put("hitboxes", Boolean.toString(hitboxes));
|
||||||
set.put("character1", character1);
|
set.put("character1", character1);
|
||||||
set.put("character2", character2);
|
set.put("character2", character2);
|
||||||
set.put("stage", stage);
|
set.put("stage", stage);
|
||||||
|
@ -75,6 +75,22 @@ public class Launcher extends Application {
|
|||||||
fs.setSelected(false);
|
fs.setSelected(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ChoiceBox<String> cbr = (ChoiceBox<String>) namespace.get("rounds");
|
||||||
|
ObservableList<String> nbrounds = FXCollections.observableArrayList("1", "3", "5", "7", "9");
|
||||||
|
cbr.setItems(nbrounds);
|
||||||
|
if (!nbrounds.contains(setter.getRounds())) {
|
||||||
|
cb.setValue("3");
|
||||||
|
} else {
|
||||||
|
cb.setValue(setter.getRounds());
|
||||||
|
}
|
||||||
|
|
||||||
|
CheckBox hb = (CheckBox) namespace.get("hitboxes");
|
||||||
|
if (setter.getHitboxes()) {
|
||||||
|
hb.setSelected(true);
|
||||||
|
} else {
|
||||||
|
hb.setSelected(false);
|
||||||
|
}
|
||||||
|
|
||||||
VBox v1 = (VBox) namespace.get("p1");
|
VBox v1 = (VBox) namespace.get("p1");
|
||||||
ChoiceBox<String> b1 = (ChoiceBox<String>) v1.getChildren().get(1);
|
ChoiceBox<String> b1 = (ChoiceBox<String>) v1.getChildren().get(1);
|
||||||
VBox v2 = (VBox) namespace.get("p2");
|
VBox v2 = (VBox) namespace.get("p2");
|
||||||
@ -139,9 +155,14 @@ public class Launcher extends Application {
|
|||||||
}
|
}
|
||||||
pointer.arraysettings.put("width", width);
|
pointer.arraysettings.put("width", width);
|
||||||
pointer.arraysettings.put("height", height);
|
pointer.arraysettings.put("height", height);
|
||||||
|
|
||||||
CheckBox fs = (CheckBox) namespace.get("fullscreen");
|
CheckBox fs = (CheckBox) namespace.get("fullscreen");
|
||||||
pointer.arraysettings.put("fullscreen", fs.isSelected());
|
pointer.arraysettings.put("fullscreen", fs.isSelected());
|
||||||
pointer.arraysettings.put("rounds", 3);
|
CheckBox hb = (CheckBox) namespace.get("hitboxes");
|
||||||
|
pointer.arraysettings.put("hitboxes", hb.isSelected());
|
||||||
|
|
||||||
|
ChoiceBox<String> rnd = (ChoiceBox<String>) namespace.get("rounds");
|
||||||
|
pointer.arraysettings.put("rounds", rnd.getValue());
|
||||||
|
|
||||||
VBox vp1 = (VBox) namespace.get("p1");
|
VBox vp1 = (VBox) namespace.get("p1");
|
||||||
ChoiceBox<String> p1 = (ChoiceBox<String>) vp1.getChildren().get(1);
|
ChoiceBox<String> p1 = (ChoiceBox<String>) vp1.getChildren().get(1);
|
||||||
|
@ -22,12 +22,13 @@ public class Settings {
|
|||||||
int height = (Integer) set.get("height");
|
int height = (Integer) set.get("height");
|
||||||
int rounds = (Integer) set.get("rounds");
|
int rounds = (Integer) set.get("rounds");
|
||||||
boolean fullscreen = (Boolean) set.get("fullscreen");
|
boolean fullscreen = (Boolean) set.get("fullscreen");
|
||||||
|
boolean hitboxes = (Boolean) set.get("hitboxes");
|
||||||
String character1 = (String) set.get("character1");
|
String character1 = (String) set.get("character1");
|
||||||
String character2 = (String) set.get("character2");
|
String character2 = (String) set.get("character2");
|
||||||
String stage = (String) set.get("stage");
|
String stage = (String) set.get("stage");
|
||||||
config.write(width, height, rounds, fullscreen, character1, character2, stage);
|
config.write(width, height, rounds, fullscreen, hitboxes, character1, character2, stage);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
config.write(800, 600, 3, false, "blue", "blue", "default");
|
config.write(800, 600, 3, false, false, "blue", "blue", "default");
|
||||||
System.out.println("Incorrect config file");
|
System.out.println("Incorrect config file");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -40,6 +41,14 @@ public class Settings {
|
|||||||
return config.fullscreen;
|
return config.fullscreen;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean getHitboxes() {
|
||||||
|
return config.hitboxes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRounds() {
|
||||||
|
return Integer.toString(config.rounds);
|
||||||
|
}
|
||||||
|
|
||||||
public String getChar1() {
|
public String getChar1() {
|
||||||
return config.p1;
|
return config.p1;
|
||||||
}
|
}
|
||||||
|
@ -42,6 +42,14 @@
|
|||||||
<CheckBox fx:id="fullscreen"/>
|
<CheckBox fx:id="fullscreen"/>
|
||||||
</children>
|
</children>
|
||||||
</HBox>
|
</HBox>
|
||||||
|
<Label text="Rounds"/>
|
||||||
|
<ChoiceBox fx:id="rounds" styleClass="res_box"/>
|
||||||
|
<HBox fx:id="hb_box" styleClass="fs_box">
|
||||||
|
<children>
|
||||||
|
<Label text="Hitboxes "/>
|
||||||
|
<CheckBox fx:id="hitboxes"/>
|
||||||
|
</children>
|
||||||
|
</HBox>
|
||||||
<Button text="Play" fx:id="btn_launch" onAction="#launch"
|
<Button text="Play" fx:id="btn_launch" onAction="#launch"
|
||||||
prefWidth="110" prefHeight="15"/>
|
prefWidth="110" prefHeight="15"/>
|
||||||
<Button text="Quit" fx:id="btn_quit" onAction="#quit"
|
<Button text="Quit" fx:id="btn_quit" onAction="#quit"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user