We can translate for U

Friday, December 14, 2018




///////////////////////////////////////////////////////////////
Code blocks IDE link: http://www.codeblocks.org
///////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////


~Instructions~


  • First download code blocks software.
  • First open code block official site which is www.codeblocks.org
  • Then click on download option
  • Click on “download the binary release” 
  • Download the code-blocks-mingw-setup.exe
  • Wait until it download 
  • Now install it 
  • Double click on code blocks setup 
  • Click on next next unless it start installing, don’t change installation path.
  • It will take some time for installation
  • how to download install code blocks
  • how to download and install code blocks
  • After installation, we need some header files to run graphics 
  • Click on the first link and download the file
  • Now extract the downloaded file 
  • # how to install code blocks
  • How to open the graphic.h file in notepad and go to line number 302 and replace the word right with top and save it as I show you
  • Now copy the graphics.h and wibgim.h file and paste in header file directory 
  • # how to install code blocks and how to run graphics program in code blocks 
  • Now copy the libbgi.a file and paste in code block’s lib folder
  • Now open code blocks and go to settings then compiler then linker setting 
  • Click on add button and browse libbgi.a file which is we copied in lib folder 
  • After that copy the command from the description and paste them in right section which is other linker option. Then click ok .
  • Now we are done 
  • Now try to run graphics program to check whether it is working or not
  • Program is build and run successfully 




Basic Graphic Programming in C++


Introduction
So far we have been using C language for simple console output only.  Most of us are unaware that using C++, low level graphics program can also be made. This means we can incorporate shapes,colors and designer fonts in our program. This article deals with the steps to enable the DevC++ compiler to generate graphics .
Configuring DevC++
  • Step 1: Download the DevC++ version 5.11 from here.
  • Step 2: Download the Graphics header files, and etc stuff needed from the given dropbox link.
  • Step 3: Extract the contents of the rar file.
  • Step 4: Go to the location where DevC++ is installed. For me its D drive. Go inside the MinGW64 folder. Copy the graphics.h and winbgim.h in the include folder and D:\Dev-Cpp\MinGW64\x86_64-w64-mingw32\include folder.
  • Step 5:Copy the libbgi.a file into lib folder and in D:\Dev-Cpp\MinGW64\x86_64-w64-mingw32\lib folder.
  • Step 6: Copy the ConsoleAppGraphics.template, ConsoleApp_cpp_graph.txt files and paste them inside the template folder of the devc++ installer location.
Now we are done with configuring of the DevC++ to support graphics programming. We shall write our very first graphics program now.
Running the first graphics program
  1. Open DevC++. Click file ->New ->Project.
  2. Make sure you get the Console Graphics option. However, we are not going to click on it.
  3. Choose Empty Project option and Give a project name and make sure the selected language is C++.
  4. Copy the following code to the editor window.
    #include<graphics.h>
    #include <conio.h>
    int main()
    {
        int gd = DETECT, gm;
        initgraph(&gd,&gm, "C:\\tc\\bgi");
        circle(300,300,50);
        closegraph();
        getch();
    }
    
    
  5. Go to “Project” menu and choose “Project Options” (or just press ALT+P).
  6. Go to the “Parameters” tab In the “Linker” field, enter the following text:
    -lbgi
    -lgdi32
    -lcomdlg32
    -luuid
    -loleaut32
    -lole32
    Basic Graphic Programming in C++
  7. Click OK and Compile and run the project and you’ll get this output:
Basic Graphic Programming in C++ 1
Program Explanation
  • The initgraph function- ?Initializes the graphics system.
  • In C Program execution starts with main() similarly Graphics Environment Starts with this function.
  • initgraph() initializes the graphics system by loading a graphics driver from disk (or validating a registered driver) then putting the system into graphics mode