|
|
|
#1
|
|||
|
|||
|
I figured it was about time we had one of these since there are a few questions that keep popping up in multiple threads.
Last Updated 18th March 2010 for firmware version 1.11.01 Got a question about programming for the ZEN X-Fi2 and it's not on this list? Why not ask it in a reply to this thread? F.A.Q. Q. I want to make an application/game, but I'm not sure what kind of thing to make, got any ideas? A. Check out the Application/Game Ideas thread to see what other people have suggested. Q. I want to make an application/game, but I don't know how to code, can someone teach me? A. There are a lot of online resources that can teach you the programming language used to make applications for the X-Fi2. Creative have a very useful development kit to help people who want to program applications for it. The development kit also contains an introduction document that gives a lot of useful information on programming for the X-Fi2. Q. What coding language are the X-Fi2 applications made with? A. The applications are made with a coding language called Lua. You can read all about it and also get tutorials from the language's main site. Q. What program should I use to code applications with? A. Some of the members here use Notepad++ or LuaEdit to make their applications. Q. My application crashes on my player, what's wrong? A. You may want to check out Creative's Applications Developer Kit which includes a very useful simulater that can usually tell you where things are going wrong. Q. Some of the functions from the Lua.org documentation don't seem to work on the X-Fi2, why? A. Creative decided not to include some of the other functions in their Lua interpreter. The functions that do work are documented at ThievingSix's X-Fi2 Lua Wiki. If you want the functions added, I recommend you head over to the Creative MP3 Player forums and start a thread about it, or contribute a post to one of the other relevant threads. Q. One of the functions doesn't work like it's supposed to, what's wrong? A. Some of the functions, such as the thickness in the screen.drawline function and the reading of lines from a file in io.lines don't work entirely correctly. You can report these to Creative through their technical support page. The more people that report the fault, the more likely it is to get fixed! Q. The sound in my application doesn't work, what's wrong? A. Make sure the sounds you're using in your application are .WAV files at 44100Hz (44.1kHz), 16bit and stereo. To do this use a program such as Audacity or Formatoz. Got another program you use to alter your .wav files? Why not let the FAQ know? Q. How do I convert a sound file I have to the right kind of .WAV file using Audacity? A. Open the sound file you have in Audacity. On the bottom left of the window is a small button called Project Rate. Set the rate to 44100Hz. Once you've done that, click the file menu and "Export as WAV". Done! Q. My image files don't display on the screen where I want them to, what's wrong? A. Did you know that the x,y position you give for where on the screen the image should display is the top left pixel of the image, not the center? Q. The accelerometer doesn't work in the ADK simulator, what's wrong? A. Creative didn't implement an accelerometer in the simulator, so the only way to test an application that uses the accelerometer is to test it on the X-Fi2 itself. If you get errors, it may be a good idea to look at the code of other people's applications that use the accelerometer and try and figure out where your code went wrong. Q. My application works in the simulator, but still not on the player, why? A. There are a number of reasons for this to happen. Sometimes one of the functions hasn't been written properly for the player's Lua interpreter, other times the simulator doesn't account for some of the player's limits. Therefore there are multiple answers to this question;
Q. I've finished my application and it no longer has any errors, where on the net should I post it to share it with people? A. You can post it on these forums in the Finished Games & Applications sub-forum or at Xeroo.net. Got another place people can share their apps? Why not let the FAQ know with a reply to this thread? Last edited by Tetrajak; 03-19-2010 at 04:25 AM. Reason: Added more to the F.A.Q. |
|
|
|||
|
|
|
#2
|
||||
|
||||
|
Nice one Tetrajak, this will definitely be useful! Thanks for taking the time to compile it.
(Thread stickied)
__________________
"If you are good enough at English to apologize, then there is no need to." - A good friend of mine Discovered something about the X-Fi2 you think others may not know? Post it here so others can learn about it! Have a question about X-Fi2 apps? Consult the FAQ before creating a thread about it. Like my work? Tell your friends. Don't like it? Tell me so I can improve. ^.^ |
|
#3
|
|||
|
|||
|
You're welcome! I was kind of surprised one hadn't been made yet, so I thought I'd fill the gap. I hope people find it useful!
|
|
#4
|
||||
|
||||
|
Quote:
Thanks yet again, now let's leave the replies to those who want to contribute to the FAQ
__________________
"If you are good enough at English to apologize, then there is no need to." - A good friend of mine Discovered something about the X-Fi2 you think others may not know? Post it here so others can learn about it! Have a question about X-Fi2 apps? Consult the FAQ before creating a thread about it. Like my work? Tell your friends. Don't like it? Tell me so I can improve. ^.^ |
|
#5
|
|||
|
|||
|
Quote:
|
|
#6
|
|||
|
|||
|
Quote:
|
|
#7
|
|||
|
|||
|
I'm not sure if anyone here knows or if this is really the right place but I was wondering if there was any information on the X-Fi2s processor and ram specs? And, also, if it would be possible to make an emulator of sorts for something like the gameboy color for it? Just a small thought.
|
|
#8
|
|||
|
|||
|
Quote:
As for a GB emulator, I'm not sure. It all depends how clean the code is and whether it can read roms. I'd say no because Lua is such a high level language that building a program for such a spe******ed purpose is difficult, considering all the other background stuff it does as a language, you'd be better off coding something like an emulator in C or C++. I could, however, be wrong. |
|
#9
|
|||
|
|||
|
if the processor is what it says it is, hardware-wise it should be possible. (given the fact the Gameboy Color and Gameboy had a 4mhz processor and apparently the x-Fi2 has at most 300mhz), though you might be right about the coding problem. The x-Fi2 can't run C++ based programs can it?
|
|
#10
|
|||
|
|||
|
Quote:
|
|
#11
|
||||
|
||||
|
Is it possible to draw a scissor rectangle of a stretched image?
I'm looking for a combination of these two: myimage:draw(0,0,0,0,32,32) --only draws part of the image and myimage:draw(0,0,x,y) --to stretch an image. If you're wondering why: Since it is possible to stretch an image beyond the screen resolution as long as the original image is not bigger than 400x240, and thus creating a scrollable environment larger than the screen, I'd like to be able to only redraw the parts that have changed, because loading the whole image every frame is way too slow. |
|
#12
|
|||
|
|||
|
Quote:
|
|
#13
|
||||
|
||||
|
Thanks for the information. I've ditched the idea. It was for ZenDuck, so that's why there is no background in the Chase Mode.
I've got another thing on my mind: I see everyone using true and false in their code, at places where I use 1 and 0. For example here in Gruffler's Minigolf: Code:
elseif (control.isButton() == 1) and (button.click() == 1) then if menu == true then endgame = true elseif menu == false then menu = true end end Code:
elseif control.isButton()==1 then if button.click()==1 then if mode==0 then menu=0 else mode=0 win=0 end end end Is there an advantage in using true and false, or is it just the same as using 1 and 0? To be honest I think working with numbers provide more possibilities, because true and false are just two options, while a number can be nil, 0, 1 and so on.. But as the more advanced codes are using true and false, I must be overlooking something? (I thought this would be the best thread to ask questions about lua coding, if it's not, please say so and I'll stop asking questions here.) |
|
#14
|
|||
|
|||
|
Quote:
|
|
#15
|
|||
|
|||
|
Quote:
So 0 does not equal false. So it's the developers of the firmware that made that choice. Personally I don't see any advantage to either one.
__________________
Only ONE more functions in the Wiki need addressing! Zen X-Fi2 LUA Wiki Want to protect your applications? Click Here! Tower Defense Thread Zen Lock - Protect Your Zen! |
|
#16
|
||||
|
||||
|
Yep, as ThievingSix said, it is mostly a personal choice.
Lua booleans can actually have three states: nil, false, true, because "false ~= nil". Okay, nil would just signify that it is undefined ... I'm using true/false, because in my opinion it looks cleaner, because the 'true' could be omitted: Code:
menu = true
if menu then
openMenu()
end
Code:
var = true var = not var -- now 'false' var = not var -- now 'true' |
|
#17
|
|||
|
|||
|
Quote:
|
|
#18
|
||||
|
||||
|
Wow thanks a lot, all of you !
I finally see what not is for, and why a code sometimes just says while menu do. And actually I do see advantages; simpler and cleaner coding and therefore less bytes in a code, and because true and false are less data in the memory, and may also be assessed a lot quicker, there's no reason not to use them when you can, I think. |
|
#19
|
|||
|
|||
|
true and false came after the 0, 1. I don't think it's less data because true and false is 0 and 1.
__________________
Only ONE more functions in the Wiki need addressing! Zen X-Fi2 LUA Wiki Want to protect your applications? Click Here! Tower Defense Thread Zen Lock - Protect Your Zen! |
|
#20
|
||||
|
||||
|
Quote:
I guess it's just a personal choice indeed. |
![]() |
| Tags |
| application, faq, lua, x-fi2 |
«
Previous Thread
|
Next Thread
»
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
All times are GMT -5. The time now is 03:52 PM.













Hybrid Mode
