-
Notifications
You must be signed in to change notification settings - Fork 196
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changes to add functionality with RandomBlocks transition. The changes are: - Utils.h: Function &GetRNG() added, which returns the common random number generator which will be needed for our function in graphics.cpp - Utils.cpp: Function &Utils::GetRNG() added. - Graphics.cpp: -> Library <array> added, to use the functions "begin" and "end". -> An anonymous namespace with two constant expressions: "random_size_blocks" (defines the width and height of each random block) and "random_array_size_blocks" (defines the number of blocks needed to cover the whole screen. This number (4800) was calculated after doing the operation (320 / random_size_blocks) * (240 / random_size_blocks) ). -> A variable "random_blocks" added in the namespace "Graphics", and initiated in "Graphics::Init". It's an array with the size of random_array_size_blocks (4800) and each value has a sequential number (0, 1, 2, ..., 4799) which we will use as an index for each block. -> In "Graphics::Transition" (each time the transition is invoked) we do a "Shuffle" to the array so the numbers are in a random order. We use here begin(), end() and Utils::GetRNG(). -> In "Graphics::UpdateTransition", we create the function that inserts blocks. The "percentage" affects the number of blocks being invoked.
- Loading branch information
1 parent
7c772ea
commit 061884c
Showing
3 changed files
with
40 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters