{"id":3053,"date":"2022-09-09T14:46:51","date_gmt":"2022-09-09T09:46:51","guid":{"rendered":"https:\/\/www.edopedia.com\/blog\/?p=3053"},"modified":"2022-09-09T14:46:52","modified_gmt":"2022-09-09T09:46:52","slug":"cpp-opengl-2d-bubble-shooter-game-source-code","status":"publish","type":"post","link":"https:\/\/www.edopedia.com\/blog\/cpp-opengl-2d-bubble-shooter-game-source-code\/","title":{"rendered":"C++ OpenGL 2D Bubble Shooter Game Source Code"},"content":{"rendered":"\n<p>Today, I will show you how to create a 2D bubble shooter game using C++ and OpenGL. This program will definitely help you learn C++ game development.<\/p>\n\n\n\n<p>The complete source code of the 2D Bubble Shooter Game written in C++ is given below.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">C++ Bubble Shooter Game Code<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">code.cpp<\/h3>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;clike&quot;,&quot;mime&quot;:&quot;text\/x-c++src&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:true,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;C++&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;cpp&quot;}\">\/*\nThis is bubble shooter game developed using C++ programming language and\nOpenGL API. Here OpenGL API is used specially for graphics related development\npurpose.\n*\/\n\n\n\n#include&lt;iostream&gt;\n#include&lt;stdio.h&gt;\n#include &lt;GL\/glut.h&gt;\n#include&lt;math.h&gt;\n#include &lt;stdlib.h&gt;\n#define PI 3.14159265\nusing namespace std;\n\n\/\/ Initialize the functions\nvoid points_to_go();\nvoid get_score();\nint rand1();\nvoid timer(int );\nvoid game_over();\nvoid drawline_between_two_points(int ,int );\n\/\/ Initialize variables\nint x=240, y=0, xs=240, ys=0, max1=620-(9*34), max2;\nint reset=1, c1=rand()%5, c4=0, ck, sc=0;\nbool flt, gover=false;\ndouble xl=x,yl=y,x3,y3,len,theta,theta1,lbound=0.13962634,rbound=3.00196631;\nint noc[5];\n\n\/\/ initialize some structs for supplying bubble pattern and \n\/\/ controlling the pointers\nstruct blast1{\n    int a,b;\n};\nstruct blast1 blast[200];\nstruct colour{\n    double r1,g1,b1;\n};\nstruct colour col1[6];\nstruct bubble{\n    int color,v,vi;\n};\nstruct bubble bubbles[15][12];\n\n\/\/ colors combinations for bubbles\nvoid cols(){\n    col1[0].r1=1;\n    col1[3].r1=1;\n    col1[1].r1=col1[2].r1=col1[4].r1=0;col1[5].r1=0.2;\n    col1[1].g1=col1[4].g1=1;\n    col1[0].g1=col1[2].g1=col1[3].g1=0;col1[5].g1=0.6;\n    col1[2].b1=col1[3].b1=col1[4].b1=1;\n    col1[0].b1=col1[1].b1=0;col1[5].b1=0.2;\n}\nstatic void resize(int width, int height)\n{\n    const float ar = (float) width \/ (float) height;\n\n    glViewport(0, 0, width, height);\n    glMatrixMode(GL_PROJECTION);\n    glLoadIdentity();\n    \/\/glFrustum(-ar, ar, -1.0, 1.0, 2.0, 100.0);\n\n    \/\/glMatrixMode(GL_MODELVIEW);\n    \/\/glLoadIdentity() ;\n}\n\nint rand1(){\n    for(int i=0;i&lt;5;i++){\n        noc[i]=0;\n    }\n    for(int j=0;j&lt;15;j++){\n        if(j%2==0){\n            for(int i=0;i&lt;12;i++){\n                if(bubbles[j][i].v==1){\n                    noc[bubbles[j][i].color]++;\n                }\n            }\n        }\n       else{\n            for(int i=0;i&lt;11;i++){\n                if(bubbles[j][i].v==1){\n                    noc[bubbles[j][i].color]++;\n                }\n            }\n       }\n    }\n    ck=0;\n    for(int i=0;i&lt;5;i++){\n        if(noc[i]==0){\n            ck++;\n        }\n    }\n    int temp=rand()%5;\n    if(ck!=5){\n    while(noc[temp]==0){\n        temp=rand()%5;\n    }}\n    return temp;\n}\n\nvoid score1(){\n        glColor3f(0.0,0,0);\n        glRasterPos2i(170,170);\n        glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24,'G');\n        glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24,'A');\n        glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24,'M');\n        glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24,'E');\n        glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24,' ');\n        glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24,'O');\n        glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24,'V');\n        glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24,'E');\n        glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24,'R');\n}\n\nvoid circle(double xc,double yc,int R,double r,double g,double b){\n    for(double t=0;t&lt;=2*PI;t+=.10){\n\n        glBegin(GL_TRIANGLES);\n        glColor3d(r,g,b);\n        glVertex2d(xc,yc);\n        glColor3d(r*0.1,g*0.1,b*0.1);\n        glVertex2d(xc+R*cos(t),yc+R*sin(t));\n        glColor3d(r*0.1,g*0.1,b*0.1);\n        glVertex2d(xc+R*cos(t+0.1),yc+R*sin(t+0.1));\n        glEnd();\n    }\n}\n\/\/20root3\nvoid inits(){\n    for(int j=0;j&lt;7;j++){\n        if(j%2==0){\n            for(int i=0;i&lt;12;i++){\n                bubbles[j][i].v=1;\n                bubbles[j][i].vi=0;\n                bubbles[j][i].color=rand()%5;\n            }\n        }\n       else{\n            for(int i=0;i&lt;11;i++){\n                bubbles[j][i].v=1;\n                bubbles[j][i].vi=0;\n                bubbles[j][i].color=rand()%5;\n            }\n       }\n    }\n}\n\n void display(void)\n{\n    glClear(GL_COLOR_BUFFER_BIT);\n    glBegin(GL_POLYGON);\n        glColor3d(1,1,1);\n        glVertex2d(0,0);\n        glColor3d(1,1,1);\n        glVertex2d(480,0);\n        glColor3d(1,1,1);\n        glVertex2d(480,640);\n        glColor3d(1,1,1);\n        glVertex2d(0,640);\n    glEnd();\n\n    \/\/circle(240,320,500,1,0.75,0.8);\n    cols();\n    for(int j=0;j&lt;15;j++){\n        if(j%2==0){\n            for(int i=0;i&lt;12;i++){\n                if(bubbles[j][i].v==1){\n                    circle((i*40)+20,620-(j*34),20,col1[bubbles[j][i].color].r1,col1[bubbles[j][i].color].g1,col1[bubbles[j][i].color].b1);max2=620-((j+1)*34);\n                }\n            }\n        }\n       else{\n            for(int i=0;i&lt;11;i++){\n                if(bubbles[j][i].v==1){\n                    circle((i*40)+40,620-(j*34),20,col1[bubbles[j][i].color].r1,col1[bubbles[j][i].color].g1,col1[bubbles[j][i].color].b1);max2=620-((j+1)*34);\n                }\n            }\n       }\n    }\n    if(ck==5) gover = true;\n    if(gover){\n        game_over();\n    }\n    \/\/circle(20,620,20,col1[bubbles[0][0].color].r1,col1[bubbles[0][0].color].g1,col1[bubbles[0][0].color].b1);\n    drawline_between_two_points(xl,yl);\n    glColor3d(0,0,0);\n    glBegin(GL_LINES);\n        glVertex2d(0,260);\n        glVertex2d(480,260);\n    glEnd();\n    if(ck!=5)\n        circle(x,y+20,20,col1[c1].r1,col1[c1].g1,col1[c1].b1);\n\n    get_score();\n    glFlush();\n}\n\nvoid dfs(int i,int j,int c){\n    cout &lt;&lt; i &lt;&lt; j &lt;&lt; c &lt;&lt;endl;\n    if(i%2==0){\n            if(i==0){\n                if(j&gt;0 &amp;&amp; j&lt;11){\n            if(bubbles[i+1][j-1].v==1&amp;&amp;bubbles[i+1][j-1].color==c&amp;&amp;bubbles[i+1][j-1].vi==0){\n                blast[c4].a=i+1;\n                blast[c4].b=j-1;\n                bubbles[i+1][j-1].vi=1;\n                c4++;\n                dfs(i+1,j-1,c);\n            }\n            if(bubbles[i+1][j].v==1&amp;&amp;bubbles[i+1][j].color==c&amp;&amp;bubbles[i+1][j].vi==0){\n                blast[c4].a=i+1;\n                blast[c4].b=j;\n                bubbles[i+1][j].vi=1;\n                c4++;\n                dfs(i+1,j,c);\n            }\n            if(bubbles[i][j-1].v==1&amp;&amp;bubbles[i][j-1].color==c&amp;&amp;bubbles[i][j-1].vi==0){\n                blast[c4].a=i;\n                blast[c4].b=j-1;\n                bubbles[i][j-1].vi=1;\n                c4++;\n                dfs(i,j-1,c);\n            }\n            if(bubbles[i][j+1].v==1&amp;&amp;bubbles[i][j+1].color==c&amp;&amp;bubbles[i][j+1].vi==0){\n                blast[c4].a=i;\n                blast[c4].b=j+1;\n                bubbles[i][j+1].vi=1;\n                c4++;\n                dfs(i,j+1,c);\n            }\n        }\n        if(j=0){\n            if(bubbles[i+1][j].v==1&amp;&amp;bubbles[i+1][j].color==c&amp;&amp;bubbles[i+1][j].vi==0){\n                blast[c4].a=i+1;\n                blast[c4].b=j;\n                bubbles[i+1][j].vi=1;\n                c4++;\n                dfs(i+1,j,c);\n            }\n            if(bubbles[i][j+1].v==1&amp;&amp;bubbles[i][j+1].color==c&amp;&amp;bubbles[i][j+1].vi==0){\n                blast[c4].a=i;\n                blast[c4].b=j+1;\n                bubbles[i][j+1].vi=1;\n                c4++;\n                dfs(i,j+1,c);\n            }\n        }\n        if(j=11){\n            if(bubbles[i+1][j-1].v==1&amp;&amp;bubbles[i+1][j-1].color==c&amp;&amp;bubbles[i+1][j-1].vi==0){\n                blast[c4].a=i+1;\n                blast[c4].b=j-1;\n                bubbles[i+1][j-1].vi=1;\n                c4++;\n                dfs(i+1,j-1,c);\n            }\n            if(bubbles[i][j-1].v==1&amp;&amp;bubbles[i][j-1].color==c&amp;&amp;bubbles[i][j-1].vi==0){\n                blast[c4].a=i;\n                blast[c4].b=j-1;\n                bubbles[i][j-1].vi=1;\n                c4++;\n                dfs(i,j-1,c);\n            }\n        }\n            }\n        else if(j&gt;0 &amp;&amp; j&lt;11){\n            if(bubbles[i-1][j-1].v==1&amp;&amp;bubbles[i-1][j-1].color==c&amp;&amp;bubbles[i-1][j-1].vi==0){\n                blast[c4].a=i-1;\n                blast[c4].b=j-1;\n                bubbles[i-1][j-1].vi=1;\n                c4++;\n                dfs(i-1,j-1,c);\n            }\n            if(bubbles[i-1][j].v==1&amp;&amp;bubbles[i-1][j].color==c&amp;&amp;bubbles[i-1][j].vi==0){\n                blast[c4].a=i-1;\n                blast[c4].b=j;\n                bubbles[i-1][j].vi=1;\n                c4++;\n                dfs(i-1,j,c);\n            }\n            if(bubbles[i+1][j-1].v==1&amp;&amp;bubbles[i+1][j-1].color==c&amp;&amp;bubbles[i+1][j-1].vi==0){\n                blast[c4].a=i+1;\n                blast[c4].b=j-1;\n                bubbles[i+1][j-1].vi=1;\n                c4++;\n                dfs(i+1,j-1,c);\n            }\n            if(bubbles[i+1][j].v==1&amp;&amp;bubbles[i+1][j].color==c&amp;&amp;bubbles[i+1][j].vi==0){\n                blast[c4].a=i+1;\n                blast[c4].b=j;\n                bubbles[i+1][j].vi=1;\n                c4++;\n                dfs(i+1,j,c);\n            }\n            if(bubbles[i][j-1].v==1&amp;&amp;bubbles[i][j-1].color==c&amp;&amp;bubbles[i][j-1].vi==0){\n                blast[c4].a=i;\n                blast[c4].b=j-1;\n                bubbles[i][j-1].vi=1;\n                c4++;\n                dfs(i,j-1,c);\n            }\n            if(bubbles[i][j+1].v==1&amp;&amp;bubbles[i][j+1].color==c&amp;&amp;bubbles[i][j+1].vi==0){\n                blast[c4].a=i;\n                blast[c4].b=j+1;\n                bubbles[i][j+1].vi=1;\n                c4++;\n                dfs(i,j+1,c);\n            }\n        }\n        if(j=0){\n            if(bubbles[i-1][j].v==1&amp;&amp;bubbles[i-1][j].color==c&amp;&amp;bubbles[i-1][j].vi==0){\n                blast[c4].a=i-1;\n                blast[c4].b=j;\n                bubbles[i-1][j].vi=1;\n                c4++;\n                dfs(i-1,j,c);\n            }\n            if(bubbles[i+1][j].v==1&amp;&amp;bubbles[i+1][j].color==c&amp;&amp;bubbles[i+1][j].vi==0){\n                blast[c4].a=i+1;\n                blast[c4].b=j;\n                bubbles[i+1][j].vi=1;\n                c4++;\n                dfs(i+1,j,c);\n            }\n            if(bubbles[i][j+1].v==1&amp;&amp;bubbles[i][j+1].color==c&amp;&amp;bubbles[i][j+1].vi==0){\n                blast[c4].a=i;\n                blast[c4].b=j+1;\n                bubbles[i][j+1].vi=1;\n                c4++;\n                dfs(i,j+1,c);\n            }\n        }\n        if(j=11){\n            if(bubbles[i-1][j-1].v==1&amp;&amp;bubbles[i-1][j-1].color==c&amp;&amp;bubbles[i-1][j-1].vi==0){\n                blast[c4].a=i-1;\n                blast[c4].b=j-1;\n                bubbles[i-1][j-1].vi=1;\n                c4++;\n                dfs(i-1,j-1,c);\n            }\n            if(bubbles[i+1][j-1].v==1&amp;&amp;bubbles[i+1][j-1].color==c&amp;&amp;bubbles[i+1][j-1].vi==0){\n                blast[c4].a=i+1;\n                blast[c4].b=j-1;\n                bubbles[i+1][j-1].vi=1;\n                c4++;\n                dfs(i+1,j-1,c);\n            }\n            if(bubbles[i][j-1].v==1&amp;&amp;bubbles[i][j-1].color==c&amp;&amp;bubbles[i][j-1].vi==0){\n                blast[c4].a=i;\n                blast[c4].b=j-1;\n                bubbles[i][j-1].vi=1;\n                c4++;\n                dfs(i,j-1,c);\n            }\n        }\n    }\n    else{\n        if(j&gt;0 &amp;&amp; j&lt;10){\n            if(bubbles[i-1][j+1].v==1&amp;&amp;bubbles[i-1][j+1].color==c&amp;&amp;bubbles[i-1][j+1].vi==0){\n                blast[c4].a=i-1;\n                blast[c4].b=j+1;\n                bubbles[i-1][j+1].vi=1;\n                c4++;\n                dfs(i-1,j+1,c);\n            }\n            if(bubbles[i-1][j].v==1&amp;&amp;bubbles[i-1][j].color==c&amp;&amp;bubbles[i-1][j].vi==0){\n                blast[c4].a=i-1;\n                blast[c4].b=j;\n                bubbles[i-1][j].vi=1;\n                c4++;\n                dfs(i-1,j,c);\n            }\n            if(bubbles[i+1][j+1].v==1&amp;&amp;bubbles[i+1][j+1].color==c&amp;&amp;bubbles[i+1][j+1].vi==0){\n                blast[c4].a=i+1;\n                blast[c4].b=j+1;\n                bubbles[i+1][j+1].vi=1;\n                c4++;\n                dfs(i+1,j+1,c);\n            }\n            if(bubbles[i+1][j].v==1&amp;&amp;bubbles[i+1][j].color==c&amp;&amp;bubbles[i+1][j].vi==0){\n                 blast[c4].a=i+1;\n                blast[c4].b=j;\n                bubbles[i+1][j].vi=1;\n                c4++;\n                dfs(i+1,j,c);\n            }\n            if(bubbles[i][j-1].v==1&amp;&amp;bubbles[i][j-1].color==c&amp;&amp;bubbles[i][j-1].vi==0){\n                blast[c4].a=i;\n                blast[c4].b=j-1;\n                bubbles[i][j-1].vi=1;\n                c4++;\n                dfs(i,j-1,c);\n            }\n            if(bubbles[i][j+1].v==1&amp;&amp;bubbles[i][j+1].color==c&amp;&amp;bubbles[i][j+1].vi==0){\n                blast[c4].a=i;\n                blast[c4].b=j+1;\n                bubbles[i][j+1].vi=1;\n                c4++;\n                dfs(i,j+1,c);\n            }\n        }\n        if(j=0){\n            if(bubbles[i-1][j+1].v==1&amp;&amp;bubbles[i-1][j+1].color==c&amp;&amp;bubbles[i-1][j+1].vi==0){\n                blast[c4].a=i-1;\n                blast[c4].b=j+1;\n                bubbles[i-1][j+1].vi=1;\n                c4++;\n                dfs(i-1,j+1,c);\n            }\n            if(bubbles[i-1][j].v==1&amp;&amp;bubbles[i-1][j].color==c&amp;&amp;bubbles[i-1][j].vi==0){\n                blast[c4].a=i-1;\n                blast[c4].b=j;\n                bubbles[i-1][j].vi=1;\n                c4++;\n                dfs(i-1,j,c);\n            }\n            if(bubbles[i+1][j+1].v==1&amp;&amp;bubbles[i+1][j+1].color==c&amp;&amp;bubbles[i+1][j+1].vi==0){\n                 blast[c4].a=i+1;\n                blast[c4].b=j+1;\n                bubbles[i+1][j+1].vi=1;\n                c4++;\n                dfs(i+1,j+1,c);\n            }\n            if(bubbles[i+1][j].v==1&amp;&amp;bubbles[i+1][j].color==c&amp;&amp;bubbles[i+1][j].vi==0){\n                blast[c4].a=i+1;\n                blast[c4].b=j;\n                bubbles[i+1][j].vi=1;\n                c4++;\n                dfs(i+1,j,c);\n            }\n            if(bubbles[i][j+1].v==1&amp;&amp;bubbles[i][j+1].color==c&amp;&amp;bubbles[i][j+1].vi==0){\n                blast[c4].a=i;\n                blast[c4].b=j+1;\n                bubbles[i][j+1].vi=1;\n                c4++;\n                dfs(i,j+1,c);\n            }\n        }\n        if(j=10){\n            if(bubbles[i-1][j+1].v==1&amp;&amp;bubbles[i-1][j+1].color==c&amp;&amp;bubbles[i-1][j+1].vi==0){\n                blast[c4].a=i-1;\n                blast[c4].b=j+1;\n                bubbles[i-1][j+1].vi=1;\n                c4++;\n                dfs(i-1,j+1,c);\n            }\n            if(bubbles[i-1][j].v==1&amp;&amp;bubbles[i-1][j].color==c&amp;&amp;bubbles[i-1][j].vi==0){\n                blast[c4].a=i-1;\n                blast[c4].b=j;\n                bubbles[i-1][j].vi=1;\n                c4++;\n                dfs(i-1,j,c);\n            }\n            if(bubbles[i+1][j+1].v==1&amp;&amp;bubbles[i+1][j+1].color==c&amp;&amp;bubbles[i+1][j+1].vi==0){\n                 blast[c4].a=i+1;\n                blast[c4].b=j+1;\n                bubbles[i+1][j+1].vi=1;\n                c4++;\n                dfs(i+1,j+1,c);\n            }\n            if(bubbles[i+1][j].v==1&amp;&amp;bubbles[i+1][j].color==c&amp;&amp;bubbles[i+1][j].vi==0){\n                blast[c4].a=i+1;\n                blast[c4].b=j;\n                bubbles[i+1][j].vi=1;\n                c4++;\n                dfs(i+1,j,c);\n            }\n            if(bubbles[i][j-1].v==1&amp;&amp;bubbles[i][j-1].color==c&amp;&amp;bubbles[i][j-1].vi==0){\n                blast[c4].a=i;\n                blast[c4].b=j-1;\n                bubbles[i][j-1].vi=1;\n                c4++;\n                dfs(i,j-1,c);\n            }\n        }\n    }\n}\n\nvoid dfs1(int i,int j){\n    if(i==0){\n                flt=false;\n            }\n    if(i%2==0){\n            if(i==0){\n                if(j&gt;0 &amp;&amp; j&lt;11){\n            if(bubbles[i+1][j-1].v==1&amp;&amp;bubbles[i+1][j-1].vi==0){\n\n                blast[c4].a=i+1;\n                blast[c4].b=j-1;\n                bubbles[i+1][j-1].vi=1;\n                c4++;\n                dfs1(i+1,j-1);\n            }\n            if(bubbles[i+1][j].v==1&amp;&amp;bubbles[i+1][j].vi==0){\n\n                blast[c4].a=i+1;\n                blast[c4].b=j;\n                bubbles[i+1][j].vi=1;\n                c4++;\n                dfs1(i+1,j);\n            }\n            if(bubbles[i][j-1].v==1&amp;&amp;bubbles[i][j-1].vi==0){\n\n                blast[c4].a=i;\n                blast[c4].b=j-1;\n                bubbles[i][j-1].vi=1;\n                c4++;\n                dfs1(i,j-1);\n            }\n            if(bubbles[i][j+1].v==1&amp;&amp;bubbles[i][j+1].vi==0){\n\n                blast[c4].a=i;\n                blast[c4].b=j+1;\n                bubbles[i][j+1].vi=1;\n                c4++;\n                dfs1(i,j+1);\n            }\n        }\n        if(j=0){\n            if(bubbles[i+1][j].v==1&amp;&amp;bubbles[i+1][j].vi==0){\n\n                blast[c4].a=i+1;\n                blast[c4].b=j;\n                bubbles[i+1][j].vi=1;\n                c4++;\n                dfs1(i+1,j);\n            }\n            if(bubbles[i][j+1].v==1&amp;&amp;bubbles[i][j+1].vi==0){\n\n                blast[c4].a=i;\n                blast[c4].b=j+1;\n                bubbles[i][j+1].vi=1;\n                c4++;\n                dfs1(i,j+1);\n            }\n        }\n        if(j=11){\n            if(bubbles[i+1][j-1].v==1&amp;&amp;bubbles[i+1][j-1].vi==0){\n                blast[c4].a=i+1;\n                blast[c4].b=j-1;\n                bubbles[i+1][j-1].vi=1;\n                c4++;\n                dfs1(i+1,j-1);\n            }\n            if(bubbles[i][j-1].v==1&amp;&amp;bubbles[i][j-1].vi==0){\n                blast[c4].a=i;\n                blast[c4].b=j-1;\n                bubbles[i][j-1].vi=1;\n                c4++;\n                dfs1(i,j-1);\n            }\n        }\n            }\n        else if(j&gt;0 &amp;&amp; j&lt;11){\n            if(bubbles[i-1][j-1].v==1&amp;&amp;bubbles[i-1][j-1].vi==0){\n\n                blast[c4].a=i-1;\n                blast[c4].b=j-1;\n                bubbles[i-1][j-1].vi=1;\n                c4++;\n                dfs1(i-1,j-1);\n            }\n            if(bubbles[i-1][j].v==1&amp;&amp;bubbles[i-1][j].vi==0){\n\n                blast[c4].a=i-1;\n                blast[c4].b=j;\n                bubbles[i-1][j].vi=1;\n                c4++;\n                dfs1(i-1,j);\n            }\n            if(bubbles[i+1][j-1].v==1&amp;&amp;bubbles[i+1][j-1].vi==0){\n\n                blast[c4].a=i+1;\n                blast[c4].b=j-1;\n                bubbles[i+1][j-1].vi=1;\n                c4++;\n                dfs1(i+1,j-1);\n            }\n            if(bubbles[i+1][j].v==1&amp;&amp;bubbles[i+1][j].vi==0){\n\n                blast[c4].a=i+1;\n                blast[c4].b=j;\n                bubbles[i+1][j].vi=1;\n                c4++;\n                dfs1(i+1,j);\n            }\n            if(bubbles[i][j-1].v==1&amp;&amp;bubbles[i][j-1].vi==0){\n\n                blast[c4].a=i;\n                blast[c4].b=j-1;\n                bubbles[i][j-1].vi=1;\n                c4++;\n                dfs1(i,j-1);\n            }\n            if(bubbles[i][j+1].v==1&amp;&amp;bubbles[i][j+1].vi==0){\n\n                blast[c4].a=i;\n                blast[c4].b=j+1;\n                bubbles[i][j+1].vi=1;\n                c4++;\n                dfs1(i,j+1);\n            }\n        }\n        if(j=0){\n            if(bubbles[i-1][j].v==1&amp;&amp;bubbles[i-1][j].vi==0){\n\n                blast[c4].a=i-1;\n                blast[c4].b=j;\n                bubbles[i-1][j].vi=1;\n                c4++;\n                dfs1(i-1,j);\n            }\n            if(bubbles[i+1][j].v==1&amp;&amp;bubbles[i+1][j].vi==0){\n\n                blast[c4].a=i+1;\n                blast[c4].b=j;\n                bubbles[i+1][j].vi=1;\n                c4++;\n                dfs1(i+1,j);\n            }\n            if(bubbles[i][j+1].v==1&amp;&amp;bubbles[i][j+1].vi==0){\n\n                blast[c4].a=i;\n                blast[c4].b=j+1;\n                bubbles[i][j+1].vi=1;\n                c4++;\n                dfs1(i,j+1);\n            }\n        }\n        if(j=11){\n            if(bubbles[i-1][j-1].v==1&amp;&amp;bubbles[i-1][j-1].vi==0){\n\n                blast[c4].a=i-1;\n                blast[c4].b=j-1;\n                bubbles[i-1][j-1].vi=1;\n                c4++;\n                dfs1(i-1,j-1);\n            }\n            if(bubbles[i+1][j-1].v==1&amp;&amp;bubbles[i+1][j-1].vi==0){\n                blast[c4].a=i+1;\n                blast[c4].b=j-1;\n                bubbles[i+1][j-1].vi=1;\n                c4++;\n                dfs1(i+1,j-1);\n            }\n            if(bubbles[i][j-1].v==1&amp;&amp;bubbles[i][j-1].vi==0){\n                blast[c4].a=i;\n                blast[c4].b=j-1;\n                bubbles[i][j-1].vi=1;\n                c4++;\n                dfs1(i,j-1);\n            }\n        }\n    }\n    else{\n        if(j&gt;0 &amp;&amp; j&lt;10){\n            if(bubbles[i-1][j+1].v==1&amp;&amp;bubbles[i-1][j+1].vi==0){\n                blast[c4].a=i-1;\n                blast[c4].b=j+1;\n                bubbles[i-1][j+1].vi=1;\n                c4++;\n                dfs1(i-1,j+1);\n            }\n            if(bubbles[i-1][j].v==1&amp;&amp;bubbles[i-1][j].vi==0){\n                blast[c4].a=i-1;\n                blast[c4].b=j;\n                bubbles[i-1][j].vi=1;\n                c4++;\n                dfs1(i-1,j);\n            }\n            if(bubbles[i+1][j+1].v==1&amp;&amp;bubbles[i+1][j+1].vi==0){\n                blast[c4].a=i+1;\n                blast[c4].b=j+1;\n                bubbles[i+1][j+1].vi=1;\n                c4++;\n                dfs1(i+1,j+1);\n            }\n            if(bubbles[i+1][j].v==1&amp;&amp;bubbles[i+1][j].vi==0){\n                 blast[c4].a=i+1;\n                blast[c4].b=j;\n                bubbles[i+1][j].vi=1;\n                c4++;\n                dfs1(i+1,j);\n            }\n            if(bubbles[i][j-1].v==1&amp;&amp;bubbles[i][j-1].vi==0){\n                blast[c4].a=i;\n                blast[c4].b=j-1;\n                bubbles[i][j-1].vi=1;\n                c4++;\n                dfs1(i,j-1);\n            }\n            if(bubbles[i][j+1].v==1&amp;&amp;bubbles[i][j+1].vi==0){\n                blast[c4].a=i;\n                blast[c4].b=j+1;\n                bubbles[i][j+1].vi=1;\n                c4++;\n                dfs1(i,j+1);\n            }\n        }\n        if(j=0){\n            if(bubbles[i-1][j+1].v==1&amp;&amp;bubbles[i-1][j+1].vi==0){\n                blast[c4].a=i-1;\n                blast[c4].b=j+1;\n                bubbles[i-1][j+1].vi=1;\n                c4++;\n                dfs1(i-1,j+1);\n            }\n            if(bubbles[i-1][j].v==1&amp;&amp;bubbles[i-1][j].vi==0){\n                blast[c4].a=i-1;\n                blast[c4].b=j;\n                bubbles[i-1][j].vi=1;\n                c4++;\n                dfs1(i-1,j);\n            }\n            if(bubbles[i+1][j+1].v==1&amp;&amp;bubbles[i+1][j+1].vi==0){\n                 blast[c4].a=i+1;\n                blast[c4].b=j+1;\n                bubbles[i+1][j+1].vi=1;\n                c4++;\n                dfs1(i+1,j+1);\n            }\n            if(bubbles[i+1][j].v==1&amp;&amp;bubbles[i+1][j].vi==0){\n                blast[c4].a=i+1;\n                blast[c4].b=j;\n                bubbles[i+1][j].vi=1;\n                c4++;\n                dfs1(i+1,j);\n            }\n            if(bubbles[i][j+1].v==1&amp;&amp;bubbles[i][j+1].vi==0){\n                blast[c4].a=i;\n                blast[c4].b=j+1;\n                bubbles[i][j+1].vi=1;\n                c4++;\n                dfs1(i,j+1);\n            }\n        }\n        if(j=10){\n            if(bubbles[i-1][j+1].v==1&amp;&amp;bubbles[i-1][j+1].vi==0){\n                blast[c4].a=i-1;\n                blast[c4].b=j+1;\n                bubbles[i-1][j+1].vi=1;\n                c4++;\n                dfs1(i-1,j+1);\n            }\n            if(bubbles[i-1][j].v==1&amp;&amp;bubbles[i-1][j].vi==0){\n                blast[c4].a=i-1;\n                blast[c4].b=j;\n                bubbles[i-1][j].vi=1;\n                c4++;\n                dfs1(i-1,j);\n            }\n            if(bubbles[i+1][j+1].v==1&amp;&amp;bubbles[i+1][j+1].vi==0){\n                 blast[c4].a=i+1;\n                blast[c4].b=j+1;\n                bubbles[i+1][j+1].vi=1;\n                c4++;\n                dfs1(i+1,j+1);\n            }\n            if(bubbles[i+1][j].v==1&amp;&amp;bubbles[i+1][j].vi==0){\n                blast[c4].a=i+1;\n                blast[c4].b=j;\n                bubbles[i+1][j].vi=1;\n                c4++;\n                dfs1(i+1,j);\n            }\n            if(bubbles[i][j-1].v==1&amp;&amp;bubbles[i][j-1].vi==0){\n                blast[c4].a=i;\n                blast[c4].b=j-1;\n                bubbles[i][j-1].vi=1;\n                c4++;\n                dfs1(i,j-1);\n            }\n        }\n    }\n}\n\nvoid remove1(){\n    sc+=c4;\n        for(int i=0;i&lt;c4;i++){\n        bubbles[blast[i].a][blast[i].b].v=0;\n\n    }\n}\n\nvoid float1(){\n    c4=0;\n    for(int j=0;j&lt;15;j++){\n        if(j%2==0){\n            for(int i=0;i&lt;12;i++){\n                    if(bubbles[j][i].vi==0){\n                c4=0;\n                flt=true;\n                dfs1(j,i);\n\n                if(flt){\n                    remove1();\n                }\n            }}\n        }\n       else{\n            for(int i=0;i&lt;11;i++){\n                if(bubbles[j][i].vi==0){\n                c4=0;\n                flt=true;\n                dfs1(j,i);\n                if(flt){\n                    remove1();\n                }\n            }\n            }\n       }\n    }\n}\n\nvoid burst(int i,int j,int c){\n    c4=0;\n    blast[c4].a=i;\n    blast[c4].b=j;\n    bubbles[i][j].vi=1;\n    c4++;\n    dfs(i,j,c);\n\n    if(c4&gt;=3){\n    remove1();\n    for(int j=0;j&lt;15;j++){\n        if(j%2==0){\n            for(int i=0;i&lt;12;i++){\n                bubbles[j][i].vi=0;\n            }\n        }\n       else{\n            for(int i=0;i&lt;11;i++){\n                bubbles[j][i].vi=0;\n            }\n       }\n    }\n    float1();}\n    for(int j=0;j&lt;15;j++){\n        if(j%2==0){\n            for(int i=0;i&lt;12;i++){\n                bubbles[j][i].vi=0;\n            }\n        }\n       else{\n            for(int i=0;i&lt;11;i++){\n                bubbles[j][i].vi=0;\n            }\n       }\n    }\n    glutPostRedisplay();\n}\n\nvoid get_score()\n{\n    int a[10];\n    a[0]=0;\n    int c=0;\n    int ss=sc;\n    if(sc==0) c=1;\n    for(int i=0;ss!=0;i++)\n    {\n        a[i]=ss%10;\n        ss=ss\/10;\n        c++;\n    }\n    glColor3f(0,0,0);\n    glRasterPos2d(330,170);\n    glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24,'S');\n    glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24,'C');\n    glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24,'O');\n    glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24,'R');\n    glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24,'E');\n    glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24,':');\n    \/\/ glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24,'-');\n    for(int i=c-1;i&gt;=0;i--)\n    {\n         glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24,48+a[i]);\n    }\n    glFlush();\n}\n\nstatic void key(int key, int x1, int y1)\n{\n    switch(key){\n        case GLUT_KEY_LEFT : if(x&gt;20&amp;&amp;reset==1) {xs-=220;x=xs;glutPostRedisplay();}break;\n        case GLUT_KEY_RIGHT : if(x&lt;460&amp;&amp;reset==1) {xs+=220;x=xs;glutPostRedisplay();}break;\n        \/\/case GLUT_KEY_UP : calculate();break;\n    }\n    glutPostRedisplay();\n}\n\nvoid mouse(int x1,int y1){\n    if(max2&gt;212){\n    xl=x1;yl=y1;glutPostRedisplay();}\n}\n\nvoid drawline_between_two_points(int x1,int y1){\n     theta=atan2((640-(double)y1-20),((double)x1-xs));\n     \/\/if(theta&gt;1.570796325 &amp;&amp; theta&lt;4.712388975 ){\n     if(theta&gt;rbound){\n        theta=rbound;\n     }\n     \/\/else{\n     if(theta&lt;lbound){\n        theta=lbound;\n     }\n    double x2=xs+(100*cos(theta)),y2=20+(100*sin(theta));\n    glLineWidth(3);\n    glBegin(GL_LINES);\n        glVertex2d(xs,20);\n        glVertex2d(x2,y2);\n    glEnd();\n    glFlush();\n}\n\nvoid timer(int val){\n    if(y&lt;max1){\n        x+=10*cos(theta1);\n        y+=10*sin(theta1);\n    }\n    else{\n        y=max1;\n        if((((620-max1)\/34)-1)%2==0){\n                int c2=0;\n        for(int i=0;i&lt;12;i++){\n\n                c2++;\n                \/\/if(bubbles[(620-max1)\/34][i].v==1){\n            x3=(i*40)+20-x;\n            y3=34;\n            len = sqrt(x3*x3+y3*y3);\n            if(bubbles[((620-max1)\/34)-1][i].v==1){\n            if(len&lt;=40){\n                if(i==11){\n                    bubbles[(620-max1)\/34][10].v=1;\n                    bubbles[(620-max1)\/34][10].vi=0;\n                    bubbles[(620-max1)\/34][10].color=c1;\n                    burst((620-max1)\/34,10,c1);\n                }\n                else{\n                    if(bubbles[(620-max1)\/34][i].v==0){\n                    bubbles[(620-max1)\/34][i].v=1;\n                    bubbles[(620-max1)\/34][i].vi=0;\n                    bubbles[(620-max1)\/34][i].color=c1;\n                    burst((620-max1)\/34,i,c1);}\n                    else{\n                        bubbles[(620-max1)\/34][i-1].v=1;\n                        bubbles[(620-max1)\/34][i-1].vi=0;\n                    bubbles[(620-max1)\/34][i-1].color=c1;\n                    burst((620-max1)\/34,i-1,c1);\n                    }\n                }\n                reset=1;x=xs;y=0;c1=rand1()%5;c2=0;break;\n            }}\n        if(c2==12){\n            max1+=34;c2=0;\n        }\n        }}\n        else{\n            int c3=0;\n        for(int i=0;i&lt;11;i++){\n            c3++;\n            x3=(i*40)+40-x;\n            y3=34;\n            len = sqrt(x3*x3+y3*y3);\n            if(bubbles[((620-max1)\/34)-1][i].v==1){\n            if(len&lt;=40){\n                    if(bubbles[(620-max1)\/34][i+1].v==0){\n                bubbles[(620-max1)\/34][i+1].v=1;\n                bubbles[(620-max1)\/34][i+1].vi=0;\n                bubbles[(620-max1)\/34][i+1].color=c1;\n                burst((620-max1)\/34,i+1,c1);}\n                else{\n                bubbles[(620-max1)\/34][i].v=1;\n                bubbles[(620-max1)\/34][i].vi=0;\n                bubbles[(620-max1)\/34][i].color=c1;\n                burst((620-max1)\/34,i,c1);\n                }\n                reset=1;x=xs;y=0;c1=rand1()%5;c3=0;break;\n            }}\n            if(c3==11){\n            max1+=34;c3=0;\n\n        }\n        }\n        }\n    }\n    glutPostRedisplay();\n    points_to_go();\n}\n\nvoid game_over(){\n        \/\/glPointSize(10);\n        glColor3f(1.0,0,0);\n        glRasterPos2i(170,170);\n        if(ck!=5){\n        glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24,'G');\n        glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24,'A');\n        glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24,'M');\n        glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24,'E');\n        glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24,' ');\n        glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24,'O');\n        glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24,'V');\n        glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24,'E');\n        glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24,'R');}\n        else{\n        glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24,'C');\n        glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24,'O');\n        glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24,'N');\n        glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24,'G');\n        glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24,'R');\n        glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24,'A');\n        glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24,'T');\n        glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24,'S');\n        }\n        glFlush();\n}\n\n\nvoid mymouse(int button,int state,int x1,int y1){\n    if(button==GLUT_LEFT_BUTTON&amp;&amp;state==GLUT_DOWN){\n           \/\/ cout &lt;&lt; max2 &lt;&lt; endl;\n        if(max2&lt;=212){\n            gover=true;\n\n        }\n        if(!gover){\n        theta1=theta;\n        reset=0;\n        max1=max2;\n        points_to_go();}\n    }\n    if(button==GLUT_RIGHT_BUTTON&amp;&amp;state==GLUT_DOWN){\n\n    }\n}\n\nvoid points_to_go(){\n    if(x&lt;20){x=20;theta1=PI-theta1;}\n    if(x&gt;460){x=460;theta1=PI-theta1;}\n    if(y&gt;620){\n        y=620;\n        double temp=(x-20)\/40;\n        x=(int)temp;\n        if(temp-x&gt;=0.5){\n            x++;\n        }\n        bubbles[0][x].v=1;\n        bubbles[0][x].color=c1;\n        reset=1;x=xs;y=0;c1=rand1()%5;\n    }\n    if(reset==0)\n        glutTimerFunc(1,timer,0);\n}\n\nstatic void idle(void)\n{\n    glutPostRedisplay();\n}\n\n\n\nint main(int argc, char *argv[])\n{\n    glutInit(&amp;argc, argv);\n    glutInitWindowSize(480,640);\n    glutInitWindowPosition(10,10);\n    glutInitDisplayMode(GLUT_RGB | GLUT_SINGLE);\n\n    glutCreateWindow(&quot;Bubble Shooter&quot;);\n    inits();\n    glutDisplayFunc(display);\n    glutSpecialFunc(key);\n    glutMouseFunc(mymouse);\n    glutPassiveMotionFunc(mouse);\n    glClearColor(0,0,0,1);\n    gluOrtho2D(0,480,0,640);\n    glutMainLoop();\n    return EXIT_SUCCESS;\n}<\/pre><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Today, I will show you how to create a 2D bubble shooter game using C++ and OpenGL. This program will definitely help you learn C++ game development. The complete source code of the 2D Bubble Shooter Game written in C++ is given below. C++ Bubble Shooter Game Code code.cpp<\/p>\n","protected":false},"author":1,"featured_media":1762,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[112],"tags":[],"class_list":["post-3053","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutorials"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>C++ OpenGL 2D Bubble Shooter Game Source Code<\/title>\n<meta name=\"description\" content=\"Today, I will show you how to create a 2D bubble shooter game using C++ and OpenGL. This program will definitely help you learn C++ game development. The\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.edopedia.com\/blog\/cpp-opengl-2d-bubble-shooter-game-source-code\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"C++ OpenGL 2D Bubble Shooter Game Source Code\" \/>\n<meta property=\"og:description\" content=\"Today, I will show you how to create a 2D bubble shooter game using C++ and OpenGL. This program will definitely help you learn C++ game development. The\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.edopedia.com\/blog\/cpp-opengl-2d-bubble-shooter-game-source-code\/\" \/>\n<meta property=\"og:site_name\" content=\"Edopedia\" \/>\n<meta property=\"article:author\" content=\"trulyfurqan\" \/>\n<meta property=\"article:published_time\" content=\"2022-09-09T09:46:51+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-09-09T09:46:52+00:00\" \/>\n<meta name=\"author\" content=\"Furqan\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Furqan\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"C++ OpenGL 2D Bubble Shooter Game Source Code","description":"Today, I will show you how to create a 2D bubble shooter game using C++ and OpenGL. This program will definitely help you learn C++ game development. The","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.edopedia.com\/blog\/cpp-opengl-2d-bubble-shooter-game-source-code\/","og_locale":"en_US","og_type":"article","og_title":"C++ OpenGL 2D Bubble Shooter Game Source Code","og_description":"Today, I will show you how to create a 2D bubble shooter game using C++ and OpenGL. This program will definitely help you learn C++ game development. The","og_url":"https:\/\/www.edopedia.com\/blog\/cpp-opengl-2d-bubble-shooter-game-source-code\/","og_site_name":"Edopedia","article_author":"trulyfurqan","article_published_time":"2022-09-09T09:46:51+00:00","article_modified_time":"2022-09-09T09:46:52+00:00","author":"Furqan","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Furqan","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.edopedia.com\/blog\/cpp-opengl-2d-bubble-shooter-game-source-code\/#article","isPartOf":{"@id":"https:\/\/www.edopedia.com\/blog\/cpp-opengl-2d-bubble-shooter-game-source-code\/"},"author":{"name":"Furqan","@id":"https:\/\/www.edopedia.com\/blog\/#\/schema\/person\/3951cb19e3aa56df09e408c98aa02339"},"headline":"C++ OpenGL 2D Bubble Shooter Game Source Code","datePublished":"2022-09-09T09:46:51+00:00","dateModified":"2022-09-09T09:46:52+00:00","mainEntityOfPage":{"@id":"https:\/\/www.edopedia.com\/blog\/cpp-opengl-2d-bubble-shooter-game-source-code\/"},"wordCount":58,"commentCount":0,"publisher":{"@id":"https:\/\/www.edopedia.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.edopedia.com\/blog\/cpp-opengl-2d-bubble-shooter-game-source-code\/#primaryimage"},"thumbnailUrl":"https:\/\/www.edopedia.com\/blog\/wp-content\/uploads\/2022\/02\/default_featured_image.jpg","articleSection":["Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.edopedia.com\/blog\/cpp-opengl-2d-bubble-shooter-game-source-code\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.edopedia.com\/blog\/cpp-opengl-2d-bubble-shooter-game-source-code\/","url":"https:\/\/www.edopedia.com\/blog\/cpp-opengl-2d-bubble-shooter-game-source-code\/","name":"C++ OpenGL 2D Bubble Shooter Game Source Code","isPartOf":{"@id":"https:\/\/www.edopedia.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.edopedia.com\/blog\/cpp-opengl-2d-bubble-shooter-game-source-code\/#primaryimage"},"image":{"@id":"https:\/\/www.edopedia.com\/blog\/cpp-opengl-2d-bubble-shooter-game-source-code\/#primaryimage"},"thumbnailUrl":"https:\/\/www.edopedia.com\/blog\/wp-content\/uploads\/2022\/02\/default_featured_image.jpg","datePublished":"2022-09-09T09:46:51+00:00","dateModified":"2022-09-09T09:46:52+00:00","description":"Today, I will show you how to create a 2D bubble shooter game using C++ and OpenGL. This program will definitely help you learn C++ game development. The","breadcrumb":{"@id":"https:\/\/www.edopedia.com\/blog\/cpp-opengl-2d-bubble-shooter-game-source-code\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.edopedia.com\/blog\/cpp-opengl-2d-bubble-shooter-game-source-code\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.edopedia.com\/blog\/cpp-opengl-2d-bubble-shooter-game-source-code\/#primaryimage","url":"https:\/\/www.edopedia.com\/blog\/wp-content\/uploads\/2022\/02\/default_featured_image.jpg","contentUrl":"https:\/\/www.edopedia.com\/blog\/wp-content\/uploads\/2022\/02\/default_featured_image.jpg","width":880,"height":495,"caption":"Default Featured Image"},{"@type":"BreadcrumbList","@id":"https:\/\/www.edopedia.com\/blog\/cpp-opengl-2d-bubble-shooter-game-source-code\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.edopedia.com\/blog\/"},{"@type":"ListItem","position":2,"name":"C++ OpenGL 2D Bubble Shooter Game Source Code"}]},{"@type":"WebSite","@id":"https:\/\/www.edopedia.com\/blog\/#website","url":"https:\/\/www.edopedia.com\/blog\/","name":"Edopedia","description":"Coding\/Programming Blog","publisher":{"@id":"https:\/\/www.edopedia.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.edopedia.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.edopedia.com\/blog\/#organization","name":"Edopedia","url":"https:\/\/www.edopedia.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.edopedia.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.edopedia.com\/blog\/wp-content\/uploads\/2017\/10\/edopedia_icon_text_10.jpg","contentUrl":"https:\/\/www.edopedia.com\/blog\/wp-content\/uploads\/2017\/10\/edopedia_icon_text_10.jpg","width":400,"height":100,"caption":"Edopedia"},"image":{"@id":"https:\/\/www.edopedia.com\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.edopedia.com\/blog\/#\/schema\/person\/3951cb19e3aa56df09e408c98aa02339","name":"Furqan","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/e5e68aef3ad8f0b83d56f4953c512c8e57bd2e6dc64daec33b5d0495d9058f51?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/e5e68aef3ad8f0b83d56f4953c512c8e57bd2e6dc64daec33b5d0495d9058f51?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/e5e68aef3ad8f0b83d56f4953c512c8e57bd2e6dc64daec33b5d0495d9058f51?s=96&d=mm&r=g","caption":"Furqan"},"description":"Well. I've been working for the past three years as a web designer and developer. I have successfully created websites for small to medium sized companies as part of my freelance career. During that time I've also completed my bachelor's in Information Technology.","sameAs":["http:\/\/www.edopedia.com\/blog\/","trulyfurqan"],"url":"https:\/\/www.edopedia.com\/blog\/author\/furqan\/"}]}},"_links":{"self":[{"href":"https:\/\/www.edopedia.com\/blog\/wp-json\/wp\/v2\/posts\/3053","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.edopedia.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.edopedia.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.edopedia.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.edopedia.com\/blog\/wp-json\/wp\/v2\/comments?post=3053"}],"version-history":[{"count":1,"href":"https:\/\/www.edopedia.com\/blog\/wp-json\/wp\/v2\/posts\/3053\/revisions"}],"predecessor-version":[{"id":3054,"href":"https:\/\/www.edopedia.com\/blog\/wp-json\/wp\/v2\/posts\/3053\/revisions\/3054"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.edopedia.com\/blog\/wp-json\/wp\/v2\/media\/1762"}],"wp:attachment":[{"href":"https:\/\/www.edopedia.com\/blog\/wp-json\/wp\/v2\/media?parent=3053"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.edopedia.com\/blog\/wp-json\/wp\/v2\/categories?post=3053"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.edopedia.com\/blog\/wp-json\/wp\/v2\/tags?post=3053"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}