From ea6e4ff654b2a8ae34d3d39522c78be7ea302885 Mon Sep 17 00:00:00 2001 From: Vladislav Khorev Date: Mon, 23 Jul 2018 01:56:46 +0500 Subject: [PATCH] Major changes --- assets/galaxy_ptree.json | 14 +- assets/gui_main_menu.json | 74 +++--- assets/level1.txt | 13 +- assets/level10.txt | 1 + assets/level11.txt | 1 + assets/level12.txt | 1 + assets/level2.txt | 1 + assets/level3.txt | 1 + assets/level4.txt | 1 + assets/level5.txt | 1 + assets/level6.txt | 1 + assets/level7.txt | 1 + assets/level8.txt | 1 + assets/level9.txt | 1 + ...n-world.jpeg => 022259762-alien-world.jpg} | Bin ...863276-illustration-spiral-galaxy-vec.jpg} | Bin ...jpeg => 029655296-mountains-landscape.jpg} | Bin ...-illeo.jpeg => 037162994-sunset-illeo.jpg} | Bin ...g-world.jpeg => 038904975-dying-world.jpg} | Bin ...jpeg => 039839543-fantastic-landscape.jpg} | Bin ...jpeg => 040712579-fantastic-landscape.jpg} | Bin ...jpeg => 040712589-fantastic-landscape.jpg} | Bin ...jpeg => 040892807-fantastic-landscape.jpg} | Bin ...jpeg => 040892815-fantastic-landscape.jpg} | Bin ...jpeg => 041515701-fantastic-landscape.jpg} | Bin ...ape.jpeg => 047196154-venus-landscape.jpg} | Bin ...cape.jpeg => 053070150-moon-landscape.jpg} | Bin ...g => 058104293-red-planet-saturn-moon.jpg} | Bin ...594794-sunset-alien-planet-and-20km-g.jpg} | Bin ...eg => 065090581-exoplanet-exploration.jpg} | Bin ...743048-exoplanet-exploration-3d-rende.jpg} | Bin ...717925-lava-landscape-3d-illustration.jpg} | Bin ...085895-flying-over-mountains-sunny-da.jpg} | Bin ...515499-mars-red-planet-landscape-moun.jpg} | Bin .../{ => level_background}/shutterstock1.png | Bin .../{ => level_background}/shutterstock10.png | Bin .../{ => level_background}/shutterstock11.png | Bin .../{ => level_background}/shutterstock12.png | Bin .../{ => level_background}/shutterstock2.png | Bin .../{ => level_background}/shutterstock3.png | Bin .../{ => level_background}/shutterstock4.png | Bin .../{ => level_background}/shutterstock5.png | Bin .../{ => level_background}/shutterstock6.png | Bin .../{ => level_background}/shutterstock7.png | Bin .../{ => level_background}/shutterstock8.png | Bin .../{ => level_background}/shutterstock9.png | Bin .../gui_transparent_blackandwhite.fragment | 19 ++ .../gui_transparent_blackandwhite.vertex | 14 ++ game/galaxy_menu.cpp | 232 ++---------------- game/galaxy_menu.h | 5 +- game/galaxy_objects.h | 2 +- game/gamecode.cpp | 95 +++++-- game/gamecode.h | 12 +- game/main_code.cpp | 189 +++++++++++--- game/main_code.h | 15 +- 55 files changed, 363 insertions(+), 332 deletions(-) rename assets/level_background/{022259762-alien-world.jpeg => 022259762-alien-world.jpg} (100%) rename assets/level_background/{024863276-illustration-spiral-galaxy-vec.jpeg => 024863276-illustration-spiral-galaxy-vec.jpg} (100%) rename assets/level_background/{029655296-mountains-landscape.jpeg => 029655296-mountains-landscape.jpg} (100%) rename assets/level_background/{037162994-sunset-illeo.jpeg => 037162994-sunset-illeo.jpg} (100%) rename assets/level_background/{038904975-dying-world.jpeg => 038904975-dying-world.jpg} (100%) rename assets/level_background/{039839543-fantastic-landscape.jpeg => 039839543-fantastic-landscape.jpg} (100%) rename assets/level_background/{040712579-fantastic-landscape.jpeg => 040712579-fantastic-landscape.jpg} (100%) rename assets/level_background/{040712589-fantastic-landscape.jpeg => 040712589-fantastic-landscape.jpg} (100%) rename assets/level_background/{040892807-fantastic-landscape.jpeg => 040892807-fantastic-landscape.jpg} (100%) rename assets/level_background/{040892815-fantastic-landscape.jpeg => 040892815-fantastic-landscape.jpg} (100%) rename assets/level_background/{041515701-fantastic-landscape.jpeg => 041515701-fantastic-landscape.jpg} (100%) rename assets/level_background/{047196154-venus-landscape.jpeg => 047196154-venus-landscape.jpg} (100%) rename assets/level_background/{053070150-moon-landscape.jpeg => 053070150-moon-landscape.jpg} (100%) rename assets/level_background/{058104293-red-planet-saturn-moon.jpeg => 058104293-red-planet-saturn-moon.jpg} (100%) rename assets/level_background/{060594794-sunset-alien-planet-and-20km-g.jpeg => 060594794-sunset-alien-planet-and-20km-g.jpg} (100%) rename assets/level_background/{065090581-exoplanet-exploration.jpeg => 065090581-exoplanet-exploration.jpg} (100%) rename assets/level_background/{065743048-exoplanet-exploration-3d-rende.jpeg => 065743048-exoplanet-exploration-3d-rende.jpg} (100%) rename assets/level_background/{068717925-lava-landscape-3d-illustration.jpeg => 068717925-lava-landscape-3d-illustration.jpg} (100%) rename assets/level_background/{081085895-flying-over-mountains-sunny-da.jpeg => 081085895-flying-over-mountains-sunny-da.jpg} (100%) rename assets/level_background/{088515499-mars-red-planet-landscape-moun.jpeg => 088515499-mars-red-planet-landscape-moun.jpg} (100%) rename assets/{ => level_background}/shutterstock1.png (100%) rename assets/{ => level_background}/shutterstock10.png (100%) rename assets/{ => level_background}/shutterstock11.png (100%) rename assets/{ => level_background}/shutterstock12.png (100%) rename assets/{ => level_background}/shutterstock2.png (100%) rename assets/{ => level_background}/shutterstock3.png (100%) rename assets/{ => level_background}/shutterstock4.png (100%) rename assets/{ => level_background}/shutterstock5.png (100%) rename assets/{ => level_background}/shutterstock6.png (100%) rename assets/{ => level_background}/shutterstock7.png (100%) rename assets/{ => level_background}/shutterstock8.png (100%) rename assets/{ => level_background}/shutterstock9.png (100%) create mode 100755 assets/shaders/gui_transparent_blackandwhite.fragment create mode 100755 assets/shaders/gui_transparent_blackandwhite.vertex diff --git a/assets/galaxy_ptree.json b/assets/galaxy_ptree.json index a10524d..8eb4274 100755 --- a/assets/galaxy_ptree.json +++ b/assets/galaxy_ptree.json @@ -43,7 +43,10 @@ "name": "level3" }, { - "name": "level3" + "name": "level4" + }, + { + "name": "level5" } ] }, @@ -61,6 +64,15 @@ }, { "name": "level7" + }, + { + "name": "level3" + }, + { + "name": "level4" + }, + { + "name": "level5" } ] }, diff --git a/assets/gui_main_menu.json b/assets/gui_main_menu.json index 34e5470..f113c21 100755 --- a/assets/gui_main_menu.json +++ b/assets/gui_main_menu.json @@ -6,11 +6,12 @@ "width": "match_parent", "height": "match_parent", "visible" : 0, + "touchTransparency": 0, "horizontalAlignment": "HA_CENTER", "verticalAlignment": "VA_CENTER", "children": [{ "type": "VerticalScrollLayout", - "name": "leftSidePanel", + "name": "panel", "background": "#faf0ffFF", "borderType": "line", "borderColor": "#808080FF", @@ -18,17 +19,16 @@ "height": "match_parent", "touchTransparency": 0, "zLevel": 10, - "marginTop" : 40, - "marginBottom" : 40, - "paddingTop": 60, + "marginTop" : 0, + "marginBottom" : 0, + "paddingTop": 10, "paddingBottom": 10, "paddingLeft": 10, "paddingRight": 10, "itemSpacing": 20, "children" : [{ "type": "HorizontalLinearLayout", - "name": "embroiderySettings", - "itemSpacing": 30, + "name": "row1", "paddingBottom": 15, "paddingTop": 15, "paddingLeft": 15, @@ -36,43 +36,43 @@ "background": "#faf0ffFF", "borderType": "line", "borderColor": "#808080FF", - "width": "wrap_content", + "width": 454, "height": "wrap_content", "touchTransparency": 0, "itemSpacing": 20, "visible": 1, "children": [{ "type": "Button", - "name": "button6", + "name": "button0", "width": 128, "height": 80, - "background": "level1_prerender", + "background": "#00000000", "pressedDrawable": "#60606060", "hoverDrawable": "#60606060" }, { "type": "Button", - "name": "button7", + "name": "button1", "width": 128, "height": 80, - "background": "level2_prerender", + "background": "#00000000", "pressedDrawable": "#60606060", "hoverDrawable": "#60606060" }, { "type": "Button", - "name": "button8", + "name": "button2", "width": 128, "height": 80, - "background": "level3_prerender", + "background": "#00000000", "pressedDrawable": "#60606060", "hoverDrawable": "#60606060" }] }, { "type": "HorizontalLinearLayout", - "name": "embroiderySettings", - "itemSpacing": 30, + "name": "row2", + "itemSpacing": 20, "paddingBottom": 15, "paddingTop": 15, "paddingLeft": 15, @@ -80,42 +80,42 @@ "background": "#faf0ffFF", "borderType": "line", "borderColor": "#808080FF", - "width": "wrap_content", + "width": 454, "height": "wrap_content", "touchTransparency": 0, "visible": 1, "children": [{ "type": "Button", - "name": "button6", + "name": "button3", "width": 128, "height": 80, - "background": "level4_prerender", + "background": "#00000000", "pressedDrawable": "#60606060", "hoverDrawable": "#60606060" }, { "type": "Button", - "name": "button7", + "name": "button4", "width": 128, "height": 80, - "background": "level5_prerender", + "background": "#00000000", "pressedDrawable": "#60606060", "hoverDrawable": "#60606060" }, { "type": "Button", - "name": "button8", + "name": "button5", "width": 128, "height": 80, - "background": "level6_prerender", + "background": "#00000000", "pressedDrawable": "#60606060", "hoverDrawable": "#60606060" }] }, { "type": "HorizontalLinearLayout", - "name": "embroiderySettings", - "itemSpacing": 30, + "name": "row3", + "itemSpacing": 20, "paddingBottom": 15, "paddingTop": 15, "paddingLeft": 15, @@ -123,7 +123,7 @@ "background": "#faf0ffFF", "borderType": "line", "borderColor": "#808080FF", - "width": "wrap_content", + "width": 454, "height": "wrap_content", "touchTransparency": 1, "visible": 1, @@ -132,7 +132,7 @@ "name": "button6", "width": 128, "height": 80, - "background": "level7_prerender", + "background": "#00000000", "pressedDrawable": "#60606060", "hoverDrawable": "#60606060" }, @@ -141,7 +141,7 @@ "name": "button7", "width": 128, "height": 80, - "background": "level8_prerender", + "background": "#00000000", "pressedDrawable": "#60606060", "hoverDrawable": "#60606060" }, @@ -150,15 +150,15 @@ "name": "button8", "width": 128, "height": 80, - "background": "level9_prerender", + "background": "#00000000", "pressedDrawable": "#60606060", "hoverDrawable": "#60606060" }] }, { "type": "HorizontalLinearLayout", - "name": "embroiderySettings", - "itemSpacing": 30, + "name": "row4", + "itemSpacing": 20, "paddingBottom": 15, "paddingTop": 15, "paddingLeft": 15, @@ -166,34 +166,34 @@ "background": "#faf0ffFF", "borderType": "line", "borderColor": "#808080FF", - "width": "wrap_content", + "width": 454, "height": "wrap_content", "touchTransparency": 0, "visible": 1, "children": [{ "type": "Button", - "name": "button6", + "name": "button9", "width": 128, "height": 80, - "background": "level10_prerender", + "background": "#00000000", "pressedDrawable": "#60606060", "hoverDrawable": "#60606060" }, { "type": "Button", - "name": "button7", + "name": "button10", "width": 128, "height": 80, - "background": "level11_prerender", + "background": "#00000000", "pressedDrawable": "#60606060", "hoverDrawable": "#60606060" }, { "type": "Button", - "name": "button8", + "name": "button11", "width": 128, "height": 80, - "background": "level12_prerender", + "background": "#00000000", "pressedDrawable": "#60606060", "hoverDrawable": "#60606060" }] diff --git a/assets/level1.txt b/assets/level1.txt index 1cfbdae..6f0cae1 100755 --- a/assets/level1.txt +++ b/assets/level1.txt @@ -1,3 +1,4 @@ +022259762-alien-world.jpg 0, 255, 255, 255 0, 0, 0, 255 255, 0, 0, 255 @@ -18,14 +19,14 @@ Colormap 000000000000 000000000000 Brickmap -111111111111 -111111111111 -111111111111 000000000000 -111111111111 -111111111111 000000000000 -111111111111 +000000000000 +000000000000 +000000000000 +000000000000 +000000000000 +000000000000 111111111111 000000000000 000000000000 diff --git a/assets/level10.txt b/assets/level10.txt index 85caa92..b2fc492 100755 --- a/assets/level10.txt +++ b/assets/level10.txt @@ -1,3 +1,4 @@ +shutterstock10.png 0, 255, 255, 255 0, 0, 0, 255 255, 0, 190, 255 diff --git a/assets/level11.txt b/assets/level11.txt index e9570db..1ee8507 100755 --- a/assets/level11.txt +++ b/assets/level11.txt @@ -1,3 +1,4 @@ +shutterstock11.png 255, 255, 255, 255 0, 0, 0, 255 0, 237, 255, 255 diff --git a/assets/level12.txt b/assets/level12.txt index 3284830..c3deff9 100755 --- a/assets/level12.txt +++ b/assets/level12.txt @@ -1,3 +1,4 @@ +shutterstock12.png 255, 128, 128, 255 0, 0, 0, 255 159, 240, 255, 255 diff --git a/assets/level2.txt b/assets/level2.txt index c1bd395..25afb97 100755 --- a/assets/level2.txt +++ b/assets/level2.txt @@ -1,3 +1,4 @@ +shutterstock2.png 255, 0, 0, 255 0, 0, 0, 255 0, 255, 255, 255 diff --git a/assets/level3.txt b/assets/level3.txt index 8a9521e..2bc748f 100755 --- a/assets/level3.txt +++ b/assets/level3.txt @@ -1,3 +1,4 @@ +shutterstock3.png 0, 255, 255, 255 0, 0, 0, 255 0, 151, 113, 255 diff --git a/assets/level4.txt b/assets/level4.txt index 7c83fc1..823fb5a 100755 --- a/assets/level4.txt +++ b/assets/level4.txt @@ -1,3 +1,4 @@ +shutterstock4.png 255, 0, 0, 255 0, 0, 0, 255 101, 97, 255, 255 diff --git a/assets/level5.txt b/assets/level5.txt index 1a5d7c4..e0211ed 100755 --- a/assets/level5.txt +++ b/assets/level5.txt @@ -1,3 +1,4 @@ +shutterstock5.png 255, 0, 255, 255 0, 0, 0, 255 163, 255, 198, 255 diff --git a/assets/level6.txt b/assets/level6.txt index cf32e5e..f1c8a6b 100755 --- a/assets/level6.txt +++ b/assets/level6.txt @@ -1,3 +1,4 @@ +shutterstock6.png 255, 255, 255, 255 0, 0, 0, 255 255, 200, 5, 255 diff --git a/assets/level7.txt b/assets/level7.txt index 5a11037..f11dd8c 100755 --- a/assets/level7.txt +++ b/assets/level7.txt @@ -1,3 +1,4 @@ +shutterstock7.png 255, 255, 0, 255 0, 0, 0, 255 230, 230, 230, 255 diff --git a/assets/level8.txt b/assets/level8.txt index 8e97e38..d052fd9 100755 --- a/assets/level8.txt +++ b/assets/level8.txt @@ -1,3 +1,4 @@ +shutterstock8.png 0, 255, 255, 255 0, 0, 0, 255 217, 56, 62, 255 diff --git a/assets/level9.txt b/assets/level9.txt index e698b59..59754e6 100755 --- a/assets/level9.txt +++ b/assets/level9.txt @@ -1,3 +1,4 @@ +shutterstock9.png 0, 255, 0, 255 0, 0, 0, 255 255, 221, 0, 255 diff --git a/assets/level_background/022259762-alien-world.jpeg b/assets/level_background/022259762-alien-world.jpg similarity index 100% rename from assets/level_background/022259762-alien-world.jpeg rename to assets/level_background/022259762-alien-world.jpg diff --git a/assets/level_background/024863276-illustration-spiral-galaxy-vec.jpeg b/assets/level_background/024863276-illustration-spiral-galaxy-vec.jpg similarity index 100% rename from assets/level_background/024863276-illustration-spiral-galaxy-vec.jpeg rename to assets/level_background/024863276-illustration-spiral-galaxy-vec.jpg diff --git a/assets/level_background/029655296-mountains-landscape.jpeg b/assets/level_background/029655296-mountains-landscape.jpg similarity index 100% rename from assets/level_background/029655296-mountains-landscape.jpeg rename to assets/level_background/029655296-mountains-landscape.jpg diff --git a/assets/level_background/037162994-sunset-illeo.jpeg b/assets/level_background/037162994-sunset-illeo.jpg similarity index 100% rename from assets/level_background/037162994-sunset-illeo.jpeg rename to assets/level_background/037162994-sunset-illeo.jpg diff --git a/assets/level_background/038904975-dying-world.jpeg b/assets/level_background/038904975-dying-world.jpg similarity index 100% rename from assets/level_background/038904975-dying-world.jpeg rename to assets/level_background/038904975-dying-world.jpg diff --git a/assets/level_background/039839543-fantastic-landscape.jpeg b/assets/level_background/039839543-fantastic-landscape.jpg similarity index 100% rename from assets/level_background/039839543-fantastic-landscape.jpeg rename to assets/level_background/039839543-fantastic-landscape.jpg diff --git a/assets/level_background/040712579-fantastic-landscape.jpeg b/assets/level_background/040712579-fantastic-landscape.jpg similarity index 100% rename from assets/level_background/040712579-fantastic-landscape.jpeg rename to assets/level_background/040712579-fantastic-landscape.jpg diff --git a/assets/level_background/040712589-fantastic-landscape.jpeg b/assets/level_background/040712589-fantastic-landscape.jpg similarity index 100% rename from assets/level_background/040712589-fantastic-landscape.jpeg rename to assets/level_background/040712589-fantastic-landscape.jpg diff --git a/assets/level_background/040892807-fantastic-landscape.jpeg b/assets/level_background/040892807-fantastic-landscape.jpg similarity index 100% rename from assets/level_background/040892807-fantastic-landscape.jpeg rename to assets/level_background/040892807-fantastic-landscape.jpg diff --git a/assets/level_background/040892815-fantastic-landscape.jpeg b/assets/level_background/040892815-fantastic-landscape.jpg similarity index 100% rename from assets/level_background/040892815-fantastic-landscape.jpeg rename to assets/level_background/040892815-fantastic-landscape.jpg diff --git a/assets/level_background/041515701-fantastic-landscape.jpeg b/assets/level_background/041515701-fantastic-landscape.jpg similarity index 100% rename from assets/level_background/041515701-fantastic-landscape.jpeg rename to assets/level_background/041515701-fantastic-landscape.jpg diff --git a/assets/level_background/047196154-venus-landscape.jpeg b/assets/level_background/047196154-venus-landscape.jpg similarity index 100% rename from assets/level_background/047196154-venus-landscape.jpeg rename to assets/level_background/047196154-venus-landscape.jpg diff --git a/assets/level_background/053070150-moon-landscape.jpeg b/assets/level_background/053070150-moon-landscape.jpg similarity index 100% rename from assets/level_background/053070150-moon-landscape.jpeg rename to assets/level_background/053070150-moon-landscape.jpg diff --git a/assets/level_background/058104293-red-planet-saturn-moon.jpeg b/assets/level_background/058104293-red-planet-saturn-moon.jpg similarity index 100% rename from assets/level_background/058104293-red-planet-saturn-moon.jpeg rename to assets/level_background/058104293-red-planet-saturn-moon.jpg diff --git a/assets/level_background/060594794-sunset-alien-planet-and-20km-g.jpeg b/assets/level_background/060594794-sunset-alien-planet-and-20km-g.jpg similarity index 100% rename from assets/level_background/060594794-sunset-alien-planet-and-20km-g.jpeg rename to assets/level_background/060594794-sunset-alien-planet-and-20km-g.jpg diff --git a/assets/level_background/065090581-exoplanet-exploration.jpeg b/assets/level_background/065090581-exoplanet-exploration.jpg similarity index 100% rename from assets/level_background/065090581-exoplanet-exploration.jpeg rename to assets/level_background/065090581-exoplanet-exploration.jpg diff --git a/assets/level_background/065743048-exoplanet-exploration-3d-rende.jpeg b/assets/level_background/065743048-exoplanet-exploration-3d-rende.jpg similarity index 100% rename from assets/level_background/065743048-exoplanet-exploration-3d-rende.jpeg rename to assets/level_background/065743048-exoplanet-exploration-3d-rende.jpg diff --git a/assets/level_background/068717925-lava-landscape-3d-illustration.jpeg b/assets/level_background/068717925-lava-landscape-3d-illustration.jpg similarity index 100% rename from assets/level_background/068717925-lava-landscape-3d-illustration.jpeg rename to assets/level_background/068717925-lava-landscape-3d-illustration.jpg diff --git a/assets/level_background/081085895-flying-over-mountains-sunny-da.jpeg b/assets/level_background/081085895-flying-over-mountains-sunny-da.jpg similarity index 100% rename from assets/level_background/081085895-flying-over-mountains-sunny-da.jpeg rename to assets/level_background/081085895-flying-over-mountains-sunny-da.jpg diff --git a/assets/level_background/088515499-mars-red-planet-landscape-moun.jpeg b/assets/level_background/088515499-mars-red-planet-landscape-moun.jpg similarity index 100% rename from assets/level_background/088515499-mars-red-planet-landscape-moun.jpeg rename to assets/level_background/088515499-mars-red-planet-landscape-moun.jpg diff --git a/assets/shutterstock1.png b/assets/level_background/shutterstock1.png similarity index 100% rename from assets/shutterstock1.png rename to assets/level_background/shutterstock1.png diff --git a/assets/shutterstock10.png b/assets/level_background/shutterstock10.png similarity index 100% rename from assets/shutterstock10.png rename to assets/level_background/shutterstock10.png diff --git a/assets/shutterstock11.png b/assets/level_background/shutterstock11.png similarity index 100% rename from assets/shutterstock11.png rename to assets/level_background/shutterstock11.png diff --git a/assets/shutterstock12.png b/assets/level_background/shutterstock12.png similarity index 100% rename from assets/shutterstock12.png rename to assets/level_background/shutterstock12.png diff --git a/assets/shutterstock2.png b/assets/level_background/shutterstock2.png similarity index 100% rename from assets/shutterstock2.png rename to assets/level_background/shutterstock2.png diff --git a/assets/shutterstock3.png b/assets/level_background/shutterstock3.png similarity index 100% rename from assets/shutterstock3.png rename to assets/level_background/shutterstock3.png diff --git a/assets/shutterstock4.png b/assets/level_background/shutterstock4.png similarity index 100% rename from assets/shutterstock4.png rename to assets/level_background/shutterstock4.png diff --git a/assets/shutterstock5.png b/assets/level_background/shutterstock5.png similarity index 100% rename from assets/shutterstock5.png rename to assets/level_background/shutterstock5.png diff --git a/assets/shutterstock6.png b/assets/level_background/shutterstock6.png similarity index 100% rename from assets/shutterstock6.png rename to assets/level_background/shutterstock6.png diff --git a/assets/shutterstock7.png b/assets/level_background/shutterstock7.png similarity index 100% rename from assets/shutterstock7.png rename to assets/level_background/shutterstock7.png diff --git a/assets/shutterstock8.png b/assets/level_background/shutterstock8.png similarity index 100% rename from assets/shutterstock8.png rename to assets/level_background/shutterstock8.png diff --git a/assets/shutterstock9.png b/assets/level_background/shutterstock9.png similarity index 100% rename from assets/shutterstock9.png rename to assets/level_background/shutterstock9.png diff --git a/assets/shaders/gui_transparent_blackandwhite.fragment b/assets/shaders/gui_transparent_blackandwhite.fragment new file mode 100755 index 0000000..de8822d --- /dev/null +++ b/assets/shaders/gui_transparent_blackandwhite.fragment @@ -0,0 +1,19 @@ +precision highp float; + +uniform sampler2D Texture; +varying vec2 texCoord; +varying vec4 color; + +void main() +{ + vec4 texColor = texture2D(Texture,texCoord).rgba; + + + + vec4 resultColor = color * texColor.rgba; + + float c = (resultColor.r * 0.3 + resultColor.g * 0.59 + resultColor.b * 0.11); + + + gl_FragColor = vec4(c,c,c,resultColor.a); +} diff --git a/assets/shaders/gui_transparent_blackandwhite.vertex b/assets/shaders/gui_transparent_blackandwhite.vertex new file mode 100755 index 0000000..96d784e --- /dev/null +++ b/assets/shaders/gui_transparent_blackandwhite.vertex @@ -0,0 +1,14 @@ +attribute vec3 vPosition; +attribute vec2 vTexCoord; +attribute vec4 vColor; +varying vec2 texCoord; +varying vec4 color; +uniform mat4 ProjectionMatrix; + +void main() +{ + //480x320 + gl_Position = ProjectionMatrix * vec4(vPosition.xyz, 1.0); + texCoord = vTexCoord; + color = vColor; +} \ No newline at end of file diff --git a/game/galaxy_menu.cpp b/game/galaxy_menu.cpp index bdb9962..ab727b7 100755 --- a/game/galaxy_menu.cpp +++ b/game/galaxy_menu.cpp @@ -52,9 +52,8 @@ bool GalaxyMenu::InitGalaxyMenu(std::string config_json, float scale) { std::string levelName = levels_pt.second.get("name", "empty"); - TGameLevel lvl; - lvl.FillWithFile(ST::PathToResources + levelName + ".txt"); - lvl.setBackground("shutterstock" + std::to_string(levelIndex++)); + std::shared_ptr lvl = std::make_shared(); + lvl->FillWithFile(ST::PathToResources + levelName + ".txt"); star.selectionMenu.gameLevels.push_back(lvl); } @@ -63,6 +62,7 @@ bool GalaxyMenu::InitGalaxyMenu(std::string config_json, float scale) { galaxies.push_back(galax); } + return true; } catch (boost::property_tree::ptree_error) { @@ -70,6 +70,9 @@ bool GalaxyMenu::InitGalaxyMenu(std::string config_json, float scale) { } } + + + void GalaxyMenu::UpdateGalaxyMenu(float s_width, float s_height, size_t dt) { /*..Reset..*/ galaxies_params.clear(); @@ -136,106 +139,6 @@ void GalaxyMenu::UpdateGalaxyMenu(float s_width, float s_height, size_t dt) { stars_params.push_back(star_params); } - /*..Level list geometry..*/ - for (int i = 0; i < galaxies.size(); i++) { - for (int j = 0; j < galaxies[i].Stars.size(); j++) { - float button_x_dim = ((1.f - (galaxies[i].Stars[j].selectionMenu.border_x_offset * 2 + (galaxies[i].Stars[j].selectionMenu.columns - 1)*galaxies[i].Stars[j].selectionMenu.buttons_offset)) / galaxies[i].Stars[j].selectionMenu.columns); // relative size - int rows_count = (int)ceil((float)galaxies[i].Stars[j].selectionMenu.gameLevels.size() / (float)galaxies[i].Stars[j].selectionMenu.columns); - galaxies[i].Stars[j].selectionMenu.params = std::make_pair( - Eigen::Vector2f( - gameScreenCenter(0) + (galaxies[i].Stars[j].selectionMenu.offset(0) * gameScreenWidth / 2), - gameScreenCenter(1) + (galaxies[i].Stars[j].selectionMenu.offset(1) * gameScreenHeight / 2) - ), - Eigen::Vector2f( - gameScreenWidth * galaxies[i].Stars[j].selectionMenu.dim(0), - //gameScreenHeight * galaxies[i].Stars[j].selectionMenu.dim(1) - //gameScreenHeight * galaxies[i].Stars[j].selectionMenu.dim(1) * (galaxies[i].Stars[j].selectionMenu.border_y_offset * 2 + (ceil(galaxies[i].Stars[j].selectionMenu.levels.size() / galaxies[i].Stars[j].selectionMenu.columns) - 1)*galaxies[i].Stars[j].selectionMenu.buttons_offset) + galaxies[i].Stars[j].selectionMenu.dim(0)*(ceil(galaxies[i].Stars[j].selectionMenu.levels.size() / galaxies[i].Stars[j].selectionMenu.columns)*(button_x_dim / galaxies[i].Stars[j].selectionMenu.buttons_ratio)) - gameScreenWidth * galaxies[i].Stars[j].selectionMenu.dim(0) * (galaxies[i].Stars[j].selectionMenu.border_y_offset * 2 + rows_count*(button_x_dim/galaxies[i].Stars[j].selectionMenu.buttons_ratio) + (rows_count-1)*galaxies[i].Stars[j].selectionMenu.border_y_offset) - ) - ); - /*..buttons plane..*/ - galaxies[i].Stars[j].selectionMenu.buttons_plane = std::make_pair( - Eigen::Vector2f( - galaxies[i].Stars[j].selectionMenu.params.first(0) + galaxies[i].Stars[j].selectionMenu.params.second(0) / 2 * galaxies[i].Stars[j].selectionMenu.plane_pos(0), - galaxies[i].Stars[j].selectionMenu.params.first(1) + galaxies[i].Stars[j].selectionMenu.params.second(1) / 2 * galaxies[i].Stars[j].selectionMenu.plane_pos(1) - ), - Eigen::Vector2f( - galaxies[i].Stars[j].selectionMenu.params.second(0) * galaxies[i].Stars[j].selectionMenu.plane_size(0), - galaxies[i].Stars[j].selectionMenu.params.second(1) * galaxies[i].Stars[j].selectionMenu.plane_size(1) - ) - ); - - // buttons - std::vector> buttons_params; - std::vector> interior_params; - int levelsCount = galaxies[i].Stars[j].selectionMenu.gameLevels.size(); - buttons_params.resize(levelsCount); - interior_params.resize(levelsCount); - for (int v = 0; v < interior_params.size(); v++) { - interior_params[v].resize(CONST_BRICKMATRIX_HEIGHT*CONST_BRICKMATRIX_WIDTH); - } - for (int y = 0; y < levelsCount; y++) { - GameLevelInterior levelInter; - - float x_rpos = (galaxies[i].Stars[j].selectionMenu.border_x_offset + (y - floor((float)y / (float)galaxies[i].Stars[j].selectionMenu.columns)*(float)galaxies[i].Stars[j].selectionMenu.columns)*(button_x_dim + galaxies[i].Stars[j].selectionMenu.buttons_offset) + button_x_dim/2); - //float y_rpos = (/**/ galaxies[i].Stars[j].selectionMenu.border_y_offset + (floor((float)y / (float)galaxies[i].Stars[j].selectionMenu.columns))*(/*..*/ galaxies[i].Stars[j].selectionMenu.buttons_offset + button_x_dim / galaxies[i].Stars[j].selectionMenu.buttons_ratio /*..*/) + button_x_dim/galaxies[i].Stars[j].selectionMenu.buttons_ratio/2 /**/); - float y_rpos = (galaxies[i].Stars[j].selectionMenu.border_y_offset + ((int)floor(((float)y)/((float)galaxies[i].Stars[j].selectionMenu.columns)))*(button_x_dim/galaxies[i].Stars[j].selectionMenu.buttons_ratio) + (((int)floor(((float)y) / ((float)galaxies[i].Stars[j].selectionMenu.columns)))) * galaxies[i].Stars[j].selectionMenu.border_y_offset + ((button_x_dim/galaxies[i].Stars[j].selectionMenu.buttons_ratio)/2.f)); - - buttons_params[y] = std::make_pair( - Eigen::Vector2f( - (galaxies[i].Stars[j].selectionMenu.buttons_plane.first(0) - galaxies[i].Stars[j].selectionMenu.buttons_plane.second(0)/2) + galaxies[i].Stars[j].selectionMenu.buttons_plane.second(0)*x_rpos, - (galaxies[i].Stars[j].selectionMenu.buttons_plane.first(1) + galaxies[i].Stars[j].selectionMenu.buttons_plane.second(1)/2) - galaxies[i].Stars[j].selectionMenu.buttons_plane.second(0)*y_rpos - ), - Eigen::Vector2f( - button_x_dim*galaxies[i].Stars[j].selectionMenu.buttons_plane.second(0), - (button_x_dim / galaxies[i].Stars[j].selectionMenu.buttons_ratio)*galaxies[i].Stars[j].selectionMenu.buttons_plane.second(0) - - ) - ); - - /*..Interior params..*/ - /*.matrix init.*/ - int brickMatr[CONST_BRICKMATRIX_WIDTH][CONST_BRICKMATRIX_HEIGHT]; - for (int w = 0; w < CONST_BRICKMATRIX_WIDTH; w++) - { - for (int h = 0; h < CONST_BRICKMATRIX_HEIGHT; h++) - { - if (galaxies[i].Stars[j].selectionMenu.gameLevels[y].BlockMatrix[w][h].IsAppear()) { - brickMatr[w][h] = 1; - } - else { - brickMatr[w][h] = 0; - } - } - } - /*.params init.*/ - float brick_w = 0.06f; - float brick_ratio = 1.6f; - float brick_h = brick_w / brick_ratio; - float xb_offset = 0.01f; // x border offset * 0.5 - float yb_offset = 0.01f; // offset from top - int loop_itr = 0; - for (int w = 0; w < CONST_BRICKMATRIX_WIDTH; w++) { - for (int h = 0; h < CONST_BRICKMATRIX_HEIGHT; h++) { - levelInter.position = Eigen::Vector2f( - (buttons_params[y].first(0) - buttons_params[y].second(0)*0.5f) + (xb_offset + brick_w * w + brick_w * 0.5f) * buttons_params[y].second(0), - (buttons_params[y].first(1) + buttons_params[y].second(1)*0.5f) - (yb_offset + brick_h * h + brick_h * 0.5f)*buttons_params[y].second(1) - ); - levelInter.dimensions = Eigen::Vector2f( - buttons_params[y].second(0)*brick_w/* * brickMatr[w][h]*/, //drawable block coefficient - #NOW NEED TO BE FIXED AT (matrix init) sections# - buttons_params[y].second(1)*brick_h/* * brickMatr[w][h]*/ - ); - //inited - interior_params[y][loop_itr++] = levelInter; - } - } - - } - galaxies[i].Stars[j].selectionMenu.levelInterior = interior_params; - galaxies[i].Stars[j].selectionMenu.buttons = buttons_params; - } - } - } Eigen::Vector2f GalaxyMenu::textureSizeNormalize(Eigen::Vector2f texVec, int t_type) { @@ -359,6 +262,7 @@ void GalaxyMenu::InteractWithGalaxy(size_t dt) { } } + /* else if (menuState == 1) { // zoomed galaxy } @@ -372,7 +276,7 @@ void GalaxyMenu::InteractWithGalaxy(size_t dt) { // OnTapDown->OnMove-> //totalTapShift = Eigen::Vector2f(totalTapShift(0) + currentTapShift(0), totalTapShift(1) + currentTapShift(1)); } - } + }*/ // \_/\_/\_/\_/ timer active \_/\_/\_/\_/ } @@ -385,22 +289,19 @@ void GalaxyMenu::InteractWithGalaxy(size_t dt) { /*..level select menu open..*/ starIndex = findPlanetByPos(lastTapPos); + + if (starIndex != -1) { planetHoverIndex = starIndex; - menuState = 2; - } - else { - planetHoverIndex = -1; - } - - if (starIndex != -1) - { + Application->SetupGalaxyUi(starIndex); ResourceManager->newGuiManager.findWidgetByName("modal_background")->setVisibility(true); } + timer_active = false; + - } + }/* else if (menuState == 1) { // zoomed galaxy if (totalTapShift(0) == 0.f && totalTapShift(1) == 0.f) { // OnTapDown->OnTapUp @@ -413,6 +314,8 @@ void GalaxyMenu::InteractWithGalaxy(size_t dt) { } else if (menuState == 2) { // level select view + + if (totalTapShift(0) == 0.f && totalTapShift(1) == 0.f) { // OnTapDown->OnTapUp @@ -437,7 +340,7 @@ void GalaxyMenu::InteractWithGalaxy(size_t dt) { } - } + }*/ } // \_/\_/\_/\_/ timer inactive \_/\_/\_/\_/ } @@ -599,107 +502,6 @@ int GalaxyMenu::findPlanetByPos(Eigen::Vector2f pos) { return -1; } -void GalaxyMenu::drawSelectionMenu(int index) { - int i = index; - if (i != -1) { - - glBindTexture(GL_TEXTURE_2D, SE::ResourceManager->TexList["matte_screen"]); - SE::Renderer->DrawRect( - Eigen::Vector2f( - 0.f, - 0.f - ), - Eigen::Vector2f( - (float)SE::Renderer->GetScreenWidth(), - (float)SE::Renderer->GetScreenHeight() - ) - ); // DrawRect - - glBindTexture(GL_TEXTURE_2D, SE::ResourceManager->TexList["red_square"]); - SE::Renderer->DrawRect( - Eigen::Vector2f( - galaxies[0].Stars[i].selectionMenu.buttons_plane.first(0) - galaxies[0].Stars[i].selectionMenu.buttons_plane.second(0) / 2, - galaxies[0].Stars[i].selectionMenu.buttons_plane.first(1) - galaxies[0].Stars[i].selectionMenu.buttons_plane.second(1) / 2 - ), - Eigen::Vector2f( - galaxies[0].Stars[i].selectionMenu.buttons_plane.first(0) + galaxies[0].Stars[i].selectionMenu.buttons_plane.second(0) / 2, - galaxies[0].Stars[i].selectionMenu.buttons_plane.first(1) + galaxies[0].Stars[i].selectionMenu.buttons_plane.second(1) / 2 - ) - ); // DrawRect - - /*..border..*/ - drawBorder( - Eigen::Vector2f( - galaxies[0].Stars[i].selectionMenu.buttons_plane.first(0) - galaxies[0].Stars[i].selectionMenu.buttons_plane.second(0) / 2, - galaxies[0].Stars[i].selectionMenu.buttons_plane.first(1) - galaxies[0].Stars[i].selectionMenu.buttons_plane.second(1) / 2 - ), - Eigen::Vector2f( - galaxies[0].Stars[i].selectionMenu.buttons_plane.first(0) + galaxies[0].Stars[i].selectionMenu.buttons_plane.second(0) / 2, - galaxies[0].Stars[i].selectionMenu.buttons_plane.first(1) + galaxies[0].Stars[i].selectionMenu.buttons_plane.second(1) / 2 - ), - 0.005f, - "outer" /*..inner/outer/center..mode */ - ); - - // buttons - int j = 0; - for (auto &button : galaxies[0].Stars[i].selectionMenu.buttons) - { - - //std::string levelName = "shutterstock" + galaxies[0].Stars[i].selectionMenu.levels[j].substr(itr + 1); - - //glBindTexture(GL_TEXTURE_2D, SE::ResourceManager->TexList[levelName]); - - std::string &levelName = galaxies[0].Stars[i].selectionMenu.gameLevels[j].levelName; - std::string levelPrerender = galaxies[0].Stars[i].selectionMenu.gameLevels[j].levelName + "_prerender"; - - glBindTexture(GL_TEXTURE_2D, SE::ResourceManager->TexList[levelPrerender]); - - SE::Renderer->DrawRect( - Eigen::Vector2f( - button.first(0) - button.second(0) / 2, - button.first(1) - button.second(1) / 2 - ), - Eigen::Vector2f( - button.first(0) + button.second(0) / 2, - button.first(1) + button.second(1) / 2 - ) - ); // DrawRect - - /*..draw level interior..*/ - //drawLevelInterior(i,j); - - /*std::list>::iterator colorBlockIterator; - for (colorBlockIterator = galaxies[0].Stars[i].selectionMenu.levelInterior[j].BlockInstansingList.ColorBlockList.begin(); colorBlockIterator != galaxies[0].Stars[i].selectionMenu.levelInterior[j].BlockInstansingList.ColorBlockList.end(); ++colorBlockIterator) - { - RenderUniform4fv("BrickColor", colorBlockIterator->first.first.data()); - glBindTexture(GL_TEXTURE_2D, ResourceManager->TexList[colorBlockIterator->first.second]); - - Renderer->DrawTriangleList(colorBlockIterator->second); - }*/ - - ++j; - } - - } -} - -TGameLevel* GalaxyMenu::findLevelByButtonPos(Eigen::Vector2f pos) { - for (int i = 0; i < galaxies[galaxyIndex].Stars[starIndex].selectionMenu.buttons.size(); i++) { - float x_l = galaxies[galaxyIndex].Stars[starIndex].selectionMenu.buttons[i].first(0) - galaxies[galaxyIndex].Stars[starIndex].selectionMenu.buttons[i].second(0)*0.5f; - float x_r = galaxies[galaxyIndex].Stars[starIndex].selectionMenu.buttons[i].first(0) + galaxies[galaxyIndex].Stars[starIndex].selectionMenu.buttons[i].second(0)*0.5f; - float y_t = galaxies[galaxyIndex].Stars[starIndex].selectionMenu.buttons[i].first(1) + galaxies[galaxyIndex].Stars[starIndex].selectionMenu.buttons[i].second(1)*0.5f; - float y_b = galaxies[galaxyIndex].Stars[starIndex].selectionMenu.buttons[i].first(1) - galaxies[galaxyIndex].Stars[starIndex].selectionMenu.buttons[i].second(1)*0.5f; - - if (pos(0) >= x_l && pos(0) <= x_r) { - if (pos(1) >= y_b && pos(1) <= y_t) { - return &galaxies[galaxyIndex].Stars[starIndex].selectionMenu.gameLevels[i]; - } - } - } - return nullptr; -} - bool GalaxyMenu::checkMenuBound(Eigen::Vector2f pos) { float x_l = galaxies[galaxyIndex].Stars[starIndex].selectionMenu.buttons_plane.first(0) - galaxies[galaxyIndex].Stars[starIndex].selectionMenu.buttons_plane.second(0)*0.5f; float x_r = galaxies[galaxyIndex].Stars[starIndex].selectionMenu.buttons_plane.first(0) + galaxies[galaxyIndex].Stars[starIndex].selectionMenu.buttons_plane.second(0)*0.5f; diff --git a/game/galaxy_menu.h b/game/galaxy_menu.h index 0b2e9bb..4ac87b0 100755 --- a/game/galaxy_menu.h +++ b/game/galaxy_menu.h @@ -27,6 +27,8 @@ public: bool InitGalaxyMenu(std::string config_json, float scale = 1.f); void DrawGalaxyMenu(); void UpdateGalaxyMenu(float s_width, float s_height, size_t dt); + + // ======== Main Methods ======== void InteractWithGalaxy(size_t dt); // Prototype for mouse/tap events @@ -79,11 +81,10 @@ private: void takeInFocus(int g_index, int s_index = -1); int findGalaxyByPos(Eigen::Vector2f pos); int findPlanetByPos(Eigen::Vector2f pos); - TGameLevel* findLevelByButtonPos(Eigen::Vector2f pos); + bool checkMenuBound(Eigen::Vector2f pos); /*..draw methodes..*/ - void drawSelectionMenu(int index); void drawBorder(Eigen::Vector2f lb_, Eigen::Vector2f rt_, float scale, std::string mode); void drawLevelInterior(int star = -1, int button = -1); diff --git a/game/galaxy_objects.h b/game/galaxy_objects.h index d8a393b..dc138aa 100755 --- a/game/galaxy_objects.h +++ b/game/galaxy_objects.h @@ -12,7 +12,7 @@ public: /*..LEVELS..*/ /*..levels interior info..*/ - std::vector gameLevels; + std::vector> gameLevels; std::vector> levelInterior; // #params diff --git a/game/gamecode.cpp b/game/gamecode.cpp index 92627a4..f4d2dfb 100755 --- a/game/gamecode.cpp +++ b/game/gamecode.cpp @@ -442,7 +442,7 @@ void TBall::Update(size_t dt) TGameLevel::TGameLevel() { - BkgTexture = "bkg"; + BkgTexture = ""; RenderBufferReady = false; PrevLevelStateIsStandby = false; @@ -623,6 +623,18 @@ void TGameLevel::ReloadLevel() } std::vector::iterator rowIterator = rows.begin(); + + + if (BkgTexture != "") + { + ResourceManager->TexList.DeleteTexture(BkgTexture); + } + BkgTexture = *rowIterator; + + ResourceManager->TexList.AddTexture("level_background/" + BkgTexture); + + ++rowIterator; + BallColor = ParseColor(*rowIterator); ++rowIterator; @@ -668,11 +680,11 @@ void TGameLevel::ReloadLevel() } +/* void TGameLevel::setBackground(const std::string& textureName) { BkgTexture = textureName; - LevelScreenTexture = textureName; -} +}*/ void TGameLevel::FillWithFile(const std::string& filename) { @@ -759,27 +771,33 @@ void TGameLevel::drawOutline(int screenWidth, int screenHeight) { ); } -void TGameLevel::DrawSnapshot(const std::string& assignedSnapshotFrameBuffer) +void TGameLevel::DrawSnapshot(const std::string& assignedSnapshotFrameBuffer, bool blackAndWhite) { InitLevel(768, 480); int prevState = LevelState; LevelState = CONST_LEVELSTATE_SNAPSHOTTING; - InnerDraw(768, 480, 768, 480); + InnerDraw(768, 480, 768, 480, blackAndWhite); LevelState = prevState; - prerenderedImage = - ResourceManager->FrameManager.GetFrameTextureCopy(assignedSnapshotFrameBuffer, levelName + "_prerender"); + std::string texName = levelName + "_prerender"; + + if (blackAndWhite) + { + texName += "_blackandwhite"; + } + + prerenderedImage = ResourceManager->FrameManager.GetFrameTextureCopy(assignedSnapshotFrameBuffer, texName); } void TGameLevel::Draw() { - InnerDraw(Renderer->GetScreenWidth(), Renderer->GetScreenHeight(), Renderer->GetMatrixWidth(), Renderer->GetMatrixHeight()); + InnerDraw(Renderer->GetScreenWidth(), Renderer->GetScreenHeight(), Renderer->GetMatrixWidth(), Renderer->GetMatrixHeight(), false); } -void TGameLevel::InnerDraw(int screenWidth, int screenHeight, int matrixWidth, int matrixHeight) +void TGameLevel::InnerDraw(int screenWidth, int screenHeight, int matrixWidth, int matrixHeight, bool blackAndWhite) { // Scaling math @@ -815,9 +833,9 @@ void TGameLevel::InnerDraw(int screenWidth, int screenHeight, int matrixWidth, i Renderer->TranslateMatrix(Vector3f(matrixWidth * 0.5f, matrixHeight * 0.5f, 0)); Renderer->ScaleMatrix(scale); Renderer->TranslateMatrix(-Vector3f(matrixWidth * 0.5f, matrixHeight * 0.5f, 0)); - glBindTexture(GL_TEXTURE_2D,ResourceManager->TexList[LevelScreenTexture]); + glBindTexture(GL_TEXTURE_2D,ResourceManager->TexList[levelName + "_prerendered"]); Renderer->DrawRect(Vector2f(xlOffset, ylOffset), Vector2f(xlOffset+tSW, ylOffset+tSH), Vector2f (0.f,0.f), Vector2f(1.f,1.f)); // Game Screen Scale - Renderer->PopMatrix(); + Renderer->PopMatrix(); CheckGlError(); return; } @@ -830,7 +848,7 @@ void TGameLevel::InnerDraw(int screenWidth, int screenHeight, int matrixWidth, i bool renderBufferReady = RenderBufferReady; - /* + if (pause && renderBufferReady) { @@ -847,6 +865,8 @@ void TGameLevel::InnerDraw(int screenWidth, int screenHeight, int matrixWidth, i } Renderer->PopMatrix(); CheckGlError(); + + drawOutline(screenWidth, screenHeight); return; } @@ -858,7 +878,7 @@ void TGameLevel::InnerDraw(int screenWidth, int screenHeight, int matrixWidth, i glClearColor(0.0f, 0.0f, 0.0f, 1.0f); glClear( GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT); CheckGlError(); - }*/ + } // Level background // ::::::::::: @@ -907,7 +927,16 @@ void TGameLevel::InnerDraw(int screenWidth, int screenHeight, int matrixWidth, i std::list>::iterator colorBlockIterator; for (colorBlockIterator = BlockInstansingList.ColorBlockList.begin(); colorBlockIterator != BlockInstansingList.ColorBlockList.end(); ++colorBlockIterator) { - RenderUniform4fv("BrickColor", colorBlockIterator->first.first.data()); + Vector4f color = colorBlockIterator->first.first; + + if (blackAndWhite) + { + float c = (color(0) * 0.3 + color(1) * 0.59 + color(2) * 0.11); + color(0) = c; + color(1) = c; + color(2) = c; + } + RenderUniform4fv("BrickColor", color.data()); glBindTexture(GL_TEXTURE_2D,ResourceManager->TexList[colorBlockIterator->first.second]); Renderer->DrawTriangleList(colorBlockIterator->second); @@ -923,7 +952,9 @@ void TGameLevel::InnerDraw(int screenWidth, int screenHeight, int matrixWidth, i Application->EffectsDraw(); - DrawBallInstancingList(); + + + DrawBallInstancingList(blackAndWhite); Renderer->PopShader(); @@ -962,7 +993,7 @@ void TGameLevel::InnerDraw(int screenWidth, int screenHeight, int matrixWidth, i } - /*/ + if (!pause && LevelState != CONST_LEVELSTATE_SNAPSHOTTING) { RenderUniform1f("Transparency", 1.f); @@ -972,19 +1003,21 @@ void TGameLevel::InnerDraw(int screenWidth, int screenHeight, int matrixWidth, i const float const_backBtnHeight = CONST_BACK_BTN_HEIGHT * Application->GetGameLevelScreenHeight()/320.f; Renderer->DrawRect(Vector2f(-const_backBtnWidth*0.5f, -const_backBtnHeight*0.5f)+BackBtnPos, Vector2f(const_backBtnWidth*0.5f, const_backBtnHeight*0.5f)+BackBtnPos); } + + drawOutline(screenWidth, screenHeight); + if (pause && !renderBufferReady) { + //ololo //See also above (same method) Renderer->SwitchToScreen(); Renderer->SetFullScreenViewport(); Renderer->PushMatrix(); - //Renderer->LoadIdentity(); Renderer->TranslateMatrix(Vector3f(matrixWidth * 0.5f, matrixHeight * 0.5f, 0)); - //Renderer->TranslateMatrix(Vector3f(Application->GetGameLevelScreenWidth(), Application->GetGameLevelScreenHeight(), 0)); Renderer->ScaleMatrix(OutScale); Renderer->TranslateMatrix(-Vector3f(matrixWidth * 0.5f, matrixHeight * 0.5f, 0)); DrawBuffer(); @@ -995,12 +1028,11 @@ void TGameLevel::InnerDraw(int screenWidth, int screenHeight, int matrixWidth, i Renderer->PopMatrix(); RenderBufferReady = true; CheckGlError(); - }*/ + } - drawOutline(screenWidth, screenHeight); - + CheckGlError(); } @@ -1016,11 +1048,22 @@ void TGameLevel::DrawPauseButtons() //continue from } -void TGameLevel::DrawBallInstancingList() +void TGameLevel::DrawBallInstancingList(bool blackAndWhite) { RenderUniform1f("Transparency", 1.f); - RenderUniform4fv("BrickColor", BallColor.data()); + + Vector4f color = BallColor; + + if (blackAndWhite) + { + float c = (color(0) * 0.3 + color(1) * 0.59 + color(2) * 0.11); + color(0) = c; + color(1) = c; + color(2) = c; + } + + RenderUniform4fv("BrickColor", color.data()); if (BonusGothroughTimer > 0.f) { @@ -1237,11 +1280,11 @@ void TGameLevel::Update(size_t dt) //Bonus floor pos if (BonusFloorTimer/CONST_BONUS_GOTHROUGH_TIME < 0.2f) { - //Bonus must go down until 0.f - if (BonusFloorPosY > 0.f) + //Bonus must go down until - 20.f + if (BonusFloorPosY > -20.f) { BonusFloorPosY -= CONST_BONUS_FLOOR_APPEAR_SPEED * dt / 1000.f; - BonusFloorPosY = max_t(BonusFloorPosY, 0.f); + BonusFloorPosY = max_t(BonusFloorPosY, -20.f); } } diff --git a/game/gamecode.h b/game/gamecode.h index a249425..8b183f7 100755 --- a/game/gamecode.h +++ b/game/gamecode.h @@ -32,7 +32,7 @@ const float CONST_BONUS_CATCH_DISTANCE_X = 65.f; const float CONST_BONUS_CATCH_DISTANCE_Y = 20.f; const float CONST_BONUS_FLOOR_TIME = 8000.f; -const float CONST_BONUS_FLOOR_APPEAR_SPEED = 50.f; +const float CONST_BONUS_FLOOR_APPEAR_SPEED = 80.f; const int CONST_BONUS_TYPE_MULTIPLIER = 0; const int CONST_BONUS_TYPE_GOTHROUGH = 1; @@ -127,7 +127,7 @@ protected: float lvlWidth; float lvlHeight; std::string BkgTexture; - std::string LevelScreenTexture; + //std::string LevelScreenTexture; std::string LevelFileName; GLuint prerenderedImage; @@ -152,7 +152,7 @@ protected: void DrawBuffer(); void DrawPauseButtons(); - void DrawBallInstancingList(); + void DrawBallInstancingList(bool blackAndWhite); void drawOutline(int screenWidth, int screenHeight); @@ -194,7 +194,7 @@ public: ~TGameLevel(); void FillWithFile(const std::string& filename); - void setBackground(const std::string& assignedShutterstock); + //void setBackground(const std::string& assignedShutterstock); //void SetLevelScale(); //Vector2f GetLevelScale(); @@ -204,8 +204,8 @@ public: bool IsLoaded(); virtual void Draw(); - void InnerDraw(int screenWidth, int screenHeight, int matrixWidth, int matrixHeight); - void DrawSnapshot(const std::string& assignedSnapshotFrameBuffer); + void InnerDraw(int screenWidth, int screenHeight, int matrixWidth, int matrixHeight, bool blackAndWhite); + void DrawSnapshot(const std::string& assignedSnapshotFrameBuffer, bool blackAndWhite); void SetPause(); bool IsPaused(); diff --git a/game/main_code.cpp b/game/main_code.cpp index 0726f96..788af89 100755 --- a/game/main_code.cpp +++ b/game/main_code.cpp @@ -61,8 +61,8 @@ void TMyApplication::InnerInit() #ifdef TARGET_WIN32 #ifdef NDEBUG - //ST::PathToResources = "resources/"; - ST::PathToResources = "../../../assets/"; + ST::PathToResources = "resources/"; + //ST::PathToResources = "../../../assets/"; #else ST::PathToResources = "../../../assets/"; #endif @@ -93,6 +93,7 @@ void TMyApplication::InnerInit() //ResourceManager->ShaderManager.AddShader("DefaultShader", "shaders/texture-shader.vertex", "shaders/texture-shader.fragment"); ResourceManager->ShaderManager.AddShader("DefaultShader", "shaders/gui_transparent.vertex", "shaders/gui_transparent.fragment"); + ResourceManager->ShaderManager.AddShader("BlackAndWhiteShader", "shaders/gui_transparent_blackandwhite.vertex", "shaders/gui_transparent_blackandwhite.fragment"); ResourceManager->ShaderManager.AddShader("ColorShader", "shaders/color-shader.vertex", "shaders/color-shader.fragment"); ResourceManager->ShaderManager.AddShader("FrameShader", "shaders/frameshader_vertex.txt", "shaders/frameshader_fragment.txt"); ResourceManager->ShaderManager.AddShader("BrickShader", "shaders/brickshader_vertex.txt", "shaders/brickshader_fragment.txt"); @@ -107,7 +108,7 @@ void TMyApplication::InnerInit() ResourceManager->TexList.AddTexture("white.bmp"); - ResourceManager->FrameManager.AddFrameRenderBuffer("LevelBuffer", 512, 512); + ResourceManager->FrameManager.AddFrameRenderBuffer("LevelBuffer", 256, 256); //OnDrawSignal.connect(boost::bind(&TGameLoading::Draw, boost::ref(GameLoading))); Inited = true; @@ -125,7 +126,7 @@ void TMyApplication::InnerInit() ResourceManager->FontManager.PushFont("lucon12"); //ResourceManager->newGuiManager.LoadFromConfig("gui_main_menu.json"); ResourceManager->newGuiManager.LoadFromConfig("gui_loading.json"); - //SetButtonsAction(); + // ------- UI ------- // TESTS of menu @@ -266,7 +267,7 @@ void TMyApplication::LoadResources() boost::property_tree::ptree Textures_pt = SE::ReadJsonFile(ST::PathToResources + "bg_textures_config.json"); //boost::property_tree::json_parser::read_json(ST::PathToResources + "bg_textures_config.json", Textures_pt); - std::string bg_ext = ".jpeg"; + std::string bg_ext = ".jpg"; // ::::::::::::::::::::::::::::::::::::: @@ -450,8 +451,8 @@ void TMyApplication::InnerUpdate(size_t dt) TextureNamesToLoad.erase(TextureNamesToLoad.begin()); } - else - { + else + { Renderer->SwitchToFrameBuffer("LevelBuffer"); @@ -461,23 +462,27 @@ void TMyApplication::InnerUpdate(size_t dt) for (auto &star : Menu.GalaxMenu.galaxies[0].Stars) { - for (auto &level : star.selectionMenu.gameLevels) + for (auto level : star.selectionMenu.gameLevels) { - level.DrawSnapshot("LevelBuffer"); - break; + level->DrawSnapshot("LevelBuffer", false); + + Renderer->PushShader("BlackAndWhiteShader"); + + level->DrawSnapshot("LevelBuffer", true); + + Renderer->PopShader(); } - break; } Renderer->SwitchToScreen(); Renderer->SetOrthoProjection(); - GameState = CONST_GAMESTATE_MENU; - ApplySignalsToMenu(); - ResourceManager->newGuiManager.Clear(); - ResourceManager->newGuiManager.LoadFromConfig("gui_main_menu.json"); - //OnDrawSignal.disconnect(boost::bind(&TGameLoading::Draw, boost::ref(GameLoading))); + GameState = CONST_GAMESTATE_MENU; + ApplySignalsToMenu(); + + LoadGalaxyUi(); + OnDrawSignal.connect(0, boost::bind(&TGameMenu::Draw, boost::ref(Menu))); StateTimer = 0.f; Loaded = true; @@ -540,7 +545,122 @@ void TMyApplication::InnerUpdate(size_t dt) } -void TMyApplication::GoFromMenuToGame(TGameLevel* level) + +void TMyApplication::LoadGalaxyUi() +{ + ResourceManager->newGuiManager.Clear(); + ResourceManager->newGuiManager.LoadFromConfig("gui_main_menu.json"); + + std::shared_ptr modal_background = ResourceManager->newGuiManager.findWidgetByName("modal_background"); + + modal_background->onMouseUpSignal.connect( + [modal_background](Vector2f v, int i) { + modal_background->visible = false; + }); + +} + + +void TMyApplication::SetupGalaxyUi(size_t levelStar) +{ + std::shared_ptr modal_background = ResourceManager->newGuiManager.findWidgetByName("modal_background"); + + + std::shared_ptr row2 = ResourceManager->newGuiManager.findWidgetByName("row2"); + std::shared_ptr row3 = ResourceManager->newGuiManager.findWidgetByName("row3"); + std::shared_ptr row4 = ResourceManager->newGuiManager.findWidgetByName("row4"); + + size_t levelCount = this->Menu.GalaxMenu.galaxies[0].Stars[levelStar].selectionMenu.gameLevels.size(); + + if (levelCount <= 3) + { + row2->setVisibility(false); + } + else + { + row2->setVisibility(true); + } + + if (levelCount <= 6) + { + row3->setVisibility(false); + } + else + { + row3->setVisibility(true); + } + + + if (levelCount <= 9) + { + row4->setVisibility(false); + } + else + { + row4->setVisibility(true); + } + + + std::string levelStarString = boost::lexical_cast(levelStar); + + + for (size_t levelIndex = 0; levelIndex < 12; levelIndex++) + { + + std::string levelIndexString = boost::lexical_cast(levelIndex); + + std::shared_ptr currentLevelButton = ResourceManager->newGuiManager.findWidgetByName("button" + levelIndexString); + + + currentLevelButton->onMouseUpSignal.disconnect_all_slots(); + + + + if (levelIndex < levelCount) + { + + std::string levelName = this->Menu.GalaxMenu.galaxies[0].Stars[levelStar].selectionMenu.gameLevels[levelIndex]->levelName; + + + if (IsLevelOpened(levelStar, levelIndex)) + { + + currentLevelButton->setVisibility(true); + + currentLevelButton->setBackground(levelName + "_prerender"); + + currentLevelButton->onMouseUpSignal.connect( + [this, modal_background, levelStar, levelIndex](Vector2f v, int i) { + modal_background->visible = false; + + std::shared_ptr lvl = this->Menu.GalaxMenu.galaxies[0].Stars[levelStar].selectionMenu.gameLevels[levelIndex]; + lvl->ReloadLevel(); + this->GoFromMenuToGame(lvl); + }); + + } + else + { + currentLevelButton->setBackground(levelName + "_prerender_blackandwhite"); + } + + //currentLevelButton->OnMouseUp(Vector2f(), 0); + + } + else + { + currentLevelButton->setVisibility(false); + } + + } + + + +} + + + +void TMyApplication::GoFromMenuToGame(std::shared_ptr level) { //#ifndef TARGET_IOS // ResourceManager->SoundManager.PlayMusicLooped("level1ogg.ogg"); @@ -637,14 +757,7 @@ float TMyApplication::GetGameLevelScreenHeight() } void TMyApplication::InnerOnMouseDown(TMouseState& mouseState) { - /* - if (mouseState.LeftButtonPressed) { - if ((float)mouseState.X >= (Renderer->GetScreenWidth())*0.25f && (float)mouseState.X <= (Renderer->GetScreenWidth())*0.75f && (float)mouseState.Y >= (Renderer->GetScreenHeight())*0.25f && (float)mouseState.Y <= (Renderer->GetScreenHeight())*0.75f) { - // some tmp code - Application->GoFromMenuToGame(1); - } - } - */ + OnTapDownSignal(Vector2f(mouseState.X, ((Renderer->GetScreenHeight()) - mouseState.Y))); // Temp mouse down action for WIN32 } @@ -652,6 +765,22 @@ void TMyApplication::InnerOnMouseMove(TMouseState& mouseState) { } +bool TMyApplication::IsLevelOpened(int levelStar, int levelIndex) +{ + if (levelStar == 0) + { + return true; + } + + if (levelStar == 1 && levelIndex < 3) + { + return true; + } + + return false; +} + + void TMyApplication::EffectsInit() { boost::property_tree::ptree JSONsource; @@ -738,13 +867,3 @@ void TMyApplication::fireworkEffect() { lvlFirework.stopSpawn(); lvlFirework.startSpawn(); } - -void TMyApplication::SetButtonsAction () { - auto backBtn = ResourceManager->newGuiManager.findWidgetByName("backButton"); - if (backBtn) { - backBtn->onMouseDownSignal.connect([this, backBtn](Vector2f pos, int touchNumber) { - this->GameLevel->SetPause(); - this->GameLevel->PrevLevelStateIsStandby = true; - }); - } -} \ No newline at end of file diff --git a/game/main_code.h b/game/main_code.h index 2abfe7d..809174b 100755 --- a/game/main_code.h +++ b/game/main_code.h @@ -98,7 +98,7 @@ protected: ParticleEffect lvlFirework; // Level finished effect TGameMenu Menu; - TGameLevel* GameLevel; + std::shared_ptr GameLevel; TGameCredits GameCredits; TGameLoading GameLoading; @@ -119,13 +119,20 @@ protected: void ApplySignalsToCredits(); void DisapplySignalsToCredits(); + + void EffectsInit(); + + // Mouse new methods virtual void InnerOnMouseDown(TMouseState& mouseState); virtual void InnerOnMouseMove(TMouseState& mouseState); + bool IsLevelOpened(int levelStar, int levelIndex); + + public: bool Loaded; @@ -139,7 +146,7 @@ public: virtual void InnerUpdate(size_t dt); - void GoFromMenuToGame(TGameLevel* level); + void GoFromMenuToGame(std::shared_ptr gameLevel); void GoFromGameToMenu(); void GoFromMenuToCredits(); void GoFromCreditsToMenu(); @@ -180,7 +187,9 @@ public: float GetGameLevelScreenHeight(); void SetGameLevelScreenScale(); - void SetButtonsAction(); + + void LoadGalaxyUi(); + void SetupGalaxyUi(size_t levelStar); };