xna-4.0


Detecting a Key Press in XNA 4.0?


http://msdn.microsoft.com/en-us/library/bb203902.aspx
I've got a title screen called 'TitleScreen' in my game.
I'm following the up^ linked tutorial, but on this argument, I want to make it so
if (newState.IsKeyDown(Keys.Space))
{
// If not down last update, key has just been pressed.
if (!oldState.IsKeyDown(Keys.Space))
{
backColor =
new Color(backColor.R, backColor.G, (byte)~backColor.B);
}
}
If spacebar is pressed, the 'TitleScreen' opacity turns to 0 or it completely disappears? Would it be possible to alter the
"backColor =
new Color(backColor.R, backColor.G, (byte)~backColor.B);"
command in such a way?
Any help is appreciated, thank you!
Your question is not well phrased, and doesn't conform to your title. Is this a question about detecting a key press, or altering the color of something? (I would've mentioned this in a comment but I don't have enough rep to comment yet)
Anyway, yes it should be possible to alter a color through a key press in the way that you've shown. Although if it doesn't query that color again then that change might not be apparent. You may need to have it re-initialize somehow after changing the color. The way you have it shown there it would toggle the component in the color each time you pressed the button.

Related Links

XNA game studio simple sprite animation
XNA phase management
How to check BoundingSphere for one ModelBone?
MonoGame: Some VertexColorPosition dissappear while drawing user primitives(DrawUserPrimitives)
Testing XNA 4.0 games On the XBOX 360 without paying $100 [duplicate]
Detecting clicks in a non-rectangular shape
What's a good way to optimise rendering a 2D tile game in XNA?
How to make 3D racing game with XNA? [closed]
How to correctly accelerate a rotated 3d model in XNA?
What's the difference between world and view for purpose of camera?
Vertexbuffer Getdata VertexPositionNormalTexture
Converting from 3.1 to 4.0… gamestates
XNA large coordinates and float precision
Trying to make Gaussian Blur stronger/blurrier - XNA 4.0 HLSL
XNA, EmguCV and perfomance issue with webcam
Does XNA apps run on Windows RT?

Categories

HOME
pandas
log4j
vbscript
blogger
omnet++
deezer
fluentd
tizen
smarty
routes
amazon-ecs
in-app-purchase
adfs
amazon-cloudformation
primary-key
gnupg
quicklook
timeout
event-handling
clearcase-ucm
fatal-error
flux
contextmenu
orleans
dcevm
kvc
dxf
facebook-access-token
publish
delicious-api
r-raster
http-status-code-503
data-manipulation
google-sites-2016
uiswipegesturerecognizer
gammu
amazon-kinesis-kpl
dosbox
jquery-bootgrid
dism
jvm-languages
eclipse-gef
angular2-meteor
taffy
appcompat
prolog-setof
jquery-nestable
drupal-6
sybase-asa
qtwebview
mako
iso8601
lync-client-sdk
orthogonal
spring-android
passport-google-oauth
probability-density
measures
bstr
gstreamer-0.10
fputcsv
disque
qcustomplot
apachebench
javax.sound.midi
map-projections
php-ci
tween
clicktag
tablelayout
nsbutton
asp.net-web-api-odata
xcode-6.2
android-2.2-froyo
gridfs
dir
comaddin
interface-orientation
sublist
trusted
quickdialog
nsnetservice
manchester-syntax
cascalog
twrequest
appconkit
wse3.0
nsdatecomponents
floating
lpeg
sudzc
h.323
createwindow
thunderbird-lightning
brewmp
exchange-server-2003
avatar
mediarss
ubuntu-9.04
ugc
django-notification

Resources

Database Users
RDBMS discuss
Database Dev&Adm
javascript
java
csharp
php
android
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App