• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Legacy GM Sprites drawing in different sizes on GUI

H

HItch

Guest
I cant figure out why the last draw_sprite command draws some sprites in a smaller size? Some of the sprites I put in there draw full size, while others draw a little smaller than half. Any ideas?


DRAW GUI


if (candraw = true) {

//draw 304 x 304 box
draw_sprite(sprite_304_304_box, -1, 8,8);

//draw 288 x 288 chatcer picture inside 304 304 box
draw_sprite(sprite_samus_288_small_tits,0,16,16,)


//draw 640 x 304 box
draw_sprite(sprite_640_304_box, -1, 320,8);

//draw_text_
draw_text(328, 64, text);

// draw button (THIS IS THE ONE WHERE THE OBJECT DRAWS SMALLER)
draw_sprite(sprite_button, -1, 333, 333)

}
 

sylvain_l

Member
draw_sprite don't alter the size.

check your sprite in the ressources tree. double-click your button to open it and see it size (W & H) , also check that if your button is the right size; that it's not a big transparent image, with just a small half-sized button in the middle :p
 
H

HItch

Guest
Thank you for the reply's. I tired both and still cant get it to work. Although I changed the rooms view ratio and port view and it did make more sprites the correct size in the code. But still some sprites shrink in the code.
 
Last edited by a moderator:

RangerX

Member
They don't shrink or expand with your code there. You seem to get it all wrong.
If your sprite is 100x100, it will be drawn 100x100 with the "draw sprite" function. No escape to that.
Check in your sprite assets, open their properties panel and check their size.
 
H

HItch

Guest
They defiantly are showing in different proportions. After playing with the port and view dimensions, I see that the smaller sprites are drawing to the dimensions of the Port(1280,720) and the larger sprites are drawing to the room view(426,240)?? I've changed like 10 sprites through the same code. What the hell am I doing wrong??
 

RangerX

Member
What you doing wrong is thinking its having to do with view and port. Actually you'd need to understand each thing a bit more fully to get what is happening with your sprite.

View = the portion of the room you want to see at once
Port = the size of that portion drawn on the application surface
Application surface = internal default surface that everything is drawn on and then GMS draws it on screen
GUI layer = layer completely independant from the Application surface and drawn on top of it.

So "draw_sprite" will draw your sprite "as is". It might APPEAR on screen differently if you did not draw it at the right place (app surf or GUI layer) or if your game scaling is wrong (view+port+app surf).
 
H

HItch

Guest
Gotcha, Thank you for the explanation. Now that you say it that way I think my problem must be the game scaling. I did a display_set_gui_size command but I cant seem to get it right. Maybe its acting up because I have multiple objects placing Gui's on the screen?

PS that game your working on looks BA btw!
 

RangerX

Member
I am not expert about the GUI layer because I have an habit of not using it at all. (GM8 habit here, we did not have such a layer before!)
But the logic would be to ALWAYS have the GUI layer the same size as your application surface. Or if you want your HUD to scale independantly from the game (which would be wierd but some people do it) then your GUI layer should be sized according your monitor's resolution (while respecting screen ratio if you don't want stretching).
 
H

HItch

Guest
Made some simplified code that causes the same problem and took some pictures. The code now is only a draw GUI.

display_set_gui_size (1280,720)

draw_sprite(sprite_button, -1, 33,33)

If I have a sprite in the code that is sized 32 x 32 it appears smaller like in picture 1

If I have a sprite that is larger like (109 x 32) it draws the correct size like picture 2

The room view is set at w=426 h=240
the port is set at w=1280 h=720

What am I doing wrong? I have checked every post on the web about GUI sprites and watched over 10 tutorials. Maybe I should just figure out how to code without a GUI. Thanks!
 

Attachments

CMAllen

Member
Without seeing the code you're using to draw these sprites, that can't be answered. Something is being done incorrectly. That's all we can tell you.
 
H

HItch

Guest
I included the code for the object. I minimized it to just 2 lines of code
 
I'd say to just upload the project (or PM it to me, if you like). Your picture looks cropped, not shrunken. To me, it looks like some other issue entirely.
 
H

HItch

Guest
I cropped the image to make it a 32 x 32 sprite. Maybe I can just show you the project with a pm. I really really appreciate everyone taking the time to help me out
 
Top