rlutil | C and C++ utilities for cross-platform console roguelike | Game Engine library
kandi X-RAY | rlutil Summary
kandi X-RAY | rlutil Summary
RLUTIL is simple utility collection to aid the creation of cross-platform console-mode roguelike games with C++ and C. At least that was the original idea. In reality, it mostly just contains functions to position and colorize text as well as reading keyboard input.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of rlutil
rlutil Key Features
rlutil Examples and Code Snippets
Community Discussions
Trending Discussions on rlutil
QUESTION
I'm trying to use rlutil.h but everytime these function are used in more than one header I have compiler error about multiple definition of 20-30 variables. rlutil is a simple header to color terminal in linux and windows in C and C++.
The variables are something like that
...ANSWER
Answered 2017-Oct-05 at 19:18The problem is that the header is only set up so that it works with C++, where the const
values defined in the header rlutil.h
are private to each translation unit (TU) — think source file plus headers — that includes the header. By contrast, in C, they are normal global variables defined in each TU that includes rlutil.h
, leading to the multiple definitions problem.
There isn't a trivial fix — unless switching from C to C++ is deemed trivial. The header attempts to be language-neutral between C and C++, but it fails on this count. Once again, proof that C and C++ are different languages.
In C, you would need to have code like:
QUESTION
I need to make a CLI similar to the Window's CMD. To make the color command I'm using the functions rlutil::setColor
and rlutil::setBackgroundColor
in rlutil.h. But, to change the colors in all the console I have to clear the screen (rlutil::cls()
), or only the new outputs will appear with this changes as in the images.
Without the cls:
In the cmd (I used @echo off to not display the current directory):
This is the function I made:
...ANSWER
Answered 2017-Apr-18 at 01:39If you use the low-level native Windows console functions you can change the colors without affecting the text. Get the console handle with GetStdHandle
or _get_osfhandle
and then call WriteConsoleOutputAttribute
.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install rlutil
You can download this project in either [zip](http://github.com/tapio/rlutil/zipball/master "zip") or [tar](http://github.com/tapio/rlutil/tarball/master "tar") formats.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page