123
-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987 0|682|0 -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=-
Socoder -> Blitz Max -> gui confusion

Page : 1 2 Next
Prev
Tue, 26 Jan 2021, 04:37
spinal

gui confusion


I was looking at blitzmax for creating a nice windows application with buttons etc.
I have strung a couple of examples together to see if I can figure out whats going on, and well, i can't.




Most of it makes perfect sense, but how on earth does it know what item has been clicked on?

Case EVENT_MOUSEDOWN makes sense, but the other parts i just don't follow. the color selector doesnt seem to check if the colour panel was clicked, neither does the button one seem to check that specific button?

What am I missing here?

-=-=-
Check out my excellent homepage!
Tue, 26 Jan 2021, 04:51
Pakz
www.2dgamecreators.com/maxgui/

I have not used blitzmax but in blitzplus you had these gadgetevents where you could find the item pressed with the variable you declared it with.
Tue, 26 Jan 2021, 05:33
Jayenkai
That's a terrible example, if you don't mind me saying so..
The "Colour palette clicker" is NOT a button, it's like a Javascript canvas, in that it recognises "MouseDown" events.
When you MouseDown, it activates the MouseDown event, which launches the colour picker, specifically because it ISN'T a button, but is just a canvas.

The GadgetAction is a different event from mousedown, and is probably confusing you more because it's indented the way it is..
Do that, and it should make much more sense.

In either case, it actually DOESN'T know which thing you've clicked.. Just that the canvas only sends mousedown, and the button only sends GadgetAction.

-=-=-
''Load, Next List!''
Tue, 26 Jan 2021, 08:20
spinal
That makes a bit more sense. Now to kick myself up the arse and make it do something!



-=-=-
Check out my excellent homepage!
Thu, 28 Jan 2021, 11:21
spinal
Wow, there doesn't seem to be a way to grap a pixel from an image in blitz max

-=-=-
Check out my excellent homepage!
Thu, 28 Jan 2021, 11:31
Jayenkai
I'm fairly sure there is.. is it not readpixel or getpixel or something?

-=-=-
''Load, Next List!''
Thu, 28 Jan 2021, 11:31
spinal
nope, best I can find, is something about pixmaps
Thu, 28 Jan 2021, 11:33
Jayenkai
Aah, yeah. Grabpixmap, then read from that..
Thu, 28 Jan 2021, 11:37
rockford
IIRC you have to call LockBuffer first before using the pixel reading/grabbing and then unlock it again. It's been an awful long time since I used BMax though, so I could be completely wrong.
Thu, 28 Jan 2021, 11:50
Jayenkai
No that's older blitz. Bmax you have to convert to a pixmap which is essentially what a locked buffer used to be, but less easy to completely break like would happen when you forget to unlock a buffer!!!

-=-=-
''Load, Next List!''
Thu, 28 Jan 2021, 12:43
rockford
There you go. Completely wrong!
Thu, 28 Jan 2021, 12:49
Jayenkai
That's ok.. Even I had to load up BMax to check

-=-=-
''Load, Next List!''
Thu, 28 Jan 2021, 13:05
spinal
hmmm, this returns -16777216



-=-=-
Check out my excellent homepage!
Thu, 28 Jan 2021, 13:47
Jayenkai
Perhaps it doesn't work in conjunction with MacGUI..?
What exactly is it you're trying to do?

-=-=-
''Load, Next List!''
Thu, 28 Jan 2021, 13:55
Jayenkai


-=-=-
''Load, Next List!''
Thu, 28 Jan 2021, 14:13
spinal
I'm attempting to pick a colour from a loaded image.
Surely the following should work? -- nope...



--edit--

This does nothing either...



-=-=-
Check out my excellent homepage!
Thu, 28 Jan 2021, 14:36
spinal
Full code, in case I'm doing something correct somewhere

The idea at this stage, is load a scenery image, then load a background layer, click the transparent colour button, followed by a click on the image somewhere and that colour should become transparent, showing the image underneath.
Currently it seems to be plucking random negative values from somewhere.



-=-=-
Check out my excellent homepage!
Thu, 28 Jan 2021, 15:04
Jayenkai
An alternative.
Load the image as both an image and as a pixmap, at the same time.
Use the image for display purposes, and the pixmap as a data component.
If you click on the image, use the same co-ords on the pixmap,

If you want, you can edit the pixmap in memory, then newimage=loadimage(thepixmap) when it changes.

-=-=-
''Load, Next List!''
Fri, 29 Jan 2021, 04:40
spinal
Worth a try i guess
Fri, 29 Jan 2021, 11:09
spinal
Getting there!, the code is a mess though.





-=-=-
Check out my excellent homepage!
Sun, 31 Jan 2021, 07:29
spinal
I wish the language would make up ots mind if it was BASIC or C

'or' is 'or' in an if statement, but '|' if its a bitwise operation? grrrrr.

-=-=-
Check out my excellent homepage!
Wed, 03 Feb 2021, 04:20
spinal
Finally picking the correct background colour and placing it in location '0' of the palette...



That took a little bit of work!

-=-=-
Check out my excellent homepage!
Wed, 03 Feb 2021, 04:25
Jayenkai
How are you getting on with MaxGUI, now? Getting the hang of it?

-=-=-
''Load, Next List!''
Wed, 03 Feb 2021, 05:03
spinal
Not a sausage!

I'm finding I have to do things twice for them to take effect, like rendering the image canvas. When I press the 'Transparent Colour' button, I then have to reload the background image with an illegal mask as you can't change the mask colour once it's loaded, then have to redraw the canvas twice for it to take effect ¯\_(ツ)_/¯ Then select the colour from the pixmap, then reload the image again with the new mask and then of cource redraw it twice or else it doesn't update.

No doubt I'll forget everything once this project is finished

-=-=-
Check out my excellent homepage!
Wed, 03 Feb 2021, 06:57
Jayenkai
Well, at least it's working
Fri, 05 Feb 2021, 07:40
spinal
Oh, this one is fun!





The line
Gives a nice error once x and y become 8...


x=8
y=8
x+tileSize*y=72
(tileSize-x)+tileSize*y=64
arraySize=81

Now, last time I checked, 64 was smaller than 81..... Argh!!!!!

-=-=-
Check out my excellent homepage!
Page : 1 2 Next
Prev