Final Project Virtual Slot Machine.

1 / 18

# Final Project Virtual Slot Machine. - PowerPoint PPT Presentation

Final Project Virtual Slot Machine. By: Bander Alrogi Khaled Al Nuaimi Mohammed Almajhad Metaib Al-Enzai Course Title: ECE 2552 Instructor: Dr Kepuska Spring 2005. Concepts Used. Classes Inheritance Abstract Class Graphic Mode and Objects Sound Function. Objective.

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.

## Final Project Virtual Slot Machine.

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

### Final ProjectVirtual Slot Machine.

By: Bander Alrogi Khaled Al Nuaimi Mohammed Almajhad Metaib Al-Enzai

Course Title: ECE 2552

Instructor: Dr Kepuska

Spring 2005

Concepts Used
• Classes
• Inheritance
• Abstract Class
• Graphic Mode and Objects
• Sound Function
Objective
• To create a program that is a simulation of a Virtual Slot Machine used specially for gambling. Color shapes appear in a window, as if slot machine wheels were turning.
Functionalities

When we start the program, three square windows appear on the screen. One of four different shapes appears randomly in each window. Red circle (apple), blue circle (blueberry), square, and pyramid. Each time a shape appears, a click sound is heard. Gradually, the shapes appear more and more slowly, as if the slot machine wheel were slowing down. Finally they stop, and the program sounds a two-tone signal. If the three shapes are same, you win otherwise you lost.

Class Hierarchy

Shape

Ball

Rectangle

Triangle

No Shape

Apple

Blueberry

Square

Pyramid

Wheel

Graphics
• Display Points, Lines, and Shapes
• Address individual pixels and dots
• Resolution of 640*480 VGA mode can address 307,200 pixels
Graphics
• initgraph() Function:

It must be executed before any other graphic mode function can be used. It switches your computer’s display system into the appropriate graphics mode. Uses Graphic.h header file

Graphics
• Graphics Driver

To specify the mode, we need to choose appropriate values for the parameters to initgraph().

• Graphics Mode

Specify the specific mode to be used. For example CGA, EGA, VGA,….

Graphics
• Driver = DETECT

Let the system decide what graphic mode to use, it checks the adaptor and choose the driver and mode that gives the highest resolution. Set the driver argument to the constant DETECT.

Graphics

initgraph(&drive, &mode, "c:\\tc\\bgi");

Instead of using like EGA and EGAHI, we placed them in variables driver and mode. & Symbol address where the constants are stored.

Graphics

initgraph(&drive, &mode, "c:\\tc\\bgi");

• Path:

It’s the path to the graphic driver. This argument must be specified whether you use auto-detect or specify a mode yourself.

Graphics

Closegraph()

• When exit from the graphics program, we should restore the system to the video mode that was previously in use.
Sound Generation

Sound Generation requires three steps

• Turning the sound on
• Delaying for an appropriate amount of time
• Turning the sound off
Sound Generation
• Sound() function

It sets the sound generation to a specific frequency in Hertz. The range of the frequency varies from 15 Hertz to 3000 Hertz. Once this function is executed, the sound remains on until specifically stopped.

Sound Generation
• Delay() function

Function to control how long the sound will continue. It takes simple argument in milliseconds.

• Nosound() function

Takes no argument and it turn off the sound.

Drawing Shapes
• Circle

It takes the (x, y) co-ordinates and radius as parameters to draw it

Drawing Shapes
• Rectangle

It takes the top-left co-ordinates and the right-bottom co-ordinates as parameters to draw it

rectangle (x1, y1, x2, y2);

Drawing Shapes
• Triangle

Fillpoly function draws and fill a polygon. It takes 2 input arguments. Number of points, and the points to a sequence of (numpoint * 2). Each pair of integers gives x and y co-ordinates of a point on the polygon.

triangle[] = {x1, y1, x2, y2, x3, y3};

fillpoly (3, triangle[]);