Click here to Skip to main content
15,904,416 members
Home / Discussions / C#
   

C#

 
GeneralRe: Logic I use.......?? Pin
PIEBALDconsult12-Aug-09 4:09
mvePIEBALDconsult12-Aug-09 4:09 
QuestionComboboxes in DataGrid Pin
AmbitiousBeginner9-Aug-09 20:31
AmbitiousBeginner9-Aug-09 20:31 
AnswerRe: Comboboxes in DataGrid Pin
PIEBALDconsult9-Aug-09 20:46
mvePIEBALDconsult9-Aug-09 20:46 
GeneralRe: Comboboxes in DataGrid Pin
AmbitiousBeginner9-Aug-09 20:52
AmbitiousBeginner9-Aug-09 20:52 
GeneralRe: Comboboxes in DataGrid Pin
PIEBALDconsult9-Aug-09 21:23
mvePIEBALDconsult9-Aug-09 21:23 
AnswerRe: Comboboxes in DataGrid Pin
stancrm9-Aug-09 20:48
stancrm9-Aug-09 20:48 
GeneralRe: Comboboxes in DataGrid Pin
AmbitiousBeginner9-Aug-09 21:18
AmbitiousBeginner9-Aug-09 21:18 
GeneralRe: Comboboxes in DataGrid Pin
stancrm9-Aug-09 21:22
stancrm9-Aug-09 21:22 
QuestionHow to update MS Access database in the installed application? Pin
Sifar - 09-Aug-09 17:38
Sifar - 09-Aug-09 17:38 
AnswerRe: How to update MS Access database in the installed application? Pin
Ennis Ray Lynch, Jr.9-Aug-09 18:27
Ennis Ray Lynch, Jr.9-Aug-09 18:27 
QuestionRegular Expressions [modified] Pin
Mikey_H9-Aug-09 17:29
Mikey_H9-Aug-09 17:29 
AnswerRe: Regular Expressions Pin
PIEBALDconsult9-Aug-09 21:33
mvePIEBALDconsult9-Aug-09 21:33 
GeneralRe: Regular Expressions Pin
Mikey_H10-Aug-09 9:30
Mikey_H10-Aug-09 9:30 
GeneralRe: Regular Expressions Pin
PIEBALDconsult10-Aug-09 9:53
mvePIEBALDconsult10-Aug-09 9:53 
QuestionUnable to send image on UDP larger than 10K Pin
atifmuzaffar9-Aug-09 15:55
atifmuzaffar9-Aug-09 15:55 
AnswerThis may sound silly but Pin
Ennis Ray Lynch, Jr.9-Aug-09 18:23
Ennis Ray Lynch, Jr.9-Aug-09 18:23 
AnswerRe: Unable to send image on UDP larger than 10K Pin
Luc Pattyn9-Aug-09 22:59
sitebuilderLuc Pattyn9-Aug-09 22:59 
QuestionRPG - character draw behind object problems [modified] Pin
jdneul9-Aug-09 11:12
jdneul9-Aug-09 11:12 
AnswerRe: RPG - character draw behind object problems Pin
Luc Pattyn9-Aug-09 11:41
sitebuilderLuc Pattyn9-Aug-09 11:41 
AnswerRe: RPG - character draw behind object problems Pin
harold aptroot9-Aug-09 12:28
harold aptroot9-Aug-09 12:28 
GeneralRe: RPG - character draw behind object problems Pin
jdneul9-Aug-09 12:59
jdneul9-Aug-09 12:59 
GeneralRe: RPG - character draw behind object problems Pin
Luc Pattyn9-Aug-09 13:05
sitebuilderLuc Pattyn9-Aug-09 13:05 
GeneralRe: RPG - character draw behind object problems Pin
harold aptroot9-Aug-09 13:14
harold aptroot9-Aug-09 13:14 
Sure, here's my most important draw function
public static void Draw(DrawItemBase D)
{
    const float inv1024 = 1f / 1024;
    int z = D.Bottom;
    if (z < 0)
        return;
    foreach (DrawItemBase d in D)
    {
        d.Draw(z * inv1024, IndexedSprite);
        z++;
    }
    if (!MouseOverHasFoundTarget && (mouseindex < 288 || mouseindex > 288 + 8))
        foreach (DrawItemBase d in D)
            DetectClickOnSelectable(D);
}

There are some mouse-related hacks in it, and the hardcoded 1024 that you see there is half random, it's 768 (screen height, shouldn't normally be hardcoded) + a bit of space for sprites that extend below the bottom of the screen, a Z value bigger than 1 will be clipped away.

The main point of it, is that a draw item keeps a list of draw items which have to be drawn in order (for when exceptional rendering order is required), and that normally the Z is set to the bottom Y of the sprite.

The "IndexedSprite" you see is a homemade spritebatch which uses a different vertex struct to send different information, because it's rendering indexed textures with a player index which changes the colour at some indices, and the player index is something that can vary per sprite (read pixel, use R component and PlayerIndex to do a 2d colour lookup in a texture which contains a colour palette which is different for each player), so making it a uniform shader variable would not work.



AnswerRe: RPG - character draw behind object problems Pin
jdneul10-Aug-09 4:40
jdneul10-Aug-09 4:40 
QuestionTalking to a telnet server [modified] Pin
shultas9-Aug-09 8:21
shultas9-Aug-09 8:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.