Difference: IntroGraphicLab8 (1 vs. 5)

Revision 52017-10-26 - JimSkon

Line: 1 to 1
 
META TOPICPARENT name="Lab7Kenyon"

Graphics with Allegro

Line: 26 to 25
  b. Install Allegro:
Changed:
<
<
Type brew install allegro on the terminal to install Allegro 5.2.x, the stable version.
>
>
Type "brew install allegro" on the terminal to install Allegro 5.2.x, the stable version.
  c. Test out the install
  • Create a new c++ progect.
Line: 34 to 33
 
  • Right click on the project, select "properties"
  • Select "Linker"
  • Select the "..." after "Additional Options"
Changed:
<
<
  • Paste in "-lallegro_image -lallegro -lallegro_primitives -lallegro_main".
>
>
  • Paste in "-lallegro_image -lallegro -lallegro_primitives -lallegro_main".
 
  • Build and run the program.
On Windows

Revision 42017-10-18 - JimSkon

Line: 1 to 1
 
META TOPICPARENT name="Lab7Kenyon"

Graphics with Allegro

Line: 41 to 42
  or This
Added:
>
>
or http://liballeg.org/stabledocs/en/build/mingw32.html
 
2. Build a program with two (or more) bounching balls.
  • Review the example
  • The program basically sets up a timer loop. You really don't need to understand this fully to do the project. What you need to understand is the code in the "while () { ... }" loop. This code loops 60 times a second (the "al_wait_for_event(event_queue, &ev);" causes it to wait 1/60 of second between iterations. The rest of the code is pretty basic. The code maintains the X and Y position of an circle and draws it. It also uses the x and y to draw a line. Each time throug the loop the position is updated, and when it hits the side, it's direction is reversed.

Revision 32017-10-10 - JimSkon

Line: 1 to 1
 
META TOPICPARENT name="Lab7Kenyon"

Graphics with Allegro

Line: 40 to 39
  Follow these instructions (this is untested): Windows Instructions
Added:
>
>
or This
 
2. Build a program with two (or more) bounching balls.
  • Review the example
  • The program basically sets up a timer loop. You really don't need to understand this fully to do the project. What you need to understand is the code in the "while () { ... }" loop. This code loops 60 times a second (the "al_wait_for_event(event_queue, &ev);" causes it to wait 1/60 of second between iterations. The rest of the code is pretty basic. The code maintains the X and Y position of an circle and draws it. It also uses the x and y to draw a line. Each time throug the loop the position is updated, and when it hits the side, it's direction is reversed.

Revision 22017-10-09 - JimSkon

Line: 1 to 1
 
META TOPICPARENT name="Lab7Kenyon"
Added:
>
>
 

Graphics with Allegro

An alternate lab 8
Changed:
<
<
Due November 2
>
>
Due November 2
Screen_Shot_2017-10-08_at_10.16.59_PM.png
 

Goal

Your goal is to make a graphic simulation of 2 or more balls interacting in a box. See an example here: InteractingBalls.

Changed:
<
<
The
>
>
For a really cool example try this.

Sample Code

A simple program using Allegro here.

The Allegro Manual is here: Allegro.

Steps

1. Install Allegro
On Mac

a. Paste the following in a terminal to install homebrew:

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

b. Install Allegro:

Type brew install allegro on the terminal to install Allegro 5.2.x, the stable version.

c. Test out the install

  • Create a new c++ progect.
  • Paste the sample code into the main.
  • Right click on the project, select "properties"
  • Select "Linker"
  • Select the "..." after "Additional Options"
  • Paste in "-lallegro_image -lallegro -lallegro_primitives -lallegro_main".
  • Build and run the program.
On Windows

Follow these instructions (this is untested): Windows Instructions

2. Build a program with two (or more) bounching balls.
  • Review the example
  • The program basically sets up a timer loop. You really don't need to understand this fully to do the project. What you need to understand is the code in the "while () { ... }" loop. This code loops 60 times a second (the "al_wait_for_event(event_queue, &ev);" causes it to wait 1/60 of second between iterations. The rest of the code is pretty basic. The code maintains the X and Y position of an circle and draws it. It also uses the x and y to draw a line. Each time throug the loop the position is updated, and when it hits the side, it's direction is reversed.
  • You can learn about simulating the collisons of balls here: When Worlds Collide: Simulating Circle-Circle Collisions

Grading Table

RequirementGrading CommentsPointsScore
C++ code includes comments, with project information at top, pre and post conditions for each functions and other cmments as needed. 10
The C++ code has good formatting, indentation, and organization. 10
Good variable and function names, appropriate use of constants rather then literal numbers. 10
Functions: Logic divided up into cohesive functions with a single purpose 20
Runs: the program runs. You will need demonstrate it to the instructor 50
Total 100

Solution

META FILEATTACHMENT attachment="Screen_Shot_2017-10-08_at_10.16.59_PM.png" attr="" comment="" date="1507515447" name="Screen_Shot_2017-10-08_at_10.16.59_PM.png" path="Screen_Shot_2017-10-08_at_10.16.59_PM.png" size="43058" user="JimSkon" version="1"

Revision 12017-10-09 - JimSkon

Line: 1 to 1
Added:
>
>
META TOPICPARENT name="Lab7Kenyon"

Graphics with Allegro

An alternate lab 8

Due November 2

Goal

Your goal is to make a graphic simulation of 2 or more balls interacting in a box. See an example here: InteractingBalls.

The

 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback