Jump to content

ZioRed

Members
  • Posts

    1,133
  • Joined

  • Last visited

Everything posted by ZioRed

  1. Unfortunately the wrapper is not documented, but it is enough OOP to let you discover everything (I usually search the functions I need in the wiki for C++, then open the wrapper source and search inside for Core.TheSearchedFunctionName method to see what is the relative method call). For positions and rotation every Entity has the properties Position and Rotation, which are Vector3.
  2. No problem, I'm happy to be useful and appreciate your offer, it may be useful nextly since I am planning something
  3. Well if the use of struct instead of class significantly affects performance then I agree that it should be done (turning up our noses for aestethics).
  4. mmh.. perhaps I remember wrong, but I thought that, when passing structs to a method, a copy of the struct is passed to the function, while passing a class a reference is passed. If it is so (as it seems from here), then I see no performance improvement changing "class" to "struct". Am I wrong?
  5. The following are the simple steps to begin a new C# project for LE (I'm building a project template to add to the solution wizard or even on ProjectWizard if he likes): 1. Open the IDE (Visual C# Express or Visual Studio) 2. Create a new Console or Windows Forms project 3. Add reference to the Leadwerks.dll wrapper (download the latest from here) 4. In the main procedure (or where you want to start the game) write the following code (haven't tried but it is similar to what I'm using): // Graphics initialization Graphics.Initialize(800, 600); // Framework initialization (the parameter enables/disables LUA) Framework.Initialize(true); if (Framework.Layers.Main.World.Pointer == World.NullPointer) return; // Details process Texture.TFilterMode = 1; Texture.AFilterMode = 4; // Collisions initalization (to change as you need) Collisions.Set(1, 1, true); Scene yourScene = Scene.Load("abstract::YOURMAP.sbx"); yourScene.CollisionType = 1; while (!Leadwerks.Window.HasRequestedClose()) { Framework.Update(); Framework.Render(); Graphics.Flip(0); } Engine.Terminate();
  6. I am trying to backup in a variable the currently used Font so that I can restore it after writing a text, but I haven't found the right command on Wiki... how can I get it?
  7. Problem solved, it seems that there is an unknown (to me) declaration of LoadFont in the wrapper, so I changed it on the wrapper and all works now (last headers 1.3b released by klepto2): File: /Leadwerks/Leadwerks.cs, Line 991: //public static extern IntPtr LoadFont(string _name, int _size, int _flags, int _charset); public static extern IntPtr LoadFont(string _name); File: /Leadwerks/Font.cs, Line 19: //return new Font(Core.LoadFont(path, size, flags, charset)); return new Font(Core.LoadFont(path)); So the call to Font.Load now requires only FontPath as it is documented in the engine.
  8. I think so too, that's why I moved my project from C++ (which I know very little) to C# (which I use from many years). I hope not to be doing a bad choice.
  9. I think you could simply try to skip the Animate() call when the current frame reaches (or exceeds) the last frame.
  10. Oh ok perhaps I understand, the "set" you intercept is for "Position" changes, not the Position's member changes. For that you may want to define a delegate in the Point class for event handling and attach an event handler in the Position set. Take a look at here if you like to implement an INotifyPropertyChanged interface for your control.
  11. You forgot to name of the property: public Position { ... } should be: public Point Position { ... } .. or is it a typo? (however I don't see the closure bracket of Position property after the "set")
  12. With SetAntialias(1) method from Framework?
  13. That page lists your blogs and the blogs you are tracking, not your favorites.
  14. Where is the link to my favorite blogs page? I have not found anywhere, but I can add blogs to favorite... Am I blind?
  15. Is the conversion of these works to GMF models enough easy and with no problem for a poor developer only? Anyone tried that? I'd like to buy GMF formats directly.. Q_Q
  16. I have tried to load a font with the following statement (I haven't understood what is and how to value the last parameter "charset", I tried with "0" and "1" and saw no difference): Font font = Font.Load("abstract::Arial12Shadow", 10, 0, 0); This line causes the following error: Now the problem seems to be in the source when calling Core.LoadFont(path, size, flags, charset) Anyone has the font loading working with the last wrapper headers? PS: with the C++ code it works: SetFont(LoadFont("abstract::Arial12Shadow"));
  17. ZioRed

    .NET Headers

    As already suggested elsewhere, the C# wrapper could be stored in a SVN (closed to commit for whom you want) so that can be easily and deeply supported by the C# community (including me, I code with C# for every kind of work ).
  18. Really I don't know and never tried that (cannot see how it may be useful since generally in a game you have GMF models for everything and so why just don't simply use the standard way?), but I think that loading a specific script for an entity other than the default way (file named same as GMF model) is not possible... But I am newbie (or less) in lua scripting, so I may be in fault. However I've found this example in which the author loads a lua script from C++
  19. That function already works with any file types, I tried to use "mytestfile.pdb" and it worked (that file was in a zip archive). EDIT: Oh, are you talking about working directly with the files contained in a zip archive? Well then I don't know how the engine load the files without extracting, but you can extract them or try to achieve the same result without extract.
  20. May be: string filePath = Leadwerks.FileSystem.GetAbsolutePath("abstract::yourmodel.gmf") It should be the absolute file path (I suspect it may run in trouble if you have more files named "youmodel.gmf" in the example, that is it may not return the path to what you expected), then you can open it with the System.IO functions.
  21. ZioRed

    C# Source

    May get it into some SVN store? It may become some nice and useful open source project and more people may work together to enhance and debug it.
  22. Is there any way to catch the Engine.Terminate()? Since I'm working to a client/server MMO with persistent world I'd need not to quit the game when engine terminates but only free its stuff and return back to login window (I use simple NET Window Form as login window because I don't know any C# GUI to use within the engine, if someone know any C# GUI that I can use please suggest).
  23. I think the lights in the editor (and probably every object you drag from the sidebar) are really models and their behaviour of "creating light" is due to the LUA scripts (see in example at /Models/Entities/Light/Directional/light_directional.lua in your SDK folder). If you load a scene in which you already have added some lights than I think you don't need to recreate the same lights in your C++ code but you have LUA enabled (see the Scene Loading Example thread): TFramework framework=CreateFramework(); //Set Lua variable BP L=GetLuaState(); lua_pushobject(L,framework); lua_setglobal(L,"fw"); lua_pop(L,1); However I think this thread should be in C++ Programming section B)
  24. Perhaps you are looking for ForEachEntityDo which allows you to cycle through entities by their class type (ENTITY_SPOTLIGHT, ENTITY_CAMERA, ENTITY_MODEL, etc).
  25. ZioRed

    C# 4.0

    NET 4.0 rulez, it's a perfect enhancement to 3.5 where I really loved LINQ features for tens of code lines it saves to us (i.e. no more annoying foreach cycles to select items from collections).
×
×
  • Create New...