View Single Post
  #3  
Old January 3rd, 2007, 05:55 AM
Arralen's Avatar

Arralen Arralen is offline
Major General
 
Join Date: Nov 2000
Location: 500km from Ulm
Posts: 2,279
Thanks: 9
Thanked 18 Times in 12 Posts
Arralen is on a distinguished road
Default Re: Another simple improvement

Dominions uses the SDL library, and only the SDL library - no ..-widgets, no GTK or something else ... do you really expect ONE hobby programmer to be able to be "fluent" with those as well, especially if he has a life?


http://www.libsdl.org/pipermail/sdl/...er/071467.html

[SDL] Drag and Drop
Paulo A Ferreira paulo at novisnet.pt
Sun Dec 4 04:10:54 PST 2005

Benjamin Grauer wrote:
>
> Hi there
>
> i was wondering, it there was some simple SDL-like trick to get DnD
> (Drag and Drop) running, so i can drop some file-links fron
> konqueror/MS-Explorer/etc. into my SDL-app??

Maybe this can help you ?

http://www.libsdl.org/projects/scrap/



Scrap 1.0

Author: Sam Lantinga
Source: scrap-1.0.tar.gz
Requires: SDL 1.0
Runs on: Linux, Win32

Description:
An example of cut-and-paste in an SDL application, using the platform-specific window message hooks SDL provides.

Instructions:
Unpack, and build. Run "scrap example.bmp" in one window, and then the program "scrap" in another window. They both will display the same image, copied from the clipboard.




As one can see, there's the critical "Mac" missing from the "runs on" list ...



http://www.libsdl.org/pipermail/sdl/...er/064976.html

[SDL] Drag and Drop
Paulo Pinto pjmlp at progtools.org

squale wrote:

>Hi,
>
>I want to know if any of you has ever programmed a drag and drop
>behaviour in something like card games, bacjgammon or chess...
>
>In that case could you please tell me the way you did it and if you
>have any source about this (URL, code sample...) it would be greatly
>appreciated !
>
>thanx

Hi,

You should do something like this:

- When you get a click event, check if the mouse
if over a moveable object, say a card. Change into
grabbing mode;

- While in grabbing mode, when the user moves
the mouse, update the object location to reflect the
movement;

- When the user releases the mouse button, return
to normal mouse mode.

The refered normal/grabbing modes are something
that you have to keep track of.

Cheers,
Paulo




Doesn't work as well I think - the icons of the items are likely not "objects" in that sense, but simply bitmaps loaded into a pre-made grid ... nothing to grab here.
This doesn't mean it can't be done, but it's unlikely: Johan does not like coding GUI (its a pain with C/C++, even if you're using SDL or Allegro Library or some widget pack), there are some urgend bugs to fix, and this would be prone to induce lots of new ones ...

What might be much easier done would be auto-sorting, preferably in the very same order the items are on the commanders:
Weapons, Shields, Helmets, Armors, Boots, Misc.
__________________
As for AI the most effective work around to this problem so far is to simply use an American instead, they tend to put up a bit more of a fight than your average Artificial Idiot.
... James McGuigan on rec.games.computer.stars somewhen back in 1998 ...
Reply With Quote