Qbasicnews.com

Full Version: paint program, need help
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6
I edited that post above..

The last code I posted worked, why couldn't you use that?
Quote:well someone said that i should use if's in the loop, so i tried putting the whole thing into one big loop, but it didnt do any better, now the screen continuously flickers, maybe ill look for a source code for a paint program out thre and modify it to work with wat i want it to do and giv mucho credit to the creator(s), unless someone can figure out this danm code, it makes sense, until you run it

Try using Pages, that should remove flicker
actually i got it to almost work, now i have gosubs that work properly, except as soon as i try to make another thing work properly, another one glitches, when i get home tonite, ill update my code on the first post, i tried using wat AGA last suggested
pages are beyond me, it is screen 13 too just in case u need to know, updated code at 9:11 exact, thats wierd
Here's something to mess with. At the very least, it will show you how to use a Sub, and how to use the mouse in FreeBASIC. Don't bother trying it under QB though. Wink


Code:
#INCLUDE "FBGFX.BI"

Screen 13,,,1

Declare Sub Draw_Palette( MouseX, MouseY, Button, Paint_Color )
Declare Sub Draw_Big_Grid( MouseX, MouseY, Button, Paint_Color, Img_Data() )
Declare Sub Copy_Pixel_Data( Img_Data() )
Declare Sub Paste_Pixel_Data( Img_Data() )

Dim Img_Data(15, 15)

Do
    Getmouse( MouseX, MouseY,,Button )    
    Draw_Palette( MouseX, MouseY, Button, Paint_Color )
    Copy_Pixel_Data( Img_Data() )
    Draw_Big_Grid( MouseX, MouseY, Button, Paint_Color, Img_Data() )
    Paste_Pixel_Data( Img_Data() )
    
    
    Line(0,0)-(17,17),31,B
    Line(1,109)-(7, 116),31,B
    Line(2,110)-(6, 115),Paint_Color,BF
Loop Until Multikey(SC_ESCAPE)



Sub Draw_Palette( MouseX, MouseY, Button, Paint_Color )
    For Y = 0 To 15
        For X = 0 To 15
            Line(X*5,(Y*5)+120)-Step(4,4),Col,BF
            
            If MouseX>=(X*5) And MouseX<=(X*5)+4 And MouseY>=(Y*5)+120 And MouseY<=(Y*5)+124 Then
                Line(X*5,(Y*5)+120)-Step(4,4),31,B
                If Button = 1 Then
                    Paint_Color = Col
                End If
            End If
            Col+=1
            
            If MouseX>=1 And MouseX<=16 And MouseY>=1 And MouseY<=16 Then
                Select Case Button
                Case 1
                    Pset(MouseX, MouseY), Paint_Color
                Case 2
                    Paint_Color = Point(MouseX, MouseY)
                End Select
            End If
            
        Next
    Next
End Sub


Sub Draw_Big_Grid( MouseX, MouseY, Button, Paint_Color, Img_Data() )
    For Y = 0 To 15
        For X = 0 To 15
            If MouseX>=(X*12)+100 And MouseX<=(X*12)+111 And MouseY>=(Y*12) And MouseY<=(Y*12)+11 Then
                If Button = 1 Then
                    Img_Data(X,Y) = Paint_Color
                Elseif Button = 2 Then
                    Paint_Color = Img_Data(X,Y)
                End If
            End If
            Line((X*12)+100,Y*12)-Step(11,11),31,B
            Line((X*12)+101,(Y*12)+1)-Step(9,9), Img_Data(X,Y),BF
            Img_Data(X,Y) = Point((X*12)+101,(Y*12)+1)
        Next
    Next
End Sub


Sub Copy_Pixel_Data( Img_Data() )
    For Y=0 To 15
        For X = 0 To 15
            Img_Data(X,Y) = Point(X+1,Y+1)
        Next
    Next
End Sub

Sub Paste_Pixel_Data( Img_Data() )
    For Y=0 To 15
        For X = 0 To 15
            Pset(X+1,Y+1),Img_Data(X,Y)
        Next
    Next
End Sub
well i tried a link to FBide but it desnt work, it sais it is missing fbc.exe, so i have no version of fb that works
quick note, besides me not having fb is dont worry about the drawing part unless you really want to, im trying to do that on my own
Click view>settings>Compiler>"...", then find your fb compiler..
FBIDE isn't the compiler. You have to feed it the path to the commandline compiler itself, otherwise it won't work.

Also, you double-posted.
but i dont have the compiler, i searched my whole cpu and i dont ahve the compiler
Pages: 1 2 3 4 5 6