Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Picture Loading on-click


azkanan
 Share

Recommended Posts

Hey guys.

I want to make it so that when a player clicks on the grid, a square of colour will show up where he clicked, the colour being dependent on what the player chose from the list on the left - as the lift will contain rooms that act as a key for colours placed down.

I'm a total newbie when it comes to graphics, so I haven't a clue on this subject. Any help as to how to draw a new image (a square colour) and for it to find where to be placed, snapping with the grid (where the mouse clicked), would be much appreciated.

![](http://puu.sh/2tI3J.png)

Regards,

Azkanan
Link to comment
Share on other sites

Write colors on that list on the left, then whenever its clicked link it to a RBGA color code. I'm not sure if that is a table or what on the right, but you'd either need to draw with directx the color and box over the space you click, or just set the color in the grid options to the hex code (instead of RBGA) of the color you have selected
Link to comment
Share on other sites

> Write colors on that list on the left, then whenever its clicked link it to a RBGA color code. I'm not sure if that is a table or what on the right, but you'd either need to draw with directx the color and box over the space you click, or just set the color in the grid options to the hex code (instead of RBGA) of the color you have selected

It's just a picture box with a grid image I drew.
Link to comment
Share on other sites

I'm looking at the source code for the map editor, and I'm all, whut. I never liked coding in VB6 because of how decentralised all the code is. There's no notations saying where or what "x" and "y" is. It just refers to it in the Call.

```
Private Sub picBackSelect_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)

' If debug mode, handle error then exit out

If Options.Debug = 1 Then On Error GoTo errorhandler

Call MapEditorChooseTile(Button, x, y)

' Error handler

Exit Sub

errorhandler:

HandleError "picBackSelect_MouseDown", "frmEditor_Map", Err.Number, Err.Description, Err.Source, Err.HelpContext

Err.Clear

Exit Sub

End Sub
```

Leads to…

```
Public Sub MapEditorChooseTile(Button As Integer, x As Single, y As Single)

' If debug mode, handle error then exit out

If Options.Debug = 1 Then On Error GoTo errorhandler

If Button = vbLeftButton Then

EditorTileWidth = 1

EditorTileHeight = 1

EditorTileX = x \ PIC_X

EditorTileY = y \ PIC_Y

frmEditor_Map.shpSelected.top = EditorTileY * PIC_Y

frmEditor_Map.shpSelected.Left = EditorTileX * PIC_X

frmEditor_Map.shpSelected.width = PIC_X

frmEditor_Map.shpSelected.height = PIC_Y

End If

' Error handler

Exit Sub

errorhandler:

HandleError "MapEditorChooseTile", "modGameEditors", Err.Number, Err.Description, Err.Source, Err.HelpContext

Err.Clear

Exit Sub

End Sub
```
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...