Navigation

    Fuze Arena Logo
    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Popular
    • Users
    • Groups
    • Help
    • Discord

    How to copy an image of the Code Editor in your program!

    Coding
    2
    2
    217
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • vinicity
      vinicity F last edited by vinicity

      HI,

      I know that some people were curious about how I managed to achieve the effect of having the code editor split apart at the beginning of my Game Jam project, The Growing Pains of Señorita Space Worm. So here is how I did it:

      Note that in order for this to work in both handheld and docked, there must be no SetMode() call made before this. You can always do that immediately afterwards if you want to.

      This must also be done before any calls to clear() or update().

      So, the actual code that captures the image is just one row:

      screenGrab = copyImage(framebuffer, {0, 0, gWidth(), gHeight()})
      

      Now, the image of the editor is stored in the screenGrab variable and you can use it as any other image.

      For example, to achieve the effect of the editor splitting and moving apart, I just do the following:

      for t = 0 to gWidth() / 2 step 5 loop
        drawImage(screenGrab, {0, 0, gWidth() / 2, gHeight()}, {-t, 0, gWidth() / 2, gHeight()})
        drawImage(screenGrab, {gWidth() / 2, 0, gWidth() / 2, gHeight()}, {t + gWidth() / 2, 0, gWidth() / 2, gHeight()})
      repeat
      

      This draws the left part of the image on the left side of the screen with a (-t) offset, and the right part of the image on the right part of the screen with a t offset.

      1 Reply Last reply Reply Quote 12
      • JMM161437
        JMM161437 F last edited by

        thanks so much this will be useful!

        1 Reply Last reply Reply Quote 2
        • First post
          Last post