Author Topic: GDplus  (Read 912 times)

Patrice Terrier

  • Administrator
  • *****
  • Posts: 547
    • zapsolution
GDplus
« on: June 20, 2017, 01:38:30 pm »
This C++ VS 2017 project, is an advanced graphic control with limited 2D sprite support inherited from GDImage.



It is composed of 4 distincts controls, each one using its own callback for the purpose of custom behavior.

The source code is composed of 5 modules:
1 - GDplus.cpp (the main code section).
2 - gControl (the generic graphic API, inherited from GDImage).
3 - custom.h (the custom graphic controls section : Add_gControl_01 to Add_gControl_04).
4 - Tools.h (the generic utility API).
5 - gdiflat.h (the specific GDIPLUS flat API, that should NOT be mixed with the {official} MSDN class encapsulation).

Add_gControl_01, is creating the thumbnails on the fly to populate the contact sheet if they don't already exist.
Add_gControl_02, is building on the fly one vectorial curve sprite object.
Add_gControl_03, is using several tiled sprites that could be resized with the mouse while hover the edges.
Add_gControl_04, is building on the fly an open polypolygon with interactive hot spots (the red dots).

This project has everything to create an interactive 2D Chart engine.

« Last Edit: June 20, 2017, 02:07:34 pm by Patrice Terrier »

Emil Weiss

  • Sr. Member
  • ****
  • Posts: 318
Re: GDplus
« Reply #1 on: June 20, 2017, 02:10:34 pm »
WOW! Good project can learn any from it. Thank you for publish

greets
« Last Edit: June 20, 2017, 02:13:28 pm by Emil Weiss »

James Fuller

  • Newbie
  • *
  • Posts: 18
Re: GDplus
« Reply #2 on: June 21, 2017, 02:37:45 pm »
Patrice,
  Thank you for the informative source.
Did you investigate Fred's Array Class instead of vector to eliminate the use of the STL and reduce size?

re, using vectors:
I am just a novice but would not range base for loops with iterators work better with your global vectors??

James


Patrice Terrier

  • Administrator
  • *****
  • Posts: 547
    • zapsolution
Re: GDplus
« Reply #3 on: June 21, 2017, 03:16:51 pm »
Quote
I am just a novice but would not range base for loops with iterators work better with your global vectors??
To say the truth i am also a novice with vector, i am using them almost the same than with PB's array for the sake of compatibility with the original GDImage.

So far i never had any problem with all the transcriptions i have done between PB, C++, and WinDev.
The begin() and end() iterator returning the same value than using direct indices or LBOUND UBOUND, at least by me ;)
And i am always using 0 as my lower bound.


« Last Edit: November 30, 2017, 10:01:30 pm by Patrice Terrier »

James Fuller

  • Newbie
  • *
  • Posts: 18
Re: GDplus
« Reply #4 on: June 22, 2017, 12:45:45 pm »
Patrice,
  I like the ease of use of the range based for.
James

int _tmain (int argc, _TCHAR** argv)
{
    wstring  ws;
    vector<wstring>  wsv;
    wsv.push_back(_T("one"));
    wsv.push_back(_T("two"));
    wsv.push_back(_T("three"));
    wsv.push_back(_T("four"));
    wsv.push_back(_T("five"));
    for (auto it : wsv)
    {
        _tprintf(_T("%ls\n"), it.c_str());
    }
}

Patrice Terrier

  • Administrator
  • *****
  • Posts: 547
    • zapsolution
Re: GDplus
« Reply #5 on: June 22, 2017, 01:00:04 pm »
I prefer to use a syntax that is the same for the 3 languages i am working with (like in PB).
However, where could i find the Fred's array class (I have the TClibBuild you sent me)

James Fuller

  • Newbie
  • *
  • Posts: 18
Re: GDplus
« Reply #6 on: June 23, 2017, 10:44:33 am »
Patrice,
  You may be better off with vectors in this code.
The version of TCLib I use does not allow GLOBAL struct/class.
My only experience with Fred's CArray is with his String class.
There is also the code I used in my Address port using the aedynarray.h include.
I used this approach for my work around of no globals.
If you are interested I'll try to find the time today to put together some code over on Josť's forum.

James


Emil Weiss

  • Sr. Member
  • ****
  • Posts: 318
Re: GDplus
« Reply #7 on: November 30, 2017, 07:56:50 pm »
Patrice,

one question.

in custom.h do use g_zObj outside of gControl.. see "gControlCallBack_03"
if that the same behavior as your do it in GDImage?

also should i do make the struct public?

greets

Patrice Terrier

  • Administrator
  • *****
  • Posts: 547
    • zapsolution
Re: GDplus
« Reply #8 on: November 30, 2017, 09:09:18 pm »
The GOBJECT sprite object structure is based on the GDImage ZOBJECT structure.
However the properties are not stored into the same order.

All that could be done in GDplus could be done in GDImage, but the reverse is not true ;)

As for the gControlCallBack CALLBACK, yes, they work almost the same than in GDImage.

« Last Edit: November 30, 2017, 09:35:54 pm by Patrice Terrier »

Patrice Terrier

  • Administrator
  • *****
  • Posts: 547
    • zapsolution
Re: GDplus
« Reply #9 on: December 04, 2017, 09:11:33 am »
Just setup/retrieve the alpha value of the GOBJECT argb parameter.

Look at gGetAlpha, GD_ARGB, GD_ColorARGB, and gSplitColorARGB

Code: [Select]
void GD_SetObjectAlpha (IN long ObjID, IN BYTE Alpha, IN long RedrawParent) {
    long nItem = gItemFromID(ObjID);
    if (nItem > -1) {
       BYTE A, R, G, B;
       gSplitColorARGB(g_zObj[nItem].argb, A, R, G, B);
       g_zObj[nItem].argb = GD_ARGB(Alpha, R, G, B);
       if (g_zObj[nItem].visible && RedrawParent) { GI_UpdateWindow(g_zObj[nItem].hwnd, TRUE); }
    }
}
« Last Edit: December 04, 2017, 09:17:35 am by Patrice Terrier »

Emil Weiss

  • Sr. Member
  • ****
  • Posts: 318
Re: GDplus
« Reply #10 on: December 04, 2017, 09:34:25 am »
Thank you for the Information.

greets