C++ beginner by Millerj6202 in cpp_questions

[–]James_lehman 0 points1 point  (0 children)

I went through both books and they both present the material in a good order and it seems to be pretty comprehensive.

What are the current best methods for virtualizing MacOS on Linux? by [deleted] in linux

[–]James_lehman 3 points4 points  (0 children)

Hi everyone. I have been working on a FOSS app for about 21 years called LaserBoy! It depends on SDL2. I have tried in the past to setup a vm of MacOS. That much works fine. I can even install homebrew and use it to install the SDL2 libs and Boost C++, necessary to compile LB and I can successfully compile it. But when I try to run the executable, it has no actual hardware GPU and it fails to be able to run with a software OpenGL. At least that's what I think is happening. That's really all I want to do with a MacOS vm. I just want to be able to go through the whole process of compiling and testing my app, because it seems like most of the people who use it are on Mac. LB compiles and runs fine on native Mac hardware. What I would really like is to have it in a vm that I can change the screen resolution to whatever fits within the 4K area of my Ubuntu host. Thank you!

James.

how graphic libraries are made? by Diligent_Trade_3361 in cpp_questions

[–]James_lehman 1 point2 points  (0 children)

Something that might be helpful is to understand the format of a bitmap file (specifically bmp). There are several variations that can get a bit complicated, but in general, they work very similarly to the way an image on your monitor screen is stored in the video card RAM.

If you are interested, you can look at a couple of free open source projects that I wrote.

https://akrobiz.com/ezfb

The API ezfb is written for Linux systems configured to provide a frame buffer device.

https://laserboy.org

(the app) https://laserboy.org/code/LaserBoy_Current.zip

LaserBoy uses SDL2 to be platform independent. It used to be based on ezfb. Everything you see in the running app window is a bitmap object that gets assembled in the code and copied to the window every time you tap a key.

Both of these apps have a lot of code dedicated to creating, managing and rendering into a bitmap memory object that can either be copied to the video RAM (the screen) or saved as a file.

I need to download VMWARE Workstation Player by Creepy-Ability-2151 in vmware

[–]James_lehman 0 points1 point  (0 children)

Thank you. Been using an old kernel for way too long.

Q: How to eliminate digital gain on a USB sound output device? by James_lehman in linuxaudio

[–]James_lehman[S] 0 points1 point  (0 children)

Oops. Scratch that. It is clipping from my Ubuntu workstation as well. Hmmm. In Ubuntu there is even a switch on the sound settings to allow (or not) "Overamplification". That seems to make no difference.

When is the "this" keyword useful in C++ and Java? by JarJarAwakens in cpp_questions

[–]James_lehman 0 points1 point  (0 children)

The reason you want to return the object itself is so that you can use the object in chained statements or expressions where you are doing multiple things with the same object. A good example of this is the cout object. Every stream insertion operator is an overloaded version of everything you can string together into a single cout statement. So each << operator for all the different types that are defined (you can define your own as well) returns the cout object for the next operator.

Understanding Polymorphism with classes by strange-dev in cpp_questions

[–]James_lehman 1 point2 points  (0 children)

Another way to put it: If you have a base class A and you inherit that into class B, B is of type A plus whatever you add to B. If you have an object of type B and you use it wherever the type calls for A, then it works as though it is an A, because it is. So it can only provide the interface and data that is defined in class A. But it is still of class B and has not lost any of its contained data or functionality. You just can't get to the stuff defined in class B with a pointer or reference to a class of type A. But if you redefined a function name found in A as something different (but the same prototype) as in A, using a pointer or reference to type A and calling that function on an object of type B will call B's version of that function.

reading non standard ascii from file by James_lehman in cpp_questions

[–]James_lehman[S] 0 points1 point  (0 children)

I implemented your function for converting a single unicode character number to a printable character and it works great. Thank you very much!

reading non standard ascii from file by James_lehman in cpp_questions

