Forum Replies Created
-
AuthorPosts
-
Hi everyone!
Meet totally new Find / Replace panel !
Say goodbye to annoying dialog.
- Ctrl+F – to find
- Ctrl+H – to replace
- Escape – to close find panel
Just build ‘dev’ branch.
Attachments:
Yes, in some cases I use classes just as a container for functions.
It’s convenient way for me – keep all similar functions in one place / scope / entry_point.
Here’s a proper class version of the above for you as well
In what place it’s proper?
- System cursor is a global thing, so we can manege it the sane way – via global functions. In your case we must create instance or instances.
- Separated global consts bring some noise in autocompletion, if I would write game for mobiles, I will see them when type cur somewhere.
- You restore CURSOR_ARROW, but cursor might be not an arrow type.
My class present not a single cursor – it is cursor manager.
There is a helper to work with cursors: http://monkeycoder.co.nz/forums/topic/systemcursor-wrapper-class-for-sdl_cursor/
September 13, 2017 at 1:35 am in reply to: Using 'private facades' to accessing protected members #10437Limitation is – you can’t inherit if class is final.
In my case I want to access to protected but somewhere in inner scope. So I put such bridges to private section.
Also there is an Internal keyword that we can use inside of our modules to access private sections. Like friend keyword in c++.
Is there a plan to add switcher for camera orthographic / perspective mode?
What are you going to do with that?)
As for me, component-based approach can be presented as a custom module – internal or 3d party.
This is a bit of a compromise in that it doesn’t store entities in components, but stores a single entity per gameobject (which is effectively its ‘transform’ too) that you can access directly.
As a variant. But storing (wrapping) entities in components allow us easilly replace mojo3d.entity with any other and our system will still work because we work with components not with raw entities.
This means a gameobject can’t have both a camera and a light component – it must have one or the other.
I checked it – unity3d allow us to place light and camera into single gameObject. So you can do it if you wish (although it’s looks abnormal way).
Wow, cool!
One thing I dislike here – using component string name. In my code above I achived this by Typeof().Name, because you can take a mistake in string but not in type name.
cam=GetComponent<Camera>()
Afaik, in unity you can’t directly create components, them exists attached to gameobject only. Private / internal constructor is here.
When we call gameObject.AddComponent () we get new instance.
In monkey we can also declare private constructor and call virtual protected OnCreate method.
My undone approach is here: https://bitbucket.org/nerobot/cluequa2d
I think my core code (GameObject, Component, Behaviour) is good enough.
DynamicProperty looks good. And I like entity’s signals, it may helps to wrap entity into gameobject if we want to provide public gameObject.Entity property to work directly with entity. But need to add many signals in this case, like Moved, Rotated, Scaled.
And the same problem have a place if we create other struct like color with comparison operators.
Hmm. If we add operator <=> via extension, we get different error message
Monkey12345678Struct Color ExtensionOperator <=>:Int( other:Color)Return 0EndEndMonkey1234567891011121314C:/proj/monkey2/tmp/untitled2.buildv1.1.06/windows_debug/include/untitled2_untitled2.h: In function 'int bbCompare(const t_default_Test&, const t_default_Test&)':C:/proj/monkey2/tmp/untitled2.buildv1.1.06/windows_debug/include/untitled2_untitled2.h:94:86: error: passing 'const t_default_Test' as 'this' argument discards qualifiers [-fpermissive]inline int bbCompare(const t_default_Test&x,const t_default_Test&y){return x.m__cmp(y);}^C:/proj/monkey2/tmp/untitled2.buildv1.1.06/windows_debug/include/untitled2_untitled2.h:82:9: note: in call to 'bbInt t_default_Test::m__cmp(t_default_Test)'bbInt m__cmp(t_default_Test l_other);^Probably, something wrong in generated c++ code.
Other operators <> ,< , > , = don’t solve error.
Because r/g/b/a components of Color is Float type, and Float is not comparable type.
Try to run these examples:
Monkey12345Local a:=3Local b:=5Local c:=-2If a-b=c Print "equals" ' workMonkey12345Local a:=0.3Local b:=0.5Local c:=-0.2If a-b=c Print "equals" ' doesn't work!Or you can write own fragment shader to process images.
Little more info: http://monkeycoder.co.nz/forums/topic/image-with-texture-mask/
My idea is
- pass R1 G1 B1 / R2 G2 B2 (to get by-component control) integer parameters into shader using Image.Material.SetInt( “R1”,200 ) method,
- inside of shader get color components, translate them into integers (color has ‘float vec4’ type in shader) and compare with your R1 G1 B1
- if there is a match – replace color with R2 G2 B2, converted back to float
-
AuthorPosts
