Add objects in the scene
Blitz3D Forums/Blitz3D Programming/Add objects in the scene
| ||
I have a button that adds a cube, which is not as giving an identifier to handle newly assigned to each cube editor.![]() ; - Menú. ; ------------------- While Not KeyHit(KEY_ESC%) WaitTimer ( tmrFPS% ) UpdateWorld RenderWorld AlbaLynx_Update(); While( alGetEvent(event) ) Select( event\type_ ) Case ALEVENT_CLICK: If (event\object_ = menuPrincipal\salir% Or event\object_ = btn_exit) Then Salir% = True End If If (event\object_ = menuPrincipal\cubo% ) Then ; New Cube Click button. Cubo. Init_TCubo() End If End Select Wend If salir% = True Exit AppTitle nCubo% Flip Wend ; - Tipo TCubo. ; ------------------- Type TCubo Field cubo Field padre% End Type Global nCubo% ; - Init TCubo / Objeto. ; ------------------- Function Init_TCubo.TCubo( padre% = False ) Local cubo.TCubo = New TCubo nCubo% = nCubo% + 1 cubo\padre% = padre% cubo\cubo% = CreateCube( cubo\padre% ) Return ( cubo.TCubo ) End Function ; - Eliminar cubos. ; ------------------- Function DeInit_TCubos%() Local cubos.TCubo = Null For cubos.TCubo = Each TCubo If ( cubos\padre% ) Then EntityParent ( cubos\padre%, False ) End If If ( cubos\padre% ) Then FreeEntity ( cubos\cubo% ) cubos\cubo% = 0 End If Delete Each TCubo Next End Function |
| ||
The InitCubo() function creates and assigns a cube to cubo\cubo% as intended. There may be an issue with the DeInit function in that Delete Each TCubo will free ALL the instances of the type, so should not be within the For Next loop. INSTEAD: Either ; - Eliminar cubos. ; ------------------- Function DeInit_TCubos%() Local cubos.TCubo = Null For cubos.TCubo = Each TCubo If ( cubos\padre% ) Then EntityParent ( cubos\padre%, False ) End If If ( cubos\padre% ) Then FreeEntity ( cubos\cubo% ) cubos\cubo% = 0 End If Delete cubos Next End Function OR ; - Eliminar cubos. ; ------------------- Function DeInit_TCubos%() Local cubos.TCubo = Null For cubos.TCubo = Each TCubo If ( cubos\padre% ) Then EntityParent ( cubos\padre%, False ) End If If ( cubos\padre% ) Then FreeEntity ( cubos\cubo% ) cubos\cubo% = 0 End If Next Delete Each TCubo End Function |
| ||
Thanks You. Now I have a problem and I can not enter data from the keypad on the keyboard. The right keypad where the numbers are. Any suggestions? ![]() |
| ||
those keyboards usually have the blue FN Key to do the numberblock keys. Or use copy paste from the font table tool. |
| ||
No Work.![]() But if income data with the numbers below the function keys if it works. |
| ||
I understand this is a gui library you use in Blitz3D? Then search the input handler and modify it, so it will accept both, numpad numbers and keypad numbers. See scancode list in help. |
| ||
![]() I am confused something: In this simpel example I can enter numbers with the keys below the functional (F1, F2), but with the number keys right side of my keyboard does not work. |
| ||
This is just how Blitz works (and has always done so) |