<windows.h> for macOS?

Pages: 12
Visual Studio for Mac IS Mac software, not Windows.

A Mac game that is also on Windows/X-Box IS a Mac game. using the Mac API.
You asked a question about wanting a <windows.h> header file for Mac. And when people offer you an alternate that is MS software you get all huffy about hating VS.
helios,
No, not particularly, I have used Windows systems before, and found them to lack some of the intuitiveness of my Mac (which, to be fair, did cost a lot more).

I think it's mainly because I'm used to macOS– my dad had one when I was a kid– it was a big white box with a separate screen– a PowerMac something, but...it was what I got used to using.

Furry Guy,
I don't want the <windows.h> header file itself. I want something that does the same things, but that is designed specifically for macOS. I don't want something that was originally made for Windows.

The main function that I want is something to position the cursor in Terminal.

I'm sorry if I was acting huffy, I was only trying to explain what I meant. Maybe it's not even possible, I don't know. But I just wanted to see if there was anything I could use, because I believe cursor repositioning is a central part of TUI's.
I really love Dear ImGUI -> https://github.com/ocornut/imgui
The main function that I want is something to position the cursor in Terminal.

That is what you should have started with.

ncurses is definitely an option for that. Your program will use ncurses API and the version of ncurses on the computer will use API of the terminal. That way your TUI program will not be limited to your current terminal.
@m4ster r0shi,
Thanks, but I'm not sure it's exactly what I want.

@keskiverto,
Ok, I think I'll look into getting it for my computer (if I don't already have it). One question, how do you test to see if your computer has ncurses?

Edit:
I dug around in my computer and I found a file called "curses.h." Would that be it?

Here's a sample of what's in it:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/****************************************************************************
 * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc.              *
 *                                                                          *
 * Permission is hereby granted, free of charge, to any person obtaining a  *
 * copy of this software and associated documentation files (the            *
 * "Software"), to deal in the Software without restriction, including      *
 * without limitation the rights to use, copy, modify, merge, publish,      *
 * distribute, distribute with modifications, sublicense, and/or sell       *
 * copies of the Software, and to permit persons to whom the Software is    *
 * furnished to do so, subject to the following conditions:                 *
 *                                                                          *
 * The above copyright notice and this permission notice shall be included  *
 * in all copies or substantial portions of the Software.                   *
 *                                                                          *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
 * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
 * THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
 *                                                                          *
 * Except as contained in this notice, the name(s) of the above copyright   *
 * holders shall not be used in advertising or otherwise to promote the     *
 * sale, use or other dealings in this Software without prior written       *
 * authorization.                                                           *
 ****************************************************************************/

/****************************************************************************
 *  Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995               *
 *     and: Eric S. Raymond <esr@snark.thyrsus.com>                         *
 *     and: Thomas E. Dickey                        1996-on                 *
 ****************************************************************************/

/* [deleted comment] */

#ifndef __NCURSES_H
#define __NCURSES_H

#define CURSES 1
#define CURSES_H 1 


Looks to me like it is. What do you think?

Hmm. I looked at it using the less command and it looks to be full of #define stuff.
Last edited on
I'm not sure it's exactly what I want

Well, ImTUI ( https://github.com/ggerganov/imtui ) is just a Google search away (dear imgui + tui)...

It uses ncurses under the hood and you can also render it on your browser.

Also, at the risk of starting a flamewar, I'll say that immediate mode GUIs are the future :)

Oh, ok. If it turns out I have Ncurses, I'll try it! And it's helpful that I would be able to use it in a browser, kind of like HTML.

I'm not sure what "immediate mode" GUI's are, so I have nothing to say ;)
They're GUIs that draw their controls directly onto a graphics library context. For example, by sending commands to DirectX, OpenGL, Vulkan, etc. They're primarily used when you have an existing graphics-intensive interactive application and you need to add simple UI elements to control various aspects in real time; for example, while debugging a game.

I don't think immediate-mode GUIs work really well for general purpose applications. As a general rule, they won't handle well international text rendering, accessibility, or both. If you know your target audience speaks your language and has the same abilities as you then they're fine. Otherwise, not so much.
Ah. I can see how that could be controversial.

