DEV Community

Discussion on: Who's looking for open source contributors? (October 22nd edition)

Collapse
 
noah11012 profile image
Noah11012

Posting my projects from last week:

Result for C++ is a library that tries to be as similar to Rust's Result type as possible. Most methods are now implemented and now we just have to monitor what new methods gets added to Result by the Rust team as time goes by.

Noah11012 / result-for-cpp

C++ implementation of Rust's Result

Build Status

C++ Result

Result for C++ an implementation of Rust's Enum type Result. This C++ implementation tries to be as close to the original thing as possible. Of course, it won't be because of the language difference between the two.

Differences

  • and() and or() are called and_() and or_() in this implementation because and and or are keywords in C++.
  • To create an Err Result use the static member from_error().
  • A panic is a std::runtime_error.
  • unwrap(), unwrap_err() and expect() do not display the error value or the okay value when they panic. This is because it might not be possible to convert the type into a string.

Warning

The ability to check for equality between a Result and a value was added. However, one problem arose when this feature was added. If the template types are the same (for example Result<int, int> or Result<std::string, std::string>) then…

If you want something a bit easier to work on then maybe you can hack on SDLImageWrapper. Originally made when I needed to work with images in SDL2 in a more convenient fashion, is a C++ wrapper around SDL_Texture that provides an easy to use API and automatic cleanup through RAII.

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:

#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…

Libpixmap is an easy to use API made in C for reading and writing PPM images. Many things have been added including support for binary PPM images, filters and the ability to draw primitive shapes. As we progress, more filters and shapes will be supported.

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:

#include "pixmap.h"
int main(int argc, char *argv[])
{
}

Documentation

pixmap_image_new(char const *name, int width, int height, int max_color_val, PixMapImageType type)

Creates a new PixMapImage at the path name and with the dimensions of width x height and the maximum color value of max_color_val with the PPM image type of type. type can either be Text or…