It looks like you're new here. If you want to get involved, click one of these buttons!
Hi,
I'm facing a problem with this tutorial and it's torturing my mind.
link
I'm trying to make a title menu with two item "Play" & "Quit" highlighted when you hover with your cursor, exactly what's proposed with this tutorial. I understand that they are dynamically creating the animation name with the help of a prefix which is launched with a global AnimationSet linked to each button.
When I'm compiling no error is shown but when I'm launching the program it spits this:
[19:34:14] [CONFIG] [orxConfig.c:orxConfig_ProcessBuffer(2781)] [ASMRd.ini]: Begin include @ASMR.ini@
[19:34:14] [CONFIG] [orxConfig.c:orxConfig_ProcessBuffer(2781)] [ASMR.ini]: Begin include @Title.ini@
[19:34:14] [CONFIG] [orxConfig.c:orxConfig_ProcessBuffer(2787)] [ASMR.ini]: End include @Title.ini@
[19:34:14] [CONFIG] [orxConfig.c:orxConfig_ProcessBuffer(2781)] [ASMR.ini]: Begin include @Inputs.ini@
[19:34:14] [CONFIG] [orxConfig.c:orxConfig_ProcessBuffer(2787)] [ASMR.ini]: End include @Inputs.ini@
[19:34:14] [CONFIG] [orxConfig.c:orxConfig_ProcessBuffer(2781)] [ASMR.ini]: Begin include @Player.ini@
[19:34:14] [CONFIG] [orxConfig.c:orxConfig_ProcessBuffer(2787)] [ASMR.ini]: End include @Player.ini@
[19:34:14] [CONFIG] [orxConfig.c:orxConfig_ProcessBuffer(2781)] [ASMR.ini]: Begin include @Crosshair.ini@
[19:34:14] [CONFIG] [orxConfig.c:orxConfig_ProcessBuffer(2787)] [ASMR.ini]: End include @Crosshair.ini@
[19:34:14] [CONFIG] [orxConfig.c:orxConfig_ProcessBuffer(2781)] [ASMR.ini]: Begin include @Physics.ini@
[19:34:14] [CONFIG] [orxConfig.c:orxConfig_ProcessBuffer(2787)] [ASMR.ini]: End include @Physics.ini@
[19:34:14] [CONFIG] [orxConfig.c:orxConfig_ProcessBuffer(2787)] [ASMRd.ini]: End include @ASMR.ini@
[19:34:14] [CONFIG] [orxConfig.c:orxConfig_ProcessBuffer(2676)] [ASMRd.ini]: <Display.Title> = ASMR -> ASMR (Debug)
[19:34:14] [LOG]
* This template project creates a simple scene
* You can play with the config parameters in ../data/config/ASMR.ini
* After changing them, relaunch the executable to see the changes.
[19:34:14] [DISPLAY] [orxGraphic.c:orxGraphic_CreateFromConfig(815)] Couldn't get text or texture for graphic (StartButtonInactive).
[19:34:14] [ANIM] [orxAnimSet.c:orxAnimSet_CreateSimpleAnimFromConfig(2241)] AnimSet [StartButtonAnimSet]: Failed to create anim [Inactive], couldn't retrieve associated texture's size.
[19:34:14] [DISPLAY] [orxGraphic.c:orxGraphic_CreateFromConfig(815)] Couldn't get text or texture for graphic (StartButtonActive).
[19:34:14] [ANIM] [orxAnimSet.c:orxAnimSet_CreateSimpleAnimFromConfig(2241)] AnimSet [StartButtonAnimSet]: Failed to create anim [Active], couldn't retrieve associated texture's size.
[19:34:14] [ANIM] [orxAnimSet.c:orxAnimSet_CreateSimpleFromConfig(2499)] AnimSet [StartButtonAnimSet]: Can't add link(s) starting from [Active]: source anim is missing.
[19:34:14] [ANIM] [orxAnimSet.c:orxAnimSet_CreateSimpleFromConfig(2499)] AnimSet [StartButtonAnimSet]: Can't add link(s) starting from [Inactive]: source anim is missing.
[19:34:14] [ANIM] [orxAnimPointer.c:orxAnimPointer_SetCurrentAnim(1070)] 0 is not a valid ID for the anim pointer.
[19:34:14] [ASSERT] [orxAnimSet.c:orxAnimSet_ComputeAnim(3438)] FAILED ASSERTION [_u32SrcAnim < orxAnimSet_GetAnimCount(_pstAnimSet)]
Illegal instruction (core dumped)
My ini
[Button]
Group = UI
[ButtonAnimSet]
KeyDuration = 1
StartAnim = Inactive
Inactive = # 0
Active = # 0
Inactive-> = Inactive # .Active
Active-> = Active # +.Inactive
[StartButton@Button]
Graphic = StartButtonInactive1
AnimationSet = StartButtonAnimSet
Position = (0,50,-1)
Pivot = center
Scale = 1
[StartButtonAnimSet@ButtonAnimSet]
Prefix = StartButton
[StartButtonInactive1]
Texture = Ui/Start_Inactive.png
TextureOrigin = (0,0,0)
TextureSize = (256,256,0)
[StartButtonActive1]
Texture = Ui/Start_Active.png
TextureOrigin = (0,0,0)
TextureSize = (256,256,0)
My Function called in orxUpdate
void _menuHover()
{
orxOBJECT *currentObj;
orxVECTOR cursorPos;
if(orxRender_GetWorldPosition(orxMouse_GetPosition(&cursorPos),orxNULL,&cursorPos) != orxNULL)
{
currentObj = orxObject_Pick(&cursorPos,orxString_GetID("UI"));
}
if(currentObj != previousObj)
{
if(previousObj != orxNULL)
{
orxObject_SetTargetAnim(previousObj, orxNULL);
}
if(currentObj != orxNULL)
{
orxObject_SetTargetAnim(currentObj, "Active");
}
previousObj = currentObj;
}
}
Finally don't know if it's relevant or not, I'm working on Ubuntu 20.04 and CodeLite.
I've tried lots of things and nothing worked, so any help is appreciated.
Thanks in advance.
Comments
Hi @DrTdb,
From the error log you posted, the interesting lines are:
Orx complains it can't create the graphics you requested for both animations (
Inactive
andActive
).Looking at your config data, I see:
Are those files paths correct (they need to be case-sensitive as well, given you're running on linux)?
Do you have any
Resource
section defined somewhere else that we do not see here? If not, the paths you're using will be relative to the executable's location.If the paths seem correct, it might be that orx isn't able to load your images. Maybe try to save them with a different application, sometimes some applications don't fully respect image formats when writing them.
Side note: if you plan on using the entire images, there's no need to define
TextureOrigin
andTextureSize
, as the default behavior is to use the full image for a texture.Hi, Thanks for answering.
The file path and the files are correct since I've tried to load them with simply an [Object] and a [Graphic], creating them in the INIT phase and it worked, plus they're not the first assets I use in this project created with the same method. No hidden resource section either.
I call a function in the init phase creating the [StartButton]
And
Maybe it's not the right method or the right place to call for [StartButton] ?
You're correct, I read the error message too fast. After having a closer look, I believe the tutorial is incorrect.
I'll need to give it a try on my side tonight, but if you want to test it on yours, here's how I'd define the config, had I to do it myself:
I'm not 100% sure it'll work until I test it though, as I typed it in the forum.
As a side note, seeing your
_setTitle
function, I'd recommend using an object hierarchy for easier handling:I've tried the solution you typed and it's better (less error), the viewport is back with the background and logo but still the StartButton is a no-show and it give me this :
Then, I tried force feeding him :
No more error, viewport is showing with everything in it except for this [StartButton] from hell.
Next I've tried to remove [StartButtonInactive] & [StartButtonActive] and it's back to square one, lots of error and no more viewport.
Back to the previous state (the almost working one), I've tried messing with the MainCamera FarFrustum and the Z axis and I'm still stuck, bummer. I will get back on it this afternoon.
Thanks for the side note, it's much much cleaner this way.
Hi again,
Another way to fix that message is to give the object a Graphic:
In any case, that's not the issue preventing you from seeing your object. As you've already verified if your object is inside your camera's frustum, we should be good on this side. So lastly, does your camera render the
UI
group?You need to check your camera's
GroupList
and verifyUI
is part of it. If you don't have anyGroupList
on it, your camera only renders thedefault
group.This wiki entry should help with this part: https://wiki.orx-project.org/en/tutorials/viewport_heads_up_display
Hi !
It's working ! You were right I forgot to set my [ButtonGroup] in my [MainCamera] group list, the tutorial you provided helped.
But it was not all, I had to swap
to
The first one wasn't showing the button, the second did, it seems like there is some sort of order or priority to follow.
Nonetheless, thanks a lot, I'm now back on track.
I'm glad you're back on track. Don't hesitate if you have any other questions.