Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - johnnywz00

Pages: [1] 2
1
General / Re: Trying to set settings in custom XCode template
« on: February 16, 2025, 03:43:59 pm »
I'm not aware that altering settings within a created project writes to a .plist anywhere. If it does I'd be happy to know. The only .plist I know to tamper with is the one(s) that go along with the SFML templates, and as mentioned, couldn't find anything about hardened runtime in those. I'm pretty certain that ENABLE_HARDENED_RUNTIME is the correct value as that's what XCode displays when you hover over the setting...

2
General / Re: Trying to set settings in custom XCode template
« on: February 14, 2025, 05:55:33 pm »
I'm afraid I don't know what you're getting at... I'm aiming to be able to start new projects with Hardened Runtime off/disenabled (because it won't allow the SFML libraries), without having to turn it off manually each time. But my statement that non-SFML-template new projects started with Hardened Runtime off was based upon an older version of XCode, and is no longer correct. A basic XCode project, without SFML template, does start with Hardened Runtime enabled. So I suppose it has nothing to do with the SFML template.
Still, I am puzzled as to why the code I posted *doesn't* turn it off, since I'm specifying it in custom settings. As mentioned, other custom settings listed the same way do indeed take effect in my customized SFML template.

3
General / Trying to set settings in custom XCode template
« on: February 11, 2025, 06:29:00 pm »
I have copied the CLT template for XCode, and successfully added some of my own build settings by inserting some additional XML in the .plist file. However, I am being foiled with the `Enable Hardened Runtime` setting. In spite of including
```
(<plist>)
(<dict>)
        <key>Project</key>
       <dict>
          <key>SharedSettings</key>
          <dict>
             <key>ENABLE_HARDENED_RUNTIME</key>
         <string>NO</string>
          </dict>
       </dict>
```
the new SFML project will always start with hardened runtime enabled, and I have to turn it off manually. I suspect that some inherited behavior from the SFML template is causing this (because when I don't use the SFML template, hardened runtime isn't on), but on inspecting the files I can't see anywhere that it's specified. Does anyone know why this setting doesn't take effect, although the others that I've tried do?

4
For any future readers of this thread, Perplexity spit out this code in regards to using Cocoa to keep a toolbar window on top. I haven't tested it.

-----

Yes, you can use a native window handle from SFML to interact with the Cocoa API and create a second RenderWindow that stays on top of the first, such as a toolbar window. Here's how you can approach this:

1. Obtain the native window handle from SFML:

```cpp
sf::WindowHandle handle = window.getSystemHandle();
```

2. Use Objective-C++ to interact with the Cocoa API. Create a .mm file to mix C++ and Objective-C code:

```objc
#import <Cocoa/Cocoa.h>
#include <SFML/Graphics.hpp>

void createToolbarWindow(sf::WindowHandle mainWindowHandle, sf::RenderWindow& toolbarWindow)
{
    NSWindow* mainWindow = (__bridge NSWindow*)mainWindowHandle;
   
    // Create the toolbar window
    NSRect frame = NSMakeRect(0, 0, 300, 50); // Adjust size as needed
    NSWindow* toolbarNSWindow = [[NSWindow alloc] initWithContentRect:frame
                                                           styleMask:NSWindowStyleMaskBorderless
                                                             backing:NSBackingStoreBuffered
                                                               defer:NO];
   
    [toolbarNSWindow setLevel:NSFloatingWindowLevel];
    [toolbarNSWindow setReleasedWhenClosed:NO];
    [toolbarNSWindow makeKeyAndOrderFront:nil];
   
    // Position the toolbar window relative to the main window
    NSRect mainFrame = [mainWindow frame];
    NSRect toolbarFrame = [toolbarNSWindow frame];
    toolbarFrame.origin.x = mainFrame.origin.x;
    toolbarFrame.origin.y = mainFrame.origin.y + mainFrame.size.height;
    [toolbarNSWindow setFrame:toolbarFrame display:YES];
   
    // Create SFML RenderWindow from the NSWindow
    toolbarWindow.create((__bridge WindowHandle)toolbarNSWindow);
   
    // Set up window following behavior
    [mainWindow addChildWindow:toolbarNSWindow ordered:NSWindowAbove];
}
```

3. In your main C++ file, call the function to create the toolbar window:

```cpp
sf::RenderWindow mainWindow(sf::VideoMode(800, 600), "Main Window");
sf::RenderWindow toolbarWindow;

createToolbarWindow(mainWindow.getSystemHandle(), toolbarWindow);

// Your main loop
while (mainWindow.isOpen())
{
    // Handle events and draw to both windows
    // ...
   
    mainWindow.display();
    toolbarWindow.display();
}
```

This approach allows you to create a toolbar window that stays on top of the main SFML window using Cocoa API calls[3][1]. The toolbar window is created as a borderless NSWindow and set to float above other windows. It's then attached to the main window as a child window, ensuring it moves along with the main window.

Remember to compile your project with Objective-C++ support and link against the Cocoa framework[2]. You may need to adjust your build settings or CMake configuration to include the necessary frameworks and compile flags.

Citations:
[1] https://github.com/SFML/SFML/issues/1549
[2] https://www.sfml-dev.org/tutorials/2.6/compile-with-cmake.php
[3] https://stackoverflow.com/questions/525609/use-c-with-cocoa-instead-of-objective-c
[4] https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/CocoaFundamentals/WhatIsCocoa/WhatIsCocoa.html
[5] https://en.sfml-dev.org/forums/index.php?topic=1600.15
[6] https://www.sfml-dev.org
[7] https://en.sfml-dev.org/forums/index.php?topic=8247.0
[8] https://www.reddit.com/r/GraphicsProgramming/comments/19cf2ey/how_a_window_drawn_by_glfw_or_sfml_is_different/

5
Window / Re: How to keep toolbar window from disappearing
« on: January 22, 2025, 03:20:57 pm »
Thanks for the reply. As I'm only toying with this for myself, I'm probably not going to obsess over it. I will probably just implement my toolbar as a RectangleShape-based entity in the main RenderWindow which can be clicked and dragged around, updating all the tool button locations simultaneously.
As mentioned, I *sort* of managed to keep it on top by calling requestFocus each frame that the isActive boolean is true, but it just looks pretty half baked flashing and reappearing every time a tool clicks the main window.

6
I've messed around with SFML for about 5 years off and on, but this is the first time I've tried to make more than one RenderWindow in a program (a platformer level editor). The second window is just a small floating toolbar. However, because the OS (MacOS 15) views it as a separate system window, it disappears when I click anywhere on the main window (which fills the screen).
I haven't played with this long, but no clean solutions come immediately to mind, so I thought I'd just ask right off.
I *can* store my own boolean about whether the tool window is supposed to be visible, and call `requestFocus` for the tool window on every iteration of the game loop, which brings it back after a click, but: the tool window flashes because it's getting destroyed and recreated on every click in the main window, which looks distracting and inelegant at the least. But also, I haven't even begun to test button clicks or keystroke-activated commands to see whether all the events work properly, so I can't even say that the above approach qualifies as a solution.

7
DotNet / How to generate SFML.Net documentation
« on: November 17, 2024, 05:35:36 am »
Never mind... I finally got AI to teach me how to generate it. I sure lost some hair in the process, though. Here is what I did. Happy are those who already knew how to generate documentation.

Download source for Doxygen (1.12.0 at the time of posting)
Build with CMake. Oh, wait... your version of "bison" isn't good enough for Doxygen? Download bison 2.7. (On Mac I used the Terminal command `brew install bison@2.7`). What, CMake still thinks your version of "bison" isn't good enough? Click on CMake's "Environment" button (GUI CMake), and where you see PATH, enter the full path to where bison 2.7 is located, and then a colon, BEFORE the paths that are currently typed there. If you used `brew install`, this path is likely to be something like `/opt/homebrew/Cellar/bison@2.7/2.7.1_1/bin`.
Now CMake should configure correctly and generate a Makefile.
In Terminal navigate to the Doxygen/build folder and enter `make`.
If you want you can install the `doxygen` binary somewhere in your PATH like /usr/local/bin. Or you can use it right where it sits and include its full path to invoke it.
You should have the source code download for SFML.Net. In Terminal, navigate to the `src` folder within that folder. Once there, enter:
`/path/to/doxygen -g Doxyfile.sfml.net`
Then open that file with a text editor. The AI recommended that I fill out the following fields: there may be more that you'll want, but this should at least give you something. The default generated Doxyfile is large, so just use the Find command to look for these keywords:

PROJECT_NAME = "SFML.Net"
PROJECT_BRIEF = "Simple and Fast Multimedia Library for .NET"
INPUT = /path/to/sfml.net/source/code   (if the Doxyfile is located in .../SFML.Net.x.x.x/src/ this can be blank)
FILE_PATTERNS = *.cs
RECURSIVE = YES
OUTPUT_DIRECTORY = ./docs
GENERATE_HTML = YES
HTML_OUTPUT = html
EXTRACT_ALL = YES
EXTRACT_PRIVATE = YES
EXTRACT_PACKAGE = YES
EXTRACT_STATIC = YES
GENERATE_LATEX = NO
HAVE_DOT = NO

Save and close the Doxyfile.
In Terminal type:
`/path/to/doxygen Doxyfile.sfml.net`
There should now be a "docs" folder located within "src". Go inside "docs", make an alias/symlink of "index.html", and put that alias somewhere easy to access.
You've finally got C# SFML Docs, and a lot less hair.

8
DotNet / .NET documentation help
« on: November 16, 2024, 03:52:30 pm »
I am trying to learn C# for a potential job opportunity in the future. I have played around with C++ SFML for several years and I'd really like to just get my feet wet by more or less translating some of my existing projects to C#/SFML.Net.
Could anyone send me/point me to the C# API docs *in HTML form*? Or give me clear step by step instructions how to produce them? All that I see docwise that came with the .Net download are four .xml files corresponding to each of the main four SFML libraries. I have wasted an entire free evening trying to figure out how to generate or get a hold of a simple doc system where I click on index.html and from there everything is linked and displayed properly in a browser. Can the C# development environment display them somehow? I tried downloading Doxygen source but first it talked about some obscure command line program that was out of date even though I have just updated my new Mac to the latest Sequoia. After some tedious wading and arcane online research, I got CMake to recognize a newer version of bison rather than the old one, and got Doxygen built. And then I was lost again, generating a default Doxyfile from the Doxygen binary, and seeing that its contents were as long as an encyclopedia and I was meant to fill it out.

9
Window / Re: ARM MacOS fullscreen problems
« on: November 03, 2024, 01:09:57 pm »
Sorry for the delay... yes, basically the same issue as the link you posted. `getFullscreenModes` was returning an empty vector. I said that I could "arm-twist" a fullscreen mode by tampering with the source file (removing the `continue` as mentioned in someone else' thread), but even though the vector was no longer empty, the result wasn't correct visually (I'm not a computer wizard, so I don't really understand what's going on with resolution and scaling).
I'd like to put some of my projects on GitHub (and have fullscreen work properly if at all possible), so I need to make sure the public has access to the same SFML release that I use, so fullscreen works the same everywhere.

Currently my code doesn't switch to fullscreen mode implicitly, but checks whether the `getFullscreenModes` vector has length before doing so.
Even if that potential crash is removed in 2.6.2, is there any news on whether the actual resolutions/scalings returned will display as expected? There was never an issue with this on my last (Intel) Mac, so I don't know where the logic differs, or how the old process could be mimicked.
Thanks, and thanks for SFML!

10
Window / ARM MacOS fullscreen problems
« on: October 26, 2024, 04:00:14 am »
I moved all of my work, SFML and other, from an Intel Mac (Mojave) to an ARM/M3 Mac (Sequoia) and was dismayed to find that my fullscreen games no longer work.

I have seen this issue reported already... I am wondering, what is the status of the fix? I am able to arm-twist a fullscreen mode (haven't verified if it's properly centered yet) on my own computer by tampering with the VideoModeImpl.cpp file and building sfml-window that way, but I would like to publish my projects to GitHub and any potential viewers will be using the "real" SFML library to build the project.

Is this fixed in 2.6.2, and does 2.6.2 have a projected release date?
Thanks,
John Z.

11
General / Re: Mouse motion trouble #2
« on: June 27, 2024, 07:24:14 pm »
I don't know much about signing, just looked some stuff up... does that require paying some kind of annual fee and getting certification?

12
General / Re: Trouble building SFGUI
« on: June 27, 2024, 05:34:39 pm »
I believe you may have been right about the font loading.  When I get time, I will try to build my own small test app with SFGUI, rather than relying on the examples, and see if things work (at least in the majority). If so, then perhaps the comment-out approach will indeed be an option that Mac users will want to be aware of (within whatever range of my OS version that produces similar behavior).
Thanks!

13
General / Re: Trouble building SFGUI
« on: June 27, 2024, 02:07:03 am »
I have been running some of the SFGUI samples, and no text appears in any of them, including Hello World!. I am going to assume that this is because I commented out the inclusion of CoreFoundation without specifying anything as a replacement?

14
General / Re: Trouble building SFGUI
« on: June 27, 2024, 01:00:04 am »
[EDIT: this allows the build process to complete, but the library does not seem to be fully functional in use]

Good news! I found at least a partial solution in a different thread. I have successfully built and installed SFGUI on MacOS 10.14.2 (although I haven't given it a test run yet). The problem revolved around a CoreFoundation framework in the OS, and the solution (such as it is) is to comment out certain lines in the CMakeLists.txt file.
That is to say, you can use CMake to do "configure" and "generate" (I used Unix makefiles, not XCode projects, so this solution may only apply to this approach).
Then, (before using "make"), navigate to the main SFGUI folder and open the file "CMakeLists.txt".
Here:

elseif( APPLE )
108    #find_library( COREFOUNDATION_LIBRARY CoreFoundation )
109   #mark_as_advanced( COREFOUNDATION_LIBRARY )

111   #add_library( CoreFoundation SHARED IMPORTED )
112   #set_target_properties(
113   #   CoreFoundation PROPERTIES
114   #      IMPORTED_LOCATION "${COREFOUNDATION_LIBRARY}"
115   #      INTERFACE_INCLUDE_DIRECTORIES "/System/Library/Frameworks/CoreFoundation.framework/Headers"
116   #)
   
118   #target_link_libraries( ${TARGET} PUBLIC CoreFoundation )
   set( SHARE_PATH "${CMAKE_INSTALL_PREFIX}/share/SFGUI" )
   set( LIB_PATH "lib" )
elseif( "${CMAKE_SYSTEM_NAME}" MATCHES "Linux" )

all of the hashtag comment symbols were added by me, and if you comment out those numbered lines, save the file, then you can open Terminal and go to the build folder and execute "make".

Mods, is this info worth posting somewhere prominent for all Mac users of SFGUI to be aware of?
Thanks!

15
General / Re: Mouse motion trouble #2
« on: June 27, 2024, 12:11:10 am »
It is, but I wasn't sure if anyone saw my ultimate question since the problem of the original post was resolved...

Pages: [1] 2