sbarisic / NuklearDotNet

.NET binding for the Nuklear immediate mode GUI
Other
186 stars 15 forks source link

Solution not passing build #29

Open sbarisic opened 8 months ago

sbarisic commented 8 months ago
          Can you share your process of getting NuklearDotNet to work in MonoGame? I just cloned the repo and I can't even get the examples to build. Not sure how to start with MonoGame.

The errors when I try to build ExampleShared or Example_WindowsForms:

Severity    Code    Description File    Line    Suppression State
Error   C1083   Cannot open include file: 'nuklear.h': No such file or directory    C:\Dev\XNA--Monogame\NuklearDotNet\NuklearDotNetRepo\Nuklear2\Nuklear.c 17  
Error   CS5001  Program does not contain a static 'Main' method suitable for an entry point C:\Dev\XNA--Monogame\NuklearDotNet\NuklearDotNetRepo\ExampleShared\CSC  1   N/A

Edit: If it matters, I installed NativeLibraryLoader, which is given as a requirement in the original project.

Originally posted by @kriskeillor in https://github.com/sbarisic/NuklearDotNet/issues/14#issuecomment-1800342611

sbarisic commented 8 months ago

After cloning the git repository, you need to initialize submodules before trying to build. Original nuklear is referenced as a submodule in this repository.

If your GUI tool does not support it, run these in the console

git submodule init
git submodule update
kriskeillor commented 6 months ago

Hello @sbarisic, thanks for the help.

I initialized the modules on your advice.


I was still getting the "Program does not contain a static 'Main' method suitable for an entry point" error.

I also noticed this diff in the ExampleShared.csproj:

<<<<<<<<
-    <OutputType>Library</OutputType>
--------
+    <OutputType>WinExe</OutputType>
>>>>>>>>

I undid this change, along with some changes to the packages I had made: ExampleShared\packages.config:

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="Microsoft.DotNet.PlatformAbstractions" version="2.0.3" targetFramework="net48" />
  <package id="Microsoft.Extensions.DependencyModel" version="2.0.3" targetFramework="net48" />
  <package id="NativeLibraryLoader" version="1.0.13" targetFramework="net48" />
  <package id="Newtonsoft.Json" version="9.0.1" targetFramework="net48" />
</packages>

(similar changes were made in the .csproj, all were removed)


This removed the build errors, but when trying to launch I get a warning that:

"A project with an Output Type of Class Library cannot be started directly. In order to debug this project, add an executable project to this solution which references the library project. Set the executable project as the startup project."

So, I changed the startup project from ExampleShared to Example_WindowsForms. This got a build launched!

I don't think the drawing is as intended however: image

The SFMLExample looks great: (is there a way to disable the console window?) image

As well as the RayLib example: image


So in summary:

  1. Initialize your git modules
  2. Don't use "ExampleShared" as a startup project
  3. Windows forms might not be working right, at least on my PC (Frame.work Win11 64 bit laptop)

Thank you again!

sbarisic commented 6 months ago

The windows forms example "works as intended", there is no built in way to draw a textured triangle so i gave up on a custom implementation as that would be slow.

As for the build errors, i will check that out later, could be that the last merge failed somewhere