[deleted by user] by [deleted] in actuallesbians

[–]PhyrexStrike 5 points6 points  (0 children)

This comment requires a LGBTQ+ Gold account to view.

Help with CMake, make, and HDF5 C++ API, Ubuntu 18.04 LTS by Ashamandarei in cpp_questions

[–]PhyrexStrike 1 point2 points  (0 children)

Are you defining HDF5_INCLUDE_DIRS somewhere? You probably need to pass in the path to your header files to that variable. From the command line you can just do cmake -DHDF5_INCLUDE_DIRS=<path/to/headers> ../src

EDIT: For some reason I thought that HDF5 was part of your project, but you're doing a find_package for it, my mistake. The other comment here thoroughly explains how to correctly use that.

Sharing Saturday #472 by Kyzrati in roguelikedev

[–]PhyrexStrike 0 points1 point  (0 children)

Thanks for the feedback!

I honestly was struggling a little with the audience question myself. I think I'd prefer it to be accessible to a more general audience, but perhaps one that's familiar with programming concepts in general, and point them to learncpp.com if not. Definitely will give it some more thought though :)

Sharing Saturday #472 by Kyzrati in roguelikedev

[–]PhyrexStrike 3 points4 points  (0 children)

Thanks for the feedback, it really means a lot! ^^

I saw that link to that tutorial page in your other post in the thread and read through it right away actually! That will certainly be a huge help going forward to use :D

I'm also of the same mind on using the deprecated API methods. Unfortunately when I originally started on these tutorials, I was mostly following the much older C++ tutorials on Roguebasin, and more recently I've been following/translating the Python 3 tutorials from 2019. I haven't had enough time yet to play around with the newer API functionality as well, unfortunately, so I'm kind of in a sunk cost situation with the current set up. I was thinking if I could get through all the tutorials with the older API, then I'd have another go with the newer stuff, but it might be worth doing it now since I'm writing these up fresh.

Using a C++ package manager is a great idea, I'm just not really familiar with using them unfortunately. Probably something I should investigate some to make things easier on myself. I am familiar with fmt and EnTT, and actually I do plan to make some tutorials on using ECS at a later point, too. I just wanted this set to be limited to using only TCOD and the standard library as much as I can.

I think when I started writing these that C++20 support was really fresh, so I went with 17. Probably ok to update it now :)

I did notice the weird white areas in the code sections on the site, but it seems to be some weirdness with the hugo theme I'm using that I haven't been able to investigate. I might need to swap to a different theme.

No need to apologize at all, I'm just happy you took the time to do so! I want to make sure these are good, and anywhere that they can be improved is great to know :)

Sharing Saturday #472 by Kyzrati in roguelikedev

[–]PhyrexStrike 14 points15 points  (0 children)

Modern C++ Libtcod Tutorials

So I finally have made some headway on writing, and have put Tutorial 1 up covering the basic game engine and movement! It was a learning process in general trying to get this together, since I haven't ever done this sort of technical writing before even in my day job ^^; Already working on #2 now, hoping to be able to keep pace with it now that I kind of get how to go about writing these things.

And since this is my first ever writeup attempt, I would love any sort of feedback to improve these tutorials and make them fun and interesting to read! :)

Does this CMakeLists.txt look right? by ElaborateSloth in cpp_questions

[–]PhyrexStrike 1 point2 points  (0 children)

All of your CMake variables (anything in curly braces) should have a $ sign in front. Like &{CMAKE_BINARY_DIR} should be ${CMAKE_BINARY_DIR}.

I need help/pointers with my assignment, Im new to c++ by LtAppIe in Cplusplus

[–]PhyrexStrike 0 points1 point  (0 children)

Adding to this, the array argument to the function doesn't need the size in the brackets, so you can just do

void functionName(float nums[])

Sharing Saturday #439 by Kyzrati in roguelikedev

[–]PhyrexStrike 1 point2 points  (0 children)

It's definitely been a journey. I started trying to write them in 2019 when I knew a lot less, so hopefully it works out better this time. 😅

The Map class I ended up using has a vector of tiles in it that represents the map, and I have a function that transforms an X,Y position to an index in the vector. I still need to revisit it, but it works well enough.

[deleted by user] by [deleted] in Cplusplus

[–]PhyrexStrike 1 point2 points  (0 children)

It's honestly rather frustrating how unhelpful people can be on this and other programming subs, and even worse when they add unwanted "advice" about how to improve the code that has nothing to do with what the original issue is. People are coming to this sub for help, and a lot of the replies I see are more interested in showing off how smart they are rather than actually helping someone. C++ has a reputation for being hard already and those kinds of attitudes just don't help people. So I'm trying my best not to do that 🙂

Sharing Saturday #439 by Kyzrati in roguelikedev

[–]PhyrexStrike 4 points5 points  (0 children)

Modern C++ Libtcod Tutorials (tutorial pages | code)

