Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » One computer, two screens (in allegro)

This thread is locked; no one can reply to it. rss feed Print
One computer, two screens (in allegro)
Aqua Regia
Member #9,855
June 2008

I want a multiplayer game where player1 has one screen and player2 has another one.

I could think of two ways to do this:

¤ Use a "weird" screen resolution in allegro, like 1280x480. Then show half the buffer on each screen.

Only problem is that when you're using a "weird" resolution, the game won't go fullscreen. Is there a way to fix that?

¤ Have two buffers writing to the both screens. You write player1's information to buffer1, then write buffer1 to screen1. And at the same time write player2's information to buffer2, then write buffer2 to screen2. Is there a way to do this in allegro?

Atm there's no computer, no graphics card, no screens etc. It will be bought based on what's needed.

Any ideas?

Thomas Fjellstrom
Member #476
June 2000
avatar

Allegro 5 (4.9) supports that out of the box :)

using 4.2-4.3 for that would be a pain in the rear.

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

Peter Hull
Member #1,136
March 2001

As Thomas says Allegro 5 will be able to do it, here's the proof:
{"name":"dualies.jpg","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/5\/9\/5939f37322f6bcb0cc6b49f3222ad356.jpg","w":800,"h":600,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/5\/9\/5939f37322f6bcb0cc6b49f3222ad356"}dualies.jpg
(image from Trent's site). But you might have to wait awhile before Allegro 5 is ready...

A third option is to make a client/server system but with the server and 2 clients running on one PC. Then put one client on each monitor. That would work with Allegro 4, definitely.

Pete

Tobias Dammers
Member #2,604
August 2002
avatar

Are you sure? How would the two windows have the focus at the same time?

---
Me make music: Triofobie
---
"We need Tobias and his awesome trombone, too." - Johan Halmén

Thomas Fjellstrom
Member #476
June 2000
avatar

Windows I think is capable of noticing that you have two separate sets of input, and letting two windows have focus, but not by default, thats for sure.

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

X-G
Member #856
December 2000
avatar

... why would you need two windows to have focus at the same time in the first place? Just have one client take care of the controls for both of them.

--
Since 2008-Jun-18, democracy in Sweden is dead. | 悪霊退散!悪霊退散!怨霊、物の怪、困った時は ドーマン!セーマン!ドーマン!セーマン! 直ぐに呼びましょう陰陽師レッツゴー!

Schyfis
Member #9,752
May 2008
avatar

Are you sure that's not just one window spanning both monitors?

________________________________________________________________________________________________________
[freedwill.us]
[unTied Games]

Trent Gamblin
Member #261
April 2000
avatar

Yes, if you're running vista and have compiled with Direct3D9Ex you can get two real fullscreen devices (or more). Under XP, it uses two windows the size of each screen because of limitations of Direct3D9 (non-Ex).

Thomas Fjellstrom
Member #476
June 2000
avatar

Quote:

why would you need two windows to have focus at the same time in the first place? Just have one client take care of the controls for both of them.

How else would two separate windows take input from two sets of devices at the same time?

Quote:

Are you sure that's not just one window spanning both monitors?

Quite sure. Try some of the allegro 4.9 examples out at any time.

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

Matthew Leverton
Supreme Loser
January 1999
avatar

The problem with Allegro 4 is that a single fullscreen program takes over both monitors. You'd have to cheat with a windowed mode that spans the entire desktop (per screen).

X-G
Member #856
December 2000
avatar

Quote:

How else would two separate windows take input from two sets of devices at the same time?

Why are you so obsessed with having both windows accept input?

--
Since 2008-Jun-18, democracy in Sweden is dead. | 悪霊退散!悪霊退散!怨霊、物の怪、困った時は ドーマン!セーマン!ドーマン!セーマン! 直ぐに呼びましょう陰陽師レッツゴー!

Thomas Fjellstrom
Member #476
June 2000
avatar

Quote:

Why are you so obsessed with having both windows accept input?

How else do two separate users interact with their own window?

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

X-G
Member #856
December 2000
avatar

Why do they have to interact with their own window? Like I already said, what's wrong with one window accepting input for both?

--
Since 2008-Jun-18, democracy in Sweden is dead. | 悪霊退散!悪霊退散!怨霊、物の怪、困った時は ドーマン!セーマン!ドーマン!セーマン! 直ぐに呼びましょう陰陽師レッツゴー!

Schyfis
Member #9,752
May 2008
avatar

Quote:

How else do two separate users interact with their own window?

With two separate computers, the old fashioned way.

________________________________________________________________________________________________________
[freedwill.us]
[unTied Games]

Matthew Leverton
Supreme Loser
January 1999
avatar

Instead of asking each other the same questions in a circular fashion, perhaps you could try to resolve your differences.

If we are talking about mouse input, then we have a problem. (But Allegro only supports one mouse, so you could get around this if the mouse only was meant to work on the first display.)

If we are talking about keyboard or joystick input, then one program can control both windows.

Schyfis
Member #9,752
May 2008
avatar

Good idea. Maybe you could make a wrapper program that executes the target program twice (thus making two windows). The wrapper program could pass keyboard and joystick input to both programs.

________________________________________________________________________________________________________
[freedwill.us]
[unTied Games]

Trezker
Member #1,739
December 2001
avatar

What? Allegro only supports one mouse?

Of course more than on mouse is unusual, but it wouldn't hurt to support more.

X-G
Member #856
December 2000
avatar

DirectX hasn't supported more than one keyboard or mouse for quite a while now. It can still be done without DirectX, it's just trickier... and most people don't have, let alone use, more than one of either at a time, so I guess it's never been much of a priority.

--
Since 2008-Jun-18, democracy in Sweden is dead. | 悪霊退散!悪霊退散!怨霊、物の怪、困った時は ドーマン!セーマン!ドーマン!セーマン! 直ぐに呼びましょう陰陽師レッツゴー!

Aqua Regia
Member #9,855
June 2008

Thank you for your answers.

Just to clarify some things, I want a single exe-file running fullscreen in the both screens at the same time.

Only one keyboard will be needed, and I won't be using a mouse at all.

Schyfis
Member #9,752
May 2008
avatar

Quote:

Use a "weird" screen resolution in allegro, like 1280x480. Then show half the buffer on each screen.

This seems like the correct approach for one exe running fullscreen on both screens. Can any other applications that you have go fullscreen on both monitors?

________________________________________________________________________________________________________
[freedwill.us]
[unTied Games]

BAF
Member #2,981
December 2002
avatar

What about one cup, two girls (in allegro)?

piccolo
Member #3,163
January 2003
avatar

It would be sweet if allegro supported multiple of the same inputs such as keyboards and mice.

Trust me when I say its the future.
I cant say any more or they will find out i really have a time machine

wow
-------------------------------
i am who you are not am i

Matt Smith
Member #783
November 2000

You could could have 6 monochrome screens on one dual head card. That's enough for MORE THAN 9000 African schoolchildren.

Go to: