loading...

re: Who's looking for open source contributors? (October 29th edition) VIEW POST

FULL DISCUSSION
 

Posting from last week:

Result for C++ is an implementation of Rust's Result type in C++. If love using Result and would love to use it in C++ then this library is suppose to solve this problem.

Check it out if you want to see more:

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…

SDLImageWrapper is a C++ convenience wrapper around SDL_Texture to help with rendering images onto the screen and automatic clean up through RAII.

Github repository:

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 C library to read and write PPM images. Recently, we gained support for binary PPM images and have some basic drawing abilities and some filter support.

If you would like to help:

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

This library contains one header and one source file. Two headers and two source files that are optional but provide filters and drawing capabilities.

Example:

clang -o program main.c another_file.c pixmap.c pixmap_filters.c pixmap_draw.c

In main.c:

#include "pixmap.h"
#include "pixmap_filters.h"
#include "pixmap_draw.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…

code of conduct - report abuse