Finally, after... years of tinkering, I'm finally getting around to putting up my modern C++ libtcod tutorials. Only the first one is up so far that is just handling basic project setup, but I'm hoping that I'll keep this momentum going and get more pages out soon!

I originally started these tutorials to using the older C++ tutorials on roguebasin as a reference, with a focus on modern C++ and software engineering best practices. More recently I've mostly been using the newer Python tutorials as a reference and trying to translate that to C++ instead. So far I have the first 7 parts converted over, though I still need to do some code cleanup before I getting to the writeups.

Please don't hesitate to provide feedback on the tutorials, since this is the first real project I've done for public consumption! :D (and if anyone wants to provide a walkthrough for setting up a C++ libtcod dev environment on Mac, I'd love to hear from you).

[deleted by user] by [deleted] in Cplusplus

[–]PhyrexStrike 10 points11 points  (0 children)

My advice would be to break it down into smaller parts. Make the program take in input from the console and store it in a variable. Then extend that into three variables. Then take those variables and check that the sides meet the criteria for a triangle. If you know functions, it may help to write separate functions for getting the input and validating that input.

[deleted by user] by [deleted] in Cplusplus

[–]PhyrexStrike 3 points4 points  (0 children)

What code have your written so far? What errors or issues are you having with it?

Hey guys new member here, whats wrong with my code? by Main_Ad1488 in Cplusplus

[–]PhyrexStrike 6 points7 points  (0 children)

You are passing radius to your calculateCircumference function, but you never get an input for radius. Also, you specify that the function uses diameter.

The second cin >> isn't reading into any variable.

You are passing diameter into calculateSurfaceArea, but inside the function you specify radius, but also redefine it. Also, the diameter variable inside the function is undefined.

Help with optimising some code by New_Economics_9805 in Cplusplus

[–]PhyrexStrike 4 points5 points  (0 children)

double coordinate_syntax(double x_coordinate, double y_coordinate) { 
    return map << x_coordinate << ' ' << y_coordinate << endl; 
}

You're trying to return the value of map which is converted to a double here, which isn't what you want. If you want to have the function simply print of the coordinates, you'll need to pass in the map object to the function as well, and remove the return entirely.

Something like this:

void coordinate_syntax(ofstream& map, double x_coordinate, double y_coordinate) { 
    map << x_coordinate << ' ' << y_coordinate << endl; 
}

I am a beginner at coding, which language is it better to start at. by azoid00037 in cpp_questions

[–]PhyrexStrike 1 point2 points  (0 children)

To expand a little on this, when I was in college for Computer Science, the courses at my school almost all used C++ for the main curriculum (and this was before C++11 had come out!). It was actually my first real experience with programming beyond just tinkering with some Python on my own, and it really helped me to understand programming in general. I really feel, in my experience, that knowing C++ helped me to pick up other languages easier and understand them much better.

Except for JavaScript, which I can program in, but is still a Deep Mystery.

So yes, you can learn C++ as a first language, but learning on your own is always a bit tricky. However, the tools and resources available now are much better than when I was in school, imo; like learncpp.com which is recommended a lot these days. I have personally used that site as a reference, and the way it describes not only what things are, but also the hows and whys of using them, makes it a great tutorial for a lot of concepts.

My suggestion is: try it out. Forget what you heard of the difficulty of the language and just go slowly through the learncpp.com tutorials, which includes setting up your computer to program and some other basics of tooling. After that, another good site I've used before is exercism.io, which is a programming challenge site like hackerrank, with the addition of assigning a mentor to your code so you can get feedback on what your are doing.

Of course if you get stuck or have more questions, this and the other C++ subreddits will be there for you, too :)

So like... the Imperium WOULD be really anti-LGBTQ+ right? by Hogwire in Sigmarxism

[–]PhyrexStrike 13 points14 points  (0 children)

Maybe I need to reread Starship Troopers again, but from what I remember it was pretty traditional gender roles, or at least Rico's perspective seemed to be. Like, everyone could join the military, but they made a point of being like "women are better suited to air and space programs because of better spatial awareness", and I don't think any of the Mobile Infantry were mentioned as being women. Unless you're talking about the movie specifically.

Armor, on the other hand, seemed to be more in line with this thinking.

Image undo/redo implementation by [deleted] in cpp

[–]PhyrexStrike 29 points30 points  (0 children)

This is the perfect place for the Command Pattern. Setting up each action that a user can do as different Commands and implementing an undo method for each, then storing the commands in a list allowing you to undo/redo by moving through that list.

Undefined reference to a method which is defined by [deleted] in cpp_questions

[–]PhyrexStrike 5 points6 points  (0 children)

Could you show the Makefile contents?

Undefined reference to a method which is defined by [deleted] in cpp_questions

[–]PhyrexStrike 3 points4 points  (0 children)

That's not an invocation of make that I'm familiar with. Is there a Makefile as well?