Jump to content

Photo

DrawFrame


  • Please log in to reply
10 replies to this topic

#1 Mero

Mero

    Touch Fluffy Tail

  • Banned
  • Real Name:Tamamo No Mae
  • Location:Rainbow Factory

Posted 13 April 2012 - 08:33 AM

CODE
//DrawFrame, used to draw frames correctly.
void DrawFrame(int layer, int bitmapID, int x, int y, int width, int height, int tile, int cset){
    Screen->SetRenderTarget(bitmapID);
    Screen->Rectangle(0, 0, 0, 256, 224, 0, 1, 0, 0, 0, true, 128);
    Screen->DrawTile(0, 0, 0, tile, 2, 2, cset, -1, -1, 0, 0, 0, 0, true, 128);
    Screen->SetRenderTarget(RT_SCREEN);
    //The Vertices.
    Screen->DrawBitmap(layer, bitmapID, 0, 0, 8, 8, x, y, 8, 8, 0, true);
    Screen->DrawBitmap(layer, bitmapID, 24, 0, 8, 8, x+width*8-8, y, 8, 8, 0, true);
    Screen->DrawBitmap(layer, bitmapID, 0, 24, 8, 8, x, y+height*8-8, 8, 8, 0, true);
    Screen->DrawBitmap(layer, bitmapID, 24, 24, 8, 8, x+width*8-8, y+height*8-8, 8, 8, 0, true);
    //Horizontal Edges.
    for(int i = 1; i < width - 1; i++){
        int offset = 8;
        if(i > width/2) offset += 8;
        Screen->DrawBitmap(layer, bitmapID, offset, 0, 8, 8, x+(i*8), y, 8, 8, 0, true);
        Screen->DrawBitmap(layer, bitmapID, offset, 24, 8, 8, x+(i*8), y+height*8-8, 8, 8, 0, true);
    }
    //Vertical Edges.
    for(int i = 1; i < height - 1; i++){
        int offset = 8;
        if(i > width/2) offset += 8;        
        Screen->DrawBitmap(layer, bitmapID, 0, offset, 8, 8, x, y+(i*8), 8, 8, 0, true);
        Screen->DrawBitmap(layer, bitmapID, 24, offset, 8, 8, x+width*8-8, y+(i*8), 8, 8, 0, true);
    }
    //Center Regions.
    for(int i = 1; i < width - 1; i++){
        int xoffset = 8;
        if(i > width/2) xoffset +=  8;
        for(int j = 1; j < height - 1; j++){
            int yoffset = 8;
            if(j > height/2) yoffset += 8;
            Screen->DrawBitmap(layer, bitmapID, xoffset, yoffset, 8, 8, x+i*8, y+j*8, 8, 8, 0, true);
        }
    }
}


#2 Mero

Mero

    Touch Fluffy Tail

  • Banned
  • Real Name:Tamamo No Mae
  • Location:Rainbow Factory

Posted 18 April 2012 - 10:24 AM

So, anybody have feedback for me yet?

#3 Gleeok

Gleeok

    It's dangerous to dough alone, bake this.

  • Members
  • Real Name:Pillsbury
  • Location:Magical Land of Dough

Posted 18 April 2012 - 06:03 PM

It looks like you are doing tiling to create a box frame of some kind, however without some sort of small description I don't know that people would instantly recognize that or know how to use it. ?

Also usually what you want to do is "cache" bitmap drawing. The point of this is you draw lots of complicated things once (to a bitmap), then render it frame-to-frame with a single draw call. ex an InitFrame() method, and a DrawFrame() method. Otherwise you can get away with simply using Screen->FastTile() most of the time.

..Unless I missed something.

#4 Moosh

Moosh

    Tiny Little Questmaker

  • ZC Developers

Posted 19 April 2012 - 12:59 AM

Doesn't ZScript have a limit of 1000 things being drawn onscreen at once? If you're saving every pixel and redrawing them all, how the heck have you not exceeded that limit?

#5 Mero

Mero

    Touch Fluffy Tail

  • Banned
  • Real Name:Tamamo No Mae
  • Location:Rainbow Factory

