Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 9

Computer Graphics Project Report

E-commerce Platform (Online Shopping website)

Submitted By

Sahil Manchanda (102103134)

Radhika Jasra (102103815)

Ridansh Kaul (102103818)

3COE-5

Submitted to - Ms. Jasmine Kaur


Computer Engineering Department
Abstract

Welcome to "Snek"! 🐍

"Snek" is a computer game based on the old snake game we used to play. It's made using C++ and
OpenGL, which help make the game look nice and run smoothly. In "Snek," you control a snake that
moves around a grid and eats food to get points. But be careful! If the snake runs into itself or the
edges of the game, it is game over. Each time the snake eats, it gets longer, making it harder to avoid
obstacles. "Snek" brings back the fun of the classic snake game in a modern way that is easy to enjoy.
TABLE OF CONTENTS

S.No. Topic Page No.


1 Introduction 3
2 Computer Graphics concepts used 3
3 User Defined Function 4-5

2
1. Introduction

"Snek" is a nostalgic journey back to the golden era of gaming, offering a modern twist on the classic
snake game we all know and love. Developed using C++ and OpenGL, this project brings the timeless
joy of guiding a snake through a grid-based world right to your desktop.

With captivating graphics and smooth gameplay mechanics, "Snek" challenges players to navigate
their snake through a maze, gobbling up food and growing longer with each bite. But beware of
colliding with yourself or the walls – one wrong move could mean game over!

Join us as we embark on an adventure filled with fun, nostalgia, and plenty of slithery action. Are you
ready to unleash your inner snake charmer? Let's dive into the world of "Snek" and see if you have

what it takes to conquer the grid! 🎮🐍

2. Computer Graphics concepts used

Concept Why was it used?


OpenGL Rendering used for displaying 2D and 3D graphics in the game.
Coordinate Systems used to represent positions of objects like the snake, food, and
walls within the game.
Transformation Matrices used for translating, rotating, and scaling objects in the game
world to ensure proper rendering.
Collision Detection Algorithms to detect when the snake collides with itself or
obstacles, triggering game over scenarios.
Rendering Pipeline Series of stages (vertex processing, rasterization, etc.) used to
render graphics efficiently in real-time.

3
3. User Defined Fucntion
Function_name Parameter Passed Description
keyboard() 1. key: ASCII value of the key pressed. Handles keyboard input for
2. (x,y): x-y coordinate of the mouse controlling game actions such as
pointer when the key is pressed. starting a new game, showing
instructions, or quitting.

frontscreen() None Displays the initial screen of the


game, prompting the user to press
ENTER to proceed to the main
menu

startscreen() None Displays the main menu options


for starting a new game, viewing
instructions, or quitting the game.

instructions() None Displays instructions for playing


the game, including how to
control the snake and earn points.

output() 1. (x,y): x-y coordinate of the text position Draws text on the screen at
2. string: The text to be displayed. specified coordinates, using the
specified font and size.

drawstring() 1. (x,y): x-y coordinate of the text. Draws text on the screen at
2. string: The text to be displayed. specified coordinates using the
3. font: The font to be used for rendering specified font.
the text.

draw_grid() None Draws the grid lines on the game


screen, providing a visual
reference for the snake's
movement and positioning.

draw_snake() None Draws the snake on the game


screen, updating its position and
appearance based on user input
and game logic.

draw_food() None Draws the food on the game


screen, updating its position and
appearance when eaten by the
snake.

4
5
Function_name Parameters passed Description
random() 1.(&_min , &_max): Reference to Generates random coordinates for
the variable to store the placing food on the game grid,
minimum/maximum value of the ensuring varied and unpredictable
random coordinate. food placement.

init() None Initializes the OpenGL environment,


setting the clear color for the screen.

display_callback() None Callback function for displaying


graphics on the screen, responsible
for rendering different screens such
as the front screen, main menu,
game screen, or instructions screen.

reshape_callback() 1. w: The new width of the window. Callback function for handling
2. h: The new height of the window. window resizing, adjusting the
viewport and projection settings
accordingly.

timer_callback() None Callback function for implementing


a game loop, triggering screen
updates at regular intervals to
maintain a consistent frame rate.

keyboard_callback() 1. key: The special key pressed. Callback function for handling
2. (x,y): x-y coordinate of the special keyboard keys such as arrow
mouse pointer when the key is keys for controlling the snake's
pressed. movement.

main() 1. argc: The number of command- Main function that initializes the
line arguments. GLUT environment, sets up display
2. argv: An array of command-line and keyboard callbacks, and starts
argument strings. the main event loop for processing
user input and rendering graphics.

4. Code Snippets
6
7

You might also like