Emuforums.com

Go Back   Emuforums.com > General Discussion > Web development / Programming
Home Register Downloads FAQ Members List Calendar Arcade Mark Forums Read

Reply
 
Thread Tools Display Modes
Old March 16th, 2003, 19:44   #1
SuperTek
Registered User
 
Join Date: Nov 2002
Posts: 4
Text Editor

I´m making my own text editor in C and i cant figured out something:

How can i know if the user is pressing shift or ctrl? I use Linux so those DOS libraries won´t work.
SuperTek is offline   Reply With Quote

Advertisement [Remove Advertisement]

Old March 17th, 2003, 12:42   #2
jegHegy
Registered User
 
Join Date: May 2001
Location: Hungary
Posts: 2,184
i think they have their own keycode, but i'm not sure. there are some experienced C programmers here, so expect a real answer from them ^^

nyaa
jegHegy is offline   Reply With Quote

Old March 17th, 2003, 20:20   #3
Exophase
Emu author
 
Join Date: Apr 2001
Location: Cleveland OH, USA
Posts: 1,438
Are you using SDL? SDL handles it fine, under the key mod stuff.

- Exo
Exophase is offline   Reply With Quote

Old March 17th, 2003, 22:54   #4
SuperTek
Registered User
 
Join Date: Nov 2002
Posts: 4
Sometimes I use Allegro but what I really want to know is how to do it using only C Ansi. I think that´s the better way to learn. But thanks for your post anyway.
SuperTek is offline   Reply With Quote

Old March 17th, 2003, 23:31   #5
ammoQ
Emu author
 
ammoQ's Avatar
 
Join Date: Mar 2002
Location: Vienna/Austria/Europe
Posts: 1,168
If you write an X application, it's easy: Both pressing and releasing the Shift or Ctrl-Button creates a KeyPress/KeyRelease Event. If you write a console application, it's hard.
__________________
If you think my English is bad, wait till you read my Polish.
ammoQ is offline   Reply With Quote

Old March 18th, 2003, 04:56   #6
Exophase
Emu author
 
Join Date: Apr 2001
Location: Cleveland OH, USA
Posts: 1,438
Quote:
Originally posted by SuperTek
Sometimes I use Allegro but what I really want to know is how to do it using only C Ansi. I think that´s the better way to learn. But thanks for your post anyway.
Strictly speaking there isn't a way to do it using ANSI C, because ANSI C doesn't standardize a means for doing so and in general C makes no attempt to have standard library access for many things, including extensive key support (well, there's getch(), but that's no good here). So what I'm what trying to say is that there isn't an ANSI C approach, and that it instead varies entirely on what platform you're programming for. That's why I strongly suggest you stick with something like SDL or yes, Allegro, because then you both make things easier on yourself and gain a lot more portability through the abstraction.

- Exo
Exophase is offline   Reply With Quote

Old March 18th, 2003, 05:10   #7
Kraelis
Transcended
 
Kraelis's Avatar
 
Join Date: Jun 2001
Location: Moonlight Spire
Posts: 1,409
Today, building everything from scratch isn't practical anymore. takes too long and too darn difficult. I used to have that approach, but when it came to actual formal programming, the time constraints imposed are simply too great to consider reinventing the wheel.
__________________
--KrÆlis Cross


Mundus vult decipi, ergo decipiatur

===============
Athlon 64 x2 3800| Asrock ALiveNF6G-VSTA | Kingston DDR2 1 Gb RAM
Kraelis is offline   Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT +1. The time now is 00:53.

© 2006 - 2012 Emu Forums | About Emu Forums | Advertisers | Investors | Legal | A member of the Crowdgather Forum Community


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.