olsu
olsu
CC#
Created by osm on 6/2/2024 in #help
Converting a code from C to C#
FNA (C#) does this with FNA3D (c) if you want to see an example
6 replies
CC#
Created by osm on 6/2/2024 in #help
Converting a code from C to C#
it depends why you want it in c#. if it's applicable, you could refactor your code (if needed) to export all the necessary functions to a dll, then import the dll in c#.
6 replies
CC#
Created by olsu on 6/1/2024 in #help
List<> modification
alright, ill explore a bit and see what i can do
73 replies
CC#
Created by olsu on 6/1/2024 in #help
List<> modification
the current project we wrote used c++ with imgui and imgui works by taking in a pointer to what data you want in the ui, then updates the value at the pointer depending on user input-- meaning you dont have to copy a bunch of stuff and i want to write an imgui wrapper so we can move all the logic to c# while not having to copy data
73 replies
CC#
Created by olsu on 6/1/2024 in #help
List<> modification
are you experienced doing things like that?
73 replies
CC#
Created by olsu on 6/1/2024 in #help
List<> modification
also the biggest problem is that fna is written to support opengl, vulkan, and direct3d, but only uses hlsl for shaders, meaning in c++, i'd have to implement all 3 and build my own shader transpiler
73 replies
CC#
Created by olsu on 6/1/2024 in #help
List<> modification
maybe, it's hard since i dont know c# well enough to know what works and what doesnt and honestly by the time i do, i think writing c++ code might not even be necessary anymore
73 replies
CC#
Created by olsu on 6/1/2024 in #help
List<> modification
me and some other guy already made a project that does this, but it's really innefficient since we're basically sending json files between the language and parsing that every frame
73 replies
CC#
Created by olsu on 6/1/2024 in #help
List<> modification
unfortunately, i really cant-- im making a mod for a game that uses fna. I could use dllimports to port c++ into c#, but it's a pain since i need data from the c# side (stuff from the game's memory) that would need to go back and forth between c++ and c#
73 replies
CC#
Created by olsu on 6/1/2024 in #help
List<> modification
i actually thought about fixing this issue by doing something similar to the cs equivalent of
std::vector<TrailVertex*>
vector.push_back(new TrailVertex(...))

//clean up memory
std::vector<TrailVertex*>
vector.push_back(new TrailVertex(...))

//clean up memory
since that way i'd be just getting the pointer to the actual instance i want to modify, but i figured c# isn't meant to be written that way
73 replies
CC#
Created by olsu on 6/1/2024 in #help
List<> modification
since in cpp, im pretty much always writing unsafe code anyway
73 replies
CC#
Created by olsu on 6/1/2024 in #help
List<> modification
how advised against is unsafe
73 replies
CC#
Created by olsu on 6/1/2024 in #help
List<> modification
to me, it seems like i need to know more about the language if i use List given the problem we've been talking about this whole time
73 replies
CC#
Created by olsu on 6/1/2024 in #help
List<> modification
i dont think it's too low level
73 replies
CC#
Created by olsu on 6/1/2024 in #help
List<> modification
i found a function Array.Resize<>() so i think i can make do
73 replies
CC#
Created by olsu on 6/1/2024 in #help
List<> modification
yeah i imagined so
73 replies
CC#
Created by olsu on 6/1/2024 in #help
List<> modification
since i think vertices[0].Position works on raw arrays
73 replies
CC#
Created by olsu on 6/1/2024 in #help
List<> modification
i assume that's how List<T> implements resizing too, so copying once is better than copying twice
73 replies
CC#
Created by olsu on 6/1/2024 in #help
List<> modification
honestly i think im just going to use raw arrays since that's copying data anyway
73 replies
CC#
Created by olsu on 6/1/2024 in #help
List<> modification
it seems sketchy since VertexPositionColor (an xna written vertex structure) is written as a struct like
[Serializable]
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct VertexPositionColor : IVertexType
{
public Vector3 Position;
...
[Serializable]
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct VertexPositionColor : IVertexType
{
public Vector3 Position;
...
73 replies