diff --git a/assets/galaxy_ptree.json b/assets/galaxy_ptree.json index bca974b..a10524d 100755 --- a/assets/galaxy_ptree.json +++ b/assets/galaxy_ptree.json @@ -32,6 +32,18 @@ }, { "name": "level5" + }, + { + "name": "level1" + }, + { + "name": "level2" + }, + { + "name": "level3" + }, + { + "name": "level3" } ] }, diff --git a/assets/gui_loading.json b/assets/gui_loading.json new file mode 100755 index 0000000..00c5bbf --- /dev/null +++ b/assets/gui_loading.json @@ -0,0 +1,26 @@ +{ + "widgets": [{ + "type": "FrameLayout", + "name": "Loading", + "background": "#000000FF", + "width": "match_parent", + "height": "match_parent", + "horizontalAlignment": "HA_CENTER", + "verticalAlignment": "VA_CENTER", + "children": [ + { + "type": "VerticalLinearLayout", + "name": "holder", + "background": "#000000FF", + "width": "wrap_content", + "height": "wrap_content", + "children":[{ + "type": "ImageView", + "name": "logo", + "height" : "400", + "width" : "400", + "background": "logo.png" + }] + }] + }] +} \ No newline at end of file diff --git a/assets/gui_main_menu.json b/assets/gui_main_menu.json index 9861604..34e5470 100755 --- a/assets/gui_main_menu.json +++ b/assets/gui_main_menu.json @@ -1,23 +1,205 @@ { "widgets": [{ "type": "FrameLayout", - "name": "menu_background", - "background": "#00000000", + "name": "modal_background", + "background": "#80808080", "width": "match_parent", "height": "match_parent", + "visible" : 0, + "horizontalAlignment": "HA_CENTER", + "verticalAlignment": "VA_CENTER", "children": [{ - "type": "FrameLayout", - "name": "stars_plane", - "background": "#00000000", - "width": "wrap_content", - "height": "wrap_content", - "children": [{ - "type": "ImageView", - "name": "galaxy", - "background": "024863276-illustration-spiral-galaxy-vec.png", - "width": 700, - "height": 480 - }] - }] + "type": "VerticalScrollLayout", + "name": "leftSidePanel", + "background": "#faf0ffFF", + "borderType": "line", + "borderColor": "#808080FF", + "width": "wrap_content", + "height": "match_parent", + "touchTransparency": 0, + "zLevel": 10, + "marginTop" : 40, + "marginBottom" : 40, + "paddingTop": 60, + "paddingBottom": 10, + "paddingLeft": 10, + "paddingRight": 10, + "itemSpacing": 20, + "children" : [{ + "type": "HorizontalLinearLayout", + "name": "embroiderySettings", + "itemSpacing": 30, + "paddingBottom": 15, + "paddingTop": 15, + "paddingLeft": 15, + "paddingRight": 15, + "background": "#faf0ffFF", + "borderType": "line", + "borderColor": "#808080FF", + "width": "wrap_content", + "height": "wrap_content", + "touchTransparency": 0, + "itemSpacing": 20, + "visible": 1, + "children": [{ + "type": "Button", + "name": "button6", + "width": 128, + "height": 80, + "background": "level1_prerender", + "pressedDrawable": "#60606060", + "hoverDrawable": "#60606060" + }, + { + "type": "Button", + "name": "button7", + "width": 128, + "height": 80, + "background": "level2_prerender", + "pressedDrawable": "#60606060", + "hoverDrawable": "#60606060" + }, + { + "type": "Button", + "name": "button8", + "width": 128, + "height": 80, + "background": "level3_prerender", + "pressedDrawable": "#60606060", + "hoverDrawable": "#60606060" + }] + }, + { + "type": "HorizontalLinearLayout", + "name": "embroiderySettings", + "itemSpacing": 30, + "paddingBottom": 15, + "paddingTop": 15, + "paddingLeft": 15, + "paddingRight": 15, + "background": "#faf0ffFF", + "borderType": "line", + "borderColor": "#808080FF", + "width": "wrap_content", + "height": "wrap_content", + "touchTransparency": 0, + "visible": 1, + "children": [{ + "type": "Button", + "name": "button6", + "width": 128, + "height": 80, + "background": "level4_prerender", + "pressedDrawable": "#60606060", + "hoverDrawable": "#60606060" + }, + { + "type": "Button", + "name": "button7", + "width": 128, + "height": 80, + "background": "level5_prerender", + "pressedDrawable": "#60606060", + "hoverDrawable": "#60606060" + }, + { + "type": "Button", + "name": "button8", + "width": 128, + "height": 80, + "background": "level6_prerender", + "pressedDrawable": "#60606060", + "hoverDrawable": "#60606060" + }] + }, + { + "type": "HorizontalLinearLayout", + "name": "embroiderySettings", + "itemSpacing": 30, + "paddingBottom": 15, + "paddingTop": 15, + "paddingLeft": 15, + "paddingRight": 15, + "background": "#faf0ffFF", + "borderType": "line", + "borderColor": "#808080FF", + "width": "wrap_content", + "height": "wrap_content", + "touchTransparency": 1, + "visible": 1, + "children": [{ + "type": "Button", + "name": "button6", + "width": 128, + "height": 80, + "background": "level7_prerender", + "pressedDrawable": "#60606060", + "hoverDrawable": "#60606060" + }, + { + "type": "Button", + "name": "button7", + "width": 128, + "height": 80, + "background": "level8_prerender", + "pressedDrawable": "#60606060", + "hoverDrawable": "#60606060" + }, + { + "type": "Button", + "name": "button8", + "width": 128, + "height": 80, + "background": "level9_prerender", + "pressedDrawable": "#60606060", + "hoverDrawable": "#60606060" + }] + }, + { + "type": "HorizontalLinearLayout", + "name": "embroiderySettings", + "itemSpacing": 30, + "paddingBottom": 15, + "paddingTop": 15, + "paddingLeft": 15, + "paddingRight": 15, + "background": "#faf0ffFF", + "borderType": "line", + "borderColor": "#808080FF", + "width": "wrap_content", + "height": "wrap_content", + "touchTransparency": 0, + "visible": 1, + "children": [{ + "type": "Button", + "name": "button6", + "width": 128, + "height": 80, + "background": "level10_prerender", + "pressedDrawable": "#60606060", + "hoverDrawable": "#60606060" + }, + { + "type": "Button", + "name": "button7", + "width": 128, + "height": 80, + "background": "level11_prerender", + "pressedDrawable": "#60606060", + "hoverDrawable": "#60606060" + }, + { + "type": "Button", + "name": "button8", + "width": 128, + "height": 80, + "background": "level12_prerender", + "pressedDrawable": "#60606060", + "hoverDrawable": "#60606060" + }] + }] + } + + ] }] } \ No newline at end of file diff --git a/assets/shaders/gui_transparent.fragment b/assets/shaders/gui_transparent.fragment new file mode 100755 index 0000000..777db41 --- /dev/null +++ b/assets/shaders/gui_transparent.fragment @@ -0,0 +1,11 @@ +precision highp float; + +uniform sampler2D Texture; +varying vec2 texCoord; +varying vec4 color; + +void main() +{ + vec4 texColor = texture2D(Texture,texCoord).rgba; + gl_FragColor = color * texColor.rgba; +} diff --git a/assets/shaders/gui_transparent.vertex b/assets/shaders/gui_transparent.vertex new file mode 100755 index 0000000..96d784e --- /dev/null +++ b/assets/shaders/gui_transparent.vertex @@ -0,0 +1,14 @@ +attribute vec3 vPosition; +attribute vec2 vTexCoord; +attribute vec4 vColor; +varying vec2 texCoord; +varying vec4 color; +uniform mat4 ProjectionMatrix; + +void main() +{ + //480x320 + gl_Position = ProjectionMatrix * vec4(vPosition.xyz, 1.0); + texCoord = vTexCoord; + color = vColor; +} \ No newline at end of file diff --git a/assets/ui/Curry_icon.png b/assets/ui/Curry_icon.png new file mode 100755 index 0000000..50b386a Binary files /dev/null and b/assets/ui/Curry_icon.png differ diff --git a/assets/ui/Durant_icon.png b/assets/ui/Durant_icon.png new file mode 100755 index 0000000..29322ec Binary files /dev/null and b/assets/ui/Durant_icon.png differ diff --git a/assets/ui/Green_icon.png b/assets/ui/Green_icon.png new file mode 100755 index 0000000..d9e4288 Binary files /dev/null and b/assets/ui/Green_icon.png differ diff --git a/assets/ui/Mcgee_icon.png b/assets/ui/Mcgee_icon.png new file mode 100755 index 0000000..663a802 Binary files /dev/null and b/assets/ui/Mcgee_icon.png differ diff --git a/assets/ui/Thompson_icon.png b/assets/ui/Thompson_icon.png new file mode 100755 index 0000000..1025992 Binary files /dev/null and b/assets/ui/Thompson_icon.png differ diff --git a/assets/ui/dots_icon.png b/assets/ui/dots_icon.png new file mode 100755 index 0000000..8ff16f6 Binary files /dev/null and b/assets/ui/dots_icon.png differ diff --git a/assets/ui/logo.png b/assets/ui/logo.png new file mode 100755 index 0000000..749fa66 Binary files /dev/null and b/assets/ui/logo.png differ diff --git a/assets/ui/logo_text.png b/assets/ui/logo_text.png new file mode 100755 index 0000000..676130c Binary files /dev/null and b/assets/ui/logo_text.png differ diff --git a/assets/ui/rowdy_icon.png b/assets/ui/rowdy_icon.png new file mode 100755 index 0000000..8852002 Binary files /dev/null and b/assets/ui/rowdy_icon.png differ diff --git a/assets/white.bmp b/assets/white.bmp new file mode 100755 index 0000000..397b5bf Binary files /dev/null and b/assets/white.bmp differ diff --git a/game/galaxy_menu.cpp b/game/galaxy_menu.cpp index d72d073..bdb9962 100755 --- a/game/galaxy_menu.cpp +++ b/game/galaxy_menu.cpp @@ -318,7 +318,7 @@ void GalaxyMenu::DrawGalaxyMenu() { } /*..Draw level selection menu..*/ - drawSelectionMenu(starIndex); + //drawSelectionMenu(starIndex); } @@ -380,7 +380,7 @@ void GalaxyMenu::InteractWithGalaxy(size_t dt) { // ::::::::::::: timer inactive :::::::::::::: if (lastTapPos != Eigen::Vector2f(-9999.9f, -9999.9f)) { if (menuState == 0) {// main view - if (totalTapShift(0) == 0.f && totalTapShift(1) == 0.f) { + // OnTapDown->OnTapUp /*..level select menu open..*/ @@ -393,21 +393,12 @@ void GalaxyMenu::InteractWithGalaxy(size_t dt) { planetHoverIndex = -1; } - } - else { - // OnTapDown->OnMove->OnTapUp - - /*..level select menu open..*/ - starIndex = findPlanetByPos(lastTapPos - totalTapShift); - if (starIndex != -1) { - planetHoverIndex = starIndex; - menuState = 2; - } - else { - planetHoverIndex = -1; + if (starIndex != -1) + { + ResourceManager->newGuiManager.findWidgetByName("modal_background")->setVisibility(true); } - } + } else if (menuState == 1) { // zoomed galaxy diff --git a/game/gamecode.cpp b/game/gamecode.cpp index 70c3f88..92627a4 100755 --- a/game/gamecode.cpp +++ b/game/gamecode.cpp @@ -87,10 +87,10 @@ void TBrick::SetInvisible() State = CONST_BRICKSTATE_INVISIBLE; } -void TBrick::TryDrawAppear(int ipos, int jpos) +void TBrick::TryDrawAppear(int ipos, int jpos, int screenWidth) { - Vector2f centerPos = GetPosFrom(ipos, jpos); + Vector2f centerPos = GetPosFrom(ipos, jpos, screenWidth); float LEVEL_VIEWPORT_WIDTH = Application->GetGameLevelScreenWidth(); float LEVEL_VIEWPORT_HEIGHT = Application->GetGameLevelScreenHeight(); @@ -158,14 +158,14 @@ Vector4f TBrick::GetColor() return Color; } -Vector2f TBrick::GetPosFrom(int ipos, int jpos) +Vector2f TBrick::GetPosFrom(int ipos, int jpos, int screenWidth) { 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)); - Vector2f outlineShift = Vector2f(((Renderer->GetScreenWidth() - 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)); } @@ -465,11 +465,12 @@ TGameLevel::~TGameLevel() -void TGameLevel::ReloadBlockInstansingList() +void TGameLevel::ReloadBlockInstansingList(int screenWidth) { float LEVEL_VIEWPORT_WIDTH = Application->GetGameLevelScreenWidth(); float LEVEL_VIEWPORT_HEIGHT = Application->GetGameLevelScreenHeight(); + std::map ConstTextureBlockMap = boost::assign::map_list_of (0,CONST_BLOCK_TEXTURE1) (1,CONST_BLOCK_TEXTURE2) (2,CONST_BLOCK_TEXTURE3); std::pair tempPair; @@ -502,8 +503,8 @@ void TGameLevel::ReloadBlockInstansingList() itr--; } - Vector2f posFrom = BlockMatrix[i][j].GetPosFrom(i,j) + 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) + 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*(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)); itr->second.Data += MakeDataTriangleList(posFrom, posTo); @@ -663,7 +664,7 @@ void TGameLevel::ReloadLevel() rowColorIterator++; } - ReloadBlockInstansingList(); + ReloadBlockInstansingList(Renderer->GetScreenWidth()); } @@ -686,25 +687,25 @@ void TGameLevel::SetStandBy() { ReloadLevel(); - InitLevel(); + InitLevel(Renderer->GetScreenWidth(), Renderer->GetScreenHeight()); LevelState = CONST_LEVELSTATE_STANDBY; } void TGameLevel::SetLoading() { - InitLevel(); + InitLevel(Renderer->GetScreenWidth(), Renderer->GetScreenHeight()); StateTimer = CONST_TIMER_LOADING; LevelState = CONST_LEVELSTATE_LOADING; } -void TGameLevel::InitLevel() +void TGameLevel::InitLevel(int screenWidth, int screenHeight) { float LEVEL_VIEWPORT_WIDTH = Application->GetGameLevelScreenWidth(); float LEVEL_VIEWPORT_HEIGHT = Application->GetGameLevelScreenHeight(); - ReflectorPos = Vector2f(Renderer->GetScreenWidth()*0.5f, 16* LEVEL_VIEWPORT_HEIGHT/320.f + 13 * LEVEL_VIEWPORT_HEIGHT / 320.f); - Vector2f ballPos = Vector2f(Renderer->GetScreenWidth()*0.5f, 80* LEVEL_VIEWPORT_HEIGHT/320.f); + 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); BallList.clear(); BallList.push_back(TBall(ballPos, Vector2f(0, 0), BallColor)); @@ -723,6 +724,8 @@ void TGameLevel::InitLevel() BonusFloorPosY = 0.f; + ReloadBlockInstansingList(screenWidth); + } bool TGameLevel::IsLoaded() @@ -730,7 +733,7 @@ bool TGameLevel::IsLoaded() return (LevelState == CONST_LEVELSTATE_STANDBY); } -void TGameLevel::drawOutline() { +void TGameLevel::drawOutline(int screenWidth, int screenHeight) { glBindTexture(GL_TEXTURE_2D, ResourceManager->TexList["black_square"]); Renderer->DrawRect( @@ -739,44 +742,51 @@ void TGameLevel::drawOutline() { 0.0f ), Vector2f( - (Renderer->GetScreenWidth() - Application->GetGameLevelScreenWidth())*0.5f, - Renderer->GetScreenHeight() + (screenWidth - Application->GetGameLevelScreenWidth())*0.5f, + screenHeight ) ); Renderer->DrawRect( Vector2f( - Renderer->GetScreenWidth() - (Renderer->GetScreenWidth() - Application->GetGameLevelScreenWidth())*0.5f, + screenWidth - (screenWidth - Application->GetGameLevelScreenWidth())*0.5f, 0.f ), Vector2f( - Renderer->GetScreenWidth(), - Renderer->GetScreenHeight() + screenWidth, + screenHeight ) ); } void TGameLevel::DrawSnapshot(const std::string& assignedSnapshotFrameBuffer) { - InitLevel(); + InitLevel(768, 480); int prevState = LevelState; LevelState = CONST_LEVELSTATE_SNAPSHOTTING; - Draw(); + InnerDraw(768, 480, 768, 480); LevelState = prevState; prerenderedImage = ResourceManager->FrameManager.GetFrameTextureCopy(assignedSnapshotFrameBuffer, levelName + "_prerender"); } + void TGameLevel::Draw() +{ + InnerDraw(Renderer->GetScreenWidth(), Renderer->GetScreenHeight(), Renderer->GetMatrixWidth(), Renderer->GetMatrixHeight()); +} + + +void TGameLevel::InnerDraw(int screenWidth, int screenHeight, int matrixWidth, int matrixHeight) { // 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 = (Renderer->GetScreenHeight() - tSH)*0.5f; // Level Screen y-offset + float xlOffset = (screenWidth - 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(ResourceManager->TexList.GetTextureOriginalHeight(CONST_WALL_UP_TEXTURE)) / static_cast(ResourceManager->TexList.GetTextureOriginalWidth(CONST_WALL_UP_TEXTURE))); // up Wall Texture Width @@ -791,6 +801,7 @@ void TGameLevel::Draw() return; } + if (LevelState == CONST_LEVELSTATE_LOADING) { Renderer->PushMatrix(); @@ -801,9 +812,9 @@ void TGameLevel::Draw() if (scale > 1.f) scale = 1.f; - Renderer->TranslateMatrix(Vector3f(Renderer->GetMatrixWidth() * 0.5f, Renderer->GetMatrixHeight() * 0.5f, 0)); + Renderer->TranslateMatrix(Vector3f(matrixWidth * 0.5f, matrixHeight * 0.5f, 0)); Renderer->ScaleMatrix(scale); - Renderer->TranslateMatrix(-Vector3f(Renderer->GetMatrixWidth() * 0.5f, Renderer->GetMatrixHeight() * 0.5f, 0)); + Renderer->TranslateMatrix(-Vector3f(matrixWidth * 0.5f, matrixHeight * 0.5f, 0)); glBindTexture(GL_TEXTURE_2D,ResourceManager->TexList[LevelScreenTexture]); 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(); @@ -819,14 +830,15 @@ void TGameLevel::Draw() bool renderBufferReady = RenderBufferReady; + /* if (pause && renderBufferReady) { //See also below (same method) Renderer->PushMatrix(); - Renderer->TranslateMatrix(Vector3f(Renderer->GetMatrixWidth() * 0.5f, Renderer->GetMatrixHeight() * 0.5f, 0)); + Renderer->TranslateMatrix(Vector3f(matrixWidth * 0.5f, matrixHeight * 0.5f, 0)); Renderer->ScaleMatrix(OutScale); - Renderer->TranslateMatrix(-Vector3f(Renderer->GetMatrixWidth() * 0.5f, Renderer->GetMatrixHeight() * 0.5f, 0)); + Renderer->TranslateMatrix(-Vector3f(matrixWidth * 0.5f, matrixHeight * 0.5f, 0)); DrawBuffer(); if (mustShowButtons) @@ -837,16 +849,16 @@ void TGameLevel::Draw() CheckGlError(); return; } - + if (pause && !renderBufferReady) { Renderer->SwitchToFrameBuffer("LevelBuffer"); - Renderer->SetProjectionMatrix(Renderer->GetScreenWidth(), Renderer->GetScreenHeight()); + Renderer->SetProjectionMatrix(screenWidth, screenHeight); glClearColor(0.0f, 0.0f, 0.0f, 1.0f); glClear( GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT); CheckGlError(); - } + }*/ // Level background // ::::::::::: @@ -860,7 +872,7 @@ void TGameLevel::Draw() if ((bkgTW/bkgTH) >= 1.6f/*screen ratio*/) { bkgSW = (tSH/bkgTH) * bkgTW; bkgSH = tSH; - bkgSWO = (((float)Renderer->GetScreenWidth()) - bkgSW) * 0.5f; + bkgSWO = (((float)screenWidth) - bkgSW) * 0.5f; bkgSHO = ylOffset; } else { bkgSH = (tSW / bkgTW) * bkgTH; @@ -873,8 +885,9 @@ void TGameLevel::Draw() 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)); + //Renderer->DrawRect(Vector2f(0,0), Vector2f(100,100), Vector2f(0.f, 0.f), Vector2f(1.f, 1.f)); + - drawOutline(); std::list::iterator iBall; @@ -885,7 +898,7 @@ void TGameLevel::Draw() { for (int j=0; jDrawTriangleList(colorBlockIterator->second); } + std::list::iterator iBonus; @@ -948,11 +962,12 @@ void TGameLevel::Draw() } + /*/ if (!pause && LevelState != CONST_LEVELSTATE_SNAPSHOTTING) { RenderUniform1f("Transparency", 1.f); glBindTexture(GL_TEXTURE_2D,ResourceManager->TexList[CONST_BACK_BTN_TEXTURE]); - const Vector2f BackBtnPos(Renderer->GetScreenWidth()*0.5f, Application->GetGameLevelScreenHeight() - 52.f*(Application->GetGameLevelScreenHeight()/320.f)); + 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); @@ -968,10 +983,10 @@ void TGameLevel::Draw() Renderer->PushMatrix(); //Renderer->LoadIdentity(); - Renderer->TranslateMatrix(Vector3f(Renderer->GetMatrixWidth() * 0.5f, Renderer->GetMatrixHeight() * 0.5f, 0)); + Renderer->TranslateMatrix(Vector3f(matrixWidth * 0.5f, matrixHeight * 0.5f, 0)); //Renderer->TranslateMatrix(Vector3f(Application->GetGameLevelScreenWidth(), Application->GetGameLevelScreenHeight(), 0)); Renderer->ScaleMatrix(OutScale); - Renderer->TranslateMatrix(-Vector3f(Renderer->GetMatrixWidth() * 0.5f, Renderer->GetMatrixHeight() * 0.5f, 0)); + Renderer->TranslateMatrix(-Vector3f(matrixWidth * 0.5f, matrixHeight * 0.5f, 0)); DrawBuffer(); if (mustShowButtons) { @@ -980,7 +995,13 @@ void TGameLevel::Draw() Renderer->PopMatrix(); RenderBufferReady = true; CheckGlError(); - } + }*/ + + + + drawOutline(screenWidth, screenHeight); + + CheckGlError(); } @@ -1581,7 +1602,7 @@ void TGameLevel::UpdateBallList(size_t dt) } - Vector2f blockPos = BlockMatrix[i][j].GetPosFrom(i, j); + Vector2f blockPos = BlockMatrix[i][j].GetPosFrom(i, j, Renderer->GetScreenWidth()); if (canThrowBonus && rand() % 20 == 0) @@ -1622,7 +1643,7 @@ void TGameLevel::UpdateBallList(size_t dt) if (blockListChanged) { - ReloadBlockInstansingList(); + ReloadBlockInstansingList(Renderer->GetScreenWidth()); } if (mustReloadBalls) diff --git a/game/gamecode.h b/game/gamecode.h index 405c700..a249425 100755 --- a/game/gamecode.h +++ b/game/gamecode.h @@ -51,9 +51,9 @@ public: TBrick(); void SetVisible(Vector4f color, int locked); void SetInvisible(); - void TryDrawAppear(int ipos, int jpos); + void TryDrawAppear(int ipos, int jpos, int screenWidth); void Update(size_t dt); - Vector2f GetPosFrom(int ipos, int jpos); + Vector2f GetPosFrom(int ipos, int jpos, int screenWidth); Vector4f GetColor(); void Appear(Vector4f color, int locked); void Appear(); @@ -145,7 +145,7 @@ protected: bool TapInBackBtnArea(const Vector2f& pos); - void ReloadBlockInstansingList(); + void ReloadBlockInstansingList(int screenWidth); void SetFinished(); void SetFinishFreeze(); @@ -154,7 +154,7 @@ protected: void DrawBallInstancingList(); - void drawOutline(); + void drawOutline(int screenWidth, int screenHeight); bool RenderBufferReady; @@ -180,7 +180,7 @@ protected: void MultiplyBalls(Vector2f pos, Vector2f velocity); Vector2f GetBlock(const Vector2f& pos); - void InitLevel(); + void InitLevel(int screenWidth, int screenHeight); float BonusGothroughTimer; float BonusFloorTimer; @@ -204,6 +204,7 @@ public: bool IsLoaded(); virtual void Draw(); + void InnerDraw(int screenWidth, int screenHeight, int matrixWidth, int matrixHeight); void DrawSnapshot(const std::string& assignedSnapshotFrameBuffer); void SetPause(); diff --git a/game/main_code.cpp b/game/main_code.cpp index 252adfb..0726f96 100755 --- a/game/main_code.cpp +++ b/game/main_code.cpp @@ -85,30 +85,31 @@ void TMyApplication::InnerInit() StateTimer = 0.f; /* - ResourceManager->ShaderManager.AddShader("DefaultShader", "shader1vertex - ", "shader1fragment.txt"); + ResourceManager->ShaderManager.AddShader("DefaultShader", "shader1vertex", "shader1fragment.txt"); ResourceManager->ShaderManager.AddShader("FrameShader", "frameshader_vertex.txt", "frameshader_fragment.txt"); ResourceManager->ShaderManager.AddShader("BrickShader", "brickshader_vertex.txt", "brickshader_fragment.txt"); Renderer->PushShader("DefaultShader"); */ - ResourceManager->ShaderManager.AddShader("DefaultShader", "shaders/texture-shader.vertex", "shaders/texture-shader.fragment"); + //ResourceManager->ShaderManager.AddShader("DefaultShader", "shaders/texture-shader.vertex", "shaders/texture-shader.fragment"); + ResourceManager->ShaderManager.AddShader("DefaultShader", "shaders/gui_transparent.vertex", "shaders/gui_transparent.fragment"); ResourceManager->ShaderManager.AddShader("ColorShader", "shaders/color-shader.vertex", "shaders/color-shader.fragment"); ResourceManager->ShaderManager.AddShader("FrameShader", "shaders/frameshader_vertex.txt", "shaders/frameshader_fragment.txt"); ResourceManager->ShaderManager.AddShader("BrickShader", "shaders/brickshader_vertex.txt", "shaders/brickshader_fragment.txt"); ResourceManager->ShaderManager.AddShader(ParticleEffect::PARTICLE_SHADER, "shaders/particle-shader.vertex", "shaders/particle-shader.fragment"); Renderer->PushShader("DefaultShader"); - ResourceManager->TexList.AddTexture(CONST_LOADING_BACKGROUND_BLACK + ".png", CONST_LOADING_BACKGROUND_BLACK); - ResourceManager->TexList.AddTexture(CONST_LOADING_TEXTURE + ".png", CONST_LOADING_TEXTURE); - ResourceManager->TexList.AddTexture(CONST_LOGO_SMALL_TEXTURE + ".png", CONST_LOGO_SMALL_TEXTURE); + //ResourceManager->TexList.AddTexture(CONST_LOADING_BACKGROUND_BLACK + ".png", CONST_LOADING_BACKGROUND_BLACK); + //ResourceManager->TexList.AddTexture(CONST_LOADING_TEXTURE + ".png", CONST_LOADING_TEXTURE); + //ResourceManager->TexList.AddTexture(CONST_LOGO_SMALL_TEXTURE + ".png", CONST_LOGO_SMALL_TEXTURE); ResourceManager->TexList.AddTexture("console_bkg.bmp"); + ResourceManager->TexList.AddTexture("white.bmp"); ResourceManager->FrameManager.AddFrameRenderBuffer("LevelBuffer", 512, 512); - OnDrawSignal.connect(boost::bind(&TGameLoading::Draw, boost::ref(GameLoading))); + //OnDrawSignal.connect(boost::bind(&TGameLoading::Draw, boost::ref(GameLoading))); Inited = true; Renderer->SetOrthoProjection(); @@ -123,6 +124,7 @@ void TMyApplication::InnerInit() ResourceManager->FontManager.AddFont("lucon12", "lucon12.png", "lucon12.txt"); ResourceManager->FontManager.PushFont("lucon12"); //ResourceManager->newGuiManager.LoadFromConfig("gui_main_menu.json"); + ResourceManager->newGuiManager.LoadFromConfig("gui_loading.json"); //SetButtonsAction(); // ------- UI ------- @@ -163,7 +165,7 @@ void TMyApplication::InnerDeinit() OnTapDownSignal.disconnect(boost::bind(&TGameCredits::OnTapDown, boost::ref(GameCredits), _1)); - OnDrawSignal.disconnect(boost::bind(&TGameLoading::Draw, boost::ref(GameLoading))); + //OnDrawSignal.disconnect(boost::bind(&TGameLoading::Draw, boost::ref(GameLoading))); OnDrawSignal.disconnect(boost::bind(&TGameMenu::Draw, boost::ref(Menu))); OnDrawSignal.disconnect(boost::bind(&TGameLevel::Draw, boost::ref(GameLevel))); OnDrawSignal.disconnect(boost::bind(&TGameCredits::Draw, boost::ref(GameCredits))); @@ -410,9 +412,11 @@ void TMyApplication::TrySaveGame() void TMyApplication::InnerDraw() { - glDisable(GL_DEPTH_TEST); + //glDisable(GL_DEPTH_TEST); + Renderer->PushShader("DefaultShader"); OnDrawSignal(); + Renderer->PopShader(); } @@ -451,19 +455,29 @@ void TMyApplication::InnerUpdate(size_t dt) Renderer->SwitchToFrameBuffer("LevelBuffer"); + Renderer->SetProjectionMatrix(768, 480); + + Renderer->LoadIdentity(); + for (auto &star : Menu.GalaxMenu.galaxies[0].Stars) { for (auto &level : star.selectionMenu.gameLevels) { level.DrawSnapshot("LevelBuffer"); + break; } + break; } Renderer->SwitchToScreen(); + Renderer->SetOrthoProjection(); + GameState = CONST_GAMESTATE_MENU; ApplySignalsToMenu(); - OnDrawSignal.disconnect(boost::bind(&TGameLoading::Draw, boost::ref(GameLoading))); + ResourceManager->newGuiManager.Clear(); + ResourceManager->newGuiManager.LoadFromConfig("gui_main_menu.json"); + //OnDrawSignal.disconnect(boost::bind(&TGameLoading::Draw, boost::ref(GameLoading))); OnDrawSignal.connect(0, boost::bind(&TGameMenu::Draw, boost::ref(Menu))); StateTimer = 0.f; Loaded = true; diff --git a/windows/DoubleHitBalls-win/DoubleHitBalls-win/tapLog.txt b/windows/DoubleHitBalls-win/DoubleHitBalls-win/tapLog.txt deleted file mode 100755 index 007102a..0000000 --- a/windows/DoubleHitBalls-win/DoubleHitBalls-win/tapLog.txt +++ /dev/null @@ -1,179 +0,0 @@ -Tapped up:: 445 35Tapped up:: 638 34Tapped up:: 582 87Tapped up:: 282 45 -Tapped up:: 602 49 -Tapped up:: 314 93 -Tapped up:: 434 12 -Tapped up:: 410 26 -Tapped up:: 398 21 -Tapped up:: 264 269 -Tapped up:: 286 218 -Tapped up:: 286 17 -Tapped up:: 286 17 -Tapped up:: 186 36 -Tapped up:: 266 95 -Tapped up:: 306 169 -Tapped up:: 234 257 -Tapped up:: 539 47 -Tapped up:: 523 361 -Tapped up:: 367 345 -Tapped up:: 5 4 -Tapped up:: 785 10 -Tapped up:: 777 468 -Tapped up:: 11 473 -Tapped up:: 19 12 -Tapped up:: 783 11 -Tapped up:: 780 468 -Tapped up:: 13 471 -Tapped up:: 406 240 -Tapped up:: 10 13 -Tapped up:: 786 10 -Tapped up:: 784 468 -Tapped up:: 8 471 -Tapped up:: 410 241 -Tapped up:: 304 160 -Tapped up:: 352 184 -Tapped up:: 277 135 -Tapped up:: 337 145 -Tapped up:: 274 106 -Tapped up:: 548 155 -Tapped up:: 341 161 -Tapped up:: 363 192 -Tapped up:: 356 166 -Tapped up:: 218 129 -Tapped up:: 214 188 -Tapped up:: 327 196 -Tapped up:: 523 185 -Tapped up:: 289 215 -Tapped up:: 306 113 -Tapped up:: 290 130 -Tapped up:: 274 125 -Tapped up:: 321 153 -Tapped up:: 261 129 -Tapped up:: 331 142 -Tapped up:: 298 126 -Tapped up:: 335 129 -Tapped up:: 289 165 -Tapped up:: 316 137 -Tapped up:: 366 197 -Tapped up:: 378 190 -Tapped up:: 173 97 -Tapped up:: 297 157 -Tapped up:: 234 109 -Tapped up:: 290 118 -Tapped up:: 321 190 -Tapped up:: 357 157 -Tapped up:: 333 180 -Tapped up:: 293 150 -Tapped up:: 254 174 -Tapped up:: 291 160 -Tapped up:: 345 154 -Tapped up:: 327 161 -Tapped up:: 313 101 -Tapped up:: 286 178 -Tapped up:: 341 102 -Tapped up:: 369 121 -Tapped up:: 253 203 -Tapped up:: 264 131 -Tapped up:: 298 166 -Tapped up:: 246 161 -Tapped up:: 257 146 -Tapped up:: 303 151 -Tapped up:: 338 144 -Tapped up:: 313 119 -Tapped up:: 327 129 -Tapped up:: 376 133 -Tapped up:: 353 117 -Tapped up:: 344 149 -Tapped up:: 311 128 -Tapped up:: 414 185 -Tapped up:: 352 141 -Tapped up:: 274 141 -Tapped up:: 326 156 -Tapped up:: 314 131 -Tapped up:: 330 149 -Tapped up:: 315 95 -Tapped up:: 319 110 -Tapped up:: 356 181 -Tapped up:: 286 101 -Tapped up:: 353 102 -Tapped up:: 344 145 -Tapped up:: 327 169 -Tapped up:: 259 95 -Tapped up:: 302 131 -Tapped up:: 215 153 -Tapped up:: 326 138 -Tapped up:: 325 206 -Tapped up:: 358 136 -Tapped up:: 335 117 -Tapped up:: 257 129 -Tapped up:: 367 145 -Tapped up:: 770 480 -Tapped up:: 310 159 -Tapped up:: 294 143 -Tapped up:: 381 137 -Tapped up:: 387 178 -Tapped up:: 283 120 -Tapped up:: 306 157 -Tapped up:: 392 296 -Tapped up:: 350 190 -Tapped up:: 296 193 -Tapped up:: 314 121 -Tapped up:: 303 132 -Tapped up:: 192 121 -Tapped up:: 282 142 -Tapped up:: 357 186 -Tapped up:: 378 146 -Tapped up:: 308 99 -Tapped up:: 278 142 -Tapped up:: 284 230 -Tapped up:: 199 111 -Tapped up:: 250 85 -Tapped up:: 370 117 -Tapped up:: 262 140 -Tapped up:: 266 150 -Tapped up:: 326 169 -Tapped up:: 383 163 -Tapped up:: 278 122 -Tapped up:: 337 146 -Tapped up:: 318 157 -Tapped up:: 290 133 -Tapped up:: 336 189 -Tapped up:: 378 117 -Tapped up:: 288 137 -Tapped up:: 287 99 -Tapped up:: 359 149 -Tapped up:: 303 170 -Tapped up:: 306 147 -Tapped up:: 244 150 -Tapped up:: 338 145 -Tapped up:: 319 156 -Tapped up:: 249 152 -Tapped up:: 284 179 -Tapped up:: 371 200 -Tapped up:: 375 153 -Tapped up:: 226 135 -Tapped up:: 306 142 -Tapped up:: 335 127 -Tapped up:: 372 118 -Tapped up:: 370 131 -Tapped up:: 236 136 -Tapped up:: 361 162 -Tapped up:: 330 116 -Tapped up:: 297 176 -Tapped up:: 355 166 -Tapped up:: 274 128 -Tapped up:: 313 148 -Tapped up:: 290 178 -Tapped up:: 463 79 -Tapped up:: 473 102 -Tapped up:: 680 332 -Tapped up:: 313 144 -Tapped up:: 297 93 -Tapped up:: 356 109 -Tapped up:: 213 197 -Tapped up:: 260 148 -Tapped up:: 310 130 -Tapped up:: 296 136 -Tapped up:: 394 181 -Tapped up:: 340 157 -Tapped up:: 322 127 -Tapped up:: 278 110 diff --git a/windows/DoubleHitBalls-win/DoubleHitBalls-win/tapLog_down.txt b/windows/DoubleHitBalls-win/DoubleHitBalls-win/tapLog_down.txt deleted file mode 100755 index a83fffa..0000000 --- a/windows/DoubleHitBalls-win/DoubleHitBalls-win/tapLog_down.txt +++ /dev/null @@ -1,46 +0,0 @@ -Tapped down::Before_signal -10 467 -Tapped down::After_signal -10 13 -Tapped down::Before_signal -786 470 -Tapped down::After_signal -786 10 -Tapped down::Before_signal -784 12 -Tapped down::After_signal -784 468 -Tapped down::Before_signal -8 9 -Tapped down::After_signal -8 471 -Tapped down::Before_signal -410 239 -Tapped down::After_signal -410 241 -Tapped down::Before_signal -230 351 -Tapped down::After_signal -230 129 -Tapped down::Before_signal -233 461 -Tapped down::After_signal -233 19 -Tapped down::Before_signal -295 179 -Tapped down::Before_signal -304 320 -Tapped down::After_signal -304 160 -Tapped down::Before_signal -383 419 -Tapped down::Before_signal -374 71 -Tapped down::Before_signal -240 424 -Tapped down::Before_signal -259 261 -Tapped down::Before_signal -390 51 -Tapped down::Before_signal -245 400