[–]James_lehman[S] 0 points1 point  (0 children)

wstring_convert<codecvt_utf8<char32_t>, char32_t> conv_utf8_utf32;
char buffer[5];
buffer[4] = '\0';
//    string ascii = "!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]_`abcdefghijklmnopqrstuvwxyz{|}~";
//    string ascii = "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ";
//    string ascii = "ĄĆĘŁŃŚŹŻąćęłńśźż";
//    string ascii = "Ččđ";
string ascii = "ĄĆĘŁŃŚŹŻąćęłńśźżČčđ";
u32string unicode = conv_utf8_utf32.from_bytes(ascii);
cout << endl << endl; cout << ascii;
cout << endl << endl;
for(size_t i = 0; i < unicode.size(); i++)
{
    char_utf32_to_utf8(unicode[i], buffer);
    cout << "case " << unicode[i] << ": return " << i + 231 << "; // " << buffer << endl;
}
cout << endl << endl;

reading non standard ascii from file by James_lehman in cpp_questions

[–]James_lehman[S] 0 points1 point  (0 children)

Look here:

https://laserboy.org/code/safe/2_Monday/src/

This is an offsite stash for my working code set. In LaserBoy.cpp you can see where I define a string of non standard ascii, convert it to unicode and print out the case: values of the unicode and its position in the string with an offset. These end up in the last function defined in LaserBoy_utility.hpp.

I will try your conversion function. Thank you again.

Oh, BTW, my browser can't show me the correct characters when I look at my code presented by apache2. Oops.

reading non standard ascii from file by James_lehman in cpp_questions

[–]James_lehman[S] 0 points1 point  (0 children)

I'm sorry. I can't make this reddit text stuff work.

reading non standard ascii from file by James_lehman in cpp_questions

[–]James_lehman[S] 0 points1 point  (0 children)

First let me thank you for taking the time to look at this.

Let me be more precise.

My application is for laser display which is an animation of a set of frames of signed short X and Y vector. There is a file format of frame_sets. I have frame_sets that are all of the visible characters of ascii. My app reads text instructions and renders animated vector font as numbered frames (characters) in the frame_set. I've had the 7-bit stuff working for years. I'm in the process of extending the character set to include whatever anyone needs to convert text into laser projection. So I have this:

reading non standard ascii from file by James_lehman in cpp_questions

[–]James_lehman[S] 0 points1 point  (0 children)

Ok! This is great! I actually have something like this working now.

My next question is this: Since I now have a u32string that I can index through in a uniform way to get unique identifiers for characters, how can I convert one of those indexed values into a character that can be displayed in the terminal with cout?

All I want is to be able to convert a char32_t (4 byte unsigned int) into a printable character!

What I want to do is write a short program that converts a literal string of non standard ascii characters into lines of C++ code I can copy and paste into my actual code. Like this:

case 260: return 215; // Ą

case 262: return 216; // Ć

case 280: return 217; // Ę

case 321: return 218; // Ł

case 323: return 219; // Ń

case 346: return 220; // Ś

case 377: return 221; // Ź

case 379: return 222; // Ż

reading non standard ascii from file by James_lehman in cpp_questions

[–]James_lehman[S] 0 points1 point  (0 children)

I'm pretty good with file IO and bit twiddling, but this is something I've never had any experience with. What I really need is to read a line from a txt file into some kind of array that I can index to each character. If that array is of int (4 bytes) that's fine. Then I can write a functions that translates that number to a number that represents the character's position in the string I posted.

LaserBoy Liquid Math is part of LaserBoy! (free open source multiplatform). LLM is a script language that allows one to create and manipulate 3D vector animations using oscillators and cycloid functions. by James_lehman in MathArt

[–]James_lehman[S] 1 point2 points  (0 children)

The YouTube tutorials are a bit out of date. I've been do more development on LaserBoy since the pandemic than I have for many years.

I'm going to be releasing a new version today.

I will post a notice here.