This project simulates the behavior of mosquitoes, the spread of the dengue virus, and human infection. It uses OpenGL for rendering and FreeGLUT for window management. The simulation includes mosquito movement, breeding, interaction with water (for breeding), and a mosquito spray feature to reduce mosquito population. The program also tracks whether the human is infected with the dengue virus.
- Mosquito Behavior: Mosquitoes fly around the screen, can breed near water, and can land on a human to transmit the dengue virus.
- Human Interaction: The human can become infected by mosquitoes. There is also an option to heal the human or spray insect-killer to kill the mosquitoes.
- Water Level and Breeding: Mosquitoes breed near water in the bucket. The water level can be increased or decreased, influencing mosquito breeding.
- Graphics: Simple 2D graphics including the human figure, mosquitoes, trees, clouds, and water.
- Dengue Transmission: If a mosquito lands near the human, it infects them with the dengue virus.
- Code::Blocks: IDE for building and running the project.
- MinGW (Minimalist GNU for Windows): Compiler for C++.
- OpenGL: For rendering 2D graphics.
- FreeGLUT: OpenGL Utility Toolkit to manage the OpenGL window and user input.
To set up the development environment and run the project, follow these steps:
- Download and install Code::Blocks with MinGW from Code::Blocks download page.
- Ensure that the MinGW compiler is installed along with Code::Blocks.
- Download FreeGLUT from the official website: FreeGLUT.
- Extract the contents of the ZIP file into a folder on your system.
-
Copy FreeGLUT Files:
- From the extracted FreeGLUT folder, copy the
freeglut.h
file into theC:\Program Files\CodeBlocks\MinGW\include\GL
directory. - Copy
libfreeglut.a
from the FreeGLUTlib
folder toC:\Program Files\CodeBlocks\MinGW\lib
.
- From the extracted FreeGLUT folder, copy the
-
Add FreeGLUT Libraries to Code::Blocks:
- Open Code::Blocks.
- Go to Settings > Compiler and click on the Search directories tab.
- Under the Compiler tab, add the path to the FreeGLUT
include
folder (wherefreeglut.h
is). - Under the Linker tab, add the path to the FreeGLUT
lib
folder (wherelibfreeglut.a
is).
-
Link FreeGLUT Libraries:
- In Code::Blocks, open the project.
- Go to Project > Build options and select the Linker settings tab.
- Add
freeglut.a
to the list of libraries.
-
Add OpenGL to Linker:
- Still in the Linker settings, add the following libraries:
-lGL
-lGLU
-lfreeglut
- Still in the Linker settings, add the following libraries:
-
Download and Extract the ZIP:
- Download the ZIP file containing the
bin
,obj
, and.exe
files along with the source code.
- Download the ZIP file containing the
-
Open the Project in Code::Blocks:
- Open the
dengue.cbp
project file using Code::Blocks.
- Open the
-
Build the Project:
- Press
Ctrl + F9
or go to Build > Build to compile the project.
- Press
-
Run the Executable:
- Once the build is successful, run the simulation by pressing
Ctrl + F10
or Build > Run.
- Once the build is successful, run the simulation by pressing
-
Key Controls:
- w: Increase water in the bucket.
- d: Decrease water in the bucket.
- b: Breed mosquitoes if water is available.
- s: Spray insect-killer to kill mosquitoes.
- h: Heal human (reset infection).
- r: Reset the simulation.
- main.cpp: The C++ source code implementing the simulation logic and rendering.
- dengue.exe: The executable file for running the simulation.
- bin/: Folder containing compiled binaries.
- obj/: Folder containing object files generated during compilation.
- dengue.cbp: The Code::Blocks project file.
- dengue.layout: The layout file used by Code::Blocks.
This project is licensed under the MIT License - see the LICENSE file for details.
- OpenGL and FreeGLUT for rendering the 2D simulation.
- The simulation concept was designed to visualize mosquito behavior and the spread of dengue.