65 lines
2.8 KiB
Markdown
65 lines
2.8 KiB
Markdown
1. Include a 2-3 sentence explanation of how to make a window resizable (5
|
||
points) and a 2-3 sentence explanation of how to keep text centered in a
|
||
resizing window (5 points).
|
||
|
||
The window can be made resizable by using the FLAG_WINDOW_RESIZABLE flag when
|
||
creating the window using the SetState method. This flag allows the user to
|
||
adjust window size.
|
||
|
||
To keep text centered in a resizing window, on every draw call, we can
|
||
calculate the center position based on the screen width and height using
|
||
GetWidth() and GetHeight() methods. Then, we have to calculate the text
|
||
width using MeasureText() and setting the origin position of the text to be
|
||
half of the text width and height. Using the DrawTextPro method allows us to
|
||
use this origin position as an anchor point to keep the text centered, which
|
||
is also useful for other transformations like rotation and scaling.
|
||
|
||
2. Include a 2-3 sentence explanation of what "cmake .." does. What is the
|
||
importance of the ".."? (5 points.) Describe how to fetch your git
|
||
submodules (5 points) with commands that can be copy and pasted into a Linux
|
||
terminal (5 points).
|
||
|
||
Running `cmake ..` tells CMake to generate the build files for the project
|
||
by looking for CMakeLists.txt in the parent directory. Because building is
|
||
done in a separate build directory within the project, it is necessary to
|
||
use the ".." to point CMake to the root directory of the project, where the
|
||
CMakeLists.txt file is located.
|
||
|
||
`git clone` has an option to initialize and fetch submodules while cloning.
|
||
However, if the repository has already been cloned, the `git submodule
|
||
update --init --recursive` command can be used to fetch and initialize all
|
||
submodules defined in the repository.
|
||
|
||
```shell
|
||
git submodule update --init --recursive
|
||
```
|
||
|
||
3. Describe how to compile your code (10 points) with copy and pasteable
|
||
commands \[assume that we have cloned your repository and are in your as0
|
||
folder\] (10 points).
|
||
|
||
Make a build directory and enter it. Run cmake to generate the build files.
|
||
Then, compile the code using make. The executable will be created in the build
|
||
directory with the name "as0".
|
||
|
||
```shell
|
||
mkdir -p build
|
||
cd build
|
||
cmake ..
|
||
make
|
||
```
|
||
|
||
4. Describe how to run you’re code (10 points) and enumerate its controls \[I
|
||
predict "not applicable" will be the most common set of controls for this
|
||
assignment.\] (10 points).
|
||
|
||
After compiling the code, the executable can be run from the build
|
||
directory. The executable is named "as0" and can be started with `./as0`
|
||
|
||
There are no specific controls other than resizing the window, which changes
|
||
how the text is displayed by remaining centered.
|
||
|
||
5. If you have any extra credit make sure to mention it so we don't miss it.
|
||
|
||
The text is animated as it continuously rotates 22.5 degrees per second.
|