Working on UI and web game
This commit is contained in:
parent
6b4b549b3c
commit
bb0f584bf6
BIN
resources/Cargo_Base_color_sRGB.png
(Stored with Git LFS)
BIN
resources/Cargo_Base_color_sRGB.png
(Stored with Git LFS)
Binary file not shown.
BIN
resources/MainCharacter_Base_color_sRGB.png
(Stored with Git LFS)
BIN
resources/MainCharacter_Base_color_sRGB.png
(Stored with Git LFS)
Binary file not shown.
@ -1,93 +1,85 @@
|
|||||||
{
|
{
|
||||||
"root": {
|
"root": {
|
||||||
"type": "LinearLayout",
|
"type": "LinearLayout",
|
||||||
"orientation": "vertical",
|
"orientation": "vertical",
|
||||||
"align": "center",
|
"vertical_align": "center",
|
||||||
"x": 0,
|
"horizontal_align": "center",
|
||||||
"y": 0,
|
"spacing": 10,
|
||||||
"width": 1920,
|
"x": 0,
|
||||||
"height": 1080,
|
"y": 0,
|
||||||
"background": {
|
"width": "match_parent",
|
||||||
"color": [0, 0, 0, 0.7]
|
"height": "match_parent",
|
||||||
},
|
"children": [
|
||||||
"children": [
|
{
|
||||||
{
|
"type": "Button",
|
||||||
"type": "Button",
|
"name": "gameOverText",
|
||||||
"name": "gameOverText",
|
"width": 327,
|
||||||
"x": 476.5,
|
"height": 26,
|
||||||
"y": 500,
|
"textures": {
|
||||||
"width": 327,
|
"normal": "resources/game_over/MissionFailed.png",
|
||||||
"height": 26,
|
"hover": "resources/game_over/MissionFailed.png",
|
||||||
"textures": {
|
"pressed": "resources/game_over/MissionFailed.png"
|
||||||
"normal": "resources/game_over/MissionFailed.png",
|
}
|
||||||
"hover": "resources/game_over/MissionFailed.png",
|
},
|
||||||
"pressed": "resources/game_over/MissionFailed.png"
|
{
|
||||||
}
|
"type": "Button",
|
||||||
},
|
"name": "underlineBtn",
|
||||||
{
|
"width": 168,
|
||||||
"type": "Button",
|
"height": 44,
|
||||||
"name": "underlineBtn",
|
"textures": {
|
||||||
"x": 556,
|
"normal": "resources/game_over/Container.png",
|
||||||
"y": 465,
|
"hover": "resources/game_over/Container.png",
|
||||||
"width": 168,
|
"pressed": "resources/game_over/Container.png"
|
||||||
"height": 44,
|
}
|
||||||
"textures": {
|
},
|
||||||
"normal": "resources/game_over/Container.png",
|
{
|
||||||
"hover": "resources/game_over/Container.png",
|
"type": "Button",
|
||||||
"pressed": "resources/game_over/Container.png"
|
"name": "finalscore",
|
||||||
}
|
"width": 87,
|
||||||
},
|
"height": 9,
|
||||||
{
|
"textures": {
|
||||||
"type": "Button",
|
"normal": "resources/game_over/FinalScore.png",
|
||||||
"name": "finalscore",
|
"hover": "resources/game_over/FinalScore.png",
|
||||||
"x": 596.5,
|
"pressed": "resources/game_over/FinalScore.png"
|
||||||
"y": 436,
|
}
|
||||||
"width": 87,
|
},
|
||||||
"height": 9,
|
{
|
||||||
"textures": {
|
"type": "TextView",
|
||||||
"normal": "resources/game_over/FinalScore.png",
|
"name": "scoreText",
|
||||||
"hover": "resources/game_over/FinalScore.png",
|
"width": 600,
|
||||||
"pressed": "resources/game_over/FinalScore.png"
|
"height": 80,
|
||||||
}
|
"text": "0",
|
||||||
},
|
"fontSize": 36,
|
||||||
{
|
"color": [
|
||||||
"type": "TextView",
|
0,
|
||||||
"name": "scoreText",
|
217,
|
||||||
"x": 350,
|
255,
|
||||||
"y": 356,
|
1
|
||||||
"width": 600,
|
],
|
||||||
"height": 80,
|
"align": "center"
|
||||||
"text": "0",
|
},
|
||||||
"fontSize": 36,
|
{
|
||||||
"color": [0, 217, 255, 1],
|
"type": "Button",
|
||||||
"align": "center"
|
"name": "restartButton",
|
||||||
},
|
"width": 382,
|
||||||
{
|
"height": 56,
|
||||||
"type": "Button",
|
"textures": {
|
||||||
"name": "restartButton",
|
"normal": "resources/game_over/Filledbuttons.png",
|
||||||
"x": 449,
|
"hover": "resources/game_over/Filledbuttons.png",
|
||||||
"y": 308,
|
"pressed": "resources/game_over/Filledbuttons.png"
|
||||||
"width": 382,
|
}
|
||||||
"height": 56,
|
},
|
||||||
"textures": {
|
{
|
||||||
"normal": "resources/game_over/Filledbuttons.png",
|
"type": "Button",
|
||||||
"hover": "resources/game_over/Filledbuttons.png",
|
"name": "gameOverExitButton",
|
||||||
"pressed": "resources/game_over/Filledbuttons.png"
|
"width": 382,
|
||||||
}
|
"height": 56,
|
||||||
},
|
"textures": {
|
||||||
{
|
"normal": "resources/game_over/Secondarybutton.png",
|
||||||
"type": "Button",
|
"hover": "resources/game_over/Secondarybutton.png",
|
||||||
"name": "gameOverExitButton",
|
"pressed": "resources/game_over/Secondarybutton.png"
|
||||||
"x": 449,
|
}
|
||||||
"y": 240,
|
}
|
||||||
"width": 382,
|
]
|
||||||
"height": 56,
|
}
|
||||||
"textures": {
|
|
||||||
"normal": "resources/game_over/Secondarybutton.png",
|
|
||||||
"hover": "resources/game_over/Secondarybutton.png",
|
|
||||||
"pressed": "resources/game_over/Secondarybutton.png"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
93
resources/config/game_over_old.json
Normal file
93
resources/config/game_over_old.json
Normal file
@ -0,0 +1,93 @@
|
|||||||
|
{
|
||||||
|
"root": {
|
||||||
|
"type": "LinearLayout",
|
||||||
|
"orientation": "vertical",
|
||||||
|
"align": "center",
|
||||||
|
"x": 0,
|
||||||
|
"y": 0,
|
||||||
|
"width": 1920,
|
||||||
|
"height": 1080,
|
||||||
|
"background": {
|
||||||
|
"color": [0, 0, 0, 0.7]
|
||||||
|
},
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"type": "Button",
|
||||||
|
"name": "gameOverText",
|
||||||
|
"x": 476.5,
|
||||||
|
"y": 500,
|
||||||
|
"width": 327,
|
||||||
|
"height": 26,
|
||||||
|
"textures": {
|
||||||
|
"normal": "resources/game_over/MissionFailed.png",
|
||||||
|
"hover": "resources/game_over/MissionFailed.png",
|
||||||
|
"pressed": "resources/game_over/MissionFailed.png"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Button",
|
||||||
|
"name": "underlineBtn",
|
||||||
|
"x": 556,
|
||||||
|
"y": 465,
|
||||||
|
"width": 168,
|
||||||
|
"height": 44,
|
||||||
|
"textures": {
|
||||||
|
"normal": "resources/game_over/Container.png",
|
||||||
|
"hover": "resources/game_over/Container.png",
|
||||||
|
"pressed": "resources/game_over/Container.png"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Button",
|
||||||
|
"name": "finalscore",
|
||||||
|
"x": 596.5,
|
||||||
|
"y": 436,
|
||||||
|
"width": 87,
|
||||||
|
"height": 9,
|
||||||
|
"textures": {
|
||||||
|
"normal": "resources/game_over/FinalScore.png",
|
||||||
|
"hover": "resources/game_over/FinalScore.png",
|
||||||
|
"pressed": "resources/game_over/FinalScore.png"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "TextView",
|
||||||
|
"name": "scoreText",
|
||||||
|
"x": 350,
|
||||||
|
"y": 356,
|
||||||
|
"width": 600,
|
||||||
|
"height": 80,
|
||||||
|
"text": "0",
|
||||||
|
"fontSize": 36,
|
||||||
|
"color": [0, 217, 255, 1],
|
||||||
|
"align": "center"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Button",
|
||||||
|
"name": "restartButton",
|
||||||
|
"x": 449,
|
||||||
|
"y": 308,
|
||||||
|
"width": 382,
|
||||||
|
"height": 56,
|
||||||
|
"textures": {
|
||||||
|
"normal": "resources/game_over/Filledbuttons.png",
|
||||||
|
"hover": "resources/game_over/Filledbuttons.png",
|
||||||
|
"pressed": "resources/game_over/Filledbuttons.png"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Button",
|
||||||
|
"name": "gameOverExitButton",
|
||||||
|
"x": 449,
|
||||||
|
"y": 240,
|
||||||
|
"width": 382,
|
||||||
|
"height": 56,
|
||||||
|
"textures": {
|
||||||
|
"normal": "resources/game_over/Secondarybutton.png",
|
||||||
|
"hover": "resources/game_over/Secondarybutton.png",
|
||||||
|
"pressed": "resources/game_over/Secondarybutton.png"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -65,28 +65,6 @@
|
|||||||
"pressed": "resources/main_menu/multi.png"
|
"pressed": "resources/main_menu/multi.png"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"type": "Button",
|
|
||||||
"name": "multiplayerButton2",
|
|
||||||
"width": 382,
|
|
||||||
"height": 56,
|
|
||||||
"textures": {
|
|
||||||
"normal": "resources/main_menu/multi.png",
|
|
||||||
"hover": "resources/main_menu/multi.png",
|
|
||||||
"pressed": "resources/main_menu/multi.png"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "Button",
|
|
||||||
"name": "exitButton",
|
|
||||||
"width": 382,
|
|
||||||
"height": 56,
|
|
||||||
"textures": {
|
|
||||||
"normal": "resources/main_menu/exit.png",
|
|
||||||
"hover": "resources/main_menu/exit.png",
|
|
||||||
"pressed": "resources/main_menu/exit.png"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"type": "Button",
|
"type": "Button",
|
||||||
"name": "versionLabel",
|
"name": "versionLabel",
|
||||||
|
|||||||
@ -1,64 +1,59 @@
|
|||||||
{
|
{
|
||||||
"root": {
|
"root": {
|
||||||
"name": "shipSelectionRoot",
|
"type": "LinearLayout",
|
||||||
"type": "node",
|
"orientation": "vertical",
|
||||||
"children": [
|
"vertical_align": "center",
|
||||||
|
"horizontal_align": "center",
|
||||||
{
|
"spacing": 10,
|
||||||
"type": "TextField",
|
"x": 0,
|
||||||
"name": "nicknameInput",
|
"y": 0,
|
||||||
"x": 400,
|
"width": "match_parent",
|
||||||
"y": 150,
|
"height": "match_parent",
|
||||||
"width": 400,
|
"children": [
|
||||||
"height": 50,
|
{
|
||||||
"placeholder": "Enter your nickname",
|
"type": "LinearLayout",
|
||||||
"fontPath": "resources/fonts/DroidSans.ttf",
|
"orientation": "horizontal",
|
||||||
"fontSize": 16,
|
"vertical_align": "center",
|
||||||
"maxLength": 256,
|
"horizontal_align": "center",
|
||||||
"color": [122, 156, 198, 1],
|
"spacing": 10,
|
||||||
"placeholderColor": [122, 156, 198, 1],
|
"width": "match_parent",
|
||||||
"backgroundColor": [15, 29, 51, 1],
|
"height": 260,
|
||||||
"borderColor": [15, 29, 51, 1]
|
"children": [
|
||||||
},
|
{
|
||||||
{
|
"type": "Button",
|
||||||
"type": "Button",
|
"name": "spaceshipButton",
|
||||||
"name": "spaceshipButton",
|
"width": 256,
|
||||||
"x": 300,
|
"height": 256,
|
||||||
"y": 320,
|
"textures": {
|
||||||
"width": 200,
|
"normal": "resources/multiplayer_menu/ship_fighter.png",
|
||||||
"height": 80,
|
"hover": "resources/multiplayer_menu/ship_fighter_pressed.png",
|
||||||
"textures": {
|
"pressed": "resources/multiplayer_menu/ship_fighter_pressed.png"
|
||||||
"normal": "resources/multiplayer_menu/JoinServer.png",
|
}
|
||||||
"hover": "resources/multiplayer_menu/JoinServer.png",
|
},
|
||||||
"pressed": "resources/multiplayer_menu/JoinServer.png"
|
{
|
||||||
|
"type": "Button",
|
||||||
|
"name": "cargoshipButton",
|
||||||
|
"width": 256,
|
||||||
|
"height": 256,
|
||||||
|
"textures": {
|
||||||
|
"normal": "resources/multiplayer_menu/ship_cargo.png",
|
||||||
|
"hover": "resources/multiplayer_menu/ship_cargo_pressed.png",
|
||||||
|
"pressed": "resources/multiplayer_menu/ship_cargo_pressed.png"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Button",
|
||||||
|
"name": "backButton",
|
||||||
|
"width": 382,
|
||||||
|
"height": 56,
|
||||||
|
"textures": {
|
||||||
|
"normal": "resources/multiplayer_menu/Backbutton.png",
|
||||||
|
"hover": "resources/multiplayer_menu/Backbutton.png",
|
||||||
|
"pressed": "resources/multiplayer_menu/Backbutton.png"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
]
|
||||||
{
|
}
|
||||||
"type": "Button",
|
}
|
||||||
"name": "cargoshipButton",
|
|
||||||
"x": 700,
|
|
||||||
"y": 320,
|
|
||||||
"width": 200,
|
|
||||||
"height": 80,
|
|
||||||
"textures": {
|
|
||||||
"normal": "resources/multiplayer_menu/JoinServer.png",
|
|
||||||
"hover": "resources/multiplayer_menu/JoinServer.png",
|
|
||||||
"pressed": "resources/multiplayer_menu/JoinServer.png"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "Button",
|
|
||||||
"name": "backButton",
|
|
||||||
"x": 449,
|
|
||||||
"y": 280,
|
|
||||||
"width": 382,
|
|
||||||
"height": 56,
|
|
||||||
"textures": {
|
|
||||||
"normal": "resources/multiplayer_menu/Backbutton.png",
|
|
||||||
"hover": "resources/multiplayer_menu/Backbutton.png",
|
|
||||||
"pressed": "resources/multiplayer_menu/Backbutton.png"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,194 +1,57 @@
|
|||||||
{
|
{
|
||||||
"root": {
|
"root": {
|
||||||
"type": "FrameLayout",
|
"type": "FrameLayout",
|
||||||
"x": 0,
|
"x": 0,
|
||||||
"y": 0,
|
"y": 0,
|
||||||
"width": 1280,
|
"width": "match_parent",
|
||||||
"height": 720,
|
"height": "match_parent",
|
||||||
"children": [
|
"children": [
|
||||||
{
|
|
||||||
"type": "FrameLayout",
|
|
||||||
"name": "leftPanel",
|
|
||||||
"x": 100,
|
|
||||||
"y": 100,
|
|
||||||
"width": 320,
|
|
||||||
"height": 400,
|
|
||||||
"children": [
|
|
||||||
{
|
{
|
||||||
"type": "LinearLayout",
|
"type": "Button",
|
||||||
"name": "mainButtons",
|
"name": "shootButton",
|
||||||
"orientation": "vertical",
|
"x": 0,
|
||||||
"spacing": 10,
|
"y": 0,
|
||||||
"x": 0,
|
"width": 150,
|
||||||
"y": 0,
|
"height": 150,
|
||||||
"width": 300,
|
"horizontal_gravity": "right",
|
||||||
"height": 300,
|
"vertical_gravity": "bottom",
|
||||||
"children": [
|
"textures": {
|
||||||
{
|
"normal": "resources/shoot_normal.png",
|
||||||
"type": "Button",
|
"hover": "resources/shoot_hover.png",
|
||||||
"name": "playButton",
|
"pressed": "resources/shoot_pressed.png"
|
||||||
"x": -1000,
|
}
|
||||||
"y": 500,
|
},
|
||||||
"width": 200,
|
{
|
||||||
"height": 50,
|
"type": "Button",
|
||||||
"animations": {
|
"name": "shootButton2",
|
||||||
"buttonsExit": {
|
"x": 0,
|
||||||
"repeat": false,
|
"y": 0,
|
||||||
"steps": [
|
"width": 150,
|
||||||
{
|
"height": 150,
|
||||||
"type": "move",
|
"horizontal_gravity": "left",
|
||||||
"to": [
|
"vertical_gravity": "bottom",
|
||||||
-400,
|
"textures": {
|
||||||
0
|
"normal": "resources/shoot_normal.png",
|
||||||
],
|
"hover": "resources/shoot_hover.png",
|
||||||
"duration": 1.0,
|
"pressed": "resources/shoot_pressed.png"
|
||||||
"easing": "easein"
|
}
|
||||||
}
|
},
|
||||||
]
|
{
|
||||||
}
|
"type": "Slider",
|
||||||
},
|
"name": "velocitySlider",
|
||||||
"textures": {
|
"x": 10,
|
||||||
"normal": "./resources/sand2.png",
|
"y": 200,
|
||||||
"hover": "./resources/sand2.png",
|
"width": 80,
|
||||||
"pressed": "./resources/sand2.png"
|
"height": 300,
|
||||||
}
|
"value": 0.0,
|
||||||
},
|
"orientation": "vertical",
|
||||||
{
|
"horizontal_gravity": "right",
|
||||||
"type": "Button",
|
"vertical_gravity": "bottom",
|
||||||
"name": "settingsButton",
|
"textures": {
|
||||||
"x": -1000,
|
"track": "resources/velocitySliderTexture.png",
|
||||||
"y": 400,
|
"knob": "resources/velocitySliderButton.png"
|
||||||
"width": 200,
|
|
||||||
"height": 50,
|
|
||||||
"animations": {
|
|
||||||
"buttonsExit": {
|
|
||||||
"repeat": false,
|
|
||||||
"steps": [
|
|
||||||
{
|
|
||||||
"type": "wait",
|
|
||||||
"duration": 0.5
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "move",
|
|
||||||
"to": [
|
|
||||||
-400,
|
|
||||||
0
|
|
||||||
],
|
|
||||||
"duration": 1.0,
|
|
||||||
"easing": "easein"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"textures": {
|
|
||||||
"normal": "./resources/sand2.png",
|
|
||||||
"hover": "./resources/sand2.png",
|
|
||||||
"pressed": "./resources/sand2.png"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "Button",
|
|
||||||
"name": "exitButton",
|
|
||||||
"x": -1000,
|
|
||||||
"y": 300,
|
|
||||||
"width": 200,
|
|
||||||
"height": 50,
|
|
||||||
"animations": {
|
|
||||||
"buttonsExit": {
|
|
||||||
"repeat": false,
|
|
||||||
"steps": [
|
|
||||||
{
|
|
||||||
"type": "wait",
|
|
||||||
"duration": 1.0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "move",
|
|
||||||
"to": [
|
|
||||||
-400,
|
|
||||||
0
|
|
||||||
],
|
|
||||||
"duration": 1.0,
|
|
||||||
"easing": "easein"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"bgScroll": {
|
|
||||||
"repeat": true,
|
|
||||||
"steps": [
|
|
||||||
{
|
|
||||||
"type": "move",
|
|
||||||
"to": [
|
|
||||||
1280,
|
|
||||||
0
|
|
||||||
],
|
|
||||||
"duration": 5.0,
|
|
||||||
"easing": "linear"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"textures": {
|
|
||||||
"normal": "./resources/sand2.png",
|
|
||||||
"hover": "./resources/sand2.png",
|
|
||||||
"pressed": "./resources/sand2.png"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
]
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "Slider",
|
|
||||||
"name": "velocitySlider",
|
|
||||||
"x": 1140,
|
|
||||||
"y": 300,
|
|
||||||
"width": 50,
|
|
||||||
"height": 300,
|
|
||||||
"value": 0.0,
|
|
||||||
"orientation": "vertical",
|
|
||||||
"textures": {
|
|
||||||
"track": "resources/velocitySliderTexture.png",
|
|
||||||
"knob": "resources/velocitySliderButton.png"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "Button",
|
|
||||||
"name": "shootButton",
|
|
||||||
"x": 100,
|
|
||||||
"y": 100,
|
|
||||||
"width": 100,
|
|
||||||
"height": 100,
|
|
||||||
"textures": {
|
|
||||||
"normal": "resources/shoot_normal.png",
|
|
||||||
"hover": "resources/shoot_hover.png",
|
|
||||||
"pressed": "resources/shoot_pressed.png"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "Button",
|
|
||||||
"name": "shootButton2",
|
|
||||||
"x": 1000,
|
|
||||||
"y": 100,
|
|
||||||
"width": 100,
|
|
||||||
"height": 100,
|
|
||||||
"textures": {
|
|
||||||
"normal": "resources/shoot_normal.png",
|
|
||||||
"hover": "resources/shoot_hover.png",
|
|
||||||
"pressed": "resources/shoot_pressed.png"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "TextView",
|
|
||||||
"name": "velocityText",
|
|
||||||
"x": 10,
|
|
||||||
"y": 10,
|
|
||||||
"width": 200,
|
|
||||||
"height": 40,
|
|
||||||
"text": "Velocity: 0",
|
|
||||||
"fontSize": 24,
|
|
||||||
"color": [1.0, 1.0, 1.0, 1.0],
|
|
||||||
"centered": false
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
194
resources/config/ui_old.json
Normal file
194
resources/config/ui_old.json
Normal file
@ -0,0 +1,194 @@
|
|||||||
|
{
|
||||||
|
"root": {
|
||||||
|
"type": "FrameLayout",
|
||||||
|
"x": 0,
|
||||||
|
"y": 0,
|
||||||
|
"width": 1280,
|
||||||
|
"height": 720,
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"type": "FrameLayout",
|
||||||
|
"name": "leftPanel",
|
||||||
|
"x": 100,
|
||||||
|
"y": 100,
|
||||||
|
"width": 320,
|
||||||
|
"height": 400,
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"type": "LinearLayout",
|
||||||
|
"name": "mainButtons",
|
||||||
|
"orientation": "vertical",
|
||||||
|
"spacing": 10,
|
||||||
|
"x": 0,
|
||||||
|
"y": 0,
|
||||||
|
"width": 300,
|
||||||
|
"height": 300,
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"type": "Button",
|
||||||
|
"name": "playButton",
|
||||||
|
"x": -1000,
|
||||||
|
"y": 500,
|
||||||
|
"width": 200,
|
||||||
|
"height": 50,
|
||||||
|
"animations": {
|
||||||
|
"buttonsExit": {
|
||||||
|
"repeat": false,
|
||||||
|
"steps": [
|
||||||
|
{
|
||||||
|
"type": "move",
|
||||||
|
"to": [
|
||||||
|
-400,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"duration": 1.0,
|
||||||
|
"easing": "easein"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"textures": {
|
||||||
|
"normal": "./resources/sand2.png",
|
||||||
|
"hover": "./resources/sand2.png",
|
||||||
|
"pressed": "./resources/sand2.png"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Button",
|
||||||
|
"name": "settingsButton",
|
||||||
|
"x": -1000,
|
||||||
|
"y": 400,
|
||||||
|
"width": 200,
|
||||||
|
"height": 50,
|
||||||
|
"animations": {
|
||||||
|
"buttonsExit": {
|
||||||
|
"repeat": false,
|
||||||
|
"steps": [
|
||||||
|
{
|
||||||
|
"type": "wait",
|
||||||
|
"duration": 0.5
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "move",
|
||||||
|
"to": [
|
||||||
|
-400,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"duration": 1.0,
|
||||||
|
"easing": "easein"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"textures": {
|
||||||
|
"normal": "./resources/sand2.png",
|
||||||
|
"hover": "./resources/sand2.png",
|
||||||
|
"pressed": "./resources/sand2.png"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Button",
|
||||||
|
"name": "exitButton",
|
||||||
|
"x": -1000,
|
||||||
|
"y": 300,
|
||||||
|
"width": 200,
|
||||||
|
"height": 50,
|
||||||
|
"animations": {
|
||||||
|
"buttonsExit": {
|
||||||
|
"repeat": false,
|
||||||
|
"steps": [
|
||||||
|
{
|
||||||
|
"type": "wait",
|
||||||
|
"duration": 1.0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "move",
|
||||||
|
"to": [
|
||||||
|
-400,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"duration": 1.0,
|
||||||
|
"easing": "easein"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"bgScroll": {
|
||||||
|
"repeat": true,
|
||||||
|
"steps": [
|
||||||
|
{
|
||||||
|
"type": "move",
|
||||||
|
"to": [
|
||||||
|
1280,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"duration": 5.0,
|
||||||
|
"easing": "linear"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"textures": {
|
||||||
|
"normal": "./resources/sand2.png",
|
||||||
|
"hover": "./resources/sand2.png",
|
||||||
|
"pressed": "./resources/sand2.png"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Slider",
|
||||||
|
"name": "velocitySlider",
|
||||||
|
"x": 1140,
|
||||||
|
"y": 300,
|
||||||
|
"width": 50,
|
||||||
|
"height": 300,
|
||||||
|
"value": 0.0,
|
||||||
|
"orientation": "vertical",
|
||||||
|
"textures": {
|
||||||
|
"track": "resources/velocitySliderTexture.png",
|
||||||
|
"knob": "resources/velocitySliderButton.png"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Button",
|
||||||
|
"name": "shootButton",
|
||||||
|
"x": 100,
|
||||||
|
"y": 100,
|
||||||
|
"width": 100,
|
||||||
|
"height": 100,
|
||||||
|
"textures": {
|
||||||
|
"normal": "resources/shoot_normal.png",
|
||||||
|
"hover": "resources/shoot_hover.png",
|
||||||
|
"pressed": "resources/shoot_pressed.png"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Button",
|
||||||
|
"name": "shootButton2",
|
||||||
|
"x": 1000,
|
||||||
|
"y": 100,
|
||||||
|
"width": 100,
|
||||||
|
"height": 100,
|
||||||
|
"textures": {
|
||||||
|
"normal": "resources/shoot_normal.png",
|
||||||
|
"hover": "resources/shoot_hover.png",
|
||||||
|
"pressed": "resources/shoot_pressed.png"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "TextView",
|
||||||
|
"name": "velocityText",
|
||||||
|
"x": 10,
|
||||||
|
"y": 10,
|
||||||
|
"width": 200,
|
||||||
|
"height": 40,
|
||||||
|
"text": "Velocity: 0",
|
||||||
|
"fontSize": 24,
|
||||||
|
"color": [1.0, 1.0, 1.0, 1.0],
|
||||||
|
"centered": false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
resources/multiplayer_menu/ship_cargo.png
(Stored with Git LFS)
Normal file
BIN
resources/multiplayer_menu/ship_cargo.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
resources/multiplayer_menu/ship_cargo_pressed.png
(Stored with Git LFS)
Normal file
BIN
resources/multiplayer_menu/ship_cargo_pressed.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
resources/multiplayer_menu/ship_fighter.png
(Stored with Git LFS)
Normal file
BIN
resources/multiplayer_menu/ship_fighter.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
resources/multiplayer_menu/ship_fighter_pressed.png
(Stored with Git LFS)
Normal file
BIN
resources/multiplayer_menu/ship_fighter_pressed.png
(Stored with Git LFS)
Normal file
Binary file not shown.
@ -96,6 +96,7 @@ namespace ZL {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
uiManager.setButtonCallback("shootButton", [this](const std::string& name) {
|
uiManager.setButtonCallback("shootButton", [this](const std::string& name) {
|
||||||
onFirePressed();
|
onFirePressed();
|
||||||
});
|
});
|
||||||
@ -103,6 +104,7 @@ namespace ZL {
|
|||||||
onFirePressed();
|
onFirePressed();
|
||||||
});
|
});
|
||||||
uiManager.setSliderCallback("velocitySlider", [this](const std::string& name, float value) {
|
uiManager.setSliderCallback("velocitySlider", [this](const std::string& name, float value) {
|
||||||
|
|
||||||
int newVel = roundf(value * 10);
|
int newVel = roundf(value * 10);
|
||||||
if (newVel > 2)
|
if (newVel > 2)
|
||||||
{
|
{
|
||||||
@ -183,8 +185,8 @@ namespace ZL {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
uiManager.setButtonCallback("multiplayerButton2", [this, shipSelectionRoot, loadGameplayUI](const std::string& name) {
|
/*uiManager.setButtonCallback("multiplayerButton2", [this, shipSelectionRoot, loadGameplayUI](const std::string& name) {
|
||||||
/*std::cerr << "Multiplayer button pressed → opening multiplayer menu\n";
|
std::cerr << "Multiplayer button pressed → opening multiplayer menu\n";
|
||||||
|
|
||||||
uiManager.startAnimationOnNode("playButton", "buttonsExit");
|
uiManager.startAnimationOnNode("playButton", "buttonsExit");
|
||||||
uiManager.startAnimationOnNode("settingsButton", "buttonsExit");
|
uiManager.startAnimationOnNode("settingsButton", "buttonsExit");
|
||||||
@ -219,7 +221,7 @@ namespace ZL {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
std::cerr << "Failed to load multiplayer menu\n";
|
std::cerr << "Failed to load multiplayer menu\n";
|
||||||
}*/
|
}
|
||||||
std::cerr << "Single button pressed: " << name << " -> open ship selection UI\n";
|
std::cerr << "Single button pressed: " << name << " -> open ship selection UI\n";
|
||||||
if (!shipSelectionRoot) {
|
if (!shipSelectionRoot) {
|
||||||
std::cerr << "Failed to load ship selection UI\n";
|
std::cerr << "Failed to load ship selection UI\n";
|
||||||
@ -255,7 +257,7 @@ namespace ZL {
|
|||||||
uiManager.setButtonCallback("exitButton", [](const std::string& name) {
|
uiManager.setButtonCallback("exitButton", [](const std::string& name) {
|
||||||
std::cerr << "Exit from main menu pressed: " << name << " -> exiting\n";
|
std::cerr << "Exit from main menu pressed: " << name << " -> exiting\n";
|
||||||
Environment::exitGameLoop = true;
|
Environment::exitGameLoop = true;
|
||||||
});
|
});*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuManager::showGameOver(int score)
|
void MenuManager::showGameOver(int score)
|
||||||
|
|||||||
@ -244,6 +244,20 @@ namespace ZL {
|
|||||||
if (valign == "center") node->layoutSettings.vAlign = VerticalAlign::Center;
|
if (valign == "center") node->layoutSettings.vAlign = VerticalAlign::Center;
|
||||||
else if (valign == "bottom") node->layoutSettings.vAlign = VerticalAlign::Bottom;
|
else if (valign == "bottom") node->layoutSettings.vAlign = VerticalAlign::Bottom;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (j.contains("horizontal_gravity")) {
|
||||||
|
std::string hg = j["horizontal_gravity"].get<std::string>();
|
||||||
|
if (hg == "right") node->layoutSettings.hGravity = HorizontalGravity::Right;
|
||||||
|
else node->layoutSettings.hGravity = HorizontalGravity::Left;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Читаем Vertical Gravity
|
||||||
|
if (j.contains("vertical_gravity")) {
|
||||||
|
std::string vg = j["vertical_gravity"].get<std::string>();
|
||||||
|
if (vg == "bottom") node->layoutSettings.vGravity = VerticalGravity::Bottom;
|
||||||
|
else node->layoutSettings.vGravity = VerticalGravity::Top;
|
||||||
|
}
|
||||||
|
|
||||||
// Подготавливаем базовый rect для компонентов (кнопок и т.д.)
|
// Подготавливаем базовый rect для компонентов (кнопок и т.д.)
|
||||||
// На этапе парсинга мы даем им "желаемый" размер
|
// На этапе парсинга мы даем им "желаемый" размер
|
||||||
UiRect initialRect = { node->localX, node->localY, node->width, node->height };
|
UiRect initialRect = { node->localX, node->localY, node->width, node->height };
|
||||||
@ -462,7 +476,14 @@ namespace ZL {
|
|||||||
|
|
||||||
void UiManager::replaceRoot(std::shared_ptr<UiNode> newRoot) {
|
void UiManager::replaceRoot(std::shared_ptr<UiNode> newRoot) {
|
||||||
root = newRoot;
|
root = newRoot;
|
||||||
layoutNode(root, 0, 0, Environment::projectionWidth, Environment::projectionHeight);
|
layoutNode(
|
||||||
|
root,
|
||||||
|
0.0f, 0.0f, // parentX, parentY (экран начинается с 0,0)
|
||||||
|
Environment::projectionWidth, // parentW
|
||||||
|
Environment::projectionHeight, // parentH
|
||||||
|
root->localX, // finalLocalX
|
||||||
|
root->localY // finalLocalY
|
||||||
|
);
|
||||||
buttons.clear();
|
buttons.clear();
|
||||||
sliders.clear();
|
sliders.clear();
|
||||||
textViews.clear();
|
textViews.clear();
|
||||||
@ -487,15 +508,15 @@ namespace ZL {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void UiManager::layoutNode(const std::shared_ptr<UiNode>& node, float parentX, float parentY, float parentW, float parentH) {
|
void UiManager::layoutNode(const std::shared_ptr<UiNode>& node, float parentX, float parentY, float parentW, float parentH, float finalLocalX, float finalLocalY) {
|
||||||
|
|
||||||
node->screenRect.w = (node->width < 0) ? parentW : node->width;
|
node->screenRect.w = (node->width < 0) ? parentW : node->width;
|
||||||
node->screenRect.h = (node->height < 0) ? parentH : node->height;
|
node->screenRect.h = (node->height < 0) ? parentH : node->height;
|
||||||
|
|
||||||
// 2. Позиция относительно родителя
|
// ТЕПЕРЬ используем переданные координаты, а не node->localX напрямую
|
||||||
node->screenRect.x = parentX + node->localX;
|
node->screenRect.x = parentX + finalLocalX;
|
||||||
node->screenRect.y = parentY + node->localY;
|
node->screenRect.y = parentY + finalLocalY;
|
||||||
|
|
||||||
// Используем удобные локальные переменные для расчетов детей
|
|
||||||
float currentW = node->screenRect.w;
|
float currentW = node->screenRect.w;
|
||||||
float currentH = node->screenRect.h;
|
float currentH = node->screenRect.h;
|
||||||
|
|
||||||
@ -579,13 +600,26 @@ namespace ZL {
|
|||||||
// Сдвигаем курсор вправо для следующего элемента
|
// Сдвигаем курсор вправо для следующего элемента
|
||||||
cursorX += childW + node->spacing;
|
cursorX += childW + node->spacing;
|
||||||
}
|
}
|
||||||
layoutNode(child, node->screenRect.x, node->screenRect.y, currentW, currentH);
|
layoutNode(child, node->screenRect.x, node->screenRect.y, currentW, currentH, child->localX, child->localY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Если Frame, просто идем по детям с их фиксированными координатами
|
|
||||||
for (auto& child : node->children) {
|
for (auto& child : node->children) {
|
||||||
layoutNode(child, node->screenRect.x, node->screenRect.y, node->width, node->height);
|
float childW = (child->width < 0) ? currentW : child->width;
|
||||||
|
float childH = (child->height < 0) ? currentH : child->height;
|
||||||
|
|
||||||
|
float fLX = child->localX;
|
||||||
|
float fLY = child->localY;
|
||||||
|
|
||||||
|
if (child->layoutSettings.hGravity == HorizontalGravity::Right) {
|
||||||
|
fLX = currentW - childW - child->localX;
|
||||||
|
}
|
||||||
|
if (child->layoutSettings.vGravity == VerticalGravity::Top) {
|
||||||
|
fLY = currentH - childH - child->localY;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Передаем рассчитанные fLX, fLY в рекурсию
|
||||||
|
layoutNode(child, node->screenRect.x, node->screenRect.y, currentW, currentH, fLX, fLY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -629,7 +663,14 @@ namespace ZL {
|
|||||||
if (!root) return;
|
if (!root) return;
|
||||||
|
|
||||||
// Запускаем расчет от корня, передавая размеры экрана как "родительские"
|
// Запускаем расчет от корня, передавая размеры экрана как "родительские"
|
||||||
layoutNode(root, 0, 0, Environment::projectionWidth, Environment::projectionHeight);
|
layoutNode(
|
||||||
|
root,
|
||||||
|
0.0f, 0.0f, // parentX, parentY (экран начинается с 0,0)
|
||||||
|
Environment::projectionWidth, // parentW
|
||||||
|
Environment::projectionHeight, // parentH
|
||||||
|
root->localX, // finalLocalX
|
||||||
|
root->localY // finalLocalY
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UiManager::collectButtonsAndSliders(const std::shared_ptr<UiNode>& node) {
|
void UiManager::collectButtonsAndSliders(const std::shared_ptr<UiNode>& node) {
|
||||||
|
|||||||
@ -53,10 +53,24 @@ namespace ZL {
|
|||||||
Bottom
|
Bottom
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum class HorizontalGravity {
|
||||||
|
Left,
|
||||||
|
Right
|
||||||
|
};
|
||||||
|
|
||||||
|
enum class VerticalGravity {
|
||||||
|
Bottom, // Обычно в OpenGL Y растет вверх, так что низ - это 0
|
||||||
|
Top
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
// В структуру или класс, отвечающий за LinearLayout (вероятно, это свойства UiNode)
|
// В структуру или класс, отвечающий за LinearLayout (вероятно, это свойства UiNode)
|
||||||
struct LayoutSettings {
|
struct LayoutSettings {
|
||||||
HorizontalAlign hAlign = HorizontalAlign::Left;
|
HorizontalAlign hAlign = HorizontalAlign::Left;
|
||||||
VerticalAlign vAlign = VerticalAlign::Top;
|
VerticalAlign vAlign = VerticalAlign::Top;
|
||||||
|
|
||||||
|
HorizontalGravity hGravity = HorizontalGravity::Left;
|
||||||
|
VerticalGravity vGravity = VerticalGravity::Top;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct UiButton {
|
struct UiButton {
|
||||||
@ -248,7 +262,7 @@ namespace ZL {
|
|||||||
void updateAllLayouts();
|
void updateAllLayouts();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void layoutNode(const std::shared_ptr<UiNode>& node, float parentX, float parentY, float parentW, float parentH);
|
void layoutNode(const std::shared_ptr<UiNode>& node, float parentX, float parentY, float parentW, float parentH, float finalLocalX, float finalLocalY);
|
||||||
void syncComponentRects(const std::shared_ptr<UiNode>& node);
|
void syncComponentRects(const std::shared_ptr<UiNode>& node);
|
||||||
void collectButtonsAndSliders(const std::shared_ptr<UiNode>& node);
|
void collectButtonsAndSliders(const std::shared_ptr<UiNode>& node);
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user