Cute Framework (CF for short) is the cutest framework available for making 2D games in C++. CF comprises of different features, where the various features avoid inter-dependencies. In this way using CF is about picking and choosing which pieces are needed for your game. Here's a video from the Handmade Seattle conference talking all about CF if you're interested in some more juicy background deets.
CF is not quite ready for the official first release! This repository is public to prepare for first release, so expect breaking changes and use at your own peril, etc.
Setting up an application and getting started is quite easy. Simply visit the app docs, grab the following code snippet for app_make, and off you go.
Creating a window and closing it.
#include <cute.h>
using namespace cute;
int main(int argc, const char** argv)
{
// Create a window with a resolution of 640 x 480.
app_t* app = app_make("Fancy Window Title", 50, 50, 640, 480, CUTE_APP_OPTIONS_DEFAULT_GFX_CONTEXT, argv[0]);
while (app_is_running(app))
{
float dt = calc_dt();
app_update(app, dt);
// All your game logic and updates go here...
app_present(app);
}
app_destroy(app);
return 0;
}
Select one of the categories below to learn more about them. Each category contains information about functions, structs, enums, and anything else relevant in the various Cute Framework header files.
app
audio
clipboard
data structures
ecs
graphics
math
networking
serialization
string
time
window
TODO
Fow now it's recommended to build CF from source, at least until CF hits a first official release. See the Building from Source section below.
Prebuilt binaries for Windows are available in the releases section. Please build and install from source for Mac/Linux users. Note - CF is designed for 64-bit only.
Feel free to open up an issue right here on GitHub to ask any questions. If you'd like to make a pull request I highly recommend opening a GitHub issue first to start a discussion on any changes you would like to make.
Here's a link to the discord chat for Cute Framework and the Cute Headers. Feel free to pop in and ask questions, make suggestions, or have a discussion.
Another easy way to get a hold of the author of Cute Framework is on twitter @randypgaul.
Install cmake. Then perform the usual cmake dance (make folder, -G to generate the build files, and then finally trigger the build), for example on Windows with Visual Studio 2019.
mkdir build_msvc_2019 > nul 2> nul
cmake -G "Visual Studio 16 2019" -A x64 -Bbuild_msvc_2019 .
cmake --build build_msvc_2019 --config Debug
cmake --build build_msvc_2019 --config Release
Some scripts for running this cmake process are laying around in the top-level folder, such as build_bash.sh
for apple/linux machines, or mingw.cmd
for building against a MingW compiler on Windows. Feel free to use or ignore these scripts as you wish.
Once built go ahead and use cmake to install the headers and shared library for CF.
cmake --install your_build_folder_name
Prebuilt releases are planned for Windows and MacOS, but not actively setup right now since CF has yet to hit first release. Building from source is recommended for now.
Make sure emscripten is installed on your machine. If on Windows go ahead and run the emscripten.cmd
file. This will build libcute.a. Though if you're using something Ninja the commands will be slightly different, as you'll need to consult emscripten docs.
Additionally you can add something like the following to your cmake build script for your own project.
if(${CMAKE_SYSTEM_NAME} MATCHES "Emscripten")
set(CMAKE_EXECUTABLE_SUFFIX ".html")
target_compile_options(your_game PUBLIC -O1 -fno-rtti -fno-exceptions)
target_link_options(your_game PRIVATE -o your_game.html --preload-file ${CMAKE_SOURCE_DIR}/content --emrun -O1)
endif()
Also don't forget to call emscripten_set_main_loop
from your main
function!