Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
kind of works? reading multiple mice: any c programmers want to look at this?
#81
(09-18-2022, 08:28 PM)madscijr Wrote:
(09-18-2022, 08:17 PM)Spriggsy Wrote: I would just Google some of the drawing functions for Windows. Google is good at finding MSDN pages.

That's what I did (I included those links a few posts up). What I found is really low level and without concrete examples. They talk about things beyond window handles, stuff that a Windows C++ programmer would understand. I started googling drawing graphics examples in c for windows, and found some, but need to go through it all. A few mention SDL2, OpenGL and other libraries, I'm just looking for the most basic library-less way to draw a rectangle, so I imagine that would be a Windows API function. I'll have to read through all that stuff and see if I find something.

Drawing Rectangles - Win32 apps | Microsoft Learn (searched "draw rectangle msdn win32")
Tread on those who tread on you

Reply
#82
(09-19-2022, 01:05 PM)Spriggsy Wrote:
(09-18-2022, 08:28 PM)madscijr Wrote:
(09-18-2022, 08:17 PM)Spriggsy Wrote: I would just Google some of the drawing functions for Windows. Google is good at finding MSDN pages.
Drawing Rectangles - Win32 apps | Microsoft Learn (searched "draw rectangle msdn win32")

Thanks, Spriggsy. 

I did some reading, which led to more reading, and so on and so on. Too much information! 
Figuring out how to put all this together is not so simple. 
If there is a simple example hidden in there of drawing a rectangle of color(r,g,b) & length/width on the screen at x/y, I haven't found it yet. 
I realize that being self-directed in learning is an important skill in life, and especially programming, but jeez louise Huh
I knew there is a reason I prefer BASIC, LOL. 
I'll have to return to this stuff when I have more time and bandwidth. 
Stay tuned!

  1. Using Filled Shapes 01/07/2021
  2. FillRect function (winuser.h) 10/13/2021
  3. Creating Colored Pens and Brushes 01/07/2021
  4. GetSysColorBrush function (winuser.h) 10/13/2021
    A brush is a bitmap that the system uses to paint the interiors of filled shapes.
  5. RGB macro (wingdi.h) 04/01/2021
  6. Rectangle function (wingdi.h) 10/13/2021
  7. Setting the Pen or Brush Color 01/07/2021
  8. Using the WM_PAINT Message - Win32 apps 01/07/2021
    You can use the WM\_PAINT message to carry out the drawing necessary for displaying information.
  9. CreateHatchBrush
  10. CreatePatternBrush
  11. CreateSolidBrush function (wingdi.h)
    CreateSolidBrush ( GetSysColor (nIndex)). An application must not register a window class for a window using a system brush. To register a window class with a system color, see the documentation of the hbrBackground member of the WNDCLASS or WNDCLASSEX structures. To paint with a system color brush, an application should use GetSysColorBrush (nIndex) instead of CreateSolidBrush.
  12. Filled Shape Functions
  13. Filled Shapes Overview
  14. GetStockObject
  15. RECT
  16. PAINTSTRUCT (winuser.h) - Win32 apps
    The PAINTSTRUCT structure contains information for an application. This information can be used to paint the client area of a window owned by that application.
  17. Drawing in the Client Area - Win32 apps
    You use the BeginPaint and EndPaint functions to prepare for and complete the drawing in the client area.
  18. MoveToEx function (wingdi.h) - Win32 apps
    The MoveToEx function updates the current position to the specified point and optionally returns the previous position.
  19. Creating Colored Pens and Brushes - Win32 apps
    Although you can specify any color for a pen when creating it, the system uses only colors that are available on the device.
  20. Invalidating the Client Area - Win32 apps
    The system is not the only source of WM\_PAINT messages. The InvalidateRect or InvalidateRgn function can indirectly generate WM\_PAINT messages for your windows. These functions mark all or part of a client area as invalid (that must be redrawn).
  21. CreateRectRgn function (wingdi.h) - Win32 apps
    The CreateRectRgn function creates a rectangular region.
  22. Using Rectangles (Windows GDI) - Win32 apps
    The example in this section illustrates how to use the rectangle functions. It consists of the main window procedure from an application that enables the user to move and size a bitmap.
  23. DeleteObject
    System color brushes are owned by the system so you don't need to destroy them. Although you don't need to delete the logical brush that GetSysColorBrush returns, no harm occurs by calling
  24. Brush Functions
  25. Brushes Overview
  26. GetSysColor function
    For system color index values. An application can retrieve the current system colors by calling this. To paint with a system color brush, an application should use GetSysColorBrush (nIndex) instead of CreateSolidBrush, because GetSysColorBrush returns a cached brush instead of allocating a new one.
  27. SetSysColors function
    An application can set the current system colors by calling this.
  28. WNDCLASS
  29. WNDCLASSEX structure
    An application must not register a window class for a window using a system brush. To register a window class with a system color, see the documentation of the hbrBackground member of the WNDCLASS or WNDCLASSEX structures.
  30. COLORREF
  31. Color Macros
  32. Colors Overview
  33. GetBValue
  34. GetGValue
  35. GetRValue
  36. PALETTEINDEX
  37. PALETTERGB
  38. RGBQUAD
  39. RoundRect
  40. WM_PAINT message
    to carry out the drawing necessary for displaying information. Because the system sends WM_PAINT messages to your application when your window must be updated or when you explicitly request an update, you can consolidate the code for drawing in your application's window procedure.
  41. Drawing in the Client Area
  42. Redrawing the Entire Client Area
  43. Redrawing in the Update Region
  44. Invalidating the Client Area
  45. Drawing a Minimized Window
  46. Drawing a Custom Window Background
Reply
#83
(09-15-2022, 06:33 PM)SpriggsySpriggs Wrote: Yeah, I think it will be quite a problem. Give me a couple of days to see about this way of unregistering the window and then re-registering it with the callback as part of its registration. That may or may not be the solution.
Update: I found a workaround for the window registering thing. It isn't ideal, because the solution uses 2 programs, and I still haven't figured out how to capture mouse clicks, but it does let a regular QB64 program read input from multiple mice, so you can use regular QB64 commands for graphics/sound/etc. and not have to do everything in API calls...
Reply




Users browsing this thread: 6 Guest(s)