Posted 19 April 2012 - 08:36 AM

@Gleeok
FastTile won''t work because I'm drawing 8x8 sections of tiles "mini tiles" Also also there is only one DrawTile function which is the InitFrame() method in disguise, the rest of the drawing functions draw mini tiles. Also any chance you could some built in zscript functions that actually draws mini tiles without having to crop a render target. May'be call it DrawMiniTile and FastMiniTile. icon_heh.gif

@Poke
I believe you don't understand what this does. What it does is draw a box frame in the same style the 2x2 frames are drawn to the subscreen and the style of string frames. It does this by drawing the 2x2 tile section to a bitmap and then drawing mini tiles "8x8 bitmap sections" to the screen.

Edited by blackbishop89, 19 April 2012 - 08:36 AM.


#6 Moosh

Moosh

    Tiny Little Questmaker

  • ZC Developers

Posted 27 April 2012 - 01:55 PM

QUOTE(blackbishop89 @ Apr 19 2012, 07:36 AM) View Post

@Poke
I believe you don't understand what this does. What it does is draw a box frame in the same style the 2x2 frames are drawn to the subscreen and the style of string frames. It does this by drawing the 2x2 tile section to a bitmap and then drawing mini tiles "8x8 bitmap sections" to the screen.

Hahaha! Somehow I thought you were saving every pixel oncreen in a given frame (as in the things that there are 60 of in a Zelda Classic second) and drawing it onscreen again, hence DrawFrame. It never occurred to me that you were drawing actual physical frames on the subscreen. icon_razz.gif

#7 Mero

Mero

    Touch Fluffy Tail

  • Banned
  • Real Name:Tamamo No Mae
  • Location:Rainbow Factory

Posted 27 April 2012 - 02:18 PM

That's not possible unfortunately. icon_frown.gif

#8 MoscowModder

MoscowModder

    Sometimes lurking. Rarely posting.

  • Members
  • Location:Wisconsin

Posted 27 April 2012 - 03:03 PM

Well, you can draw them on the passive subscreen... just not the active one. I think I'm going to give this a try, now that I know what it does!

P.S. Some documentation would be nice. Just explain all the arguments and what they're for (bitmap ID - what's that? Is w/h in pixels or tiles? Etc).

Edit: Tried it; bottom border of the frame never appears. Why?

Edited by MoscowModder, 27 April 2012 - 03:41 PM.


#9 Mero

Mero

    Touch Fluffy Tail

  • Banned
  • Real Name:Tamamo No Mae
  • Location:Rainbow Factory

Posted 27 April 2012 - 03:57 PM

bitmapID uses the same values as bitmap_ID from SetRenderTarget and DrawBitmap. Width and height are in half tiles. icon_smile.gif

QUOTE(MoscowModder @ Apr 27 2012, 02:03 PM) View Post

Edit: Tried it; bottom border of the frame never appears. Why?


Let me see your setup.

#10 Zim2

Zim2

    Newbie

  • Members

Posted 17 February 2015 - 12:53 AM

Can anybody tell me something about the DrawBitmap and other functions?

I read somewhere online years ago that one might be able to embed .bmp files in a .dat file and use those to draw

graphics directly on to the screen with the DrawBitmap function.

 

I still haven't been able to accomplish this yet.

 

I figured it might also be possible to do sort of like the Game->PlayEnhancedMusic function,

using an integer like this:

int Song[]="SomeLameSongName.mp3"

Game->PlayEnhancedMusic(Song,1);

 

Oh yeah, and could someone please help me retrieve my password for my original account?

I don't use the same email address anymore so I couldn't even reset my password.


Edited by Zim2, 17 February 2015 - 12:55 AM.


#11 MoscowModder

MoscowModder

    Sometimes lurking. Rarely posting.

  • Members
  • Location:Wisconsin

Posted 17 February 2015 - 01:06 AM

I don't think you can draw from a .bmp file. What you can do is draw a bunch of stuff to a built-in bitmap, then draw that entire bitmap directly to the screen in one command.

 

You'd be better off asking in the staff dropbox about recovering your old account.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users