Any way to access the Back Buffer with a simple line

The Partridge Family were neither partridges nor a family. Discuss.
Post Reply
User avatar
codinitup
Posts: 112
Joined: June 27th, 2012, 7:43 am

Any way to access the Back Buffer with a simple line

Post by codinitup » July 20th, 2012, 6:59 am

Hey Chili and others, I have used the entire C language in my programming experience (C,C#,C++), and I know in the .XNA framework for C# I can access the Back Buffer with 2 lines:

Code: Select all

graphics.BackBufferWidth = 800;
graphics.BackBufferHeight = 600;
and I would be able to change the screen resolution. Is there any way to do that in your framework, and if not...How can I implement it?
I really don't need it though, mostly because 800/600 pixels is enough room (and more), I'm just curious about it.
MOOOOOO

User avatar
LuX
Posts: 1492
Joined: April 22nd, 2012, 12:33 pm
Location: Finland

Re: Any way to access the Back Buffer with a simple line

Post by LuX » July 20th, 2012, 12:44 pm

You access the back buffer to retrieve pixel information.

If you want to change the resolution, you need to do it in the screen creation process. In this case you might want to take a careful look at the Windows.cpp

There's probably some code to get the screen size, but you could also define the screen size and use that everywhere you need to know it.
ʕ •ᴥ•ʔ

User avatar
chili
Site Admin
Posts: 3948
Joined: December 31st, 2011, 4:53 pm
Location: Japan
Contact:

Re: Any way to access the Back Buffer with a simple line

Post by chili » July 21st, 2012, 7:07 am

To change the screen size you need to change the size of the window and you need to change the size of the flipping chain attached to the d3d device. It's not just a couple of lines I'm afraid, although you could write a function that makes it easy to do. You will understand this better after I have explained the framework.
Chili

User avatar
codinitup
Posts: 112
Joined: June 27th, 2012, 7:43 am

Re: Any way to access the Back Buffer with a simple line

Post by codinitup » July 21st, 2012, 7:20 am

It's probably better that I wait until you have explained the framework anyways so I don't screw anything up :lol:
I'm also curious as to if you'll be explaining the DirectX parts of the framework (after all your videos are "DirectX" videos") such as the WINAPI parts and creating handles blah blah blah...

P.S. Sorry if that sounded really stupid/incorrect when you read it. I barely know what I'm talking about.
MOOOOOO

User avatar
chili
Site Admin
Posts: 3948
Joined: December 31st, 2011, 4:53 pm
Location: Japan
Contact:

Re: Any way to access the Back Buffer with a simple line

Post by chili » July 21st, 2012, 7:28 am

I will be explaining everything about the framework, and Direct3D and WinAPI will take up most of the video time for those lessons.
Chili

User avatar
Asimov
Posts: 814
Joined: May 19th, 2012, 11:38 pm

Re: Any way to access the Back Buffer with a simple line

Post by Asimov » July 21st, 2012, 9:50 am

Hi Chilli,

I can't wait for the video for the framework. I have been reading lots about win api even before I found the Chilli tutorials. Actually that is how I found the chilli tutorials. I was looking for tutorials on programming the win api and came acros them on youtube.

I have been dabbling with the API myself with setting up a menu, but I want to be able to do things like change the menu on the fly and stuff. Also I want to centre the game on the screen when I run the game. I think this will be in the CreateWindow section somewhere.

Asimov
----> Asimov
"You know no matter how much I think I have learnt. I always end up hitting brick walls"
http://www.asimoventerprises.co.uk

User avatar
LuX
Posts: 1492
Joined: April 22nd, 2012, 12:33 pm
Location: Finland

Re: Any way to access the Back Buffer with a simple line

Post by LuX » July 21st, 2012, 10:35 am

@Asimov

If you look at the screen creation, chili uses a screen offset which tells the location for the program to spawn. So what you want to do is look up a function that will get the desctop resolution, then simply divide that by two and minus half of the screen size.

I've used this method in some of my games. Forgot to add it in my space shooter tho. Also made a couple of fullscreen demos and a game without borders or control buttons, etc.

Pretty much everything. MSND got these things covered pretty well.
ʕ •ᴥ•ʔ

User avatar
Asimov
Posts: 814
Joined: May 19th, 2012, 11:38 pm

Re: Any way to access the Back Buffer with a simple line

Post by Asimov » July 21st, 2012, 11:04 am

Hi Lux,

Yes I will look into this. I do want to learn a bit more about the api, so I will be watching that tutorial avidly when it comes out.

I do agree that msdn has everything, but I can never work it out from msdn LOL.
They have everything but don't seem to convey the information in a way I can understand heh heh.

Asimov
----> Asimov
"You know no matter how much I think I have learnt. I always end up hitting brick walls"
http://www.asimoventerprises.co.uk

Natories
Posts: 107
Joined: June 21st, 2012, 7:06 am
Location: USA
Contact:

Re: Any way to access the Back Buffer with a simple line

Post by Natories » July 21st, 2012, 3:38 pm

Asimov,

I am with you on how MSDN works; a lot of information that isn't easily explained! "It reads like stereo instructions!" LOL

Natories

Post Reply