New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
drawing outside _draw in fullscreen mode #9
Comments
hoi! So, drawing things outside of draw, how do I fix my game if I have different draw functions? Instead of _ENV would calling a function as a variable (like |
Using _ENV is fine, the problem is calling any draw functions inside _init or _update. I just took a closer look at your cart; there's a edit for clarity: comment out draw_start in p8code/2.lua: function update_start()
-- draw_start()
if btnreleased |
ok so I took a look at the functions that ARE working, and what's interesting is in tab 1, I have functions like EDIT: |
NEVERMIND I GOT IT TO WORK!!!! AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA |
glad to hear it!! and thanks for the tip about rnd -- I didn't realize that had changed in picotron. ah, I think we're miscommunicating over the word "inside" -- grid() is fine, it's being called "inside" draw. every line of code that runs is running "inside" of either _init, _update, or _draw. your _draw() calls draw_game() (via _ENV) which calls grid() which calls line(), and this call to line() is happening "inside" _draw, so it's fine A different example: function do_a() do_b() end
function do_b() do_c() end
function do_c() spr(0,24,24) end
function _update()
do_a() -- this line calls `spr`, which is a problem
end
function _draw()
do_a() -- this line calls `spr`, and that's fine
end as to your other question about keeping up with p8x8 updates, I haven't updated the docs yet but I've sketched an outline here I'm happy the tool's working for you now! best of luck finishing the game :) |
cart authors must do all drawing inside _draw -- don't do any during _update. if you do, p8x8's fullscreen mode will break
todo:
notes:
cherrybomb and #pony9k_2_0 both have issues with fullscreen mode -- I think cherrybomb probably uses a
while ... flip() end
fade-in loop, which I suspect is the issue. (I didn't think picotron could even handle those style of loops! maybe just not carts that have no _draw at all?)I tried adding
set_draw_target(fakecanvas)
to the end of the fullscreen draw in pony9k_2_0 but it made things worse; very strange (and earlier on I addedlocal fakecanvas = userdata("u8",128,128)
The text was updated successfully, but these errors were encountered: