-
Posts
2,953 -
Joined
-
Last visited
Content Type
Blogs
Forums
Store
Gallery
Videos
Posts posted by Roland
-
-
You could if it was return a pointer to the object and not a const, but probably wouldn't want to do that.
I just hope the whole Create() thing from LEO goes away. I was never a fan of that. In any C++ library I have never seen anything like that. If you want to create something after a certain part of code runs you either place it after that code OR use pointers. There is nothing confusing about:
Cube* cube; ... cube = new Cube(...);
That's how it should work. Not this:
Cube cube; cube.Create(...);
or any kind of weird CREATENOW thing in the ctor. That's my vote anyway.
Yes Rick. Absolutely correct. That was how I wanted to design LEO from start,
but I was voted down on that one. Maybe we could get it the proper way in LE3
And -> is a beautiful as .
-
More ideas, polymorph methods for identified data types:
Position pos=Vec3(0,0,1); Rotation rot=Vec3(80,0,0);
cube.Set(pos); cube.Set(rot); cube.Add(pos); cube.Subtract(pos);
How is Position and Rotation declared above ?
-
To conclude this long discussion.
Here is my opinion.
1 All members should be either private or protected
2 Retrieving a member should be done using a GetXXXX() const method
3 Setting a member should be done using a SetXXXX( const& value ) method
4 Queering an object state should be done by calling a bool IsXXXX() const method
5 Destructors should ALWAYS be virtual.
6 Public members should NEVER be allowed.
-
you can set a value to a Get?
No of course not. My mistake.
GetRotation is const.
Must be tired.
-
you can do
cube:GetRotation().z cube:GetRotation(1).z
in lua right now...
Same goes for LEO.
cube.GetRotation().X = 10 ;
-
Data protection is a non-existing issue in this case, since you can do the same with Set()/Get() anyway.
And it really depends what attributes you expose as public, but position is not a very secret and vulnerable information.
There's no need to be absolutarian when you can use common sense, and use whatever method is best in each situation
Speed, easyness and effectiveness is everything here, since it's one of the most used commands.
cube.MoveZ(1); cube.GetZ(); cube.MoveZ(1,1); // global cube.GetZ(1); // global cube.TurnZ(1); cube.GetRotationZ();
My approach is that either you go with oop-rules or you don't.
You cant have if kind of half-oop and go the struct public way
in some places and not in other places.
Get,Set is simple to understand.
Its fast as it will be inline code when optimized by the compiler
Its a question about be consistent in you coding.
If you are making members public, well whats the idea of using classes at all.
Then you could use struct's instead.
About adding extra methods like suggested. That may be OK even though
I think thats not needed. If anyone want those I would be easy to make
an own version with those methods that inherits the original.
-
Just brainstorming, all commands do the same thing, move a cube 1 unit forward.
cube.Move(Vec3(0,0,1));
LE 0-2 way
cube.Move(0,0,1);
also LE 0-2 way, but not officially implemented (except in BlitzMax and Lua)
cube.MoveForward(1);
shorter to write, faster and more effective since x and y values don't need to be passed
cube.position+=Vec3(0,0,1);
interesting way also, since = and += operators can do seperate things like SetPosition and Move
cube.position.z+=1;
now i kinda start to like it, no need to create additional memory, just do it directly! and shortest to write too
The two last suggestion can seem handy, but they goes against all oop rules. I would not recommend those.
Data protection (or hiding) is a very important part of good oop programming.
-
Agreed. The C# header is okay the way it is, but in version 3.0 I think the syntax should match C++.
I will question a lot of basic design elements in the next few months. Keep in mind it is because I want to make sure we are designing 3.0 the right way.
The command reference database I created is for version 2.x. A lot of it can be copied to a new database for 3.0, and we will make whatever changes are needed.
Cant wait to dive into it :P
-
My personal preference is to go the LEO way, of course
Set to set things
Get to get things
Create to create things
Always the same. You never have to wonder ...
Edit:
Oh.. and one more thing while I'm at it
GetXXXX should always be const method
All arguments that is input-only should also be const
-
We would not have an equivalent to this:
entity.SetPosition(1,2,3)
...because we can only assign one value. We could do this:
entity.position.x = 1; entity.position.y = 2; entity.position.z = 3;
...but this would involve a separate hierarchical matrix update for each line, so it would be very suboptimal.
Yes thats true.
Using properties you would have to go this way
entity.Position = new Vec3( 1,2,3 ) ; // C# entity.SetPosition( Vec3( 1, 2, 3 ) ) ; // C++
Edit:
In C++ you could have Position Vec3 as a public and then use a Vec3= operator
Then you would have almost same as in C#
entity.Position = Vec3( 1,2,3 ) ; // C++
-
No. The property approach works just like an assignment. You can compare the set thing with the operator=( some value ) in C++
For more than one argument you have to go with a normal Method.
Edit:
In LEO I implemented some kind of set/get approach
Everything that assigns something has a SetXXXX method
and everything that queries a value has a GetXXXX method
-
So when you assign this value, there is a set method that gets called internally?:
myEntity.Position = new Vector3(1.5f, 2f, 4.5f);
Is it customary to call the base class "core"? If not, wouldn't "engine" be more appropriate?
I don't like this approach because it splits the command into two commands that aren't really even commands:
myEntity.Position = new Vector3(1.5f, 2f, 4.5f); myEntity.GlobalPosition = new Vector3(1.5f, 2f, 4.5f);
I understand you know more about C# than I do, but I would like additional feedback from other C# programmers.
I'm no C# expert but this is how it works
A property can be declared and then when used it has a get and a set method internally.
An example
public class myClass { private int myval = 0 ; public int MyValue { get { return myval ; } set { myval = value ; } } }
the class can then be used like this
myClass c = new myClass ; c.MyValue = 10 ; // the internal set will be called and assign 10 to myval int x = c.MyValue ; // the internal get will be called and it returns the myval
You can omit to write the internal set method
c.MyValue = 10 ; // Causes a compiler error as the MyValue now is ReadOnly (it has no set method)
Of course you can the have more code inside the internal get and set to do more things as
range checking or whatever you decide
-
Maybe some did, but memory leaks are not always easy to catch,
so that may be the reason you have not got any answer. Usually
the community gives quick answers.
I cant help you either as I do all my stuff in C++ only.
Hopefully someone will help though.
At least you have now seen that someone read your post
-
From my experience FontHeight() and TextWidth() are not returning correct values when using any font other than the Arial9 that comes with the engine. So i advise you to test the functions before you start relying on them. Maybe it has been fixed or i was wrong, dunno.
Yes DaDonik you are right. I have now tested and they are not returning the correct values.
I found this when setting the max length of my Editboxes in my Cells C++ GUI. TextWidth return
incorrect values.
-
This looks just great.
Then only thing I has to add is
that it would be just perfect if
keyword links was generated.
That means that if in the documentation
of a function or a class, another function
or class is mentioned, this would be a linked
to that other class documentation page.
-
Yes. Looks very nice and Pro
-
I thought both of those just actually returned the height and width, not actually set them?
Yes. They are only returning values.
What I was thinking of that you could use those values to
resize the surroundings, like a text field height and width.
-
I have a few questions around fonts and font sizes. According to the wiki, LE has only 1 font with fixed size available: Arial9.
http://www.leadwerks.com/wiki/index.php?title=LoadFont
I seem to recall from the old forum that several other fonts were supported like calibri and Tahoma. Anyway this would mean that for every different font and different size, I would have to create a new dds and ini?
Suggestion:
You could use FontHeight and TextWidth functions to dynamically resize things
depending on current font
-
I'm in no position of influence what is going to be done with LE in the future.
I was just giving my personal opinion and thats an opinion coming from a C++ developer.
I might be wise or not. In fact I don't care what Josh use to get the thing going
as long as it does and I can use it from C++. But if someone ask me I would prefer
the C++ solution.
I bought BMax and Blide to get started with that, but after a while i found that
although it works perfectly I made better results with C++. Why? Not because there
is something wrong with BMax. The reason is that I'm used to C++ since dirt was invented
and makes things faster in C++. So I guess its a question of ones personal background.
And I still think using C++ makes the engine less dependent on non-Leadwerks resources.
But that could be said about using OpenGL also, so in the end its up to what Josh find
best to work with.
I can live with any solution as long as the engine is good and has a C++ API.
Maybe if BMax had more promotion it could take off?
The question is if it should be Leadwerks task to promote it.
As all knows I vote for a C++ engine with Bmax API supported.
C# and other language API by the community as before
-
keep in mind though that BMax is pure asm after the project is built. It uses flat assembler to compile the final .exe, library etc. I wrote my own compiled basic language using fAsm and it is a clean, fast way to do it. I guess what i am saying is alot of "compiled" languages like c++, BMax etc. all end up as assembly code. The advantage to c or c++ is tighter asm code from years of refinement. But most things can only be done one way in cpu land.
Compiled blitz code example at asm level
mov eax,5 mov [var],eax
Compiled c++ example at asm level
mov eax,5 mov [var],eax
that may not be correct syntax as i am a little rusty at asm, but you get the point
Yes. That might be true, but you missed my point.
I don't dispute the BMax language, the point was to minimize the dependency on
3rd party software as BMax and its modules are.
I'm sure BMax is a great language but still it makes the engine dependent
on the BMax developers when thats not needed. If the engine was written in C++
and then had a BMax API that dependency would be gone. BMax user would still have
an engine API
-
I think the new logo is great
That's all
-
My thoughts on this is that C++ is, has always been and will always bee (except pure ASM)
the ground bolt to build on. No 3rd Party things needed, works on all platforms etc etc etc.
I would make the engine in C++ and then make an BMax API instead of
having a BMAX engine with a C++ API. Other languages as C# or what the
community is interested in doing can still be done as before, by the community.
So my 2 cents for a C++ engine with a Bmax API. No one loses anything and the
engine won't be dependent on BMax developer team.
-
First of all I want to really encourage this good imitative by you NA.
Your knowledge would surely help many of us from just 'poking around'
to actually make something usable.
The best tutorial serial I could think of is one that shows
how to make something usable from scratch to goal. This could
be a very simple level but well done. A level that includes
the most common things that is needed such as those you are
mentioning. The tutorials could then show different techniques
as they need to be implemented for this level.
The end result would then be a simple playable level.
This Game Tutorial could be divided into a number of steps
where you go from "the empty screen" to the end result.
This way many techniques could be shown as separate
sub tutorials along the way to reach the final goal.
Also then each of them would fit into a bigger picture
and would follow a red thread aiming for the end result.
Of course I understand that making such a serial would
generate much work, but it does not need to be as
complicated at it sounds.
On the other hand, every "advanced" tutorial is
appreciated in any form or flavour. I have been
playing around now for some years without producing
more than small bits of a game, without actually
coming to an end of anything.
Best wishes
Roland
-
That's why I invented the Global Standard. If you don't use it, you only get problems In GS the "." seperates decimals and the "," seperates thousands. If you use that rule, you can avoid hundreds of problems with all kinds of computer software, including BizTalk, CSV files, Excel, Paradox, etc..., and now even with FontStudio. It just pays back, since time is money.
To bad the FontStudio creator did not know about your NWO. ..oh..ooops... GS I mean
However its nice to get the problems solved.
Official documentation
in General Discussion
Posted
Hmmm.. Wish I could write in Swedish.
What I mean is when you checks the state of an object as in
entity.IsVisible() ;
Here you don't get a value, you get an answer on a question about the object state.