Projects Inventory

Simulation of Computer Graphics Techniques Gaming Project in C++

Explanation:

  1. Initialization:
    • initWindow(SDL_Renderer** renderer): Initializes SDL, creates a window, and sets up a renderer. Handles errors and prints messages if initialization fails.
    • Advertisement
  2. Main Function:
    • Creates a window and renderer using initWindow()
      Advertisement
      .
    • Enters the main loop where it handles events (e.g., window close) and updates the graphics.
    • Clears the screen with a white color.
    • Draws a red rectangle using SDL_RenderFillRect().
    • Draws a blue circle by iterating over pixel coordinates and checking if they fall within the circle’s radius using the equation x2+y2≤r2x^2 + y^2 \leq r^2
      Advertisement
      .
    • Updates the screen with SDL_RenderPresent().
  3. Cleanup:
    • Destroys the renderer and window, and quits SDL before exiting the program.
Exit mobile version