Click here to Skip to main content
15,886,075 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: WSACleanup delays when called how can I get around this? Pin
Gisle Vanem8-May-14 23:30
Gisle Vanem8-May-14 23:30 
GeneralRe: WSACleanup delays when called how can I get around this? Pin
Member 433675510-May-14 5:50
Member 433675510-May-14 5:50 
QuestionMCI QUESTION!!! Is it different file extension name and codec? Pin
AmissU6-May-14 21:00
AmissU6-May-14 21:00 
QuestionCompiling VLC in Visual Studio 2013 Pin
Django_Untaken5-May-14 5:32
Django_Untaken5-May-14 5:32 
AnswerRe: Compiling VLC in Visual Studio 2013 Pin
leon de boer5-May-14 7:10
leon de boer5-May-14 7:10 
AnswerRe: Compiling VLC in Visual Studio 2013 Pin
Richard MacCutchan5-May-14 20:18
mveRichard MacCutchan5-May-14 20:18 
Questiongood algorithm to determine if there are overlapping in multiple rectangles Pin
Falconapollo3-May-14 19:46
Falconapollo3-May-14 19:46 
AnswerRe: good algorithm to determine if there are overlapping in multiple rectangles Pin
Software_Developer3-May-14 20:52
Software_Developer3-May-14 20:52 
The Bounding Box method is fairly simple, this technique involves checking whether an object has intercepted (overlapped) an invisible square boundary that is usually placed over, and often remains relative to, a game object.



C++
int bounding_box_collision(int b1_x, int b1_y, int b1_w, int b1_h, int b2_x, int b2_y, int b2_w, int b2_h)
{
    if ((b1_x > b2_x + b2_w - 1) || // is b1 on the right side of b2?
        (b1_y > b2_y + b2_h - 1) || // is b1 under b2?
        (b2_x > b1_x + b1_w - 1) || // is b2 on the right side of b1?
        (b2_y > b1_y + b1_h - 1))   // is b2 under b1?
    {
        // no collision
        return 0;
    }
 
    // collision
    return 1;
}


http://wiki.allegro.cc/index.php?title=Bounding_Box[^]

modified 5-May-14 9:51am.

AnswerRe: good algorithm to determine if there are overlapping in multiple rectangles Pin
CPallini4-May-14 23:09
mveCPallini4-May-14 23:09 
GeneralRe: good algorithm to determine if there are overlapping in multiple rectangles Pin
leon de boer5-May-14 2:29
leon de boer5-May-14 2:29 
QuestionTo fix the first column of CListView grid type control in MFC Pin
sma123#2-May-14 7:35
sma123#2-May-14 7:35 
QuestionRe: To fix the first column of CListView grid type control in MFC Pin
David Crow5-May-14 7:04
David Crow5-May-14 7:04 
AnswerRe: To fix the first column of CListView grid type control in MFC Pin
sma123#6-May-14 1:42
sma123#6-May-14 1:42 
SuggestionRe: To fix the first column of CListView grid type control in MFC Pin
David Crow6-May-14 5:08
David Crow6-May-14 5:08 
AnswerRe: To fix the first column of CListView grid type control in MFC Pin
Richard MacCutchan5-May-14 20:23
mveRichard MacCutchan5-May-14 20:23 
QuestionHow to get cursor position in status bar? Pin
Vladislav Gospodinov2-May-14 2:36
Vladislav Gospodinov2-May-14 2:36 
QuestionRe: How to get cursor position in status bar? Pin
David Crow2-May-14 2:50
David Crow2-May-14 2:50 
AnswerRe: How to get cursor position in status bar? Pin
Vladislav Gospodinov2-May-14 3:24
Vladislav Gospodinov2-May-14 3:24 
QuestionRe: How to get cursor position in status bar? Pin
jeron12-May-14 4:20
jeron12-May-14 4:20 
AnswerRe: How to get cursor position in status bar? Pin
Vladislav Gospodinov2-May-14 5:08
Vladislav Gospodinov2-May-14 5:08 
QuestionRe: How to get cursor position in status bar? Pin
jeron12-May-14 5:15
jeron12-May-14 5:15 
AnswerRe: How to get cursor position in status bar? Pin
Vladislav Gospodinov2-May-14 5:21
Vladislav Gospodinov2-May-14 5:21 
GeneralRe: How to get cursor position in status bar? Pin
jeron12-May-14 5:43
jeron12-May-14 5:43 
QuestionRe: How to get cursor position in status bar? Pin
David Crow2-May-14 5:46
David Crow2-May-14 5:46 
AnswerRe: How to get cursor position in status bar? Pin
Vladislav Gospodinov2-May-14 5:59
Vladislav Gospodinov2-May-14 5:59 

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.