Final Project

Final Project - Final Project Virtual Slot Machine. By:...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 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 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"); Address of Operator: & 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 1. Turning the sound on 2. Delaying for an appropriate amount of time 3. 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 circle (x, y, radius); 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); ...
View Full Document

This note was uploaded on 02/10/2012 for the course ECE 2552 taught by Professor Vkepuska during the Fall '11 term at FIT.

Ask a homework question - tutors are online