• 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 [SOLVED]d3d game in a window inside a window

I

InfantRegalia

Guest
Hey guys, so here's a pic of my game. It's a simple d3d dungeon.


But I want to make it look like this.



See the difference? Now the d3d game screen is in a small window in the middle of the game window. And I can draw a HUD all around it, like in them old school games.

Alas, I can't find a way to do it. It just stretches my dungeon all over me screen. And painting a HUD over the parts of the first person view is terrible. Help me out?

I tried using views, but they don't seem to do anything.
 
R

renex

Guest
You don't have to do that. Game maker does this for you.

1. Disable automatic draw using application_surface_draw_enable(0) on a game start event somewhere.
2. While you're there, resize the application surface to the desired 3d rectangle size using surface_resize(application_surface,w,h).
3. Add a draw gui event to a controller object.
4. On this draw gui event, draw your game hud and then draw the application surface using draw_surface(application_surface,u,v).
 
I

InfantRegalia

Guest
You don't have to do that. Game maker does this for you.

1. Disable automatic draw using application_surface_draw_enable(0) on a game start event somewhere.
2. While you're there, resize the application surface to the desired 3d rectangle size using surface_resize(application_surface,w,h).
3. Add a draw gui event to a controller object.
4. On this draw gui event, draw your game hud and then draw the application surface using draw_surface(application_surface,u,v).
thanks a lot! I'm gonna retry this method in a few hours, but I think I've already done it, and my gui made by draw gui event still drew inside the resized application surface! where could've I gone wrong?
 

slayer 64

Member
You could try making two views in the level editor and in the draw event only draw to view 1. View 1 comes after 0 so it should draw on top of view 0. You'll need to set an orthographic projection to draw 2d while 3d mode is on.
controller draw GUI
Code:
if view_current=0
{
d3d_set_projection_ortho(0,0,view_portw[0],view_porth[0],0)
//draw white scribbles
}

if view_current=1
{
//draw 3d
}
 
I

InfantRegalia

Guest
You don't have to do that. Game maker does this for you.

1. Disable automatic draw using application_surface_draw_enable(0) on a game start event somewhere.
2. While you're there, resize the application surface to the desired 3d rectangle size using surface_resize(application_surface,w,h).
3. Add a draw gui event to a controller object.
4. On this draw gui event, draw your game hud and then draw the application surface using draw_surface(application_surface,u,v).

Niiiiiiiiiice! It worked, sort of! Not ideal, but the problems I'm having now, I know how to solve! Thank you so much, my man! That was a great answer after all! :3
Lots of love!
 
I

InfantRegalia

Guest
You could try making two views in the level editor and in the draw event only draw to view 1. View 1 comes after 0 so it should draw on top of view 0. You'll need to set an orthographic projection to draw 2d while 3d mode is on.
controller draw GUI
Code:
if view_current=0
{
d3d_set_projection_ortho(0,0,view_portw[0],view_porth[0],0)
//draw white scribbles
}

if view_current=1
{
//draw 3d
}
This is also a great idea, gonna use it as my backup if all else fails! Thanks for sparing your time answering my desperate plea, man! Love and peace!
 
I

InfantRegalia

Guest
I don't know, I have no problem using this method.


Hey, man, I'm regretful to ask any more of you, but maybe you can help me solve a weird thing that's going on.
Ok, so I have my resolution at 1280x720
my hud picture is 1280x720 also

In my start event I have

application_surface_draw_enable(0)
surface_resize(application_surface,880,520)


in my draw gui event i have

draw_sprite(sexyhud,1,0,0);
draw_surface(application_surface,200,20);

and yet what I get is




See? The HUD (red lines) and the game window are tilted 30-40 pixels to the right. This is fixable by simply making

draw_surface(application_surface,160,20);

but I can't understand why it tilts like this. Where's the error?
 
R

renex

Guest
Are you using d3d transformations?

If so, make sure you are setting it to identity after each usage.

Also check to see if views are disabled.
 
I

InfantRegalia

Guest
Are you using d3d transformations?

If so, make sure you are setting it to identity after each usage.

Also check to see if views are disabled.
I don't think I do, i just have walls made with d3d draw block
and this camera -

var vect_x = lengthdir_x(32, dir)
var vect_y = lengthdir_y(32, dir)
var r = 8/5
d3d_set_projection_ext(x,y,z,x+vect_x, y+vect_y, z, 0,0,1,97,r,1,16000);

but I don't know what setting to identity means tho :(
 
M

Morriarte

Guest
Can anyone give the source code? I was trying to do, but it does not work. I can not make a picture behind 3d scene.
 
Top