What about the "curses.h" file that I found? (see above) Do you think that's the ncurses library, or at least part of it?
I wouldn't say that. You just have to keep in mind the problem you're trying to solve and the limitations of your tools.

That's probably ncurses, yes. ncurses is developed by the FSF. If it only defines macros it's likely that OSX's console API is curses-compatible, and thus implementing ncurses on top of it is just a matter of renaming identifiers.
Mmm, that makes sense.

Oh, ok! I also looked a bit further, and found another file that was specifically called "ncurses.h," so I think that's probably another part of it.

They're in some kind of hidden directory that I can only access through the Terminal. There's a whole bunch more of them, too. Stuff like "unistd.h," "termcap.h," "libc.h," "bootstrap.h," etc.

The copyright is 2008, that's pretty old. Do you think it will still work?
Last edited on
2008?! Shit. Nah, it won't work at all. It probably doesn't have video-to-text conversion, vector autoencabulation, flux capacitance, or any other of those new technologies that have appeared for terminals since 2008. How do you expect to encabulate your vectors automatically like that, huh?! Yeah, didn't think so. May as well throw your computer in the garbage because with such an old ncurses version it's as good as useless, and be sure to slap yourself in the back of the head for making such a blundering error in judgement.
closed account (z05DSL3A)

agent max wrote:
What about the "curses.h" file that I found? (see above) Do you think that's the ncurses library, or at least part of it?
and wrote:
The copyright is 2008, that's pretty old. Do you think it will still work?


Just type in some code...somthing like...
1
2
3
4
5
6
7
8
9
10
11
12
13
#include <ncurses.h>

int main(void)
{
    initscr();
    addstr(“Goodbye, cruel C programming!”);
    refresh();

    getch();

    endwin();
    return(0);
}
goodbye.c

and compile it with something like clang –lncurses goodbye.c and run the output.
D'oh! I didn't think of that, but of course! Thanks, Furry Guy! Although, in retrospect, even if I had thought of it, I wouldn't have known what to put in it ;)

But hey, it worked!!!! Thanks so much!

Now for to make me some TUI programs...

BTW I thought getch() was part of the <conio.h> header file?

Also, what's with the void parameter for main()? Is that needed to use Ncurses?
closed account (z05DSL3A)
Also, what's with the void parameter for main()? Is that needed to use Ncurses?
No, it's just C.
In C, if you don’t specify the parameters of a function, it can accept any number of parameters of any type. The way to define a function, that does not accept parameters in C is to use the keyword void as the only element in the parameters list.
Grey Wolf,
Oh ok.

helios,
Oops, just saw your reply from earlier. Wow. But, Grey Wolf's example worked perfectly! I linked with -lncurses and it worked! At least I think it did...

Flux capacitance...ಠ_ಠ...that's from Back to the Future, isn't it?

Vector autoencabulation...what the...?

Um, I did a Google search on that and it asked me if what I meant was "vector auto encabulator," and...that???
https://www.reddit.com/r/VXJunkies/comments/dzrrj7/coworker_gave_me_his_old_encabulator/

Edit:
Oh.
https://en.wikipedia.org/wiki/Turboencabulator

FTR I am really bad at knowing if people are being sarcastic or making some kind of joke...my excuse.
Last edited on
BTW I thought getch() was part of the <conio.h> header file?

Nothing prevents two libraries from providing function with identical name.
They might not do the same thing.
Using both libraries would be an error; multiple definition.

You have to read the documentation of ncurses to find out what it provides and how to use it.
Ah. I figured something like that. Well, I don't even have <conio.h>, which I think is from the 90s or something anyway, so accidentally including it won't be a problem ;)

I did find a manual on invisible-island.net that has documentation for Ncurses, so I'll be reading that.
https://invisible-island.net/ncurses/man/
Last edited on
https://www.reddit.com/r/VXJunkies/
LOL. That's awesome. "Dial the gamma harmons to sub-16 values". "The shielded variance cables leak yttrium everywhere".
Topic archived. No new replies allowed.
Pages: 12