10.03.2019 - Round 1 results of our "A Love Letter For FreeBASIC" game dev competition have been published. Please be sure to check the results thread: http://games.freebasic.net/forum/index.php?topic=629.0. Don't forget that the competition is continuing with a round 2, lasting till 29th of April, 300 USD first prize. Stay tuned!

Author Topic: making a window in freebasic .....  (Read 17636 times)

neo

  • Novice
  • ***
  • Posts: 90
    • View Profile
    • Email
making a window in freebasic .....
« on: July 13, 2010, 05:02:02 PM »
Well, it seems to be time to work on putting my interface in a window. All I need it to do is run console commands. Grin It is going to take a bit of time to get working. Right now I have a sprite in the window that you can move around with the keyboard, so I know the GUI will work OK.

If there as anyone who can help me with this I would appreciate it. I'm trying to adjust and populate a window, then down down the road I'll need to do stuff like text fields and mouse drawing. Big thanks to the guy who helped me so far. Smiley

This is for the gamers who love playing all night long. Wink
« Last Edit: July 13, 2010, 08:54:53 PM by neo »
IF you can make a game that's cool and fun....
in time you may have a good job in time ......

its like at the end of doom 2 what do i have to kill next lol put code in my brain and i will think mmmm css rocks

Brick Break

  • Forum Sage
  • *****
  • Posts: 405
    • View Profile
Re: making a window in freebasic .....
« Reply #1 on: July 13, 2010, 06:34:10 PM »
Translation:

Well, it seems to be time to work on putting my interface in a window. All I need it to do is run console commands. ;D It is going to take a bit of time to get working. Right now I have a sprite in the window that you can move around with the keyboard, so I know the GUI will work OK.

If there as anyone who can help me with this I would appreciate it. I'm trying to adjust and populate a window, then down down the road I'll need to do stuff like text fields and mouse drawing. Big thanks to the guy who helped me so far. :)

This is for the gamers who love playing all night long. ;)

neo

  • Novice
  • ***
  • Posts: 90
    • View Profile
    • Email
Re: making a window in freebasic .....
« Reply #2 on: July 13, 2010, 08:49:14 PM »
http://www.youtube.com/user/58duomaxwell#p/a/u/0/9Uj5-OP7Zp4

here is my small interface and command line on youtube take a look if you like .......
ps
here is the code to the the starting of the game interface...... if any one wants it lol

Code: [Select]


Screen 20, 32, 4, 1

sleep 250



dim button as any ptr
dim button2 as any ptr
dim button3 as any ptr

dim as integer mousex,mousey,mousebuttons,buttonposx,buttonposy, imgwidth, imgheight
dim as integer buttonsizex,buttonsizey,exittheloop
dim as integer buttonsizex2,buttonsizey2,buttonposx2,buttonposy2
dim as integer buttonsizex3,buttonsizey3,buttonposx3,buttonposy3


   Const True = 1
    const false = not true
       
    buttonsizex = 169
    buttonsizey = 63
    buttonposx = 400
    buttonposy = 300
   
    buttonsizex2 = 169
    buttonsizey2 = 63
    buttonposx2 = 700       
    buttonposy2 =  500         
   
    buttonsizex3 = 527
    buttonsizey3 = 389
    buttonposx3 =  500
    buttonposy3 = 400


button = imagecreate(buttonsizex,buttonsizey)
bload "one.bmp",button '' new game
button2 = imagecreate(buttonsizex2,buttonsizey2)
bload  "quitb.bmp",button2 '' used for help
button3 = imagecreate(buttonsizex3,buttonsizey3)
bload  "bar.bmp",button3  '' quit game

screenset 1,0


do

    cls
 
  bload  "shell10.bmp"
    put (buttonposx,buttonposy),button
    put (buttonposx2,buttonposy2),button2
     put (buttonposx3,buttonposy3),button3

    GetMouse mousex, mousey , , mousebuttons 

    if mousebuttons=1 then
        if mousex>buttonposx and mousex<buttonposx+buttonsizex then
            if mousey>buttonposy and mousey<buttonposy+buttonsizey then
                ' Put here what you want to happen when you
                ' press button 1.
       
                Print "loading "
       
       
           endif
        endif
       
     
       
        if mousex>buttonposx2 and mousex<buttonposx2+buttonsizex2 then
            if mousey>buttonposy2 and mousey<buttonposy2+buttonsizey2 then
                ' Put here what you want to happen when you
                ' press button 2.
             
    end
               
            endif
        endif
 
        if mousex>buttonposx3 and mousex<buttonposx3+buttonsizex3 then
            if mousey>buttonposy3 and mousey<buttonposy3+buttonsizey3 then
                ' Put here what you want to happen when you
                ' press button 3.
  bload  "help.bmp"
          print "window placesminet is here"
     endif
        endif
 

   
       
    endif
   
   
   
   
   sleep 1,1 ' Put ANY sleep in all your loops to prevent 100 % CPU usage!
    screencopy
   
loop until exittheloop = True or Multikey(&h01) ' exit loop if you also press ESCAPE





ps you have to put the bmp file and make them
« Last Edit: July 13, 2010, 08:52:05 PM by neo »
IF you can make a game that's cool and fun....
in time you may have a good job in time ......

its like at the end of doom 2 what do i have to kill next lol put code in my brain and i will think mmmm css rocks

Brick Break

  • Forum Sage
  • *****
  • Posts: 405
    • View Profile
Re: making a window in freebasic .....
« Reply #3 on: July 14, 2010, 12:23:45 PM »
I see, you need graphics for your GUI? Could you give us a list of each one with the appropriate dimensions?

