Ah, ok, so if I calculate uvs, then it will be ok.
Another question reladed to "image" method. We could allow to pass actual Sprite objects, but in this case renderer shoud be fixed. like "IF pcmd->TextureId IS g_id then engine->bindTexture() ELSE IF pcmd->TextureId IS Sprite THEN draw sprite". What do you think?
Yes, you can compute the UV for TextureData (TextureBase) (0,0)-(width/exwidth,height/exheight), or take them directly from BitmapData structure (TextureRegion).
For Sprite instead of Texture, it could be possible with a lot of restrictions and trouble: you'll have to keep refs to the sprites so that they don't get destroyed (garbage collected), they won't be part of the hierarchy from Gideros point of view, need to compute the transform matrix from imgui vertices, etc.
For Sprite instead of Texture, it could be possible with a lot of restrictions and trouble: you'll have to keep refs to the sprites so that they don't get destroyed (garbage collected), they won't be part of the hierarchy from Gideros point of view, need to compute the transform matrix from imgui vertices, etc.
There is a global function defined within gideros code to do that:
int getKeyboardModifiers();
but wether you can actually use it from a plugin is platform dependant, and I am almost sure you can't from a DLL. Usual way used in plugins is to invoke lua from C code, using the appliction instance, such as:
I want to ask everyone who is interested. ImGui changes values by passing pointer to a function. in other words, if I do that:
float *v = 0.0f;
ImGui::DragFloat("my slider", v)
then value of "v" will be change by "DragFloat" function. LUA cant do that. All we can do in this situation is to return value that was changed like so:
v = imgui:dragFloat("my slider", v)
BUT! "DragFloat" also return "true" if value is changing RIGHT NOW ("false" otherwise), so we should also return this flag in LUA like so:
v, active = imgui:dragFloat("my slider", v)
There is 4 types of sliders:
And a few more for colors.
My question is: in what order should I return values?
the number of values is at most 4 and always determined by the function called, right? in this case i vote for "value1, value2, value3, value4, activeFlag" order.
the number of values is at most 4 and always determined by the function called, right? in this case i vote for "value1, value2, value3, value4, activeFlag" order.
Yes, they called "DragFloat", "DragFloat2", "DragFloat3", "DragFloat4" and etc.
In gideros lua side, there was a third parameter filtering which was antialising as far as i remembered, maybe something related with it. It is just a wild guess and nothing related with cpp code .
Re fonts: Set the filtering to 3, it's always a nice setting.
Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!). https://deluxepixel.com
In gideros lua side, there was a third parameter filtering which was antialising as far as i remembered, maybe something related with it. It is just a wild guess and nothing related with cpp code .
@rraptor, can you try to enable texture filtering (GTEXTURE_LINEAR at the end of initImGui) and see what happen ? I am a bit surprised of how the glyphs are packed in the texture, I saw in the code the oversampleH default value is 3, so I would have expected your additional glyphs to be 3x bigger in X direction in the texture itself.
Thanks, iam really intrigued if imgui is versatile enough to convert my gui to it. Eg. My buttons have long click capability, can I do that with imgui?
I guess ImGui does not have this abilty out of the box, so I did this:
imgui:button("my button")-- can be any windgetif(imgui:isItemHovered())thenlocal seconds = imgui:mouseDownSec(KeyCode.MOUSE_LEFT)if(seconds >0)then-- holding buttonendend
Thanks, great, no need for native function, I can do the same. Rather add the official ones. And can't wait to try these in next gideros release. Awesome.
@hgy29 question for you How to correctly pass array to "Combo" or any other function that accepts "const ANY_TYPE* items[]"? I kinda know how to work with "const ANY_TYPE* items" but not with this one...
A few things that may/will go wrong with the code above: - you assume that the item array given from lua has numerical keys (length returned by lua_objlen), but you traverse it as a generic table, with lua_next. You should use lua_rawgeti instead of lua_next in that case. - items array (C side) is allocated on stack, but freeed as if dynamically allocated. You don't need to 'free()' it when allocated on stack
A few things that may/will go wrong with the code above: - you assume that the item array given from lua has numerical keys (length returned by lua_objlen), but you traverse it as a generic table, with lua_next. You should use lua_rawgeti instead of lua_next in that case.
But technicaly I still can use lua_next, right?
Now it works
int ImGui_impl_Combo(lua_State *L){
luaL_checktype(L, 4, LUA_TTABLE);
size_t len = luaL_getn(L, 4);if(len ==0)return0;
const char* label = luaL_checkstring(L, 2);
int item_current = luaL_checkinteger(L, 3);
const char* items[len];
lua_pushvalue(L, 4);for(int i =0; i < len; i++){
lua_rawgeti(L, 4, i+1);
const char* str = lua_tostring(L,-1);
items[i]= str;
lua_pop(L, 1);}
lua_pop(L, 1);
bool result = ImGui::Combo(label, &item_current, items, len);
lua_pushnumber(L, item_current);
lua_pushboolean(L, result);return2;}
Comments
Another question reladed to "image" method. We could allow to pass actual Sprite objects, but in this case renderer shoud be fixed. like "IF pcmd->TextureId IS g_id then engine->bindTexture() ELSE IF pcmd->TextureId IS Sprite THEN draw sprite". What do you think?
For Sprite instead of Texture, it could be possible with a lot of restrictions and trouble: you'll have to keep refs to the sprites so that they don't get destroyed (garbage collected), they won't be part of the hierarchy from Gideros point of view, need to compute the transform matrix from imgui vertices, etc.
I'll repeat my prev. question:
Can I get keyboard modifiers without usign LUA?
Usual way used in plugins is to invoke lua from C code, using the appliction instance, such as:
I want to ask everyone who is interested.
ImGui changes values by passing pointer to a function. in other words, if I do that:
And a few more for colors.
My question is: in what order should I return values?
OR
OR
in this case i vote for "value1, value2, value3, value4, activeFlag" order.
Likes: MoKaLux
Fragmenter - animated loop machine and IKONOMIKON - the memory game
Likes: keszegh, MoKaLux, SinisterSoft
@hgy29 can you see whats wrong? Font loading in "initImGui".
https://wiki.giderosmobile.com/index.php/Font.new
https://github.com/ocornut/imgui/issues/1498
https://github.com/ocornut/imgui/issues/1065
Friendly speaking didn't understand all as i am far away from imgui but maybe you will sort it out hence you are more experinced than me @rrraptor
https://deluxepixel.com
I've already looked at these topics but I haven't found a solution. But Ive fixed names
On the left is GTEXTURE_NEAREST, on the right - GTEXTURE_LINEAR.
The are all 13px "Courier new" with different oversampling value (1, 2, 4 and 8).
Color format is different from ImGui original. It is gideros like: 0xaabbcc, alpha. Alpha is optional and by default is 1.
Likes: hgy29, keszegh, MoKaLux, SinisterSoft
Likes: SinisterSoft
Fragmenter - animated loop machine and IKONOMIKON - the memory game
I can make it into a native function if you want
Likes: MoKaLux
Fragmenter - animated loop machine and IKONOMIKON - the memory game
Likes: keszegh, MoKaLux
I just found out this:
Basically its that simple:
Likes: MoKaLux
How to correctly pass array to "Combo" or any other function that accepts "const ANY_TYPE* items[]"? I kinda know how to work with "const ANY_TYPE* items" but not with this one...
- you assume that the item array given from lua has numerical keys (length returned by lua_objlen), but you traverse it as a generic table, with lua_next. You should use lua_rawgeti instead of lua_next in that case.
- items array (C side) is allocated on stack, but freeed as if dynamically allocated. You don't need to 'free()' it when allocated on stack
Now it works
@hgy29 I used same font as on wiki page and UVs are different? (on the left is original image)
Likes: MoKaLux
Fragmenter - animated loop machine and IKONOMIKON - the memory game