Getting Started
Cute Framework (CF for short) is the cutest framework available for making 2D games in C++. CF provides a portable foundational layer for building 2D games in C/C++ without baggage, gnarly dependencies, or cryptic APIs. CF runs almost anywhere, including Windows, MacOS, iOS, Android, Linux, and more!
Note
Cute Framework documentation covers the C API, however, the vast majority of CF also has associated C++ wrapper APIs that sit along-side the C API in each header.
Download and Setup¶
CF must be built from source using Cmake. Cmake provides one of the only reliable ways to setup and build C/C++ programs in a cross-platform manner. If you're new to Cmake there are some step-by-step instructions just below written specifically for getting your project up and running. These steps are a great way to learn about cross-platform developement in general, not just for CF!
Building from Source¶
Make sure you have a compiler installed that you're familiar with beforehand. If you're new to C/C++ I highly recommend using Microsoft Visual Studio (Community Edition), for Windows users. If you're MacOS XCode (and command line tools) are recommended. For Linux you'll probably use g++.
- Download and install CMake (v3.14 or higher, you can just get the latest version). CMake is for easy cross-platform building. Also install git. If you're new to git and a Windows user it's highly recommended to use Github Desktop.
- Copy CMakeLists.txt (this one here) into the top-level of your project directory.
- Find + replace "mygame".
- Make a folder called
src
in the top-level of your project, and place your initialmain.cpp
there. - Run CMake on your project folder. If you need help with this step, try reading the CF + CMake 101 section here.
Example Game Window¶
Creating a window and closing it.
#include <cute.h>
using namespace Cute;
int main(int argc, char* argv[])
{
// Create a window with a resolution of 640 x 480.
CF_Result result = make_app("Fancy Window Title", 0, 0, 0, 640, 480, CF_APP_OPTIONS_WINDOW_POS_CENTERED_BIT, argv[0]);
if (is_error(result)) {
printf("Error: %s\n", result.details);
return -1;
}
while (app_is_running())
{
app_update();
// All your game logic and updates go here...
app_draw_onto_screen();
}
destroy_app();
return 0;
}