Compare commits
8 Commits
Author | SHA1 | Date | |
---|---|---|---|
64faf81a0d | |||
3d0bbe7ca8 | |||
cee9693119 | |||
3248d72416 | |||
21c4c2a685 | |||
d2431e9f1c | |||
99cd961d44 | |||
a9f6a9be2b |
1
.gitignore
vendored
@ -7,6 +7,7 @@
|
||||
## Build generated
|
||||
build/
|
||||
DerivedData/
|
||||
.idea/
|
||||
|
||||
## Various settings
|
||||
*.pbxuser
|
||||
|
@ -1,217 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="34a09786-f26b-40ab-ab95-a13a014633b6" name="Default" comment="" />
|
||||
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
||||
<option name="TRACKING_ENABLED" value="true" />
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||
</component>
|
||||
<component name="Git.Settings">
|
||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
||||
</component>
|
||||
<component name="GradleLocalSettings">
|
||||
<option name="externalProjectsViewState">
|
||||
<projects_view />
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectFrameBounds" extendedState="6">
|
||||
<option name="x" value="604" />
|
||||
<option name="width" value="1057" />
|
||||
<option name="height" value="1004" />
|
||||
</component>
|
||||
<component name="ProjectView">
|
||||
<navigator currentView="AndroidView" proportions="" version="1">
|
||||
<flattenPackages />
|
||||
<showMembers />
|
||||
<showModules />
|
||||
<showLibraryContents />
|
||||
<hideEmptyPackages />
|
||||
<abbreviatePackageNames />
|
||||
<autoscrollToSource />
|
||||
<autoscrollFromSource />
|
||||
<sortByType />
|
||||
<manualOrder />
|
||||
<foldersAlwaysOnTop value="true" />
|
||||
</navigator>
|
||||
<panes>
|
||||
<pane id="ProjectPane" />
|
||||
<pane id="AndroidView">
|
||||
<subPane>
|
||||
<expand>
|
||||
<path>
|
||||
<item name="double-hit-balls" type="1abcf292:AndroidViewProjectNode" />
|
||||
<item name="double-hit-balls" type="e9137016:NonAndroidModuleNode" />
|
||||
</path>
|
||||
</expand>
|
||||
<select />
|
||||
</subPane>
|
||||
</pane>
|
||||
<pane id="Scratches" />
|
||||
<pane id="PackagesPane" />
|
||||
<pane id="Scope" />
|
||||
</panes>
|
||||
</component>
|
||||
<component name="PropertiesComponent">
|
||||
<property name="android.sdk.path" value="$USER_HOME$/AppData/Local/Android/Sdk" />
|
||||
<property name="settings.editor.selected.configurable" value="android.sdk-updates" />
|
||||
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
|
||||
</component>
|
||||
<component name="RunDashboard">
|
||||
<option name="ruleStates">
|
||||
<list>
|
||||
<RuleState>
|
||||
<option name="name" value="ConfigurationTypeDashboardGroupingRule" />
|
||||
</RuleState>
|
||||
<RuleState>
|
||||
<option name="name" value="StatusDashboardGroupingRule" />
|
||||
</RuleState>
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="RunManager">
|
||||
<configuration default="true" type="AndroidJUnit" factoryName="Android JUnit">
|
||||
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
|
||||
<module name="" />
|
||||
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
|
||||
<option name="ALTERNATIVE_JRE_PATH" />
|
||||
<option name="PACKAGE_NAME" />
|
||||
<option name="MAIN_CLASS_NAME" />
|
||||
<option name="METHOD_NAME" />
|
||||
<option name="TEST_OBJECT" value="class" />
|
||||
<option name="VM_PARAMETERS" value="-ea" />
|
||||
<option name="PARAMETERS" />
|
||||
<option name="WORKING_DIRECTORY" value="$MODULE_DIR$" />
|
||||
<option name="ENV_VARIABLES" />
|
||||
<option name="PASS_PARENT_ENVS" value="true" />
|
||||
<option name="TEST_SEARCH_SCOPE">
|
||||
<value defaultName="singleModule" />
|
||||
</option>
|
||||
<envs />
|
||||
<patterns />
|
||||
</configuration>
|
||||
<configuration default="true" type="Application" factoryName="Application">
|
||||
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
|
||||
<option name="MAIN_CLASS_NAME" />
|
||||
<option name="VM_PARAMETERS" />
|
||||
<option name="PROGRAM_PARAMETERS" />
|
||||
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
|
||||
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
|
||||
<option name="ALTERNATIVE_JRE_PATH" />
|
||||
<option name="ENABLE_SWING_INSPECTOR" value="false" />
|
||||
<option name="ENV_VARIABLES" />
|
||||
<option name="PASS_PARENT_ENVS" value="true" />
|
||||
<module name="" />
|
||||
<envs />
|
||||
</configuration>
|
||||
<configuration default="true" type="Remote" factoryName="Remote">
|
||||
<option name="USE_SOCKET_TRANSPORT" value="true" />
|
||||
<option name="SERVER_MODE" value="false" />
|
||||
<option name="SHMEM_ADDRESS" value="javadebug" />
|
||||
<option name="HOST" value="localhost" />
|
||||
<option name="PORT" value="5005" />
|
||||
</configuration>
|
||||
<configuration default="true" type="TestNG" factoryName="TestNG">
|
||||
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
|
||||
<module name="" />
|
||||
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
|
||||
<option name="ALTERNATIVE_JRE_PATH" />
|
||||
<option name="SUITE_NAME" />
|
||||
<option name="PACKAGE_NAME" />
|
||||
<option name="MAIN_CLASS_NAME" />
|
||||
<option name="METHOD_NAME" />
|
||||
<option name="GROUP_NAME" />
|
||||
<option name="TEST_OBJECT" value="CLASS" />
|
||||
<option name="VM_PARAMETERS" value="-ea" />
|
||||
<option name="PARAMETERS" />
|
||||
<option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
|
||||
<option name="OUTPUT_DIRECTORY" />
|
||||
<option name="ANNOTATION_TYPE" />
|
||||
<option name="ENV_VARIABLES" />
|
||||
<option name="PASS_PARENT_ENVS" value="true" />
|
||||
<option name="TEST_SEARCH_SCOPE">
|
||||
<value defaultName="singleModule" />
|
||||
</option>
|
||||
<option name="USE_DEFAULT_REPORTERS" value="false" />
|
||||
<option name="PROPERTIES_FILE" />
|
||||
<envs />
|
||||
<properties />
|
||||
<listeners />
|
||||
</configuration>
|
||||
<configuration name="<template>" type="Applet" default="true" selected="false">
|
||||
<option name="MAIN_CLASS_NAME" />
|
||||
<option name="HTML_FILE_NAME" />
|
||||
<option name="HTML_USED" value="false" />
|
||||
<option name="WIDTH" value="400" />
|
||||
<option name="HEIGHT" value="300" />
|
||||
<option name="POLICY_FILE" value="$APPLICATION_HOME_DIR$/bin/appletviewer.policy" />
|
||||
<option name="VM_PARAMETERS" />
|
||||
</configuration>
|
||||
<configuration name="<template>" type="JUnit" default="true" selected="false">
|
||||
<option name="MAIN_CLASS_NAME" />
|
||||
<option name="VM_PARAMETERS" value="-ea" />
|
||||
<option name="PARAMETERS" />
|
||||
<option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
|
||||
</configuration>
|
||||
<configuration name="<template>" type="#org.jetbrains.idea.devkit.run.PluginConfigurationType" default="true" selected="false">
|
||||
<option name="VM_PARAMETERS" value="-Xmx512m -Xms256m -XX:MaxPermSize=250m -ea" />
|
||||
</configuration>
|
||||
</component>
|
||||
<component name="ShelveChangesManager" show_recycled="false">
|
||||
<option name="remove_strategy" value="false" />
|
||||
</component>
|
||||
<component name="SvnConfiguration">
|
||||
<configuration />
|
||||
</component>
|
||||
<component name="TaskManager">
|
||||
<task active="true" id="Default" summary="Default task">
|
||||
<changelist id="34a09786-f26b-40ab-ab95-a13a014633b6" name="Default" comment="" />
|
||||
<created>1531738153088</created>
|
||||
<option name="number" value="Default" />
|
||||
<option name="presentableId" value="Default" />
|
||||
<updated>1531738153088</updated>
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
<component name="ToolWindowManager">
|
||||
<frame x="-9" y="-9" width="1938" height="1060" extended-state="6" />
|
||||
<layout>
|
||||
<window_info id="Android Profiler" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Palette	" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Image Layers" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Build Variants" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
|
||||
<window_info id="Capture Analysis" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32919955" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" />
|
||||
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Logcat" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Captures" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Capture Tool" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Designer" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Project" active="true" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.25349087" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
|
||||
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Device File Explorer" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="true" content_ui="tabs" />
|
||||
<window_info id="Theme Preview" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
|
||||
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
|
||||
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
|
||||
</layout>
|
||||
</component>
|
||||
<component name="VcsContentAnnotationSettings">
|
||||
<option name="myLimit" value="2678400000" />
|
||||
</component>
|
||||
<component name="XDebuggerManager">
|
||||
<breakpoint-manager />
|
||||
<watches-manager />
|
||||
</component>
|
||||
</project>
|
Before Width: | Height: | Size: 6.6 KiB |
52
assets/gui_game_pause_menu.json
Executable file
@ -0,0 +1,52 @@
|
||||
{
|
||||
"widgets": [
|
||||
{
|
||||
"type": "FrameLayout",
|
||||
"name": "gameFrame",
|
||||
"background": "#00000000",
|
||||
"width": "match_parent",
|
||||
"height": "match_parent",
|
||||
"visible": 1,
|
||||
"touchTransparency": 1,
|
||||
"marginTop": 20,
|
||||
"horizontalAlignment": "HA_CENTER",
|
||||
"verticalAlignment": "VA_TOP",
|
||||
"children" : [
|
||||
{
|
||||
"type": "Button",
|
||||
"name": "pauseButton",
|
||||
"width": 128,
|
||||
"height": 64,
|
||||
"background": "back_btn.png"
|
||||
}]
|
||||
},
|
||||
{
|
||||
"type": "VerticalLinearLayout",
|
||||
"name": "buttonList",
|
||||
"background": "#00000000",
|
||||
"width": "match_parent",
|
||||
"height": "match_parent",
|
||||
"touchTransparency": 0,
|
||||
"visible": 0,
|
||||
"zLevel": 10,
|
||||
"marginLeft" : 0,
|
||||
"itemSpacing": 20,
|
||||
"horizontalAlignment": "HA_LEFT",
|
||||
"verticalAlignment": "VA_BOTTOM",
|
||||
"children" : [
|
||||
{
|
||||
"type": "Button",
|
||||
"name": "exitButton",
|
||||
"width": 128,
|
||||
"height": 128,
|
||||
"background": "slide_up_btn.png"
|
||||
},
|
||||
{
|
||||
"type": "Button",
|
||||
"name": "resumeButton",
|
||||
"width": 128,
|
||||
"height": 128,
|
||||
"background": "tap_to_continue_btn.png"
|
||||
}]
|
||||
}]
|
||||
}
|
@ -7,7 +7,7 @@
|
||||
"y_coord": 0.0
|
||||
},
|
||||
"texture": "galaxy_0.png",
|
||||
"scale": 1.2,
|
||||
"scale": 1,
|
||||
"Stars": [
|
||||
{
|
||||
"name": "star2",
|
||||
@ -157,7 +157,7 @@
|
||||
"y_coord": 0.55
|
||||
},
|
||||
"texture": "levels/star3/star-flare-3.png",
|
||||
"scale": 0.3,
|
||||
"scale": 0.15,
|
||||
"levels": [
|
||||
{
|
||||
"name": "levels/star3/star3_level1"
|
||||
@ -204,7 +204,7 @@
|
||||
"y_coord": 0.0
|
||||
},
|
||||
"texture": "levels/star4/star-flare-4.png",
|
||||
"scale": 0.3,
|
||||
"scale": 0.15,
|
||||
"levels": [
|
||||
{
|
||||
"name": "levels/star4/star4_level1"
|
||||
@ -247,11 +247,11 @@
|
||||
{
|
||||
"name": "star_0_5",
|
||||
"position": {
|
||||
"x_coord": 0.5,
|
||||
"x_coord": 0.6,
|
||||
"y_coord": -0.25
|
||||
},
|
||||
"texture": "levels/star5/star-flare-5.png",
|
||||
"scale": 0.3,
|
||||
"scale": 0.15,
|
||||
"levels": [
|
||||
{
|
||||
"name": "levels/star5/star5_level1"
|
||||
@ -298,7 +298,7 @@
|
||||
"y_coord": -0.55
|
||||
},
|
||||
"texture": "levels/star6/star-flare-6.png",
|
||||
"scale": 0.3,
|
||||
"scale": 0.15,
|
||||
"levels": [
|
||||
{
|
||||
"name": "levels/star6/star6_level1"
|
||||
@ -345,7 +345,7 @@
|
||||
"y_coord": -0.5
|
||||
},
|
||||
"texture": "levels/star7/star-flare-7.png",
|
||||
"scale": 0.3,
|
||||
"scale": 0.15,
|
||||
"levels": [
|
||||
{
|
||||
"name": "levels/star7/star7_level1"
|
||||
@ -392,7 +392,7 @@
|
||||
"y_coord": -0.26
|
||||
},
|
||||
"texture": "levels/star8/star-flare-8.png",
|
||||
"scale": 0.3,
|
||||
"scale": 0.15,
|
||||
"levels": [
|
||||
{
|
||||
"name": "levels/star8/star8_level1"
|
||||
@ -439,7 +439,7 @@
|
||||
"y_coord": 0.15
|
||||
},
|
||||
"texture": "levels/star9/star-flare-9.png",
|
||||
"scale": 0.3,
|
||||
"scale": 0.15,
|
||||
"levels": [
|
||||
{
|
||||
"name": "levels/star9/star9_level1"
|
||||
@ -486,7 +486,7 @@
|
||||
"y_coord": 0.35
|
||||
},
|
||||
"texture": "levels/star10/star-flare-10.png",
|
||||
"scale": 0.3,
|
||||
"scale": 0.15,
|
||||
"levels": [
|
||||
{
|
||||
"name": "levels/star10/star10_level1"
|
||||
@ -533,7 +533,7 @@
|
||||
"y_coord": 0.09
|
||||
},
|
||||
"texture": "levels/star11/star-flare-11.png",
|
||||
"scale": 0.3,
|
||||
"scale": 0.15,
|
||||
"levels": [
|
||||
{
|
||||
"name": "levels/star11/star11_level1"
|
||||
@ -580,7 +580,7 @@
|
||||
"y_coord": -0.05
|
||||
},
|
||||
"texture": "levels/star12/star-flare-12.png",
|
||||
"scale": 0.3,
|
||||
"scale": 0.15,
|
||||
"levels": [
|
||||
{
|
||||
"name": "levels/star12/star12_level1"
|
||||
@ -627,7 +627,7 @@
|
||||
"y_coord": -0.14
|
||||
},
|
||||
"texture": "levels/star13/star-flare-13.png",
|
||||
"scale": 0.3,
|
||||
"scale": 0.15,
|
||||
"levels": [
|
||||
{
|
||||
"name": "levels/star13/star13_level1"
|
||||
@ -674,7 +674,7 @@
|
||||
"y_coord": -0.0
|
||||
},
|
||||
"texture": "levels/star14/star-flare-14.png",
|
||||
"scale": 0.3,
|
||||
"scale": 0.15,
|
||||
"levels": [
|
||||
{
|
||||
"name": "levels/star14/star14_level1"
|
||||
@ -721,7 +721,7 @@
|
||||
"y_coord": 0.3
|
||||
},
|
||||
"texture": "levels/star15/star-flare-15.png",
|
||||
"scale": 0.3,
|
||||
"scale": 0.15,
|
||||
"levels": [
|
||||
{
|
||||
"name": "levels/star15/star15_level1"
|
||||
@ -735,7 +735,7 @@
|
||||
"y_coord": 0.07
|
||||
},
|
||||
"texture": "levels/star16/star-flare-16.png",
|
||||
"scale": 0.3,
|
||||
"scale": 0.15,
|
||||
"levels": [
|
||||
{
|
||||
"name": "levels/star16/star16_level1"
|
||||
|
@ -1,7 +1,7 @@
|
||||
precision mediump float;
|
||||
|
||||
in vec2 texCoord;
|
||||
flat in vec4 color;
|
||||
varying vec2 texCoord;
|
||||
varying vec4 color;
|
||||
|
||||
uniform sampler2D Texture;
|
||||
|
||||
|
@ -2,8 +2,8 @@ attribute vec3 vPosition;
|
||||
attribute vec2 vTexCoord;
|
||||
attribute vec4 vColor;
|
||||
|
||||
out vec2 texCoord;
|
||||
flat out vec4 color;
|
||||
varying vec2 texCoord;
|
||||
varying vec4 color;
|
||||
|
||||
uniform mat4 ProjectionMatrix;
|
||||
|
||||
|
Before Width: | Height: | Size: 9.4 KiB |
Before Width: | Height: | Size: 6.7 KiB |
Before Width: | Height: | Size: 6.6 KiB After Width: | Height: | Size: 16 KiB |
BIN
assets/ui/slide_up_btn.png
Executable file
After Width: | Height: | Size: 9.4 KiB |
BIN
assets/ui/tap_to_continue_btn.png
Executable file
After Width: | Height: | Size: 8.2 KiB |
@ -16,7 +16,7 @@ JNIEXPORT void JNICALL Java_fishrungames_doublehitballs_JniWrapper_Init(JNIEnv *
|
||||
|
||||
std::stringstream LoadFileFromAndroid(const std::string& fileName)
|
||||
{
|
||||
*Console << "LoadFileFromAndroid called \n";
|
||||
GetConsole() << "LoadFileFromAndroid called \n";
|
||||
|
||||
JNIEnv* jEnv;
|
||||
localJavaVirtualMachine->GetEnv((void**)&jEnv, JNI_VERSION_1_4);
|
||||
@ -33,14 +33,14 @@ std::stringstream LoadFileFromAndroid(const std::string& fileName)
|
||||
std::stringstream ss;
|
||||
ss << jEnv->GetStringUTFChars(jFileContent, &jCopy);
|
||||
|
||||
*Console << ss.str();
|
||||
GetConsole() << ss.str();
|
||||
|
||||
return ss;
|
||||
}
|
||||
|
||||
void SaveFileToAndroid(const std::string& fileName, const std::string& fileContent)
|
||||
{
|
||||
*Console << "SaveFileToAndroid called \n";
|
||||
GetConsole() << "SaveFileToAndroid called \n";
|
||||
|
||||
JNIEnv* jEnv;
|
||||
localJavaVirtualMachine->GetEnv((void**)&jEnv, JNI_VERSION_1_4);
|
||||
|
@ -4,6 +4,8 @@
|
||||
#include <algorithm>
|
||||
#include <math.h>
|
||||
|
||||
std::shared_ptr<WidgetAncestor> modal_background = nullptr;
|
||||
|
||||
GalaxyMenu::GalaxyMenu()
|
||||
{
|
||||
|
||||
@ -92,6 +94,15 @@ bool GalaxyMenu::InitGalaxyMenu(std::string config_json, float scale) {
|
||||
|
||||
void GalaxyMenu::UpdateGalaxyMenu(float s_width, float s_height, size_t dt) {
|
||||
/*..Reset..*/
|
||||
|
||||
if (s_width == currentWindowWidth && s_height == currentWindowHeight)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
currentWindowWidth = s_width;
|
||||
currentWindowHeight = s_height;
|
||||
|
||||
galaxies_params.clear();
|
||||
stars_params.clear();
|
||||
|
||||
@ -111,6 +122,7 @@ void GalaxyMenu::UpdateGalaxyMenu(float s_width, float s_height, size_t dt) {
|
||||
);*/
|
||||
|
||||
/*..Menu geometry..*/
|
||||
|
||||
xDimension = menuScale * gameScreenWidth;
|
||||
yDimension = menuScale * gameScreenHeight;
|
||||
Eigen::Vector2f currentMenuPos = Eigen::Vector2f(gameScreenCenter(0) + (gameScreenWidth/2/*relative to the screen x-dimension*/)*(menuPosition(0) - menu_offset(0)), gameScreenCenter(1) + (gameScreenHeight/2/*relative to the screen y-dimension*/)*(menuPosition(1) - menu_offset(1)));
|
||||
@ -158,34 +170,24 @@ void GalaxyMenu::UpdateGalaxyMenu(float s_width, float s_height, size_t dt) {
|
||||
|
||||
}
|
||||
|
||||
Eigen::Vector2f GalaxyMenu::textureSizeNormalize(Eigen::Vector2f texVec, int t_type) {
|
||||
float tex_ratio = texVec(0)/texVec(1);
|
||||
Eigen::Vector2f GalaxyMenu::textureSizeNormalize(Eigen::Vector2f texVec, int t_type)
|
||||
{
|
||||
float x_dim, y_dim;
|
||||
float Xmax; // Max normalized texture width
|
||||
float Xmin;
|
||||
float Ymax; // Max normalized texture height
|
||||
float Ymin;
|
||||
if (t_type == 0) {
|
||||
Xmax = SE::Renderer->GetScreenWidth();
|
||||
Xmin = Xmax;
|
||||
Ymax = SE::Renderer->GetScreenHeight();
|
||||
Ymin = Ymax;
|
||||
}
|
||||
else { // temp for star textures
|
||||
Xmax = (((float)SE::Renderer->GetScreenWidth())/2);
|
||||
Xmin = Xmax;
|
||||
Ymax = (((float)SE::Renderer->GetScreenHeight())/2);
|
||||
Ymin = Ymax;
|
||||
}
|
||||
|
||||
if (texVec(0) > texVec(1)) {
|
||||
x_dim = val_clamp(texVec(0), Xmin, Xmax);
|
||||
y_dim = x_dim / tex_ratio;
|
||||
}
|
||||
else {
|
||||
y_dim = val_clamp(texVec(1), Ymin, Ymax);
|
||||
float tex_ratio = texVec(0) / texVec(1);
|
||||
|
||||
float screenRatio = SE::Renderer->GetScreenWidth() / (float)SE::Renderer->GetScreenHeight();
|
||||
|
||||
if (tex_ratio > screenRatio)
|
||||
{
|
||||
y_dim = SE::Renderer->GetScreenHeight();
|
||||
x_dim = y_dim * tex_ratio;
|
||||
}
|
||||
else
|
||||
{
|
||||
x_dim = SE::Renderer->GetScreenWidth();
|
||||
y_dim = x_dim / tex_ratio;
|
||||
}
|
||||
|
||||
return Eigen::Vector2f(x_dim, y_dim);
|
||||
}
|
||||
@ -199,7 +201,11 @@ float GalaxyMenu::val_clamp(float val, float min, float max) {
|
||||
return val;
|
||||
}
|
||||
|
||||
void GalaxyMenu::DrawGalaxyMenu() {
|
||||
void GalaxyMenu::DrawGalaxyMenu(bool drawStars) {
|
||||
|
||||
Renderer->PushOrthoProjection();
|
||||
Renderer->PushMatrix();
|
||||
Renderer->LoadIdentity();
|
||||
|
||||
for (int i = 0; i < galaxies_params.size(); i++) {
|
||||
|
||||
@ -215,6 +221,8 @@ void GalaxyMenu::DrawGalaxyMenu() {
|
||||
)
|
||||
); // DrawRect
|
||||
|
||||
if (drawStars)
|
||||
{
|
||||
/*..Draw stars..*/
|
||||
Renderer->PushShader("HoverableButtonShader");
|
||||
if (stars_params.size() >= i) {
|
||||
@ -240,19 +248,40 @@ void GalaxyMenu::DrawGalaxyMenu() {
|
||||
}
|
||||
}
|
||||
Renderer->PopShader();
|
||||
}
|
||||
|
||||
/*..Draw level selection menu..*/
|
||||
//drawSelectionMenu(starIndex);
|
||||
|
||||
}
|
||||
|
||||
Renderer->PopMatrix();
|
||||
Renderer->PopProjectionMatrix();
|
||||
|
||||
}
|
||||
|
||||
|
||||
void GalaxyMenu::resetValuesOnGameStart()
|
||||
{
|
||||
modal_background = nullptr;
|
||||
totalTapShift = { 0, 0 };
|
||||
planetHoverIndex = -1;
|
||||
timer_active = false;
|
||||
}
|
||||
|
||||
void GalaxyMenu::InteractWithGalaxy(size_t dt) {
|
||||
|
||||
if (!modal_background) modal_background = ResourceManager->newGuiManager.findWidgetByName("modal_background");
|
||||
|
||||
if (modal_background->visible)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (timer_active) {
|
||||
// ::::::::::::: timer active ::::::::::::::
|
||||
if (menuState == 0) { // main view
|
||||
//if (menuState == 0)
|
||||
{ // main view
|
||||
//if (currentTapShift(0) == 0.f && currentTapShift(1) == 0.f) {
|
||||
if (currentTapShift(0) == totalTapShift(0) && currentTapShift(1) == totalTapShift(1)) {
|
||||
// OnTapDown->
|
||||
@ -305,12 +334,13 @@ void GalaxyMenu::InteractWithGalaxy(size_t dt) {
|
||||
else {
|
||||
// ::::::::::::: timer inactive ::::::::::::::
|
||||
if (lastTapPos != Eigen::Vector2f(-9999.9f, -9999.9f)) {
|
||||
if (menuState == 0) {// main view
|
||||
//if (menuState == 0)
|
||||
{// main view
|
||||
|
||||
// OnTapDown->OnTapUp
|
||||
|
||||
/*..level select menu open..*/
|
||||
starIndex = findPlanetByPos(lastTapPos);
|
||||
starIndex = findPlanetByPos(lastTapPos - totalTapShift);
|
||||
|
||||
|
||||
if (starIndex != -1) {
|
||||
@ -318,8 +348,6 @@ void GalaxyMenu::InteractWithGalaxy(size_t dt) {
|
||||
Application->SetupGalaxyUi(starIndex);
|
||||
}
|
||||
|
||||
timer_active = false;
|
||||
|
||||
|
||||
|
||||
}/*
|
||||
@ -377,6 +405,7 @@ void GalaxyMenu::InteractWithGalaxy(size_t dt) {
|
||||
lastTapPos = Eigen::Vector2f(-9999.9f, -9999.9f); // reset
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
void GalaxyMenu::tapDown(Eigen::Vector2f pos) {
|
||||
@ -394,7 +423,7 @@ void GalaxyMenu::tapUp(Eigen::Vector2f pos) {
|
||||
}
|
||||
|
||||
void GalaxyMenu::tapMove(Eigen::Vector2f shift) {
|
||||
if (timer_active) {
|
||||
if (timer_active && modal_background && !modal_background->visible) {
|
||||
|
||||
totalTapShift += shift;
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ public:
|
||||
|
||||
// ======== Main Methods ========
|
||||
bool InitGalaxyMenu(std::string config_json, float scale = 1.f);
|
||||
void DrawGalaxyMenu();
|
||||
void DrawGalaxyMenu(bool drawStars);
|
||||
void UpdateGalaxyMenu(float s_width, float s_height, size_t dt);
|
||||
|
||||
|
||||
@ -36,9 +36,12 @@ public:
|
||||
// ::#Params#::
|
||||
Eigen::Vector2f menuPosition = Eigen::Vector2f(0.f, 0.f); // relative to the screen center(0.f,0.f means center) (not const!!)
|
||||
float menuScale = 1.f; // (not const!!)
|
||||
int currentWindowWidth;
|
||||
int currentWindowHeight;
|
||||
float xDimension;
|
||||
float yDimension;
|
||||
float anchorSize = 1.f;
|
||||
int planetHoverIndex = -1;
|
||||
std::vector<std::pair<Eigen::Vector2f, Eigen::Vector2f>> galaxies_params; // ::position/dimensions::
|
||||
std::vector<std::vector<std::pair<Eigen::Vector2f, Eigen::Vector2f>>> stars_params;
|
||||
|
||||
@ -49,6 +52,7 @@ public:
|
||||
|
||||
void setTimerActivity(bool value);
|
||||
|
||||
void resetValuesOnGameStart();
|
||||
|
||||
private:
|
||||
|
||||
@ -67,14 +71,13 @@ private:
|
||||
int menuState = 0; // 0 - all galaxies are visible, 1 - zoomed to current galaxy(reserved) , 2 - level select menu
|
||||
int starIndex = -1;
|
||||
int galaxyIndex = 0; // zoomed galaxy
|
||||
int planetHoverIndex = -1;
|
||||
|
||||
/*..Interact params..*/
|
||||
bool timer_active = false;
|
||||
float interact_timer = 0.f; // reset
|
||||
Eigen::Vector2f lastTapPos = Eigen::Vector2f(-9999.9f, -9999.9f); // reset
|
||||
Eigen::Vector2f currentTapShift; // reset
|
||||
Eigen::Vector2f totalTapShift; // reset
|
||||
Eigen::Vector2f currentTapShift = Eigen::Vector2f(0.f, 0.f); // reset
|
||||
Eigen::Vector2f totalTapShift = Eigen::Vector2f(0.f, 0.f); // reset
|
||||
|
||||
/*..coefficients..*/
|
||||
Eigen::Vector2f menu_offset = Eigen::Vector2f(0, 0);
|
||||
|
@ -89,12 +89,28 @@ void TBrick::SetInvisible()
|
||||
|
||||
void TBrick::TryDrawAppear(int ipos, int jpos, int screenWidth)
|
||||
{
|
||||
float screenRatio = Renderer->GetMatrixWidth() / (float)Renderer->GetMatrixHeight();
|
||||
float screenRatioToFixedRatio = screenRatio / 1.6f;
|
||||
Vector2f offset;
|
||||
float scale;
|
||||
if (screenRatioToFixedRatio > 1.f)
|
||||
{
|
||||
offset[0] = (Renderer->GetMatrixWidth() - Renderer->GetMatrixWidth() / screenRatioToFixedRatio) / 2.f;
|
||||
offset[1] = 0;
|
||||
scale = Renderer->GetMatrixHeight() / 480.f;
|
||||
}
|
||||
else
|
||||
{
|
||||
offset[0] = 0;
|
||||
offset[1] = 0;// (screenHeight - screenHeight * screenRatioToFixedRatio) / 2.f;
|
||||
scale = Renderer->GetMatrixWidth() / 768.f;
|
||||
}
|
||||
|
||||
Vector2f centerPos = GetPosFrom(ipos, jpos, screenWidth);
|
||||
float LEVEL_VIEWPORT_WIDTH = Application->GetGameLevelScreenWidth();
|
||||
float LEVEL_VIEWPORT_HEIGHT = Application->GetGameLevelScreenHeight();
|
||||
//float LEVEL_VIEWPORT_WIDTH = Application->GetGameLevelScreenWidth();
|
||||
//float LEVEL_VIEWPORT_HEIGHT = Application->GetGameLevelScreenHeight();
|
||||
|
||||
Vector2f blockHalfSize = Vector2f(0.5f*CONST_BRICK_WIDTH * (LEVEL_VIEWPORT_WIDTH/480.f), 0.5f*CONST_BRICK_HEIGHT * (LEVEL_VIEWPORT_HEIGHT/320.f));
|
||||
Vector2f blockHalfSize = Vector2f(0.5f*CONST_BRICK_WIDTH * (768/480.f), 0.5f*CONST_BRICK_HEIGHT * (480/320.f));
|
||||
|
||||
std::string texName;
|
||||
if (Locked == 2)
|
||||
@ -110,13 +126,16 @@ void TBrick::TryDrawAppear(int ipos, int jpos, int screenWidth)
|
||||
texName = CONST_BLOCK_TEXTURE1;
|
||||
}
|
||||
|
||||
//Vector2f offset = { (Renderer->GetMatrixWidth() - 768) / 2.f,
|
||||
// (Renderer->GetMatrixHeight() - 480) / 2.f };
|
||||
|
||||
if (State == CONST_BRICKSTATE_DISAPPEAR)
|
||||
{
|
||||
|
||||
RenderUniform1f("Transparency", StateTimer/CONST_BRICK_DISAPPEAR_TIME);
|
||||
RenderUniform4fv("BrickColor", (Color.data()));
|
||||
glBindTexture(GL_TEXTURE_2D,ResourceManager->TexList[texName]);
|
||||
Renderer->DrawRect(centerPos - blockHalfSize, centerPos + blockHalfSize);
|
||||
Renderer->DrawRect((centerPos - blockHalfSize) * scale + offset, (centerPos + blockHalfSize) * scale + offset);
|
||||
}
|
||||
else if (State == CONST_BRICKSTATE_APPEAR)
|
||||
{
|
||||
@ -124,7 +143,7 @@ void TBrick::TryDrawAppear(int ipos, int jpos, int screenWidth)
|
||||
RenderUniform1f("Transparency", 1.f - StateTimer/CONST_BRICK_APPEAR_TIME);
|
||||
RenderUniform4fv("BrickColor", Color.data());
|
||||
glBindTexture(GL_TEXTURE_2D,ResourceManager->TexList[texName]);
|
||||
Renderer->DrawRect(centerPos - blockHalfSize, centerPos + blockHalfSize);
|
||||
Renderer->DrawRect((centerPos - blockHalfSize) * scale + offset, (centerPos + blockHalfSize) * scale + offset);
|
||||
}
|
||||
}
|
||||
|
||||
@ -160,14 +179,15 @@ Vector4f TBrick::GetColor()
|
||||
|
||||
Vector2f TBrick::GetPosFrom(int ipos, int jpos, int screenWidth)
|
||||
{
|
||||
float LEVEL_VIEWPORT_WIDTH = Application->GetGameLevelScreenWidth();
|
||||
float LEVEL_VIEWPORT_HEIGHT = Application->GetGameLevelScreenHeight();
|
||||
//float LEVEL_VIEWPORT_WIDTH = Application->GetGameLevelScreenWidth();
|
||||
//float LEVEL_VIEWPORT_HEIGHT = Application->GetGameLevelScreenHeight();
|
||||
|
||||
const Vector2f BorderShift(CONST_BRICK_SHIFT_X * (LEVEL_VIEWPORT_WIDTH/480.f), CONST_BRICK_SHIFT_Y * (LEVEL_VIEWPORT_HEIGHT/320.f));
|
||||
const Vector2f BorderShift(CONST_BRICK_SHIFT_X * (768/480.f), CONST_BRICK_SHIFT_Y * (480 /320.f));
|
||||
|
||||
Vector2f outlineShift = Vector2f(((screenWidth - LEVEL_VIEWPORT_WIDTH)*0.5f),0.f);
|
||||
//Vector2f outlineShift = Vector2f(((screenWidth - LEVEL_VIEWPORT_WIDTH)*0.5f),0.f);
|
||||
|
||||
return outlineShift+BorderShift+Vector2f(CONST_BRICK_WIDTH*(LEVEL_VIEWPORT_WIDTH/480.f)*ipos + 0.5f*CONST_BRICK_WIDTH*(LEVEL_VIEWPORT_WIDTH/480.f), LEVEL_VIEWPORT_HEIGHT - CONST_BRICK_HEIGHT*(LEVEL_VIEWPORT_HEIGHT/320.f)*(jpos)-0.5f*CONST_BRICK_HEIGHT*(LEVEL_VIEWPORT_HEIGHT/320.f));
|
||||
return BorderShift+Vector2f(CONST_BRICK_WIDTH*(768 /480.f)*ipos + 0.5f*CONST_BRICK_WIDTH*(768 /480.f),
|
||||
480 - CONST_BRICK_HEIGHT*(480 /320.f)*(jpos)-0.5f*CONST_BRICK_HEIGHT*(480.f /320.f));
|
||||
}
|
||||
|
||||
void TBrick::Disappear()
|
||||
@ -257,6 +277,22 @@ int TBonusFalling::GetType()
|
||||
|
||||
void TBonusFalling::Draw()
|
||||
{
|
||||
float screenRatio = Renderer->GetMatrixWidth() / (float)Renderer->GetMatrixHeight();
|
||||
float screenRatioToFixedRatio = screenRatio / 1.6f;
|
||||
Vector2f offset;
|
||||
float scale;
|
||||
if (screenRatioToFixedRatio > 1.f)
|
||||
{
|
||||
offset[0] = (Renderer->GetMatrixWidth() - Renderer->GetMatrixWidth() / screenRatioToFixedRatio) / 2.f;
|
||||
offset[1] = 0;
|
||||
scale = Renderer->GetMatrixHeight() / 480.f;
|
||||
}
|
||||
else
|
||||
{
|
||||
offset[0] = 0;
|
||||
offset[1] = 0;// (screenHeight - screenHeight * screenRatioToFixedRatio) / 2.f;
|
||||
scale = Renderer->GetMatrixWidth() / 768.f;
|
||||
}
|
||||
|
||||
Vector2f BonusHalfSize = Vector2f(16.f, 16.f);
|
||||
|
||||
@ -266,7 +302,7 @@ void TBonusFalling::Draw()
|
||||
RenderUniform1f("Transparency", transparency);
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D,ResourceManager->TexList[TexName]);
|
||||
Renderer->DrawRect(Pos - BonusHalfSize, Pos + BonusHalfSize);
|
||||
Renderer->DrawRect((Pos - BonusHalfSize) * scale + offset, (Pos + BonusHalfSize) * scale + offset);
|
||||
|
||||
}
|
||||
|
||||
@ -310,12 +346,11 @@ void TBall::Go()
|
||||
{
|
||||
|
||||
// Velocity = Normalize(Vector2f(2.f, 1.f));
|
||||
Velocity = Vector2f(2.f, 1.f).normalized();
|
||||
Velocity = { 0, 1 }; // Vector2f(2.f, 1.f).normalized();
|
||||
}
|
||||
|
||||
void TBall::ReflectToLeft()
|
||||
{
|
||||
|
||||
Application->hitSpark("left",Pos);
|
||||
|
||||
if (Velocity(0) > 0.f)
|
||||
@ -326,7 +361,6 @@ void TBall::ReflectToLeft()
|
||||
|
||||
void TBall::ReflectToRight()
|
||||
{
|
||||
|
||||
Application->hitSpark("right", Pos);
|
||||
|
||||
if (Velocity(0) < 0.f)
|
||||
@ -337,7 +371,6 @@ void TBall::ReflectToRight()
|
||||
|
||||
void TBall::ReflectToUp()
|
||||
{
|
||||
|
||||
Application->hitSpark("up", Pos);
|
||||
|
||||
if (Velocity(1) < 0.f)
|
||||
@ -348,7 +381,6 @@ void TBall::ReflectToUp()
|
||||
|
||||
void TBall::ReflectToDown()
|
||||
{
|
||||
|
||||
Application->hitSpark("down", Pos);
|
||||
|
||||
if (Velocity(1) > 0.f)
|
||||
@ -367,11 +399,11 @@ float ReflectorPlaneFunction(float shift)
|
||||
Something like this
|
||||
|
||||
*/
|
||||
float LEVEL_VIEWPORT_WIDTH = Application->GetGameLevelScreenWidth();
|
||||
float LEVEL_VIEWPORT_HEIGHT = Application->GetGameLevelScreenHeight();
|
||||
float hRW = (CONST_REFLECTOR_WIDTH*LEVEL_VIEWPORT_WIDTH / 700.f)*0.5f; // Half Reflector width
|
||||
//float LEVEL_VIEWPORT_WIDTH = Application->GetGameLevelScreenWidth();
|
||||
//float LEVEL_VIEWPORT_HEIGHT = Application->GetGameLevelScreenHeight();
|
||||
float hRW = (CONST_REFLECTOR_WIDTH*768 / 700.f)*0.5f; // Half Reflector width
|
||||
float hRPW = hRW*0.594f; // Half Reflector plane width
|
||||
float cRH = CONST_REFLECTOR_HEIGHT*LEVEL_VIEWPORT_HEIGHT / 480.f; // Current Reflector Height
|
||||
float cRH = CONST_REFLECTOR_HEIGHT*480 / 480.f; // Current Reflector Height
|
||||
|
||||
if (shift >= -(hRW) && shift < -(hRPW)) {
|
||||
float t = (shift+ hRW)/cRH;
|
||||
@ -390,9 +422,9 @@ float ReflectorPlaneFunction(float shift)
|
||||
void TBall::TryReflectOnReflector(Vector2f refPos)
|
||||
{
|
||||
|
||||
float LEVEL_VIEWPORT_HEIGHT = Application->GetGameLevelScreenHeight();
|
||||
//float LEVEL_VIEWPORT_HEIGHT = Application->GetGameLevelScreenHeight();
|
||||
const float reflectionShiftY = 13.f;
|
||||
const float reflectionMaxHeight = CONST_REFLECTOR_HEIGHT*LEVEL_VIEWPORT_HEIGHT/480.f;
|
||||
const float reflectionMaxHeight = CONST_REFLECTOR_HEIGHT*480/480.f;
|
||||
|
||||
|
||||
|
||||
@ -438,6 +470,7 @@ void TBall::Update(size_t dt)
|
||||
//===========================================
|
||||
//===========================================
|
||||
|
||||
bool TGameLevel::XXX = true;
|
||||
|
||||
TGameLevel::TGameLevel(int levelStar, int levelIndex)
|
||||
{
|
||||
@ -480,8 +513,8 @@ int TGameLevel::getLevelIndex()
|
||||
void TGameLevel::ReloadBlockInstansingList(int screenWidth)
|
||||
{
|
||||
|
||||
float LEVEL_VIEWPORT_WIDTH = Application->GetGameLevelScreenWidth();
|
||||
float LEVEL_VIEWPORT_HEIGHT = Application->GetGameLevelScreenHeight();
|
||||
//float LEVEL_VIEWPORT_WIDTH = Application->GetGameLevelScreenWidth();
|
||||
//float LEVEL_VIEWPORT_HEIGHT = Application->GetGameLevelScreenHeight();
|
||||
|
||||
std::map<int, std::string> ConstTextureBlockMap = boost::assign::map_list_of (0,CONST_BLOCK_TEXTURE1) (1,CONST_BLOCK_TEXTURE2) (2,CONST_BLOCK_TEXTURE3);
|
||||
|
||||
@ -515,8 +548,8 @@ void TGameLevel::ReloadBlockInstansingList(int screenWidth)
|
||||
itr--;
|
||||
}
|
||||
|
||||
Vector2f posFrom = BlockMatrix[i][j].GetPosFrom(i,j, screenWidth) + Vector2f(-0.5f*CONST_BRICK_WIDTH*(LEVEL_VIEWPORT_WIDTH/480.f), -0.5f*CONST_BRICK_HEIGHT*(LEVEL_VIEWPORT_HEIGHT/320.f));
|
||||
Vector2f posTo = BlockMatrix[i][j].GetPosFrom(i,j, screenWidth) + Vector2f(+0.5f*CONST_BRICK_WIDTH*(LEVEL_VIEWPORT_WIDTH/480.f), +0.5f*CONST_BRICK_HEIGHT*(LEVEL_VIEWPORT_HEIGHT/320.f));
|
||||
Vector2f posFrom = BlockMatrix[i][j].GetPosFrom(i,j, screenWidth) + Vector2f(-0.5f*CONST_BRICK_WIDTH*(768/480.f), -0.5f*CONST_BRICK_HEIGHT*(480/320.f));
|
||||
Vector2f posTo = BlockMatrix[i][j].GetPosFrom(i,j, screenWidth) + Vector2f(+0.5f*CONST_BRICK_WIDTH*(768 /480.f), +0.5f*CONST_BRICK_HEIGHT*(480 /320.f));
|
||||
|
||||
itr->second.Data += MakeDataTriangleList(posFrom, posTo);
|
||||
|
||||
@ -534,10 +567,10 @@ void TGameLevel::ReloadBlockInstansingList(int screenWidth)
|
||||
Vector2f TGameLevel::GetBlock(const Vector2f& pos)
|
||||
{
|
||||
|
||||
float LEVEL_VIEWPORT_WIDTH = Application->GetGameLevelScreenWidth();
|
||||
float LEVEL_VIEWPORT_HEIGHT = Application->GetGameLevelScreenHeight();
|
||||
int x = static_cast<int>((pos(0) - CONST_BRICK_SHIFT_X*(LEVEL_VIEWPORT_WIDTH /480.f) - ((Renderer->GetScreenWidth() - LEVEL_VIEWPORT_WIDTH)*0.5f)) / (CONST_BRICK_WIDTH*(LEVEL_VIEWPORT_WIDTH /480.f)));
|
||||
int y = static_cast<int>((LEVEL_VIEWPORT_HEIGHT + CONST_BRICK_SHIFT_Y*(LEVEL_VIEWPORT_HEIGHT/320.f) - pos(1)) / (CONST_BRICK_HEIGHT*(LEVEL_VIEWPORT_HEIGHT/320.f)));
|
||||
//float LEVEL_VIEWPORT_WIDTH = Application->GetGameLevelScreenWidth();
|
||||
//float LEVEL_VIEWPORT_HEIGHT = Application->GetGameLevelScreenHeight();
|
||||
int x = static_cast<int>((pos(0) - CONST_BRICK_SHIFT_X*(768 /480.f)) / (CONST_BRICK_WIDTH*(768 /480.f)));
|
||||
int y = static_cast<int>((480 + CONST_BRICK_SHIFT_Y*(480/320.f) - pos(1)) / (CONST_BRICK_HEIGHT*(480/320.f)));
|
||||
|
||||
|
||||
if (x < 0)
|
||||
@ -692,7 +725,7 @@ void TGameLevel::ReloadLevel()
|
||||
rowColorIterator++;
|
||||
}
|
||||
|
||||
ReloadBlockInstansingList(Renderer->GetScreenWidth());
|
||||
ReloadBlockInstansingList(Application->GetGameLevelScreenHeight());
|
||||
|
||||
}
|
||||
|
||||
@ -722,7 +755,7 @@ void TGameLevel::SetStandBy()
|
||||
void TGameLevel::SetLoading()
|
||||
{
|
||||
|
||||
InitLevel(Renderer->GetScreenWidth(), Renderer->GetScreenHeight());
|
||||
InitLevel(Application->GetGameLevelScreenWidth(), Application->GetGameLevelScreenHeight());
|
||||
StateTimer = CONST_TIMER_LOADING;
|
||||
LevelState = CONST_LEVELSTATE_LOADING;
|
||||
}
|
||||
@ -730,10 +763,10 @@ void TGameLevel::SetLoading()
|
||||
void TGameLevel::InitLevel(int screenWidth, int screenHeight)
|
||||
{
|
||||
|
||||
float LEVEL_VIEWPORT_WIDTH = Application->GetGameLevelScreenWidth();
|
||||
float LEVEL_VIEWPORT_HEIGHT = Application->GetGameLevelScreenHeight();
|
||||
ReflectorPos = Vector2f(screenWidth*0.5f, 16* LEVEL_VIEWPORT_HEIGHT/320.f + 13 * LEVEL_VIEWPORT_HEIGHT / 320.f);
|
||||
Vector2f ballPos = Vector2f(screenWidth*0.5f, 80* LEVEL_VIEWPORT_HEIGHT/320.f);
|
||||
//float LEVEL_VIEWPORT_WIDTH = Application->GetGameLevelScreenWidth();
|
||||
//float LEVEL_VIEWPORT_HEIGHT = Application->GetGameLevelScreenHeight();
|
||||
ReflectorPos = { 0.5f, 43.5 / Application->GetGameLevelScreenHeight() }; // Vector2f(screenWidth*0.5f, 16 * LEVEL_VIEWPORT_HEIGHT / 320.f + 13 * LEVEL_VIEWPORT_HEIGHT / 320.f);
|
||||
Vector2f ballPos = Vector2f(768*0.5f, 80* 480/320.f);
|
||||
|
||||
BallList.clear();
|
||||
BallList.push_back(TBall(ballPos, Vector2f(0, 0), BallColor));
|
||||
@ -812,7 +845,6 @@ void TGameLevel::Draw()
|
||||
InnerDraw(Renderer->GetScreenWidth(), Renderer->GetScreenHeight(), Renderer->GetMatrixWidth(), Renderer->GetMatrixHeight(), false);
|
||||
}
|
||||
|
||||
|
||||
void TGameLevel::InnerDraw(int screenWidth, int screenHeight, int matrixWidth, int matrixHeight, bool blackAndWhite)
|
||||
{
|
||||
|
||||
@ -835,10 +867,13 @@ void TGameLevel::InnerDraw(int screenWidth, int screenHeight, int matrixWidth, i
|
||||
return;
|
||||
}
|
||||
|
||||
Renderer->PushProjectionMatrix(screenWidth, screenHeight);
|
||||
Renderer->PushMatrix();
|
||||
Renderer->LoadIdentity();
|
||||
|
||||
if (LevelState == CONST_LEVELSTATE_LOADING)
|
||||
{
|
||||
Renderer->PushMatrix();
|
||||
|
||||
float scale = 1.f - 0.5f*StateTimer/CONST_TIMER_LOADING;
|
||||
if (scale < 0.5f)
|
||||
scale = 0.5f;
|
||||
@ -846,13 +881,13 @@ void TGameLevel::InnerDraw(int screenWidth, int screenHeight, int matrixWidth, i
|
||||
if (scale > 1.f)
|
||||
scale = 1.f;
|
||||
|
||||
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[levelName + "_prerendered"]);
|
||||
glBindTexture(GL_TEXTURE_2D,ResourceManager->TexList[levelName + "_prerender"]);
|
||||
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();
|
||||
CheckGlError();
|
||||
|
||||
Renderer->PopMatrix();
|
||||
Renderer->PopProjectionMatrix();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@ -869,20 +904,24 @@ void TGameLevel::InnerDraw(int screenWidth, int screenHeight, int matrixWidth, i
|
||||
{
|
||||
|
||||
//See also below (same method)
|
||||
Renderer->PushMatrix();
|
||||
Renderer->TranslateMatrix(Vector3f(matrixWidth * 0.5f, matrixHeight * 0.5f, 0));
|
||||
Renderer->ScaleMatrix(OutScale);
|
||||
Renderer->TranslateMatrix(-Vector3f(matrixWidth * 0.5f, matrixHeight * 0.5f, 0));
|
||||
// Renderer->PushMatrix();
|
||||
//Renderer->TranslateMatrix(Vector3f(matrixWidth * 0.5f, matrixHeight * 0.5f, 0));
|
||||
// Renderer->ScaleMatrix(OutScale);
|
||||
//Renderer->TranslateMatrix(-Vector3f(matrixWidth * 0.5f, matrixHeight * 0.5f, 0));
|
||||
DrawBuffer();
|
||||
|
||||
if (mustShowButtons)
|
||||
{
|
||||
DrawPauseButtons();
|
||||
}
|
||||
Renderer->PopMatrix();
|
||||
//if (mustShowButtons)
|
||||
//{
|
||||
// DrawPauseButtons();
|
||||
//}
|
||||
//Renderer->PopMatrix();
|
||||
CheckGlError();
|
||||
|
||||
drawOutline(screenWidth, screenHeight);
|
||||
//drawOutline(screenWidth, screenHeight);
|
||||
|
||||
Renderer->PopMatrix();
|
||||
Renderer->PopProjectionMatrix();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@ -918,31 +957,54 @@ void TGameLevel::InnerDraw(int screenWidth, int screenHeight, int matrixWidth, i
|
||||
}
|
||||
|
||||
// :::::::::::
|
||||
*SE::Console << BkgTexture;
|
||||
*SE::Console << std::to_string(ResourceManager->TexList[BkgTexture]);
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D,ResourceManager->TexList[BkgTexture]);
|
||||
//Renderer->DrawRect(Vector2f(xlOffset, ylOffset), Vector2f(xlOffset+tSW, ylOffset+tSH),Vector2f(0.f, 0.f), Vector2f(1.f, 1.f));
|
||||
Renderer->DrawRect(Vector2f(bkgSWO, bkgSHO), Vector2f(bkgSWO + bkgSW, bkgSHO + bkgSH), Vector2f(0.f, 0.f), Vector2f(1.f, 1.f));
|
||||
|
||||
float backgroundHorOffset = (xlOffset - bkgSWO) / screenWidth;
|
||||
|
||||
Renderer->DrawRect(Vector2f(xlOffset, bkgSHO), Vector2f(xlOffset + tSW, bkgSHO + bkgSH), Vector2f(backgroundHorOffset, 0.f), Vector2f(1.f - backgroundHorOffset, 1.f));
|
||||
//Renderer->DrawRect(Vector2f(0,0), Vector2f(100,100), Vector2f(0.f, 0.f), Vector2f(1.f, 1.f));
|
||||
|
||||
|
||||
|
||||
std::list<TBall>::iterator iBall;
|
||||
|
||||
|
||||
float screenRatio = screenWidth / (float)screenHeight;
|
||||
float screenRatioToFixedRatio = screenRatio / 1.6f;
|
||||
Vector2f offset;
|
||||
float scale;
|
||||
if (screenRatioToFixedRatio > 1.f)
|
||||
{
|
||||
offset[0] = (Renderer->GetScreenWidth() - screenWidth / screenRatioToFixedRatio) / 2.f;
|
||||
offset[1] = 0;
|
||||
scale = matrixHeight / 480.f;
|
||||
}
|
||||
else
|
||||
{
|
||||
offset[0] = 0;
|
||||
offset[1] = 0;// (screenHeight - screenHeight * screenRatioToFixedRatio) / 2.f;
|
||||
scale = matrixWidth / 768.f;
|
||||
}
|
||||
|
||||
Renderer->PushShader("BrickShader");
|
||||
|
||||
|
||||
for (int i=0; i<CONST_BRICKMATRIX_WIDTH; i++)
|
||||
for (int i = 0; i < CONST_BRICKMATRIX_WIDTH; i++)
|
||||
{
|
||||
for (int j=0; j<CONST_BRICKMATRIX_HEIGHT; j++)
|
||||
for (int j = 0; j < CONST_BRICKMATRIX_HEIGHT; j++)
|
||||
{
|
||||
BlockMatrix[i][j].TryDrawAppear(i,j, screenWidth); //Draws only appearing/disappearing blocks
|
||||
BlockMatrix[i][j].TryDrawAppear(i, j, screenWidth); //Draws only appearing/disappearing blocks
|
||||
}
|
||||
}
|
||||
|
||||
RenderUniform1f("Transparency", 1.f);
|
||||
|
||||
//Vector2f outlineShift = Vector2f(((screenWidth - Application->GetGameLevelScreenWidth())*0.5f), 0.f);
|
||||
Renderer->PushMatrix();
|
||||
Renderer->TranslateMatrix(Vector3f(offset[0], offset[1], 0));
|
||||
Renderer->ScaleMatrix(scale);
|
||||
|
||||
std::list<std::pair<PairColorTexture, TTriangleList>>::iterator colorBlockIterator;
|
||||
for (colorBlockIterator = BlockInstansingList.ColorBlockList.begin(); colorBlockIterator != BlockInstansingList.ColorBlockList.end(); ++colorBlockIterator)
|
||||
{
|
||||
@ -961,6 +1023,10 @@ void TGameLevel::InnerDraw(int screenWidth, int screenHeight, int matrixWidth, i
|
||||
Renderer->DrawTriangleList(colorBlockIterator->second);
|
||||
}
|
||||
|
||||
DrawBallInstancingList(blackAndWhite);
|
||||
|
||||
Renderer->PopMatrix();
|
||||
|
||||
|
||||
std::list<TBonusFalling>::iterator iBonus;
|
||||
|
||||
@ -971,17 +1037,17 @@ void TGameLevel::InnerDraw(int screenWidth, int screenHeight, int matrixWidth, i
|
||||
|
||||
Application->EffectsDraw();
|
||||
|
||||
|
||||
|
||||
DrawBallInstancingList(blackAndWhite);
|
||||
|
||||
Renderer->PopShader();
|
||||
|
||||
//float LEVEL_VIEWPORT_WIDTH = Application->GetGameLevelScreenWidth();
|
||||
//float LEVEL_VIEWPORT_HEIGHT = Application->GetGameLevelScreenHeight();
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D,ResourceManager->TexList[CONST_REFLECTOR_TEXTURE]);
|
||||
float xRW = 210.f * tSW/700.f; // x Reflector Width
|
||||
float yRH = 45.f * tSH/480.f; // y Reflector Height
|
||||
Renderer->DrawRect(Vector2f(-xRW*0.5f, -yRH*0.5f)+ReflectorPos, Vector2f(xRW*0.5f, yRH*0.5f)+ReflectorPos, Vector2f(0.f, 0.f), Vector2f(1.f, 1.f));
|
||||
float xRW = 210.f; // x Reflector Width
|
||||
float yRH = 45.f; // y Reflector Height
|
||||
Vector2f matrixSize = ReflectorPos.cwiseProduct(Vector2f(768, 480));
|
||||
Renderer->DrawRect(Vector2f(-xRW * 0.5f, -yRH * 0.5f) * scale + offset + matrixSize,
|
||||
Vector2f(xRW*0.5f, yRH*0.5f) * scale + offset + matrixSize, Vector2f(0.f, 0.f), Vector2f(1.f, 1.f));
|
||||
|
||||
const Vector2f wallUpPos1(xlOffset, tSH-ylOffset-uWTW);
|
||||
const Vector2f wallUpPos2(tSW + xlOffset, tSH-ylOffset);
|
||||
@ -1015,15 +1081,15 @@ void TGameLevel::InnerDraw(int screenWidth, int screenHeight, int matrixWidth, i
|
||||
|
||||
if (!pause && LevelState != CONST_LEVELSTATE_SNAPSHOTTING)
|
||||
{
|
||||
RenderUniform1f("Transparency", 1.f);
|
||||
glBindTexture(GL_TEXTURE_2D,ResourceManager->TexList[CONST_BACK_BTN_TEXTURE]);
|
||||
const Vector2f BackBtnPos(screenWidth*0.5f, Application->GetGameLevelScreenHeight() - 52.f*(Application->GetGameLevelScreenHeight()/320.f));
|
||||
const float const_backBtnWidth = CONST_BACK_BTN_WIDTH * Application->GetGameLevelScreenWidth()/480.f;
|
||||
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);
|
||||
// RenderUniform1f("Transparency", 1.f);
|
||||
// glBindTexture(GL_TEXTURE_2D,ResourceManager->TexList[CONST_BACK_BTN_TEXTURE]);
|
||||
// const Vector2f BackBtnPos(screenWidth*0.5f, Application->GetGameLevelScreenHeight() - 52.f*(Application->GetGameLevelScreenHeight()/320.f));
|
||||
//const float const_backBtnWidth = CONST_BACK_BTN_WIDTH * Application->GetGameLevelScreenWidth()/480.f;
|
||||
//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);
|
||||
//drawOutline(screenWidth, screenHeight);
|
||||
|
||||
|
||||
if (pause && !renderBufferReady)
|
||||
@ -1040,18 +1106,26 @@ void TGameLevel::InnerDraw(int screenWidth, int screenHeight, int matrixWidth, i
|
||||
Renderer->ScaleMatrix(OutScale);
|
||||
Renderer->TranslateMatrix(-Vector3f(matrixWidth * 0.5f, matrixHeight * 0.5f, 0));
|
||||
DrawBuffer();
|
||||
if (mustShowButtons)
|
||||
{
|
||||
DrawPauseButtons();
|
||||
}
|
||||
//if (mustShowButtons)
|
||||
//{
|
||||
// DrawPauseButtons();
|
||||
//}
|
||||
Renderer->PopMatrix();
|
||||
RenderBufferReady = true;
|
||||
CheckGlError();
|
||||
|
||||
//Renderer->DrawRect(Vector2f(bkgSWO, bkgSHO), Vector2f(bkgSWO + bkgSW, bkgSHO + bkgSH), Vector2f(0.f, 0.f), Vector2f(1.f, 1.f));
|
||||
//Renderer->DrawRect(Vector2f(xlOffset, bkgSHO), Vector2f(xlOffset + tSW, bkgSHO + bkgSH), Vector2f(0.f, 0.f), Vector2f(1.f, 1.f));
|
||||
|
||||
horOffset = xlOffset / screenWidth;
|
||||
verOffset = bkgSH / screenHeight;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Renderer->PopMatrix();
|
||||
Renderer->PopProjectionMatrix();
|
||||
|
||||
CheckGlError();
|
||||
}
|
||||
@ -1059,11 +1133,14 @@ void TGameLevel::InnerDraw(int screenWidth, int screenHeight, int matrixWidth, i
|
||||
void TGameLevel::DrawPauseButtons() //continue from
|
||||
{
|
||||
|
||||
float x_levelScreenCenter = Renderer->GetScreenWidth()*0.5f;
|
||||
float y_levelScreenCenter = Renderer->GetScreenHeight()*0.5f;
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D,ResourceManager->TexList[CONST_SLIDE_UP_BTN_TEXTURE]);
|
||||
Renderer->DrawRect(Vector2f(-128.f, -64.f)+CONST_SLIDE_UP_POS, Vector2f(128.f, 64.f)+CONST_SLIDE_UP_POS);
|
||||
Renderer->DrawRect(Vector2f(x_levelScreenCenter - 128.f, y_levelScreenCenter - 64.f) + CONST_SLIDE_UP_POS, Vector2f(x_levelScreenCenter + 128.f, y_levelScreenCenter + 64.f) + CONST_SLIDE_UP_POS);
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D,ResourceManager->TexList[CONST_TAP_TO_CONTINUE_BTN_TEXTURE]);
|
||||
Renderer->DrawRect(Vector2f(-128.f, -128.f)+CONST_TAP_TO_CONTINUE_POS, Vector2f(128.f, 128.f)+CONST_TAP_TO_CONTINUE_POS);
|
||||
Renderer->DrawRect(Vector2f(x_levelScreenCenter - 128.f, y_levelScreenCenter - 128.f) + CONST_TAP_TO_CONTINUE_POS, Vector2f(x_levelScreenCenter + 128.f, y_levelScreenCenter + 128.f) + CONST_TAP_TO_CONTINUE_POS);
|
||||
|
||||
}
|
||||
|
||||
@ -1114,15 +1191,70 @@ void TGameLevel::DrawBuffer()
|
||||
RenderUniform1f("Brightness", brightness);
|
||||
glBindTexture(GL_TEXTURE_2D,ResourceManager->FrameManager.GetFrameTexture("LevelBuffer"));
|
||||
|
||||
float screenRatio = Renderer->GetMatrixWidth() / (float)Renderer->GetMatrixHeight();
|
||||
float screenRatioToFixedRatio = screenRatio / 1.6f;
|
||||
Vector2f offset;
|
||||
float scale;
|
||||
if (screenRatioToFixedRatio > 1.f)
|
||||
{
|
||||
offset[0] = (Renderer->GetMatrixWidth() - Renderer->GetMatrixWidth() / screenRatioToFixedRatio) / 2.f;
|
||||
offset[1] = 0;
|
||||
scale = Renderer->GetMatrixHeight() / 480.f;
|
||||
}
|
||||
else
|
||||
{
|
||||
offset[0] = 0;
|
||||
offset[1] = 0;// (screenHeight - screenHeight * screenRatioToFixedRatio) / 2.f;
|
||||
scale = Renderer->GetMatrixWidth() / 768.f;
|
||||
}
|
||||
|
||||
//Matrix switched to identity
|
||||
//Vector2f RectPos = Vector2f(-1, -1);
|
||||
//Vector2f RectSize = Vector2f(2, 2);
|
||||
float x_levelScreenCenter = Renderer->GetScreenWidth()*0.5f;
|
||||
float y_levelScreenCenter = Renderer->GetScreenHeight()*0.5f;
|
||||
float x_levelScreenSize = x_levelScreenCenter - offset[0];
|
||||
float y_levelScreenSize = y_levelScreenCenter - offset[1];
|
||||
Vector2f RectPos = Vector2f(x_levelScreenCenter, y_levelScreenCenter);
|
||||
Vector2f RectSize = Vector2f(x_levelScreenCenter, y_levelScreenCenter);
|
||||
Vector2f RectSize = Vector2f(x_levelScreenSize, y_levelScreenSize);
|
||||
|
||||
Renderer->DrawRect(RectPos-RectSize, RectPos+RectSize);
|
||||
//Renderer->DrawRect(RectPos-RectSize, RectPos+RectSize);
|
||||
|
||||
// Scaling math
|
||||
float tSW = Application->GetGameLevelScreenWidth(); // Screen Width
|
||||
float tSH = Application->GetGameLevelScreenHeight(); // Screen Height
|
||||
float xlOffset = (Renderer->GetScreenWidth() - tSW)*0.5f; // Level Screen x-offset
|
||||
|
||||
float ylOffset = 0.f;
|
||||
float lrFBO = 4 * tSH / 320.f; // Left/Right Wall Textures offset from bottom
|
||||
float uWTW = tSW * (static_cast<float>(ResourceManager->TexList.GetTextureOriginalHeight(CONST_WALL_UP_TEXTURE)) / static_cast<float>(ResourceManager->TexList.GetTextureOriginalWidth(CONST_WALL_UP_TEXTURE))); // up Wall Texture Width
|
||||
float lWTW = (static_cast<float>(ResourceManager->TexList.GetTextureOriginalWidth(CONST_WALL_LEFT_TEXTURE)) / static_cast<float>(ResourceManager->TexList.GetTextureOriginalHeight(CONST_WALL_LEFT_TEXTURE))) * (tSH - uWTW - lrFBO); // left Wall Texture Width
|
||||
float rWTW = lWTW; // right Wall Texture Width
|
||||
float bWTO = (lWTW + rWTW) * 0.5f; // bonus Wall x-Offset
|
||||
float bWTW = (tSW - bWTO) * (static_cast<float>(ResourceManager->TexList.GetTextureOriginalHeight(CONST_WALL_BONUS_TEXTURE)) / static_cast<float>(ResourceManager->TexList.GetTextureOriginalWidth(CONST_WALL_BONUS_TEXTURE))); // bonus Wall Texture Width
|
||||
|
||||
float bkgTW = (float)ResourceManager->TexList.GetTextureOriginalWidth(BkgTexture);
|
||||
float bkgTH = (float)ResourceManager->TexList.GetTextureOriginalHeight(BkgTexture);
|
||||
float bkgSW; // Background Secreen Width
|
||||
float bkgSH; // Background Secreen Height
|
||||
float bkgSWO; // Background Secreen Width Offset
|
||||
float bkgSHO; // Background Secreen Height Offset
|
||||
|
||||
if ((bkgTW / bkgTH) >= 1.6f/*screen ratio*/) {
|
||||
bkgSW = (tSH / bkgTH) * bkgTW;
|
||||
bkgSH = tSH;
|
||||
bkgSWO = (((float)Renderer->GetScreenWidth()) - bkgSW) * 0.5f;
|
||||
bkgSHO = ylOffset;
|
||||
}
|
||||
else {
|
||||
bkgSH = (tSW / bkgTW) * bkgTH;
|
||||
bkgSW = tSW;
|
||||
bkgSWO = xlOffset;
|
||||
bkgSHO = ylOffset;
|
||||
}
|
||||
|
||||
//Renderer->DrawRect(Vector2f(bkgSWO, bkgSHO), Vector2f(bkgSWO + bkgSW, bkgSHO + bkgSH), Vector2f(horOffset, 0.f), Vector2f(1.f - horOffset, verOffset));
|
||||
Renderer->DrawRect(Vector2f(xlOffset, bkgSHO), Vector2f(xlOffset + tSW, bkgSHO + bkgSH), Vector2f(horOffset, 0.f), Vector2f(1.f - horOffset, verOffset));
|
||||
|
||||
Renderer->PopShader();
|
||||
|
||||
@ -1131,6 +1263,10 @@ void TGameLevel::DrawBuffer()
|
||||
|
||||
void TGameLevel::SetPause()
|
||||
{
|
||||
if (LevelState == CONST_LEVELSTATE_STANDBY)
|
||||
{
|
||||
PrevLevelStateIsStandby = true;
|
||||
}
|
||||
|
||||
OutScaleVelocity = 0.f;
|
||||
OutScale = 1.f;
|
||||
@ -1165,7 +1301,6 @@ bool TGameLevel::IsPaused()
|
||||
|
||||
void TGameLevel::Update(size_t dt)
|
||||
{
|
||||
|
||||
if (LevelState == CONST_LEVELSTATE_NODRAW)
|
||||
{
|
||||
return;
|
||||
@ -1186,7 +1321,7 @@ void TGameLevel::Update(size_t dt)
|
||||
if (LevelState == CONST_LEVELSTATE_PAUSE)
|
||||
{
|
||||
OutScale += OutScaleVelocity * dt;
|
||||
TryGoToMenu();
|
||||
//TryGoToMenu();
|
||||
CheckGlError();
|
||||
return;
|
||||
}
|
||||
@ -1262,8 +1397,8 @@ void TGameLevel::Update(size_t dt)
|
||||
{
|
||||
iBonus->Update(dt);
|
||||
|
||||
if ((fabs(ReflectorPos(0) - iBonus->GetPos()(0))<CONST_BONUS_CATCH_DISTANCE_X) &&
|
||||
(fabs(ReflectorPos(1) - iBonus->GetPos()(1))<CONST_BONUS_CATCH_DISTANCE_Y))
|
||||
if ((fabs(ReflectorPos(0) * 768 - iBonus->GetPos()(0))<CONST_BONUS_CATCH_DISTANCE_X) &&
|
||||
(fabs(ReflectorPos(1) * 480 - iBonus->GetPos()(1))<CONST_BONUS_CATCH_DISTANCE_Y))
|
||||
{
|
||||
int bonusType = iBonus->GetType();
|
||||
iBonus = BonusFallingList.erase(iBonus);
|
||||
@ -1558,8 +1693,8 @@ void TGameLevel::UpdateBallList(size_t dt)
|
||||
|
||||
std::list<TBall>::iterator iBall;
|
||||
|
||||
float LEVEL_VIEWOPRT_WIDTH = Application->GetGameLevelScreenWidth();
|
||||
float LEVEL_VIEWPORT_HEIGHT = Application->GetGameLevelScreenHeight();
|
||||
//float LEVEL_VIEWOPRT_WIDTH = Application->GetGameLevelScreenWidth();
|
||||
//float LEVEL_VIEWPORT_HEIGHT = Application->GetGameLevelScreenHeight();
|
||||
|
||||
bool mustReloadBalls = false;
|
||||
|
||||
@ -1605,33 +1740,34 @@ void TGameLevel::UpdateBallList(size_t dt)
|
||||
|
||||
Vector2f ballPos = iBall->GetPos();
|
||||
|
||||
float xWO = (Renderer->GetScreenWidth()-LEVEL_VIEWOPRT_WIDTH)*0.5f; // x Wall Offest
|
||||
float yWO = (Renderer->GetScreenHeight()-LEVEL_VIEWPORT_HEIGHT)*0.5f; // y Wall Offset
|
||||
// float xWO = (Renderer->GetScreenWidth()-LEVEL_VIEWOPRT_WIDTH)*0.5f; // x Wall Offest
|
||||
//float yWO = (Renderer->GetScreenHeight()-LEVEL_VIEWPORT_HEIGHT)*0.5f; // y Wall Offset
|
||||
|
||||
if (ballPos(0) > (xWO + LEVEL_VIEWOPRT_WIDTH)-15.f*(LEVEL_VIEWOPRT_WIDTH/480.f))
|
||||
if (ballPos(0) > (768)-15.f*(768 /480.f))
|
||||
{
|
||||
iBall->ReflectToLeft();
|
||||
}
|
||||
|
||||
if (ballPos(0) < xWO + 15.f)
|
||||
if (ballPos(0) < 15.f)
|
||||
{
|
||||
iBall->ReflectToRight();
|
||||
}
|
||||
|
||||
if (ballPos(1) > (yWO+LEVEL_VIEWPORT_HEIGHT)-16.f * (LEVEL_VIEWPORT_HEIGHT/320.f))
|
||||
if (ballPos(1) > (480)-16.f * (480 /320.f))
|
||||
{
|
||||
iBall->ReflectToDown();
|
||||
}
|
||||
|
||||
if (BonusFloorTimer > 0.f)
|
||||
{
|
||||
if (ballPos(1) < yWO+13.0f*(LEVEL_VIEWPORT_HEIGHT/320.f))
|
||||
if (ballPos(1) < 13.0f*(480 /320.f))
|
||||
{
|
||||
iBall->ReflectToUp();
|
||||
}
|
||||
}
|
||||
|
||||
iBall->TryReflectOnReflector(ReflectorPos);
|
||||
Vector2f matrixSize = { 768, 480 };
|
||||
iBall->TryReflectOnReflector(ReflectorPos.cwiseProduct(matrixSize));
|
||||
|
||||
Vector2f ipos = GetBlock(ballPos);
|
||||
if (!(ipos == iBall->BallInBlock))
|
||||
@ -1706,7 +1842,7 @@ void TGameLevel::UpdateBallList(size_t dt)
|
||||
|
||||
if (blockListChanged)
|
||||
{
|
||||
ReloadBlockInstansingList(Renderer->GetScreenWidth());
|
||||
ReloadBlockInstansingList(Application->GetGameLevelScreenWidth());
|
||||
}
|
||||
|
||||
if (mustReloadBalls)
|
||||
@ -1748,42 +1884,28 @@ void TGameLevel::MultiplyBalls(Vector2f pos, Vector2f velocity)
|
||||
|
||||
void TGameLevel::OnTapDown(Vector2f pos)
|
||||
{
|
||||
float xOffset = (Renderer->GetMatrixWidth() - Application->GetGameLevelScreenWidth()) / 2.f;
|
||||
float yOffset = (Renderer->GetMatrixHeight() - Application->GetGameLevelScreenHeight()) / 2.f;
|
||||
|
||||
float xPos = pos(0) - xOffset;
|
||||
float yPos = pos(1) - yOffset;
|
||||
|
||||
if (LevelState == CONST_LEVELSTATE_STANDBY)
|
||||
{
|
||||
if (TapInBackBtnArea(pos))
|
||||
{
|
||||
SetPause();
|
||||
PrevLevelStateIsStandby = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
LevelState = CONST_LEVELSTATE_PLAYING;
|
||||
BallList.begin()->Go();
|
||||
}
|
||||
}
|
||||
else if (LevelState == CONST_LEVELSTATE_PLAYING)
|
||||
{
|
||||
|
||||
|
||||
if (TapInBackBtnArea(pos))
|
||||
{
|
||||
SetPause();
|
||||
}
|
||||
else if (fabs(ReflectorPos(0) - pos(0))>64.f)
|
||||
{
|
||||
ReflectorPos(0) = pos(0);
|
||||
}
|
||||
|
||||
}
|
||||
else if (LevelState == CONST_LEVELSTATE_PAUSE)
|
||||
{
|
||||
if (pos(1) > 128.f)
|
||||
{
|
||||
ReleasePause();
|
||||
}
|
||||
ReflectorPos(0) = xPos / Application->GetGameLevelScreenWidth();
|
||||
}
|
||||
//else if (LevelState == CONST_LEVELSTATE_PAUSE)
|
||||
//{
|
||||
// if (yPos > 128.f)
|
||||
// {
|
||||
// ReleasePause();
|
||||
// }
|
||||
//}
|
||||
}
|
||||
|
||||
void TGameLevel::OnTapUp(Vector2f pos)
|
||||
@ -1806,7 +1928,7 @@ void TGameLevel::OnScroll(Vector2f shift)
|
||||
const float CONST_SCROLL_SCALE = 1.1f;
|
||||
if (LevelState == CONST_LEVELSTATE_PLAYING || LevelState == CONST_LEVELSTATE_STANDBY)
|
||||
{
|
||||
ReflectorPos(0) -= CONST_SCROLL_SCALE*shift(0);
|
||||
ReflectorPos(0) -= CONST_SCROLL_SCALE * shift(0) / Application->GetGameLevelScreenWidth();
|
||||
}
|
||||
else if (LevelState == CONST_LEVELSTATE_PAUSE)
|
||||
{
|
||||
@ -1814,23 +1936,26 @@ void TGameLevel::OnScroll(Vector2f shift)
|
||||
|
||||
OutScale += shift(1)/320.f;
|
||||
|
||||
TryGoToMenu();
|
||||
//TryGoToMenu();
|
||||
}
|
||||
}
|
||||
|
||||
void TGameLevel::TryGoToMenu()
|
||||
{
|
||||
|
||||
if (OutScale < 0.5f)
|
||||
{
|
||||
OutScale = 0.5f;
|
||||
LevelState = CONST_LEVELSTATE_NODRAW;
|
||||
Application->GoFromGameToMenu();
|
||||
}
|
||||
if (OutScale > 1.f)
|
||||
{
|
||||
OutScale = 1.f;
|
||||
}
|
||||
|
||||
//if (OutScale < 0.5f)
|
||||
//{
|
||||
// OutScale = 0.5f;
|
||||
// LevelState = CONST_LEVELSTATE_NODRAW;
|
||||
// Application->GoFromGameToMenu();
|
||||
//}
|
||||
//if (OutScale > 1.f)
|
||||
//{
|
||||
// OutScale = 1.f;
|
||||
//}
|
||||
}
|
||||
|
||||
bool TBrick::IsAppear() {
|
||||
|
@ -126,6 +126,10 @@ class TGameLevel : public TGameAreaAncestor
|
||||
protected:
|
||||
float lvlWidth;
|
||||
float lvlHeight;
|
||||
|
||||
float verOffset;
|
||||
float horOffset;
|
||||
|
||||
std::string BkgTexture;
|
||||
//std::string LevelScreenTexture;
|
||||
std::string LevelFileName;
|
||||
@ -196,6 +200,8 @@ public:
|
||||
TGameLevel(int levelStar, int levelIndex);
|
||||
~TGameLevel();
|
||||
|
||||
static bool XXX;
|
||||
|
||||
void FillWithFile(const std::string& filename);
|
||||
//void setBackground(const std::string& assignedShutterstock);
|
||||
|
||||
|
@ -57,6 +57,11 @@ TMyApplication* Application;
|
||||
int currentStar;
|
||||
int currentLevel;
|
||||
|
||||
boost::property_tree::ptree gamePauseMenuUi;
|
||||
boost::property_tree::ptree galaxyMenuUi;
|
||||
|
||||
bool ignoreTapUp = false;
|
||||
|
||||
void TMyApplication::LoadUserProgress()
|
||||
{
|
||||
boost::property_tree::ptree userProgressJson;
|
||||
@ -130,6 +135,28 @@ void TMyApplication::SaveUserProgress(int levelStar, int levelIndex)
|
||||
#endif
|
||||
}
|
||||
|
||||
void TMyApplication::InnerChangeWidthHeight(int screenWidth, int screenHeight, float matrixWidth, float matrixHeight)
|
||||
{
|
||||
Menu.GalaxMenu.UpdateGalaxyMenu(matrixWidth, matrixHeight, 0);
|
||||
SetGameLevelScreenScale();
|
||||
|
||||
float screenRatio = Renderer->GetMatrixWidth() / (float)Renderer->GetMatrixHeight();
|
||||
float screenRatioToFixedRatio = screenRatio / 1.6f;
|
||||
float marginLeft;
|
||||
if (screenRatioToFixedRatio > 1.f)
|
||||
{
|
||||
marginLeft = (Renderer->GetMatrixWidth() - Renderer->GetMatrixWidth() / screenRatioToFixedRatio) / 2.f;
|
||||
}
|
||||
else
|
||||
{
|
||||
marginLeft = 0;
|
||||
}
|
||||
|
||||
if (GameState == CONST_GAMESTATE_LEVEL)
|
||||
{
|
||||
ResourceManager->newGuiManager.findWidgetByName("buttonList")->setMargin(0, 0, marginLeft, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void TMyApplication::InnerInit()
|
||||
{
|
||||
@ -137,8 +164,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
|
||||
@ -152,12 +179,11 @@ void TMyApplication::InnerInit()
|
||||
ST::PathToResources = "";
|
||||
#endif
|
||||
|
||||
if (Console != NULL)
|
||||
{
|
||||
*Console<<"APP INIT\n";
|
||||
}
|
||||
GetConsole() <<"APP INIT\n";
|
||||
|
||||
srand (static_cast<size_t>(time(NULL)));
|
||||
GameState = CONST_GAMESTATE_PRELOADING;
|
||||
Menu.SetGameState(GameState);
|
||||
StateTimer = 0.f;
|
||||
|
||||
ResourceManager->ShaderManager.AddShader("DefaultShader", "shaders/gui_transparent.vertex", "shaders/gui_transparent.fragment");
|
||||
@ -222,10 +248,8 @@ void TMyApplication::InnerDeinit()
|
||||
{
|
||||
Inited = false;
|
||||
Loaded = false;
|
||||
if (Console != NULL)
|
||||
{
|
||||
*Console<<"APP DEINIT\n";
|
||||
}
|
||||
|
||||
GetConsole() << "APP DEINIT\n";
|
||||
|
||||
OnTapUpSignal.disconnect(boost::bind(&TGameLevel::OnTapUp, boost::ref(GameLevel), _1));
|
||||
OnTapUpSignal.disconnect(boost::bind(&TGameMenu::OnTapUp, boost::ref(Menu), _1));
|
||||
@ -253,11 +277,21 @@ void TMyApplication::InnerDeinit()
|
||||
|
||||
void TMyApplication::InnerOnTapUp(Vector2f p)
|
||||
{
|
||||
if (ignoreTapUp)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
OnTapUpSignal(Vector2f(p(0), p(1)));
|
||||
}
|
||||
|
||||
void TMyApplication::InnerOnTapUpAfterMove(Vector2f p)
|
||||
{
|
||||
if (ignoreTapUp)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
OnTapUpAfterMoveSignal(Vector2f(p(0), p(1)));
|
||||
}
|
||||
|
||||
@ -422,9 +456,9 @@ void TMyApplication::LoadResources()
|
||||
TextureNamesToLoad.push_back(std::pair<std::string, std::string>(CONST_WALL_UP_TEXTURE + ".png", CONST_WALL_UP_TEXTURE));
|
||||
TextureNamesToLoad.push_back(std::pair<std::string, std::string>(CONST_WALL_BONUS_TEXTURE + ".png", CONST_WALL_BONUS_TEXTURE));
|
||||
TextureNamesToLoad.push_back(std::pair<std::string, std::string>(CONST_REFLECTOR_TEXTURE + ".png", CONST_REFLECTOR_TEXTURE));
|
||||
TextureNamesToLoad.push_back(std::pair<std::string, std::string>(CONST_BACK_BTN_TEXTURE + ".png", CONST_BACK_BTN_TEXTURE));
|
||||
TextureNamesToLoad.push_back(std::pair<std::string, std::string>(CONST_SLIDE_UP_BTN_TEXTURE + ".png", CONST_SLIDE_UP_BTN_TEXTURE));
|
||||
TextureNamesToLoad.push_back(std::pair<std::string, std::string>(CONST_TAP_TO_CONTINUE_BTN_TEXTURE + ".png", CONST_TAP_TO_CONTINUE_BTN_TEXTURE));
|
||||
//TextureNamesToLoad.push_back(std::pair<std::string, std::string>(CONST_BACK_BTN_TEXTURE + ".png", CONST_BACK_BTN_TEXTURE));
|
||||
//TextureNamesToLoad.push_back(std::pair<std::string, std::string>(CONST_SLIDE_UP_BTN_TEXTURE + ".png", CONST_SLIDE_UP_BTN_TEXTURE));
|
||||
//TextureNamesToLoad.push_back(std::pair<std::string, std::string>(CONST_TAP_TO_CONTINUE_BTN_TEXTURE + ".png", CONST_TAP_TO_CONTINUE_BTN_TEXTURE));
|
||||
TextureNamesToLoad.push_back(std::pair<std::string, std::string>(CONST_CREDITS_TEXTURE + ".png", CONST_CREDITS_TEXTURE));
|
||||
|
||||
#ifdef TARGET_IOS
|
||||
@ -436,8 +470,6 @@ void TMyApplication::LoadResources()
|
||||
ResourceManager->FontManager.AddFont("droid_sans14", "droid_sans14_font_bitmap.png", "droid_sans14_font_charmap.txt");
|
||||
ResourceManager->FontManager.PushFont("droid_sans14");
|
||||
|
||||
TryLoadSavedGame();
|
||||
|
||||
}
|
||||
|
||||
void TMyApplication::TryLoadSavedGame()
|
||||
@ -475,7 +507,10 @@ void TMyApplication::TrySaveGame()
|
||||
|
||||
}
|
||||
|
||||
|
||||
void TMyApplication::OnKeyPress(size_t key)
|
||||
{
|
||||
TGameLevel::XXX = !TGameLevel::XXX;
|
||||
}
|
||||
|
||||
void TMyApplication::InnerDraw()
|
||||
{
|
||||
@ -496,11 +531,11 @@ void TMyApplication::InnerUpdate(size_t dt)
|
||||
if (StateTimer >= 1.f)
|
||||
{
|
||||
StateTimer -= 1.f;
|
||||
skipUpdateToUpdateScreen = false;
|
||||
}
|
||||
|
||||
if (skipUpdateToUpdateScreen)
|
||||
{
|
||||
skipUpdateToUpdateScreen = false;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -513,10 +548,8 @@ void TMyApplication::InnerUpdate(size_t dt)
|
||||
ResourceManager->ShaderManager.AddShader("BrickShader", "shaders/brickshader_vertex.txt", "shaders/brickshader_fragment.txt");
|
||||
ResourceManager->ShaderManager.AddShader(ParticleEffect::PARTICLE_SHADER, "shaders/particle-shader.vertex", "shaders/particle-shader.fragment");
|
||||
|
||||
|
||||
ResourceManager->FrameManager.AddFrameRenderBuffer("LevelBuffer", 256, 256);
|
||||
|
||||
|
||||
//OnDrawSignal.connect(boost::bind(&TGameLoading::Draw, boost::ref(GameLoading)));
|
||||
Inited = true;
|
||||
Application->SetGameLevelScreenScale();
|
||||
@ -525,6 +558,9 @@ void TMyApplication::InnerUpdate(size_t dt)
|
||||
|
||||
// ------- UI -------
|
||||
|
||||
gamePauseMenuUi = SE::ReadJsonFile(ST::PathToResources + "gui_game_pause_menu.json");
|
||||
galaxyMenuUi = SE::ReadJsonFile(ST::PathToResources + "gui_main_menu.json");
|
||||
|
||||
// TESTS of menu
|
||||
if (Menu.GalaxMenu.InitGalaxyMenu("levels/galaxy_ptree.json")) {
|
||||
std::cout << "ok" << std::endl;
|
||||
@ -533,10 +569,10 @@ void TMyApplication::InnerUpdate(size_t dt)
|
||||
std::cout << "menu error" << std::endl;
|
||||
}
|
||||
|
||||
RenderLevelSnapshots();
|
||||
|
||||
LoadResources();
|
||||
|
||||
GameState = CONST_GAMESTATE_LOADING;
|
||||
Menu.SetGameState(GameState);
|
||||
}
|
||||
else if (GameState == CONST_GAMESTATE_LOADING)
|
||||
{
|
||||
@ -555,11 +591,39 @@ void TMyApplication::InnerUpdate(size_t dt)
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
// Renderer->SwitchToFrameBuffer("LevelBuffer");
|
||||
//
|
||||
// Renderer->LoadIdentity();
|
||||
//
|
||||
// for (auto &star : Menu.GalaxMenu.galaxies[0].Stars)
|
||||
// {
|
||||
// for (auto level : star.selectionMenu.gameLevels)
|
||||
// {
|
||||
// level->DrawSnapshot("LevelBuffer", false);
|
||||
//
|
||||
// Renderer->PushShader("BlackAndWhiteShader");
|
||||
//
|
||||
// level->DrawSnapshot("LevelBuffer", true);
|
||||
//
|
||||
// Renderer->PopShader();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// Renderer->SwitchToScreen();
|
||||
//
|
||||
// Renderer->SetOrthoProjection();
|
||||
|
||||
RenderLevelSnapshots();
|
||||
|
||||
GameState = CONST_GAMESTATE_MENU;
|
||||
Menu.SetGameState(GameState);
|
||||
ApplySignalsToMenu();
|
||||
|
||||
LoadGalaxyUi();
|
||||
|
||||
Menu.GalaxMenu.UpdateGalaxyMenu(Renderer->GetMatrixWidth(), Renderer->GetMatrixHeight(), 0);
|
||||
|
||||
OnDrawSignal.connect(0, boost::bind(&TGameMenu::Draw, boost::ref(Menu)));
|
||||
StateTimer = 0.f;
|
||||
Loaded = true;
|
||||
@ -583,10 +647,54 @@ void TMyApplication::InnerUpdate(size_t dt)
|
||||
{
|
||||
//*SE::Console << "5CONST_GAMESTATE_FROM_MENU_TO_LEVEL";
|
||||
GameState = CONST_GAMESTATE_LEVEL;
|
||||
OnDrawSignal.disconnect(boost::bind(&TGameMenu::Draw, boost::ref(Menu)));
|
||||
Menu.SetGameState(GameState);
|
||||
//OnDrawSignal.disconnect(boost::bind(&TGameMenu::Draw, boost::ref(Menu)));
|
||||
//CONNECT SLOT
|
||||
DisapplySignalsToMenu();
|
||||
ApplySignalsToGame();
|
||||
|
||||
ResourceManager->newGuiManager.LoadFromConfig(gamePauseMenuUi);
|
||||
|
||||
auto pauseButton = (Button*)ResourceManager->newGuiManager.findWidgetByName("pauseButton").get();
|
||||
auto resumeButton = (Button*)ResourceManager->newGuiManager.findWidgetByName("resumeButton").get();
|
||||
auto exitButton = (Button*)ResourceManager->newGuiManager.findWidgetByName("exitButton").get();
|
||||
auto gameFrame = (WidgetAncestor*)ResourceManager->newGuiManager.findWidgetByName("gameFrame").get();
|
||||
auto pauseBackground = (WidgetAncestor*)ResourceManager->newGuiManager.findWidgetByName("buttonList").get();
|
||||
|
||||
float screenRatio = Renderer->GetMatrixWidth() / (float)Renderer->GetMatrixHeight();
|
||||
float screenRatioToFixedRatio = screenRatio / 1.6f;
|
||||
float marginLeft;
|
||||
if (screenRatioToFixedRatio > 1.f)
|
||||
{
|
||||
marginLeft = (Renderer->GetMatrixWidth() - Renderer->GetMatrixWidth() / screenRatioToFixedRatio) / 2.f;
|
||||
}
|
||||
else
|
||||
{
|
||||
marginLeft = 0;
|
||||
}
|
||||
|
||||
pauseBackground->setMargin(0, 0, marginLeft, 0);
|
||||
|
||||
pauseButton->onMouseDownSignal.connect([this, gameFrame, pauseBackground](Vector2f, int) {
|
||||
GameLevel->SetPause();
|
||||
|
||||
gameFrame->setVisibility(false);
|
||||
pauseBackground->setVisibility(true);
|
||||
});
|
||||
|
||||
resumeButton->onMouseDownSignal.connect([this, gameFrame, pauseBackground](Vector2f, int) {
|
||||
GameLevel->ReleasePause();
|
||||
|
||||
gameFrame->setVisibility(true);
|
||||
pauseBackground->setVisibility(false);
|
||||
});
|
||||
|
||||
pauseBackground->onMoveSignal.connect([this](Vector2f, Vector2f shift, int) {
|
||||
if (shift.norm() > 15)
|
||||
{
|
||||
GameLevel->TryGoToMenu();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
else if (GameState == CONST_GAMESTATE_FROM_MENU_TO_CREDITS)
|
||||
@ -597,6 +705,7 @@ void TMyApplication::InnerUpdate(size_t dt)
|
||||
if (StateTimer <= 0.f)
|
||||
{
|
||||
GameState = CONST_GAMESTATE_CREDITS;
|
||||
Menu.SetGameState(GameState);
|
||||
OnDrawSignal.disconnect(boost::bind(&TGameMenu::Draw, boost::ref(Menu)));
|
||||
ApplySignalsToCredits();
|
||||
StateTimer = 0.f;
|
||||
@ -626,7 +735,7 @@ void TMyApplication::InnerUpdate(size_t dt)
|
||||
void TMyApplication::LoadGalaxyUi()
|
||||
{
|
||||
ResourceManager->newGuiManager.Clear();
|
||||
ResourceManager->newGuiManager.LoadFromConfig("gui_main_menu.json");
|
||||
ResourceManager->newGuiManager.LoadFromConfig(galaxyMenuUi);
|
||||
|
||||
std::shared_ptr<WidgetAncestor> modal_background = ResourceManager->newGuiManager.findWidgetByName("modal_background");
|
||||
|
||||
@ -634,6 +743,7 @@ void TMyApplication::LoadGalaxyUi()
|
||||
[modal_background, this](Vector2f v, int i) {
|
||||
PerformInMainThreadAsync([modal_background, this]() {
|
||||
modal_background->setVisibility(false);
|
||||
Menu.GalaxMenu.planetHoverIndex = -1;
|
||||
Menu.GalaxMenu.setTimerActivity(false);
|
||||
});
|
||||
});
|
||||
@ -715,6 +825,7 @@ void TMyApplication::SetupGalaxyUi(size_t levelStar)
|
||||
[this, modal_background, levelStar, levelIndex](Vector2f v, int i) {
|
||||
PerformInMainThreadAsync([this, modal_background, levelStar, levelIndex]() {
|
||||
modal_background->setVisibility(false);
|
||||
Menu.GalaxMenu.planetHoverIndex = -1;
|
||||
|
||||
std::shared_ptr<TGameLevel> lvl = this->Menu.GalaxMenu.galaxies[0].Stars[levelStar].selectionMenu.gameLevels[levelIndex];
|
||||
lvl->ReloadLevel();
|
||||
@ -755,8 +866,11 @@ void TMyApplication::GoFromMenuToGame(std::shared_ptr<TGameLevel> level)
|
||||
GameLevel = level;
|
||||
GameLevel->SetLoading();
|
||||
GameState = CONST_GAMESTATE_FROM_MENU_TO_LEVEL;
|
||||
Menu.SetGameState(GameState);
|
||||
OnDrawSignal.connect(1, boost::bind(&TGameLevel::Draw, boost::ref(*GameLevel)));
|
||||
|
||||
Menu.GalaxMenu.resetValuesOnGameStart();
|
||||
|
||||
DisapplySignalsToMenu();
|
||||
|
||||
}
|
||||
@ -766,16 +880,28 @@ void TMyApplication::GoFromGameToMenu()
|
||||
//#ifndef TARGET_IOS
|
||||
// ResourceManager->SoundManager.StopMusic("level1ogg.ogg");
|
||||
//#endif
|
||||
|
||||
PerformInMainThreadAsync([this]() {
|
||||
TrySaveGame();
|
||||
DisapplySignalsToGame();
|
||||
|
||||
//ignoreTapUp = true;
|
||||
|
||||
LoadGalaxyUi();
|
||||
|
||||
Menu.GalaxMenu.UpdateGalaxyMenu(Renderer->GetMatrixWidth(), Renderer->GetMatrixHeight(), 0);
|
||||
|
||||
ApplySignalsToMenu();
|
||||
GameState = CONST_GAMESTATE_MENU;
|
||||
Menu.SetGameState(GameState);
|
||||
OnDrawSignal.disconnect(boost::bind(&TGameLevel::Draw, boost::ref(GameLevel)));
|
||||
});
|
||||
}
|
||||
|
||||
void TMyApplication::GoFromMenuToCredits()
|
||||
{
|
||||
GameState = CONST_GAMESTATE_FROM_MENU_TO_CREDITS;
|
||||
Menu.SetGameState(GameState);
|
||||
StateTimer = CONST_CREDITS_SHOW_TIME;
|
||||
GameCredits.StartAppear();
|
||||
OnDrawSignal.connect(1, boost::bind(&TGameCredits::Draw, boost::ref(GameCredits)));
|
||||
@ -787,6 +913,7 @@ void TMyApplication::GoFromCreditsToMenu()
|
||||
{
|
||||
|
||||
GameState = CONST_GAMESTATE_FROM_CREDITS_TO_MENU;
|
||||
Menu.SetGameState(GameState);
|
||||
StateTimer = CONST_CREDITS_SHOW_TIME;
|
||||
GameCredits.StartDisappear();
|
||||
OnDrawSignal.connect(0, boost::bind(&TGameMenu::Draw, boost::ref(Menu)));
|
||||
@ -796,12 +923,12 @@ void TMyApplication::GoFromCreditsToMenu()
|
||||
|
||||
void TMyApplication::MarkSetGameLevelPause()
|
||||
{
|
||||
OnDrawSignal.connect(0, boost::bind(&TGameMenu::Draw, boost::ref(Menu)));
|
||||
//OnDrawSignal.connect(0, boost::bind(&TGameMenu::Draw, boost::ref(Menu)));
|
||||
}
|
||||
|
||||
void TMyApplication::MarkReleaseGameLevelPause()
|
||||
{
|
||||
OnDrawSignal.disconnect(boost::bind(&TGameMenu::Draw, boost::ref(Menu)));
|
||||
//OnDrawSignal.disconnect(boost::bind(&TGameMenu::Draw, boost::ref(Menu)));
|
||||
}
|
||||
|
||||
|
||||
@ -845,6 +972,8 @@ float TMyApplication::GetGameLevelScreenHeight()
|
||||
|
||||
void TMyApplication::InnerOnMouseDown(TMouseState& mouseState) {
|
||||
|
||||
ignoreTapUp = false;
|
||||
|
||||
OnTapDownSignal(Vector2f(mouseState.X, ((Renderer->GetScreenHeight()) - mouseState.Y))); // Temp mouse down action for WIN32
|
||||
}
|
||||
|
||||
@ -909,14 +1038,49 @@ void TMyApplication::EffectsUpdate(size_t dt) {
|
||||
lvlFirework.update(dt / 1000.f);
|
||||
}
|
||||
void TMyApplication::EffectsDraw() {
|
||||
|
||||
float screenRatio = Renderer->GetMatrixWidth() / (float)Renderer->GetMatrixHeight();
|
||||
float screenRatioToFixedRatio = screenRatio / 1.6f;
|
||||
Vector2f offset;
|
||||
float scale;
|
||||
if (screenRatioToFixedRatio > 1.f)
|
||||
{
|
||||
offset[0] = (Renderer->GetMatrixWidth() - Renderer->GetMatrixWidth() / screenRatioToFixedRatio) / 2.f;
|
||||
offset[1] = 0;
|
||||
scale = Renderer->GetMatrixHeight() / 480.f;
|
||||
}
|
||||
else
|
||||
{
|
||||
offset[0] = 0;
|
||||
offset[1] = 0;// (screenHeight - screenHeight * screenRatioToFixedRatio) / 2.f;
|
||||
scale = Renderer->GetMatrixWidth() / 768.f;
|
||||
}
|
||||
|
||||
Renderer->PushMatrix();
|
||||
Renderer->TranslateMatrix(Vector3f(offset[0], offset[1], 0));
|
||||
Renderer->ScaleMatrix(scale);
|
||||
|
||||
//glPushAttrib(GL_ALL_ATTRIB_BITS);
|
||||
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
glEnable(GL_BLEND);
|
||||
|
||||
lsparkler.draw();
|
||||
rsparkler.draw();
|
||||
tsparkler.draw();
|
||||
bsparkler.draw();
|
||||
lvlFirework.draw();
|
||||
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
glEnable(GL_BLEND);
|
||||
|
||||
Renderer->PopMatrix();
|
||||
|
||||
//glPopAttrib();
|
||||
}
|
||||
|
||||
void TMyApplication::hitSpark(std::string direct,Vector2f Pos) {
|
||||
|
||||
if (direct == "left") {
|
||||
lsparkler.setCoords({ Pos(0),Pos(1),0 });
|
||||
lsparkler.stopSpawn();
|
||||
|
@ -143,6 +143,10 @@ public:
|
||||
void LoadUserProgress();
|
||||
void SaveUserProgress(int levelStar, int levelIndex);
|
||||
|
||||
void InnerChangeWidthHeight(int screenWidth, int screenHeight, float matrixWidth, float matrixHeight) override;
|
||||
|
||||
|
||||
virtual void OnKeyPress(size_t key);
|
||||
virtual void InnerInit();
|
||||
|
||||
virtual void RenderLevelSnapshots();
|
||||
|
@ -45,7 +45,7 @@ void TGameMenu::Draw()
|
||||
glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
|
||||
|
||||
/*..GalaxMenu draw..*/
|
||||
GalaxMenu.DrawGalaxyMenu();
|
||||
GalaxMenu.DrawGalaxyMenu(GameState == CONST_GAMESTATE_MENU);
|
||||
#endif
|
||||
|
||||
#ifndef GALAX_MENU_DRAW
|
||||
@ -90,7 +90,7 @@ void TGameMenu::Update(size_t dt)
|
||||
#ifdef GALAX_MENU_UPDATE
|
||||
/*..Galaxy Menu..*/
|
||||
GalaxMenu.InteractWithGalaxy(dt);
|
||||
GalaxMenu.UpdateGalaxyMenu((float)SE::Renderer->GetScreenWidth(), (float)SE::Renderer->GetScreenHeight(), dt);
|
||||
//GalaxMenu.UpdateGalaxyMenu((float)SE::Renderer->GetScreenWidth(), (float)SE::Renderer->GetScreenHeight(), dt);
|
||||
#else
|
||||
if (HoldToTap)
|
||||
return;
|
||||
@ -247,3 +247,8 @@ void TGameMenu::SetMenuItemCount(int menuItemCount)
|
||||
{
|
||||
MenuItemCount = menuItemCount;
|
||||
}
|
||||
|
||||
void TGameMenu::SetGameState(int gameState)
|
||||
{
|
||||
GameState = gameState;
|
||||
}
|
3
game/menucode.h
Normal file → Executable file
@ -20,6 +20,8 @@ protected:
|
||||
|
||||
int SelectedGame;
|
||||
|
||||
int GameState;
|
||||
|
||||
|
||||
public:
|
||||
TGameMenu();
|
||||
@ -34,6 +36,7 @@ public:
|
||||
void OpenNextLevel();
|
||||
int GetMenuItemCount();
|
||||
void SetMenuItemCount(int menuItemCount);
|
||||
void SetGameState(int gameState);
|
||||
|
||||
/*..Galaxy Menu..*/
|
||||
GalaxyMenu GalaxMenu;
|
||||
|
@ -1,6 +1,6 @@
|
||||
cmake_minimum_required(VERSION 3.4.1)
|
||||
|
||||
set(BOOST_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../boost_1_67_0)
|
||||
set(BOOST_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../boost_1_68_0)
|
||||
set(BOOST_GIL_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../libs/boost-gil-extension)
|
||||
set(ZIP_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../libs/julienr-libzip-android/jni)
|
||||
set(LIBPNG_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../libs/libpng_1.4.1_android)
|
||||
|
@ -3,7 +3,7 @@ apply plugin: 'kotlin-android'
|
||||
|
||||
android {
|
||||
compileSdkVersion 28
|
||||
buildToolsVersion "28.0.0"
|
||||
buildToolsVersion "28.0.3"
|
||||
defaultConfig {
|
||||
applicationId "fishrungames.DoubleHitBalls"
|
||||
minSdkVersion 19
|
||||
@ -46,9 +46,9 @@ android {
|
||||
dependencies {
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||
|
||||
implementation 'com.android.support:appcompat-v7:28+'
|
||||
implementation "com.android.support:appcompat-v7:$supportLibraryVersion"
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
|
||||
|
||||
implementation project(':SalmonEngineAndroid')
|
||||
|
||||
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
||||
}
|
||||
|
@ -9,9 +9,8 @@ import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.PackageManager.NameNotFoundException;
|
||||
import android.os.Bundle;
|
||||
import android.view.GestureDetector;
|
||||
import android.util.Log;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.GestureDetector.SimpleOnGestureListener;
|
||||
import android.view.MotionEvent;
|
||||
|
||||
//Deprecated
|
||||
@ -28,7 +27,6 @@ public class GL2JNIActivity extends Activity
|
||||
@Override
|
||||
protected void onCreate(Bundle icicle)
|
||||
{
|
||||
|
||||
super.onCreate(icicle);
|
||||
|
||||
instance = this;
|
||||
|
@ -1,14 +1,22 @@
|
||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
|
||||
buildscript {
|
||||
ext.kotlin_version = '1.2.70'
|
||||
ext {
|
||||
compileSdkVersion = 28
|
||||
targetSdkVersion = 28
|
||||
|
||||
kotlin_version = "1.3.10"
|
||||
supportLibraryVersion = "28.0.0"
|
||||
}
|
||||
|
||||
repositories {
|
||||
jcenter()
|
||||
google()
|
||||
|
||||
}
|
||||
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:3.2.0-alpha18'
|
||||
classpath 'com.android.tools.build:gradle:3.2.1'
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
|