Skip to content

2D simulation of mosquito behavior and dengue virus transmission using OpenGL and FreeGLUT.

Notifications You must be signed in to change notification settings

itsLatifur/Yellow-Fever-Awareness-Dengue-

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mosquito Simulation with Dengue Virus Transmission

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.


Features:

  • 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.

Requirements:

Software Dependencies:

  • 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.

Setting up the Development Environment:

To set up the development environment and run the project, follow these steps:

1. Install Code::Blocks:

  • Download and install Code::Blocks with MinGW from Code::Blocks download page.
  • Ensure that the MinGW compiler is installed along with Code::Blocks.

2. Install FreeGLUT:

  • Download FreeGLUT from the official website: FreeGLUT.
  • Extract the contents of the ZIP file into a folder on your system.

3. Set up FreeGLUT in Code::Blocks:

  1. Copy FreeGLUT Files:

    • From the extracted FreeGLUT folder, copy the freeglut.h file into the C:\Program Files\CodeBlocks\MinGW\include\GL directory.
    • Copy libfreeglut.a from the FreeGLUT lib folder to C:\Program Files\CodeBlocks\MinGW\lib.
  2. 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 (where freeglut.h is).
    • Under the Linker tab, add the path to the FreeGLUT lib folder (where libfreeglut.a is).
  3. 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.
  4. Add OpenGL to Linker:

    • Still in the Linker settings, add the following libraries:
      • -lGL
      • -lGLU
      • -lfreeglut

How to Run:

Steps to Run the Simulation:

  1. Download and Extract the ZIP:

    • Download the ZIP file containing the bin, obj, and .exe files along with the source code.
  2. Open the Project in Code::Blocks:

    • Open the dengue.cbp project file using Code::Blocks.
  3. Build the Project:

    • Press Ctrl + F9 or go to Build > Build to compile the project.
  4. Run the Executable:

    • Once the build is successful, run the simulation by pressing Ctrl + F10 or Build > Run.
  5. 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.

File Overview:

  • 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.

License:

This project is licensed under the MIT License - see the LICENSE file for details.


Acknowledgments:

  • OpenGL and FreeGLUT for rendering the 2D simulation.
  • The simulation concept was designed to visualize mosquito behavior and the spread of dengue.