Disable Window API
#1
Posted 26 April 2015 - 03:22 AM
At this point, I'd like to try disabling the Window API when it starts to see if that helps at all.
If that doesn't work, I have a few more ideas, but first I'd like to try this
I vaguely remember that the Window API really slows down rendering on Advanced Computers
If this isn't actually the case, I guess disabling it wouldn't help...
So how would I go about disabling it, then enabling when the program finishes?
#2
Posted 26 April 2015 - 03:32 AM
Redirect to term.native(). Use term.current() to keep track of what the "initial" term was so you can go back to it later.
Edit:
That said, if you rigged your "drawObject" function to clear each line before drawing it - or even just the parts of each line that need to be cleared! - as opposed to clearing the whole display then drawing the lines one at a time, that'd help no end.
Edited by Bomb Bloke, 26 April 2015 - 03:35 AM.
#3
Posted 26 April 2015 - 05:28 AM
Bomb Bloke, on 26 April 2015 - 03:32 AM, said:
Works perfectly, it stops all the flickering
I guessed it was flickering because of my drawing of the screen (Well duh)
I use a buffer, which could be used to redraw everything without having to recalculate the positions of anything
Thing is, when you drag something around, it has to clear and reset the buffer, then redraw the screen... for every mouse_drag event
Is there a better way?
I need the buffer, I want to be able to color text based on the background of the pixel its being drawn on
Oh, also I'm using CCEmuRedux, so I can only imagine any flicker or lag will be amplified in-game
Edited by HPWebcamAble, 26 April 2015 - 05:29 AM.
#4
Posted 26 April 2015 - 05:40 AM
Sometimes making a script more efficient means making it a lot longer, so that it can handle individual scenarios better.
#5
Posted 26 April 2015 - 05:57 AM
buffer = {}
Its a table, and to clear it I just make it a blank tableWould it be more efficient to see if every pixel changed, and only draw each if it did?
Or is it better to just overwrite it anyway?
Basically what I'm asking is which is faster; drawing a pixel OR comparing two buffers and drawing only the necessary pixels?
#6
Posted 26 April 2015 - 06:11 AM
My general tactic is to figure out the bounds within which things might be changing, then redraw just that area of the screen.
#7
Posted 26 April 2015 - 09:42 AM
#8
Posted 26 April 2015 - 10:25 AM
It doesn't change colors for every pixel, instead it checks if the next pixel has a different color and if so, it writes the last pixels and changes the color.
It uses the least amount of draw calls possible.
You can also look at the code yourself (note that this comes straight out of the Surface API):
Edited by CrazedProgrammer, 26 April 2015 - 10:26 AM.
#9
Posted 26 April 2015 - 04:12 PM
Bomb Bloke, on 26 April 2015 - 06:11 AM, said:
I'll see if I can get this working, I considered it earlier but decided against it. Probably the most efficient.
MKlegoman357, on 26 April 2015 - 09:42 AM, said:
I might use this method if I can't get the first to work
CrazedProgrammer, on 26 April 2015 - 10:25 AM, said:
It doesn't change colors for every pixel, instead it checks if the next pixel has a different color and if so, it writes the last pixels and changes the color.
It uses the least amount of draw calls possible.
You can also look at the code yourself (note that this comes straight out of the Surface API):
I might end up using a slightly modified version of your API if I can't get one of the first two working
PS On your forum post for it, some of the links for the function documentation aren't working
#10
Posted 26 April 2015 - 05:04 PM
HPWebcamAble, on 26 April 2015 - 04:12 PM, said:
PS On your forum post for it, some of the links for the function documentation aren't working
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