neo

  • Novice
  • ***
  • Posts: 90
    • View Profile
    • Email
Re: making a window in freebasic .....
« Reply #4 on: September 26, 2010, 10:36:46 AM »
ok ...
the main thing i should get done is making a icon that makes a window for the gui inteface.
but have no idea how to start ?
IF you can make a game that's cool and fun....
in time you may have a good job in time ......

its like at the end of doom 2 what do i have to kill next lol put code in my brain and i will think mmmm css rocks

Brick Break

  • Forum Sage
  • *****
  • Posts: 405
    • View Profile
Re: making a window in freebasic .....
« Reply #5 on: September 27, 2010, 11:47:23 PM »
ok ...
the main thing i should get done is making a icon that makes a window for the gui inteface.
but have no idea how to start ?

Windows Icon files have the .ico extension and are nothing more than images. You can use a program like Greenfish Icon Editor to make one and Resource Hacker to put it in. The GUI interface is triggered by calling the SCREEN or ScreenRes command with the appropriate parameters. However, this will only provide the facility to draw to the screen. If you want a cross-platform way to use an operating system's native GUI, FreeBASIC is not the program to use. It sounds to me like you want a high level library for buttons and such, and I don't know if one has been made for FreeBASIC or not. I myself am not about ready to go make one at this moment, but given time I might. I'd suggest asking around for a GUI library.

neo

  • Novice
  • ***
  • Posts: 90
    • View Profile
    • Email
Re: making a window in freebasic .....
« Reply #6 on: February 01, 2014, 01:47:02 PM »
i got the window to work but its blue lolz
ps i have to debug this ones i do this i have the start to a freebasic gui :)
IF you can make a game that's cool and fun....
in time you may have a good job in time ......

its like at the end of doom 2 what do i have to kill next lol put code in my brain and i will think mmmm css rocks

neo

  • Novice
  • ***
  • Posts: 90
    • View Profile
    • Email
IF you can make a game that's cool and fun....
in time you may have a good job in time ......

its like at the end of doom 2 what do i have to kill next lol put code in my brain and i will think mmmm css rocks

berrian

  • Novice
  • ***
  • Posts: 52
  • Mr. Dev
    • View Profile
    • Email
David

Email me at grand.superior@musician.org

neo

  • Novice
  • ***
  • Posts: 90
    • View Profile
    • Email
Re: making a window in freebasic .....
« Reply #9 on: February 02, 2014, 08:48:32 PM »
thx i just fixed the comline so now its not on the desktop it has as window for it now :) 

:)
http://www.youtube.com/watch?v=M6z-mssl5sk&feature=youtu.be
thx for all the help :)
IF you can make a game that's cool and fun....
in time you may have a good job in time ......

its like at the end of doom 2 what do i have to kill next lol put code in my brain and i will think mmmm css rocks

neo

  • Novice
  • ***
  • Posts: 90
    • View Profile
    • Email
Re: making a window in freebasic .....
« Reply #10 on: February 03, 2014, 11:41:06 AM »
today im going to start working on a icon for the desktop
IF you can make a game that's cool and fun....
in time you may have a good job in time ......

its like at the end of doom 2 what do i have to kill next lol put code in my brain and i will think mmmm css rocks

neo

  • Novice
  • ***
  • Posts: 90
    • View Profile
    • Email
Re: making a window in freebasic .....
« Reply #11 on: February 04, 2014, 01:11:30 PM »
i think i did it i will show you off youtube
IF you can make a game that's cool and fun....
in time you may have a good job in time ......

its like at the end of doom 2 what do i have to kill next lol put code in my brain and i will think mmmm css rocks

neo

  • Novice
  • ***
  • Posts: 90
    • View Profile
    • Email
Re: making a window in freebasic .....
« Reply #12 on: February 05, 2014, 08:10:14 PM »
if i have a bmp file that needs 2 buttons on it how would i make that ?
IF you can make a game that's cool and fun....
in time you may have a good job in time ......

its like at the end of doom 2 what do i have to kill next lol put code in my brain and i will think mmmm css rocks

BadMrBox

  • Forum Sage
  • *****
  • Posts: 411
    • View Profile
    • BadMrBox.com
Re: making a window in freebasic .....
« Reply #13 on: May 20, 2014, 04:57:18 AM »
This is something quick that I put together. I hope it'll help out.
As we are not allowed to upload bmp's you have to convert the included png to bmp.

Code: [Select]
nclude "fbgfx.bi"
screenres 640,480,32,2,1
Dim As Integer x, y, buttons, mouse
dim as any ptr theimage
dim as integer bgclr

theimage =imagecreate(250,180)
bload "buttons.bmp",theimage

bgclr=rgb(00,00,00)
screenset 1,0
do
    cls
    mouse = GetMouse (x, y, , buttons)
    line(1,1)-(639,479),bgclr,bf
    put (150,150),theimage,pset
    if buttons=1 then
    if y>=267 and y<=297 then
        if x>=155 and x<=253 then
        bgclr=rgb(00,00,00)
        endif
        if x>=286 and x<=381 then
        bgclr=rgb(255,255,255)
        endif
    endif
    endif
    screencopy
    
loop until multikey(fb.sc_escape)

berrian

  • Novice
  • ***
  • Posts: 52
  • Mr. Dev
    • View Profile
    • Email
Re: making a window in freebasic .....
« Reply #14 on: May 31, 2014, 01:36:01 PM »
Hey Box, you're a real pro at it!
David

Email me at grand.superior@musician.org