menu interact
Before Width: | Height: | Size: 3.6 MiB After Width: | Height: | Size: 2.1 MiB |
BIN
assets/galax_menu/galaxies/galaxy_1.png
Executable file
After Width: | Height: | Size: 5.4 MiB |
Before Width: | Height: | Size: 995 KiB After Width: | Height: | Size: 1000 KiB |
Before Width: | Height: | Size: 1.7 MiB |
Before Width: | Height: | Size: 870 KiB After Width: | Height: | Size: 1.1 MiB |
BIN
assets/galax_menu/planets/star_1_0.png
Executable file
After Width: | Height: | Size: 1.2 MiB |
BIN
assets/galax_menu_backup/galaxies/galaxy_1.png
Executable file
After Width: | Height: | Size: 5.4 MiB |
BIN
assets/galax_menu_backup/planets/star_1_0.png
Executable file
After Width: | Height: | Size: 1.1 MiB |
@ -3,17 +3,17 @@
|
|||||||
{
|
{
|
||||||
"name": "galaxy_0",
|
"name": "galaxy_0",
|
||||||
"position":{
|
"position":{
|
||||||
"x_coord": 0.0,
|
"x_coord": -0.45,
|
||||||
"y_coord": 0.0
|
"y_coord": 0.4
|
||||||
},
|
},
|
||||||
"texture": "galaxy_0.png",
|
"texture": "galaxy_0.png",
|
||||||
"scale": 1.0,
|
"scale": 0.6,
|
||||||
"Stars": [
|
"Stars": [
|
||||||
{
|
{
|
||||||
"name": "star_0_0",
|
"name": "star_0_0",
|
||||||
"position": {
|
"position": {
|
||||||
"x_coord": -0.45,
|
"x_coord": -0.45,
|
||||||
"y_coord": 0.18
|
"y_coord": 0.15
|
||||||
},
|
},
|
||||||
"texture": "star_0_0.png",
|
"texture": "star_0_0.png",
|
||||||
"scale": 0.06,
|
"scale": 0.06,
|
||||||
@ -38,6 +38,31 @@
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "galaxy_1",
|
||||||
|
"position":{
|
||||||
|
"x_coord": 0.4,
|
||||||
|
"y_coord": 0.05
|
||||||
|
},
|
||||||
|
"texture": "galaxy_1.png",
|
||||||
|
"scale": 0.7,
|
||||||
|
"Stars": [
|
||||||
|
{
|
||||||
|
"name": "star_1_0",
|
||||||
|
"position": {
|
||||||
|
"x_coord": -0.15,
|
||||||
|
"y_coord": 0.15
|
||||||
|
},
|
||||||
|
"texture": "star_1_0.png",
|
||||||
|
"scale": 0.06,
|
||||||
|
"levels": [
|
||||||
|
{
|
||||||
|
"name": "level_1"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
@ -26,7 +26,7 @@ bool GalaxyMenu::InitGalaxyMenu(std::string config_json, float scale) {
|
|||||||
error_pt.put("error", "something goes wrong at InitGalaxyMenu");
|
error_pt.put("error", "something goes wrong at InitGalaxyMenu");
|
||||||
|
|
||||||
/*..Init Menu..*/
|
/*..Init Menu..*/
|
||||||
BOOST_FOREACH(auto menu_pt, config_pt.get_child("Space")) {
|
BOOST_FOREACH(auto menu_pt, config_pt.get_child("Space", error_pt)) {
|
||||||
Galaxy galax;
|
Galaxy galax;
|
||||||
|
|
||||||
galax.name = menu_pt.second.get<std::string>("name", "error");
|
galax.name = menu_pt.second.get<std::string>("name", "error");
|
||||||
@ -62,8 +62,8 @@ void GalaxyMenu::UpdateGalaxyMenu(float s_width, float s_height) {
|
|||||||
stars_params.clear();
|
stars_params.clear();
|
||||||
|
|
||||||
/*..Menu ancestor geometry..*/
|
/*..Menu ancestor geometry..*/
|
||||||
float gameScreenWidth = s_width;
|
float gameScreenWidth = s_width * anchorSize;
|
||||||
float gameScreenHeight = s_height;
|
float gameScreenHeight = s_height * anchorSize;
|
||||||
Eigen::Vector2f gameScreenCenter = Eigen::Vector2f(gameScreenWidth/2,gameScreenHeight/2);
|
Eigen::Vector2f gameScreenCenter = Eigen::Vector2f(gameScreenWidth/2,gameScreenHeight/2);
|
||||||
|
|
||||||
/*..Menu geometry..*/
|
/*..Menu geometry..*/
|
||||||
@ -81,13 +81,14 @@ void GalaxyMenu::UpdateGalaxyMenu(float s_width, float s_height) {
|
|||||||
); // normalized
|
); // normalized
|
||||||
galaxies_params.push_back(std::make_pair(
|
galaxies_params.push_back(std::make_pair(
|
||||||
Eigen::Vector2f(
|
Eigen::Vector2f(
|
||||||
currentMenuPos(0) + (xDimension/2)*galaxies[i].position(0),
|
currentMenuPos(0) + (xDimension / 2)*galaxies[i].position(0),
|
||||||
currentMenuPos(1) + (yDimension / 2)*galaxies[i].position(1)),
|
currentMenuPos(1) + (yDimension / 2)*galaxies[i].position(1)),
|
||||||
Eigen::Vector2f(
|
Eigen::Vector2f(
|
||||||
(tex_size(0)*galaxies[i].scale)*menuScale,
|
(tex_size(0)*galaxies[i].scale)*menuScale,
|
||||||
(tex_size(1)*galaxies[i].scale)*menuScale
|
(tex_size(1)*galaxies[i].scale)*menuScale
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
|
*SE::Console << "dimensions: " << std::to_string(((tex_size(0)*galaxies[i].scale)*menuScale)) << " " << std::to_string(((tex_size(1)*galaxies[i].scale)*menuScale));
|
||||||
|
|
||||||
/*..Stars geometry..*/
|
/*..Stars geometry..*/
|
||||||
std::vector<std::pair<Eigen::Vector2f, Eigen::Vector2f>> star_params;
|
std::vector<std::pair<Eigen::Vector2f, Eigen::Vector2f>> star_params;
|
||||||
@ -125,16 +126,16 @@ Eigen::Vector2f GalaxyMenu::textureSizeNormalize(Eigen::Vector2f texVec, int t_t
|
|||||||
float Ymax; // Max normalized texture height
|
float Ymax; // Max normalized texture height
|
||||||
float Ymin;
|
float Ymin;
|
||||||
if (t_type == 0) {
|
if (t_type == 0) {
|
||||||
Xmax = 1280.f;
|
Xmax = SE::Renderer->GetScreenWidth();
|
||||||
Xmin = 800.f;
|
Xmin = Xmax;
|
||||||
Ymax = 1024.f;
|
Ymax = SE::Renderer->GetScreenHeight();
|
||||||
Ymin = 640.f;
|
Ymin = Ymax;
|
||||||
}
|
}
|
||||||
else { // temp for star textures
|
else { // temp for star textures
|
||||||
Xmax = 512.f;
|
Xmax = (((float)SE::Renderer->GetScreenWidth())/2);
|
||||||
Xmin = 320.f;
|
Xmin = Xmax;
|
||||||
Ymax = 512.f;
|
Ymax = (((float)SE::Renderer->GetScreenHeight())/2);
|
||||||
Ymin = 320.f;
|
Ymin = Ymax;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (texVec(0) > texVec(1)) {
|
if (texVec(0) > texVec(1)) {
|
||||||
@ -148,6 +149,7 @@ Eigen::Vector2f GalaxyMenu::textureSizeNormalize(Eigen::Vector2f texVec, int t_t
|
|||||||
*SE::Console << "==============";
|
*SE::Console << "==============";
|
||||||
*SE::Console << std::to_string(texVec(0));
|
*SE::Console << std::to_string(texVec(0));
|
||||||
*SE::Console << std::to_string(texVec(1));
|
*SE::Console << std::to_string(texVec(1));
|
||||||
|
*SE::Console << "if value 0.0000 - must be textures not inited at main_code.cpp or texture-name is wrong";
|
||||||
*SE::Console << "--------------";
|
*SE::Console << "--------------";
|
||||||
return Eigen::Vector2f(x_dim, y_dim);
|
return Eigen::Vector2f(x_dim, y_dim);
|
||||||
}
|
}
|
||||||
@ -166,11 +168,6 @@ void GalaxyMenu::DrawGalaxyMenu() {
|
|||||||
for (int i = 0; i < galaxies_params.size(); i++) {
|
for (int i = 0; i < galaxies_params.size(); i++) {
|
||||||
|
|
||||||
glBindTexture(GL_TEXTURE_2D, SE::ResourceManager->TexList["galaxy_" + std::to_string(i)]);
|
glBindTexture(GL_TEXTURE_2D, SE::ResourceManager->TexList["galaxy_" + std::to_string(i)]);
|
||||||
/*SE::Console << "c_out::";
|
|
||||||
*SE::Console << std::to_string((galaxies_params[i].second(0)));
|
|
||||||
*SE::Console << std::to_string((galaxies_params[i].first(1) - galaxies_params[i].second(1) / 2));
|
|
||||||
*SE::Console << std::to_string((galaxies_params[i].first(0) + galaxies_params[i].second(0) / 2));
|
|
||||||
*SE::Console << std::to_string((galaxies_params[i].first(1) + galaxies_params[i].second(1) / 2));*/
|
|
||||||
SE::Renderer->DrawRect(
|
SE::Renderer->DrawRect(
|
||||||
Eigen::Vector2f(
|
Eigen::Vector2f(
|
||||||
galaxies_params[i].first(0) - galaxies_params[i].second(0)/2,
|
galaxies_params[i].first(0) - galaxies_params[i].second(0)/2,
|
||||||
@ -202,6 +199,193 @@ void GalaxyMenu::DrawGalaxyMenu() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GalaxyMenu::InteractWithGalaxy() {
|
void GalaxyMenu::InteractWithGalaxy(size_t dt) {
|
||||||
|
if (timer_active) {
|
||||||
|
// ::::::::::::: timer active ::::::::::::::
|
||||||
|
if (menuState == 0) { // main view
|
||||||
|
//std::pair<Eigen::Vector2f, Eigen::Vector2f> spacePlane = std::make_pair(findCorner(0, 0), findCorner(1, 1));
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
if (menuState == 1) { // zoomed galaxy
|
||||||
|
|
||||||
|
}
|
||||||
|
if (menuState == 2) { // level select view
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// \_/\_/\_/\_/ timer active \_/\_/\_/\_/
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// ::::::::::::: timer inactive ::::::::::::::
|
||||||
|
if (lastTapPos != Eigen::Vector2f(-9999.9f, -9999.9f)) {
|
||||||
|
if (menuState == 0) {// main view
|
||||||
|
//if ((currentTapShift(0) <= 0.01f && currentTapShift(0) >= -0.01f) && (currentTapShift(1) <= 0.01f && currentTapShift(1) >= -0.01f)) {
|
||||||
|
if (currentTapShift(0) == 0.f && currentTapShift(1) == 0.f){
|
||||||
|
// OnTapDown->OnTapUp
|
||||||
|
//int y = findGalaxyByPos(Eigen::Vector2f());
|
||||||
|
Eigen::Vector2f t = currentTapShift;
|
||||||
|
*SE::Console << "DU vec(" + std::to_string(t(0)) + ", " + std::to_string(t(1)) + ") ";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// OnTapDown->OnMove->OnTapUp
|
||||||
|
Eigen::Vector2f t = currentTapShift;
|
||||||
|
*SE::Console << "DMU vec(" + std::to_string(t(0)) + ", " + std::to_string(t(1)) + ") ";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
if (menuState == 1) { // zoomed galaxy
|
||||||
|
if ((currentTapShift(0) <= 0.01f && currentTapShift(0) >= -0.01f) && (currentTapShift(1) <= 0.01f && currentTapShift(1) >= -0.01f)) {
|
||||||
|
// OnTapDown->OnTapUp
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// OnTapDown->OnMove->OnTapUp
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
if (menuState == 2) { // level select view
|
||||||
|
if ((currentTapShift(0) <= 0.01f && currentTapShift(0) >= -0.01f) && (currentTapShift(1) <= 0.01f && currentTapShift(1) >= -0.01f)) {
|
||||||
|
// OnTapDown->OnTapUp
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// OnTapDown->OnMove->OnTapUp
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
lastTapPos = Eigen::Vector2f(-9999.9f, -9999.9f); // tap position reset
|
||||||
|
}
|
||||||
|
// \_/\_/\_/\_/ timer inactive \_/\_/\_/\_/
|
||||||
|
}
|
||||||
|
|
||||||
|
// timer reset
|
||||||
|
if (timer_active) {
|
||||||
|
interact_timer += (float)dt;
|
||||||
|
}
|
||||||
|
else if (interact_timer != 0.f) {
|
||||||
|
interact_timer = 0.f;
|
||||||
|
currentTapShift = Eigen::Vector2f(0.f, 0.f);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GalaxyMenu::tapDown(Eigen::Vector2f pos) {
|
||||||
|
if (!timer_active) {
|
||||||
|
timer_active = true;
|
||||||
|
lastTapPos = pos;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void GalaxyMenu::tapUp(Eigen::Vector2f pos) {
|
||||||
|
if (timer_active) {
|
||||||
|
timer_active = false;
|
||||||
|
// lastTapPos = vec(0,0) useless for now
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void GalaxyMenu::tapMove(Eigen::Vector2f shift) {
|
||||||
|
if (timer_active) {
|
||||||
|
currentTapShift = shift; // shift need to be fixed
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Eigen::Vector2f GalaxyMenu::findCorner(int x_c, int y_c) {
|
||||||
|
float x_pos = 0.f;
|
||||||
|
float y_pos = 0.f;
|
||||||
|
float x_p, y_p;
|
||||||
|
if (x_c > 0) { // ===
|
||||||
|
if (y_c > 0) { // ---
|
||||||
|
for (int i = 0; i < galaxies_params.size(); i++) {
|
||||||
|
x_p = galaxies_params[i].first(0) + (galaxies_params[i].second(0) / 2);
|
||||||
|
y_p = galaxies_params[i].first(1) + (galaxies_params[i].second(1) / 2);
|
||||||
|
x_pos = graterV(x_pos, x_p);
|
||||||
|
y_pos = graterV(y_pos, y_p);
|
||||||
|
for (int j = 0; j < stars_params[i].size(); j++) {
|
||||||
|
x_p = stars_params[i][j].first(0) + (stars_params[i][j].second(0));
|
||||||
|
y_p = stars_params[i][j].first(1) + (stars_params[i][j].second(1));
|
||||||
|
x_pos = graterV(x_pos, x_p);
|
||||||
|
y_pos = graterV(y_pos, y_p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {// ---
|
||||||
|
for (int i = 0; i < galaxies_params.size(); i++) {
|
||||||
|
x_p = galaxies_params[i].first(0) + (galaxies_params[i].second(0) / 2);
|
||||||
|
y_p = galaxies_params[i].first(1) - (galaxies_params[i].second(1) / 2);
|
||||||
|
x_pos = graterV(x_pos, x_p);
|
||||||
|
y_pos = lowerV(y_pos, y_p);
|
||||||
|
for (int j = 0; j < stars_params[i].size(); j++) {
|
||||||
|
x_p = stars_params[i][j].first(0) + (stars_params[i][j].second(0));
|
||||||
|
y_p = stars_params[i][j].first(1) - (stars_params[i][j].second(1));
|
||||||
|
x_pos = graterV(x_pos, x_p);
|
||||||
|
y_pos = lowerV(y_pos, y_p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}// ---
|
||||||
|
}
|
||||||
|
else { // ===
|
||||||
|
if (y_c > 0) { // ---
|
||||||
|
for (int i = 0; i < galaxies_params.size(); i++) {
|
||||||
|
x_p = galaxies_params[i].first(0) - (galaxies_params[i].second(0) / 2);
|
||||||
|
y_p = galaxies_params[i].first(1) + (galaxies_params[i].second(1) / 2);
|
||||||
|
x_pos = lowerV(x_pos, x_p);
|
||||||
|
y_pos = graterV(y_pos, y_p);
|
||||||
|
for (int j = 0; j < stars_params[i].size(); j++) {
|
||||||
|
x_p = stars_params[i][j].first(0) - (stars_params[i][j].second(0));
|
||||||
|
y_p = stars_params[i][j].first(1) + (stars_params[i][j].second(1));
|
||||||
|
x_pos = lowerV(x_pos, x_p);
|
||||||
|
y_pos = graterV(y_pos, y_p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else { // ---
|
||||||
|
for (int i = 0; i < galaxies_params.size(); i++) {
|
||||||
|
x_p = galaxies_params[i].first(0) - (galaxies_params[i].second(0) / 2);
|
||||||
|
y_p = galaxies_params[i].first(1) - (galaxies_params[i].second(1) / 2);
|
||||||
|
x_pos = lowerV(x_pos, x_p);
|
||||||
|
y_pos = lowerV(y_pos, y_p);
|
||||||
|
for (int j = 0; j < stars_params[i].size(); j++) {
|
||||||
|
x_p = stars_params[i][j].first(0) - (stars_params[i][j].second(0));
|
||||||
|
y_p = stars_params[i][j].first(1) - (stars_params[i][j].second(1));
|
||||||
|
x_pos = lowerV(x_pos, x_p);
|
||||||
|
y_pos = lowerV(y_pos, y_p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} // ---
|
||||||
|
} // ===
|
||||||
|
return Eigen::Vector2f(x_pos, y_pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
float GalaxyMenu::graterV(float first_val, float second_val) {
|
||||||
|
if (first_val > second_val)
|
||||||
|
return first_val;
|
||||||
|
else
|
||||||
|
return second_val;
|
||||||
|
}
|
||||||
|
|
||||||
|
float GalaxyMenu::lowerV(float first_val, float second_val) {
|
||||||
|
if (first_val < second_val)
|
||||||
|
return first_val;
|
||||||
|
else
|
||||||
|
return second_val;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GalaxyMenu::galaxyFocus(int index) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
int GalaxyMenu::findGalaxyByPos(Eigen::Vector2f pos) {
|
||||||
|
|
||||||
|
for (int i = 0; i < galaxies_params.size(); i++) {
|
||||||
|
if (pos(0) >= (galaxies_params[i].first(0) - galaxies_params[i].second(0)/2) && pos(0) <= (galaxies_params[i].first(0) + galaxies_params[i].second(0)/2)) {
|
||||||
|
if (pos(1) >= (galaxies_params[i].first(1) - galaxies_params[i].second(1) / 2) && pos(1) <= (galaxies_params[i].first(1) + galaxies_params[i].second(1)/2)) {
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
@ -28,22 +28,44 @@ public:
|
|||||||
void UpdateGalaxyMenu(float s_width, float s_height);
|
void UpdateGalaxyMenu(float s_width, float s_height);
|
||||||
// ======== Main Methods ========
|
// ======== Main Methods ========
|
||||||
|
|
||||||
void InteractWithGalaxy(/*..Vector/Vector/Int..*/); // Prototype for mouse/tap events
|
void InteractWithGalaxy(size_t dt); // Prototype for mouse/tap events
|
||||||
|
|
||||||
// ::#Params#::
|
// ::#Params#::
|
||||||
Eigen::Vector2f menuPosition = Eigen::Vector2f(0.f, 0.f); // relative to the screen center(0.f,0.f means center) (not const!!)
|
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!!)
|
float menuScale = 1.f; // (not const!!)
|
||||||
float xDimension;
|
float xDimension;
|
||||||
float yDimension;
|
float yDimension;
|
||||||
|
float anchorSize = 1.f;
|
||||||
std::vector<std::pair<Eigen::Vector2f, Eigen::Vector2f>> galaxies_params; // ::position/dimensions::
|
std::vector<std::pair<Eigen::Vector2f, Eigen::Vector2f>> galaxies_params; // ::position/dimensions::
|
||||||
std::vector<std::vector<std::pair<Eigen::Vector2f, Eigen::Vector2f>>> stars_params;
|
std::vector<std::vector<std::pair<Eigen::Vector2f, Eigen::Vector2f>>> stars_params;
|
||||||
|
|
||||||
|
/*..Outer Interact..*/
|
||||||
|
void tapDown(Eigen::Vector2f pos);
|
||||||
|
void tapUp(Eigen::Vector2f pos);
|
||||||
|
void tapMove(Eigen::Vector2f shift);
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void readSaveData(); // inner init method
|
void readSaveData(); // inner init method
|
||||||
|
|
||||||
Eigen::Vector2f textureSizeNormalize(Eigen::Vector2f texVec, int t_type = 0/*0-galaxy, 1-stars*/);
|
Eigen::Vector2f textureSizeNormalize(Eigen::Vector2f texVec, int t_type = 0/*0-galaxy, 1-stars*/);
|
||||||
float val_clamp(float v, float min, float max);
|
float val_clamp(float v, float min, float max);
|
||||||
|
Eigen::Vector2f findCorner(int x_c, int y_c);
|
||||||
|
float graterV(float first_v, float second_v);
|
||||||
|
float lowerV(float first_v, float second_v);
|
||||||
|
|
||||||
|
int menuState = 0; // 0 - all galaxies are visible, 1 - zoomed to current galaxy , 2 - level select menu
|
||||||
|
|
||||||
|
/*..Interact params..*/
|
||||||
|
bool timer_active = false;
|
||||||
|
float interact_timer = 0.f;
|
||||||
|
Eigen::Vector2f lastTapPos = Eigen::Vector2f(-9999.9f, -9999.9f);
|
||||||
|
Eigen::Vector2f currentTapShift;
|
||||||
|
|
||||||
|
/*..Interact methods..*/
|
||||||
|
void galaxyFocus(int index);
|
||||||
|
int findGalaxyByPos(Eigen::Vector2f pos);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -194,6 +194,11 @@ void TMyApplication::ApplySignalsToMenu()
|
|||||||
OnScrollSignal.connect(boost::bind(&TGameMenu::OnScroll, boost::ref(Menu), _1));
|
OnScrollSignal.connect(boost::bind(&TGameMenu::OnScroll, boost::ref(Menu), _1));
|
||||||
OnTapDownSignal.connect(boost::bind(&TGameMenu::OnTapDown, boost::ref(Menu), _1));
|
OnTapDownSignal.connect(boost::bind(&TGameMenu::OnTapDown, boost::ref(Menu), _1));
|
||||||
|
|
||||||
|
/*..Galaxy Menu..*/ // Can be replaced to "Menu" OnTap(events)
|
||||||
|
OnTapDownSignal.connect(boost::bind(&GalaxyMenu::tapDown, boost::ref(Menu.GalaxMenu), _1));
|
||||||
|
OnTapUpSignal.connect(boost::bind(&GalaxyMenu::tapUp, boost::ref(Menu.GalaxMenu), _1));
|
||||||
|
OnScrollSignal.connect(boost::bind(&GalaxyMenu::tapMove, boost::ref(Menu.GalaxMenu), _1));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -204,6 +209,12 @@ void TMyApplication::DisapplySignalsToMenu()
|
|||||||
OnFlingSignal.disconnect(boost::bind(&TGameMenu::OnFling, boost::ref(Menu), _1));
|
OnFlingSignal.disconnect(boost::bind(&TGameMenu::OnFling, boost::ref(Menu), _1));
|
||||||
OnScrollSignal.disconnect(boost::bind(&TGameMenu::OnScroll, boost::ref(Menu), _1));
|
OnScrollSignal.disconnect(boost::bind(&TGameMenu::OnScroll, boost::ref(Menu), _1));
|
||||||
OnTapDownSignal.disconnect(boost::bind(&TGameMenu::OnTapDown, boost::ref(Menu), _1));
|
OnTapDownSignal.disconnect(boost::bind(&TGameMenu::OnTapDown, boost::ref(Menu), _1));
|
||||||
|
|
||||||
|
/*..Galaxy Menu..*/ // Can be replaced to "Menu" OnTap(events)
|
||||||
|
OnTapDownSignal.disconnect(boost::bind(&GalaxyMenu::tapDown, boost::ref(Menu.GalaxMenu), _1));
|
||||||
|
OnTapUpSignal.disconnect(boost::bind(&GalaxyMenu::tapUp, boost::ref(Menu.GalaxMenu), _1));
|
||||||
|
OnScrollSignal.disconnect(boost::bind(&GalaxyMenu::tapMove, boost::ref(Menu.GalaxMenu), _1));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TMyApplication::ApplySignalsToGame()
|
void TMyApplication::ApplySignalsToGame()
|
||||||
@ -281,8 +292,9 @@ void TMyApplication::LoadResources()
|
|||||||
|
|
||||||
/*..galaxies and stars/planets Init..*/ // tmp
|
/*..galaxies and stars/planets Init..*/ // tmp
|
||||||
std::vector<int> galaxies;
|
std::vector<int> galaxies;
|
||||||
galaxies.resize(1);
|
galaxies.resize(2);
|
||||||
galaxies[0] = 2;
|
galaxies[0] = 2;
|
||||||
|
galaxies[1] = 1;
|
||||||
for (int i = 0; i < galaxies.size(); i++) {
|
for (int i = 0; i < galaxies.size(); i++) {
|
||||||
TextureNamesToLoad.push_back(std::pair<std::string, std::string>("/galax_menu/galaxies/galaxy_" + std::to_string(i) + ".png", "galaxy_" + std::to_string(i)));
|
TextureNamesToLoad.push_back(std::pair<std::string, std::string>("/galax_menu/galaxies/galaxy_" + std::to_string(i) + ".png", "galaxy_" + std::to_string(i)));
|
||||||
for (int j = 0; j < galaxies[i]; j++) {
|
for (int j = 0; j < galaxies[i]; j++) {
|
||||||
|
@ -82,6 +82,7 @@ void TGameMenu::Draw()
|
|||||||
void TGameMenu::Update(size_t dt)
|
void TGameMenu::Update(size_t dt)
|
||||||
{
|
{
|
||||||
/*..Galaxy Menu..*/
|
/*..Galaxy Menu..*/
|
||||||
|
GalaxMenu.InteractWithGalaxy(dt);
|
||||||
GalaxMenu.UpdateGalaxyMenu((float)SE::Renderer->GetScreenWidth(), (float)SE::Renderer->GetScreenHeight());
|
GalaxMenu.UpdateGalaxyMenu((float)SE::Renderer->GetScreenWidth(), (float)SE::Renderer->GetScreenHeight());
|
||||||
|
|
||||||
if (HoldToTap)
|
if (HoldToTap)
|
||||||
|