µLua DS - Forum officiel | Official forum Forum Index

µLua DS - Forum officiel | Official forum
Le bon endroit pour en savoir plus sur MicroLua et pour parler de vos projets ! | The right place to learn more about MicroLua and talk about your projects !

 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Current suggestions and fixes waiting to be commited

 
Post new topic   Reply to topic    µLua DS - Forum officiel | Official forum Forum Index -> English section -> Suggestion
Previous topic :: Next topic  
Author Message
sk8erace1


Offline

Joined: 25 Jul 2010
Posts: 26

PostPosted: Sat 7 Aug 2010 - 11:55    Post subject: Current suggestions and fixes waiting to be commited Reply with quote

OK since Grahack suggested that I create a new forum to list all of the changes I've made.. So here it is.
Ready for commit, I'll try and have demos and stats sometime later today Smile
 screen.drawTri(screen, x0,y0, x1,y1, x2,y2, color)
    Draws a triangle on the screen between the 3 given points at the desired color.
    screen: the screen to draw to
    (x0,y0 - x2,y2): the coordinates of each of the corners of the triangle
    color: the color to draw with
 screen.drawQuad(screen, x0,y0, x1,y1, x2,y2, x3,y3, color)
    Draws a quad on the screen between the 4 given points with the desired color.
    Quads can be used to for instance rotate rectangles and create odd shapes.
    screen: the screen to draw to
    (x0,y0 - x3,y3): the coordinates of each of the corners of the quad
    color: the color to draw with

 screen.translate (xOff, yOff)
    Moves everything on the screen by the desired amount.
    xOff,yOff: the offset value of the screen
 screen.scale (XScale, yScale)
    Scales everything on the screen by the desired amount.
    xScale,yScale: the desired scale of the screen in percentages
 screen.setRes(w,h)
    Sets the screen resolution to the desired amounts.
    w,h: The width and height of the screen resolution (note default text doesn't scale well.. will still need tested for custom fonts)
 screen.rotate(Angle)
    Rotates the screen by the desired angle.
    Angle: the desired angle of the screen (Angle 0 - 360)

 canvas.newTri(x0,y0, x1,y1, x2,y2, color)
    Creates a triangle object for use with the Canvas object
    (x0,y0 - x2,y2): the coordinates of each of the corners of the triangle
    color: the color to draw with
 canvas.newQuad(x0,y0, x1,y1, x2,y2, x3,y3, color)
    Creates a quad object for use with the Canvas object
    (x0,y0 - x3,y3): the coordinates of each of the corners of the quad
    color: the color to draw with

 Possible fix for VRAM Image memory leaks
    Internal workings changed to use number index references which makes cleanup possible
 Image.cleanup()
    Would probably be called after the users script stops executing in the shell.lua
    Sweeps through the image array and clears out all the UL_IMAGE values correctly

 Debug.totalMemory()
    Returns: total VRAM texture memory.
 Debug.usedMemory()
    Returns: used VRAM texture memory.

I'm open for any suggestions


P.S: Please ignore the odd formatting.. this forum keeps messing things up for no reason..  Neutral


Last edited by sk8erace1 on Mon 9 Aug 2010 - 12:36; edited 10 times in total
Back to top
Publicité






PostPosted: Sat 7 Aug 2010 - 11:55    Post subject: Publicité

PublicitéSupprimer les publicités ?
Back to top
Reylak
Administrateur

Offline

Joined: 24 Nov 2008
Posts: 2,838
Localisation: Toulouse

PostPosted: Sat 7 Aug 2010 - 12:13    Post subject: Current suggestions and fixes waiting to be commited Reply with quote

I'm not sure about what screen.drawQuad() is made for. Drawing a square? Sorry, but it's just stupid in the way you did it, it is still more convenient to use screen.drawRect() with the same coordinates.
Same thing for the Canvas one.

I can't give any advice about Image.cleanup() since I never look at this part of code, but I want to say that the other two functions are really for debug purpose, so I think it should be in Debug.

Finally, please write a description line like in the documentation so the functions' purpose is obvious.
_________________


Plein d'infos sur le SourceForge !


Back to top
Visit poster’s website MSN Skype
Quent42340


Offline

Joined: 03 Jun 2009
Posts: 1,388
Localisation: Veauche

PostPosted: Mon 9 Aug 2010 - 10:51    Post subject: Current suggestions and fixes waiting to be commited Reply with quote

These fonctions are simple to add to µLua. I doubt however for Image.cleanup().
_________________
Mes projets: https://github.com/Quent42340


Back to top
Visit poster’s website
sk8erace1


Offline

Joined: 25 Jul 2010
Posts: 26

PostPosted: Mon 9 Aug 2010 - 12:19    Post subject: Current suggestions and fixes waiting to be commited Reply with quote

Yep, however the original post asked if anyone had any ideas for something that didn't just directly wrap uLib functions,
I guess I forgot to add that again sorry.
I'm looking into possible box2d for uLua, but I'm dealing with the current issues before I add any more stuff
Was thinking about 3d, I could make my own make shift 3d lib using uLib's 2d functions but it would probably be better to use some lib that has it already.. (why reinvent the wheel  Wink )
Image.cleanup() was relatively simple if you know how arrays work  Razz .
the user data variables were substituted by index values in the array and after that its simple just managing an array
for cleanup you just loop the array backwards and ulDeleteImage the images
The main reason for replacing the return values of Image.new is because before you had to nullify the referencing variable to fully cleanup, this could not have been done through C to my knowledge (perhaps by using the stack but I believe the parameters get popped off the stack)
At any rate, index values are generally how you would keep track of an instance through lua in most cases anyway from my experience
Note, I think I plan to make the canvas object use the main image list too later on but we'll see how that goes.
The canvas doesn't have image cleanup code that I know of yet, I'll take a look later on and confirm if you want
Edit:just to clear things up, this does not effect in any way or form how you use images in ulua, its all still the same just the internal workings are diferant

any suggestions are welcome! ^^
P.S: Grahack gave me svn access but I think I'll be addressing some of the issues first before I add these.


Back to top
Display posts from previous:   
Post new topic   Reply to topic    µLua DS - Forum officiel | Official forum Forum Index -> English section -> Suggestion All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  

Index | Create a forum | Free support forum | Free forums directory | Report a violation | Cookies | Charte | Conditions générales d'utilisation
Powered by phpBB © 2001, 2005 phpBB Group