473,394 Members | 1,960 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

vb graphics

What is the best way to flip a drawing.... I designed a chess game that can
be played over the network. I would like the board to be oriented according
to the player selection -- if player 1 is looking at the board, the white
pieces should start off at the bottom and if player 2 is viewing the board,
the black pieces should be on the bottom. I would like to accomplish this
while maintaining my current coordinate system for determining which square
was selected. Currently, when the user selects a square, a series of
calculations is performed that determines which square was selected... i
would like to preserve this while flipping the board!!

any help / suggestions / different ways of approaching the issue are are
much appreciated.

:\\derian
Nov 20 '05 #1
2 974
Hi,

You can use the bitmap classes rotate flip method.

Dim bm As New Bitmap("C:\camera.bmp")

bm.RotateFlip(RotateFlipType.Rotate180FlipNone)

PictureBox2.Image = bm

Ken

------------------

":\\derian" <de****@someplace.com> wrote in message
news:es**************@tk2msftngp13.phx.gbl...
What is the best way to flip a drawing.... I designed a chess game that can be played over the network. I would like the board to be oriented according to the player selection -- if player 1 is looking at the board, the white
pieces should start off at the bottom and if player 2 is viewing the board, the black pieces should be on the bottom. I would like to accomplish this
while maintaining my current coordinate system for determining which square was selected. Currently, when the user selects a square, a series of
calculations is performed that determines which square was selected... i
would like to preserve this while flipping the board!!

any help / suggestions / different ways of approaching the issue are are
much appreciated.

:\\derian

Nov 20 '05 #2
Hi Derian,

Your question has a sneaky little catch in it, I believe. ;-)

When you swap sides in chess (or stand over the other player's shoulder),
you <rotate> the board. This gives the same layout of squares, but, of course,
a different layout of the pieces.

You don't actually want to flip the board at all. You certainly don't want
to <draw> the board flipped!!

Black
o Q K x
x o x o
o x o P
x Q K o
White (Queen on Player's Lhs)
versus
White
o K Q x
P o x o
o x o x
x K Q o
Black (Queen on Player's Rhs)

Ok, let's talk about that solitary P on the board. To White, it's at X=4,
Y=2. To Black it's at X=1, Y=3. These are not the same <screen> square but
they <are> the same <game> square. In other words, you <must> have a mapping
from a player-centric screen square to your game board. [And, of course, vice
versa so that you draw the pieces in the correct places.]

One of your players is going to be 'lucky' in that their mapping is
one-to-one. The other player will need this 'flip' of yours. Let's have White
stay and Black be flipped.

White {X, Y} = Board {X, Y}
Black {X, Y} = Board {NS - X + 1, NS - Y + 1}

NS is the number of squares on each side (4 in my example)
So: White {4, 2} => Board {4, 2} => Black {4 - 4 + 1, 4 - 2 + 1} = Black
{1, 3}

[Of course, the game Board might be 0-based while for the Players it will
be 1-based so you'd have to have that adjustment in when you display any
co-ordinates.]

That covers what I understand the question to be. If there's more, come on
down! ;-)

Regards,
Fergus

Nov 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: JBiagio | last post by:
Hello All, I am attempting to learn a bit about the GDI+ transforms and charting data and I feel like I'm getting a handle on how the transforms work. My chart object has a large "canvas" bitmap...
12
by: Sanjay | last post by:
hi, We are currently porting our project from VB6 to VB .NET. Earlier we used to make scale transformations on objects like pictureBox , forms etc.Now Such transformations are made on the...
2
by: John Bailo | last post by:
I am walking through some of the very first sample code from the book "Beginning .NET Game Programming" from Apress. I identify his sample code with //SC This code puzzles me: Graphics graph...
14
by: Pmb | last post by:
At the moment I'm using Borland's C++ (http://www.borland.com/products/downloads/download_cbuilder.html#) I want to be able to take an array of points and plot them on the screen. Is there a way...
5
by: Charles A. Lackman | last post by:
Hello, I have created a complete PrintDocument and need to create an image from it. How is this done? e.Graphics.SmoothingMode = Drawing2D.SmoothingMode.HighQuality...
6
by: Chris Dunaway | last post by:
The method for printing documents in .Net can be confusing, especially for newer users. I would like to create a way to simplify this process. My idea would be implemented using a PrintDocument...
12
by: Xah Lee | last post by:
Of Interest: Introduction to 3D Graphics Programing http://xahlee.org/3d/index.html Currently, this introduction introduces you to the graphics format of Mathematica, and two Java Applet...
6
by: active | last post by:
I have an image and a graphics object created (FromImage) from that image. I need to create a new image and create a new graphics object from the new image. I want the new graphics object have...
9
by: DaveL | last post by:
hello I have a Bit map 1367 wide 32 high this bitmap contains like 40 separate Images 32x32 I tell it the id*32 to get the approiate Image from the source Bitmap When i CreateGraphics()...
8
by: Abhiraj Chauhan | last post by:
I need someone to make an example of how to create a graphics window in VB.net 2008. I understand the basics of how to draw a rectangle and lines etc. What I need is an example of how to make a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.