Function Calling Problem- Please HELP
Übersicht

tharshanBetreff: Function Calling Problem- Please HELP |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
sorry for the bad language...
------------------------------------------------------ i want to create entities / load images from a included function.. but it not works becasue its not a Global Variable.. i could call the function manytime as needed.. so its hard to declare each objects as Global Var. is there any ways to do this ? maybe Types ? Please Reply.. ================================================ ich möchte Wesen/Last Bilder von einer enthaltenen Funktion verursachen. aber es nicht funktioniert das becasue, das nicht eine globale Variable. sein ist. gibt es irgendwelche Weisen, dies zu tun? möglicherweise Arten? Bitte Antwort. ich könnte das Funktion manytime benennen, wie gebraucht. so wendet sein hartes, jedes zu erklären als globale Sorten ein. ================================================ ==================================== MAIN.BB ==================================== Include "func.bb" Graphics 640,480,32,2 a("c:\texture.png","a") a2("a",15,15) WaitKey End ==================================== FUNC.BB ==================================== Function a(file$,name$) name$ = LoadImage(file$) If name$= 0 Then RuntimeError "Couldn't load image: "+file$ End Function Function a2(name$,x#,y#) DrawImage(name$,x#,y#) End Function |
||
Venkadesan V Tharshan |
Dreamora |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
If german is not your native language, please visit www.blitzbasic.com to ask your questions in english.
This is a german community board. And you do several elemental errors: 1. Load functions return integers, not strings, so assigning them to string is the wrong step 2. You could return the value from the function and assign it to something like someImage = a(path$) for example. Der Code hat einige grundlegen Fehler: 1. Ladefunktionen geben Integer zurück, nicht Strings, von daher ist die Zuweisung zu einem String (name$) falsch 2. Anstatt globaler Variablen kann man das geladene Bild auch zurück geben und danach einer variable zuweisen moved da im falschen board |
||
Ihr findet die aktuellen Projekte unter Gayasoft und könnt mich unter @gayasoft auf Twitter erreichen. |
tharshanBetreff: Thanks |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
ok,
i will go and Ask In BlitzBasic.com anyways Really Thank You For Your Help. |
||
Venkadesan V Tharshan |
tharshanBetreff: if you.. |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
2. You could return the value from the function and assign it to something like someImage = a(path$) for example. ......
if you dont mind.. can you show me a simple example of.. that please ? its important for me ![]() all i need to do is load , draw images from another include file.. not in main.bb file.. i need to handle the entity pointer from include function. really sorry if i am annonying you. Thanks. |
||
Venkadesan V Tharshan |
Dreamora |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
Blitz3D / BlitzPlus has no entity pointers, it only has integer handles.
They do as well not support by Reference , so you can not give the function the variable or its and fill the variable within the function!h what you tried with a2 will never work at all. realtime variable generation like this only works in scripting languages, not in compiled languages. For further questions please use german or the english boards at http://www.blitzbasic.com . Most users do not understand english and thus this thread is of no use to them. Code: [AUSKLAPPEN] ==================================== MAIN.BB ==================================== Include "func.bb" Graphics 640,480,32,2 image % a("c:\texture.png","a") a2(image,15,15) WaitKey End ==================================== FUNC.BB ==================================== Function a%(file$) result% = LoadImage(file$) If result= 0 Then RuntimeError "Couldn't load image: "+file$ return result End Function function a2(img%, x#, y#) drawimage img, x, y end function |
||
Ihr findet die aktuellen Projekte unter Gayasoft und könnt mich unter @gayasoft auf Twitter erreichen. |
tharshanBetreff: thaNKS |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
Thank you..
i will ask in german / ask the future questions in www.blitzbasic.com Thanks for your help. |
||
Venkadesan V Tharshan |
Übersicht


Powered by phpBB © 2001 - 2006, phpBB Group