This is an implementation in C++ of Rust's Result. This is a WIP so not all methods found on Rust's Result type will be here at first. If you would like to help and implement the methods found in Rust's Result, that would be appreciated.
List of methods to implement
iter()
Quick Start
This library contains a header and a source file. Just include the header and add the source file to your list of files to build. Result for C++ uses some C++ 17 library features so you will need a compiler that supports C++ 17.
Compile with clang++ -o program main.cpp other_file.cpp -std=c++17
In other_file.cpp:
#include"result.hpp"
...
Documentation
Currently, no documentation exist at the moment. The best source of documentation is at the Rust STD Documentation website.
A C++ wrapper and helper class to render images in SDL2
SDL Image Wrapper
SDLImageWrapper is a C++ wrapper around SDL_Texture for ease of rendering in SDL2.
Quick Start
Build
You will need SDL2 and SDL2_image to build and use this library. This library contains only a header and a source file. Simply include the header file and add the source file to the list of files to be built.
For example, if you have clang++ installed:
clang++ -o program main.cpp other_file.cpp `sdl2-config --cflags --libs` -lSDL2_image
In other_file.cpp:
#include"sdl-image-wrapper.hpp"
...
Of course, if you were using a build system generator like CMake you can just add the source file to the list of files for a target.
Usage
When using SDLImageWrapper you must ensure that SDL2 is initialized and that also SDL2_image is initialized. The constructor and open_image() will throw an SDLImageWrapperException if an error occurred. If a call to render_image() results in an error, an…
Because this library only contains a header and source file, you can simply include pixmap.h and add pixmap.c to the list of files needing to be built.
pixmap_image_new(char const *name, int width, int height, int max_color_val)
Creates a new at the path name and with the dimensions of with x height and the maximum color value of max_color_val. max_color_val is clamped at 255. Free with pixmap_image_close(). Returns 0 on failure.
Hello everyone!
Result For C++ has seen several improvements from last week. Several new functions were added:
map()
map_err()
expect()
unwrap_err()
All methods now have a const counterpart (except for
or()
andand()
) and const references are used as arguments wherever possible.If you like what you hear, you can check out the repository:
Noah11012 / result-for-cpp
C++ implementation of Rust's Result
C++ Result
This is an implementation in C++ of Rust's Result. This is a WIP so not all methods found on Rust's Result type will be here at first. If you would like to help and implement the methods found in Rust's Result, that would be appreciated.
List of methods to implement
iter()
Quick Start
This library contains a header and a source file. Just include the header and add the source file to your list of files to build. Result for C++ uses some C++ 17 library features so you will need a compiler that supports C++ 17.
Compile with
clang++ -o program main.cpp other_file.cpp -std=c++17
In other_file.cpp:
Documentation
Currently, no documentation exist at the moment. The best source of documentation is at the Rust STD Documentation website.
SDLImageWrapper is C++ wrapper around
SDL_Texture
to provide an easy to use API and automated clean up through RAII.A few new things were added including the ability to flip and rotate the image.
Noah11012 / sdl-image-wrapper
A C++ wrapper and helper class to render images in SDL2
SDL Image Wrapper
SDLImageWrapper is a C++ wrapper around
SDL_Texture
for ease of rendering in SDL2.Quick Start
Build
You will need SDL2 and SDL2_image to build and use this library. This library contains only a header and a source file. Simply include the header file and add the source file to the list of files to be built.
For example, if you have clang++ installed:
clang++ -o program main.cpp other_file.cpp `sdl2-config --cflags --libs` -lSDL2_image
In
other_file.cpp
:Of course, if you were using a build system generator like CMake you can just add the source file to the list of files for a target.
Usage
When using SDLImageWrapper you must ensure that SDL2 is initialized and that also SDL2_image is initialized. The constructor and
open_image()
will throw anSDLImageWrapperException
if an error occurred. If a call torender_image()
results in an error, an…Libpixmap is an easy to use C library that allows you create, open and manipulate pixels of PPM image formats.
Not much has been updated since then but documentation has been updated.
Noah11012 / libpixmap
Simple to use library to read and write PPM (portable pixmap) images
PixMap library in C
Libpixmap is a library to read and write pixmap image formats with a simple to use API.
Getting Started
git clone https://github.com/Noah11012/libpixmap.git
cd /path/to/libpixmap
mkdir build && cd build
cmake ..
If you want to change the install prefix, enter the following:
cmake .. -DCMAKE_INSTALL_PREFIX=/path/to/install/prefix
make
Because this library only contains a header and source file, you can simply include pixmap.h and add pixmap.c to the list of files needing to be built.
Example:
clang -o program main.c another_file.c pixmap.c
In main.c:
Documentation
pixmap_image_new(char const *name, int width, int height, int max_color_val)
Creates a new at the path
name
and with the dimensions ofwith
xheight
and the maximum color value ofmax_color_val
.max_color_val
is clamped at 255. Free withpixmap_image_close()
. Returns 0 on failure.pixmap_image_close(PixMapImage *image)
Frees…