Lua Programming Help Thread
This is a discussion on Lua Programming Help Thread within the PSP Development Forum forums, part of the PSP Development, Hacks, and Homebrew category; Zitat von Merick can anyone point me to some code that can rotate an image? With or without the GU?...
-
03-04-2007, 06:46 AM #5941QJ Gamer Silver

- Registriert seit
- Jun 2006
- Ort
- UK
- Beiträge
- 2.326
- Points
- 10.263
- Level
- 67
- Downloads
- 0
- Uploads
- 0
With or without the GU?
Zitat von Merick
[Blog] [Portfolio]
[Homebrew Illuminati - Serious Homebrew Development Forums]
[I want to make Homebrew FAQ] [How I broke into the Games Industry]
[Programming Book List] [Programming Article List]
-
03-04-2007, 07:05 AM #5942
hmm...
well, right now my program is only using 2d, I haven't even looked at the 3d GU yet, but if the GU can be combined with my 2d stuff without problems, and if it works better than a 2d function would....
Basically, I'm making a tile map editor and I'd like to be able to rotate the tile images by 1/4, 1/2, and 3/4 turns
-
03-04-2007, 07:17 AM #5943Banned for LIFE
- Registriert seit
- Oct 2006
- Ort
- East London, England
- Beiträge
- 2
- Points
- 18.744
- Level
- 86
- Downloads
- 0
- Uploads
- 0
gu works better than any other way. but i dont know if it will cooperate with your 2d stuff easily
-
03-04-2007, 07:20 AM #5944QJ Gamer Silver

- Registriert seit
- Jun 2006
- Ort
- UK
- Beiträge
- 2.326
- Points
- 10.263
- Level
- 67
- Downloads
- 0
- Uploads
- 0
Doing it without the GU is (very?) slow but still possible.
This will help: http://forums.qj.net/f-psp-developme...lua-98105.html[Blog] [Portfolio]
[Homebrew Illuminati - Serious Homebrew Development Forums]
[I want to make Homebrew FAQ] [How I broke into the Games Industry]
[Programming Book List] [Programming Article List]
-
03-04-2007, 07:42 AM #5945
thanks, I will eventually be looking into the gu, but for now it looks like this will do what I need
-
03-04-2007, 09:23 AM #5946QJ Gamer Gold
- Registriert seit
- Aug 2006
- Beiträge
- 1.633
- Points
- 11.629
- Level
- 70
- Downloads
- 0
- Uploads
- 0
Round a number:
Or just useCode:function roundnum(roundnum_num) return math.floor(roundnum_num+0.5) end
Code:math.floor(number+0.5)
-
03-04-2007, 12:53 PM #5947
- Registriert seit
- Jan 2007
- Beiträge
- 6
- Points
- 3.458
- Level
- 36
- Downloads
- 0
- Uploads
- 0
hii all,
I want to copy a file, but i don't know how...
It shoud work like when you are in level 5 of my game a photo need to be copied
to the photo map
-
03-04-2007, 03:35 PM #5948
Sulfer, do you mean like copy a file that's already on your memcard, or do you want to make a screenshot or something?
-
03-04-2007, 08:30 PM #5949
- Registriert seit
- Sep 2006
- Beiträge
- 484
- Points
- 8.718
- Level
- 62
- Downloads
- 0
- Uploads
- 0
Hey in netlib you need netget(id)? Becuase i looked at some online games and they dont use netget when reciing from yourgame_room..room_numbe r. They just netrecv() and netvalue, so I took out netget from the example and it didn't work?? Is there a reason for this.
-
03-05-2007, 11:41 AM #5950
- Registriert seit
- Jan 2007
- Beiträge
- 6
- Points
- 3.458
- Level
- 36
- Downloads
- 0
- Uploads
- 0
@Merick, i want copy file's that are already on my memstick, could you help me whit that? thx
(ps don't flame me for my english :o )
-
03-05-2007, 04:38 PM #5951QJ Gamer Blue
- Registriert seit
- Sep 2006
- Ort
- 6ft. Down Underground........Oh and guess what my avatar is
- Beiträge
- 387
- Points
- 4.918
- Level
- 44
- Downloads
- 0
- Uploads
- 0
Is it possible to disable a button in lua?....like lets say the "home" button. if so how
-
03-05-2007, 05:23 PM #5952
this will copy a file:
Code:file = io.open("filename.ext","r") filecopy = file:read("*a") file:close() copiedfile = io.open("newfile.ext", "w") copiedfile:write(filecopy) copiedfile:close()
-
03-05-2007, 05:53 PM #5953QJ Gamer Blue
- Registriert seit
- Sep 2006
- Ort
- 6ft. Down Underground........Oh and guess what my avatar is
- Beiträge
- 387
- Points
- 4.918
- Level
- 44
- Downloads
- 0
- Uploads
- 0
wont that just copy whats in a file and paste it in a already created file?
-
03-05-2007, 06:13 PM #5954
only if "newfile.ext" already exists. If you use the io.open and write commands with a filename for a file that doesn't exist, then it will create a new file with that name to write to
-
03-05-2007, 06:47 PM #5955I'm Baaaack!

- Registriert seit
- May 2006
- Ort
- Nowhere
- Beiträge
- 2.186
- Points
- 17.067
- Level
- 83
- Downloads
- 0
- Uploads
- 0
No, there is not. If you would like to disable people from using the HOME button, modify the LuaPlayer src to disable the callbacks. Takes about 5 seconds.
Zitat von the undead

-
03-05-2007, 07:07 PM #5956
Well, I have successfully integrated KleptoOne's image rotate function into my prog. It works fine, except that the rotated images it produces end up a bit distorted. It'll do for now but eventually I'll need to find a better way.
-
03-05-2007, 07:13 PM #5957QJ Gamer Blue
- Registriert seit
- Sep 2006
- Ort
- 6ft. Down Underground........Oh and guess what my avatar is
- Beiträge
- 387
- Points
- 4.918
- Level
- 44
- Downloads
- 0
- Uploads
- 0
ok, so do i need to install psptoolchain and cgwin or w/e?
Zitat von Access_Denied
-
03-05-2007, 08:03 PM #5958Developer

- Registriert seit
- Oct 2006
- Ort
- San Diego
- Beiträge
- 177
- Points
- 4.205
- Level
- 41
- Downloads
- 0
- Uploads
- 0
I found out the best way is to use the GU. what you do is draw four triangles with starting points in the center forming a square. Then you texture your image over it and modify the z value to change its size and (depending on how you drew the triangles) modify the roll to rotate. If you want some sample code, let me know.
Zitat von Merick
-
03-05-2007, 09:49 PM #5959
2 triangles would be easier, or one rectangle.
and using gu over top of the rest of your game is kind of a bad idea, make it all gu rendered or none of it gu rendered.
-
03-05-2007, 10:11 PM #5960Ponies and Unicorns
- Registriert seit
- Aug 2006
- Ort
- Pelennor Fields
- Beiträge
- 547
- Points
- 5.778
- Level
- 49
- Downloads
- 0
- Uploads
- 0
Well yah because you would need to recompile it after you disables the callbacks.
Zitat von the undead
If you play WoW come find me on DOOMHAMMER (US) I am Human mage lvl 64 Atrana is the name (dont ask for runs!)
Gold donations are highly appreciated!
-
03-05-2007, 10:27 PM #5961Developer

- Registriert seit
- Oct 2006
- Ort
- San Diego
- Beiträge
- 177
- Points
- 4.205
- Level
- 41
- Downloads
- 0
- Uploads
- 0
I found that 2 triangles rotates the image at the corner rather than the center. Is it just the way I drew the triangles that gives me that glitch? Also how do you draw rectangles in lua?
Zitat von eyece
-
03-06-2007, 01:59 AM #5962
its how to have positioned the texture, it should be in the center.
(middleOfSquare - (widthOfTexture / 2)) basically
-
03-06-2007, 02:55 AM #5963
Can someone tell me what the exact .WAV audio support is for LUA?
-
03-06-2007, 04:10 AM #5964
Seeing as I haven't even looked at the GU yet, I'm not even sure how I would convert my current tile drawing routines to use it. On the other hand, If i could use the GU to blit a rotated image to the screen and then use a screen capture function to save it as a regular 2d image in my tile array, then that should be pretty easy to combine with what I already have
-
03-06-2007, 05:53 AM #5965QJ Gamer Blue
- Registriert seit
- Sep 2006
- Ort
- 6ft. Down Underground........Oh and guess what my avatar is
- Beiträge
- 387
- Points
- 4.918
- Level
- 44
- Downloads
- 0
- Uploads
- 0
Can u open up a prx in lua and change a specific part of the code?
-
03-06-2007, 07:46 AM #5966Banned for LIFE
- Registriert seit
- Oct 2006
- Ort
- East London, England
- Beiträge
- 2
- Points
- 18.744
- Level
- 86
- Downloads
- 0
- Uploads
- 0
right guys another day, another question. Im still not sure if im doing the right thing. Right im using scanf to remember the letters that i enter but here's my problem when scaning for an integer you just do int NAME OF VARIABLE;
what would you enter for a string ?
-
03-06-2007, 11:10 AM #5967
- Registriert seit
- Jan 2007
- Beiträge
- 6
- Points
- 3.458
- Level
- 36
- Downloads
- 0
- Uploads
- 0
thx for the help, but how can you define wher it's need to be copied?
Zitat von Merick
-
03-06-2007, 03:01 PM #5968
Just put in the name of the folder where you want it to go:
"./folder name/filename.ext"
-
03-06-2007, 06:55 PM #5969QJ Gamer Blue
- Registriert seit
- Sep 2006
- Ort
- 6ft. Down Underground........Oh and guess what my avatar is
- Beiträge
- 387
- Points
- 4.918
- Level
- 44
- Downloads
- 0
- Uploads
- 0
y doesnt this work?....it doesnt write to the file, or print it
here is my code
Code:irsignal = nil System.irdaInit() while true do pad = Controls.read() screen:clear() if irsignal == nil then irsignal = System.irdaRead() end if irsignal ~= nil then screen:print(10, 10, irsignal) end if pad:cross() then copiedfile = io.open("remote.txt", "w") copiedfile:write(irsignal) copiedfile:close() end screen.flip() end
-
03-06-2007, 07:17 PM #5970
I don't really know anything about using the irda, but are you sure that you've got the sensor lined up properly with whatever device you're trying to read from?


LinkBack URL
About LinkBacks
Mit Zitat antworten

Hello everyone I am new here and I am glad to be part of this amazing community and I think there...
New to forum