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

Displaying seconds in XNA with Keypress?
XNA game how to make a snake tail
Creating an array of game objects
Lap timer in XNA 4.0?
XNA: Identifying identical sprites created with for loop
Increase Character Spacing in XNA
XNA choosing a subgroup of Game.Components
Loading Silverlight Texture2D from Resources
XNA Game - Open a Popup or a Custom Game Screen before launching a game
'Microsoft.Xna.Framework.Vector2' is a 'type' but is used like a variable?
Making a trading card game XNA
How do I fix 'No suitable method found to override' error on XNA 4.0?
When to use PresentationParameters.BackBufferWidth vs .Viewport.Width
What does the pixel shader function tex1D do with a Texture2d
How to add a lap timer in XNA?
Is there a Texture1D in XNA?

Categories

HOME
cloud
netbeans
azure-data-factory
mockito
google-api-php-client
json.net
tesseract
webstorm
alfresco
kalman-filter
setup-deployment
amortized-analysis
malloc
mvvmcross
slurm
awesome-wm
python-unittest
modx-revolution
circular-dependency
windows-phone-7
finite-automata
django-cms
pass-by-reference
captiveportal
tdd
minitab
jspm
newline
madlib
nameservers
column-family
overriding
android-ble
main
dartium
multilingual
mixture-model
reportbuilder
cookiecutter-django
core-plot
spring-security-kerberos
vao
checkboxlist
flashair
businessworks
jsch
xml-documentation
errordocument
worksheet
togetherjs
google-perftools
android-cursor
pdfclown
gcsfuse
imanage
time-and-attendance
multi-level
paypal-express
jwplayer7
php-parse-error
ford-fulkerson
unity-networking
pervasive-sql
prerequisites
collapse
purge
ibaction
oberon
jsapi
nsmutabledictionary
ng-animate
c3
funcunit
p4java
braille
jboss-weld
app42
viadeo
openlaszlo
ruby-datamapper
qt-faststart
limejs
delphi-6
referrer
path-separator
cascalog
wse3.0
enter
hgsubversion
zend-translate
swing-app-framework
eqatec
privilege
w3wp
django-notification
paul-graham

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App