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: new gui all freebasic  (Read 2919 times)

neo

  • Novice
  • ***
  • Posts: 90
    • View Profile
    • Email
new gui all freebasic
« on: November 07, 2020, 02:32:57 PM »
i have worked out a lot of the new code in the Gui interface
__________file list
mouse.bi
win.bi
button.bi
Gui.bi
i still don't know what to call this gui im building

 i been watching "hail an catch fire" so ill think of a good name.
ps i will place upload a you-tube clip of the gui small but working.....
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: new gui all freebasic
« Reply #1 on: March 18, 2021, 05:23:46 AM »
so i have thought about it an i will give the code out for free
its taken me some time to work it right .
ps .... not for your icon img is in new file called pic dont for get to make
file listing you must build

#include "button.bi"
#include "mouse.bi"
#include "win.bi"
#include "icons.bi"
#include "window.bi"
GUI .bas fist file you have to make
Code: [Select]
#include "button.bi"
#include "mouse.bi"
#include "win.bi"
#include "icons.bi"
#include "window.bi"



ScreenRes 1024 ,768 ,16,2
 
  '' Desktop width/height

'' screen
  '' Create a screen at the width/height of your monitor.
  '' Normally this would be slow, but GDI is fairly fast for this kind
  '' of thing.
  '' Start our timer/
'' loads starting pic
print "Made by NEO2501 "
print "loading mouse drivers"

dim as integer exittheloop

Const True = 1   '' if true then 1
const false = not true '' if false then not true



'' for win button window .... just a note ... donnt 11 get 11


 


      '' calls the statring buttons to the right pic and placement
 
 

 GetMouse  mousex, mousey , , mousebuttons, '' gets the mosue

    '' cls screen  do not fuck with .....or timeing with get messywith out
 Do

 
 Mouse = GetMouse (x, y, , buttons)

   '' Draw checkered background
icons = imagecreate(iconsposx,iconsposy)
 bload exepath + "/pic/icon.bmp",icons

winpx=x:winpy=y
'' from this line down is  buttonsize x,y ,buttonpos x,y
 
 
 
   if buttons=1 then           
            winpx=x:winpy=y
   CLS
put (iconsposx,iconsposy),icons
Cwindow(x,y,420,240,"",3)

DRAW STRING(+150,+150),"-gui demo"

DRAW STRING(410,465),"Press 'Esc' to exit the demo"

     
         endif 
   
   



Sleep 1,1 ' Put ANY sleep in all your loops to prevent 100 % CPU usage!

 
 
ImageDestroy( icons )

   
loop until exittheloop = True or Multikey(&h01) ' exit loop if you also press ESCAPE

end




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: new gui all freebasic
« Reply #2 on: March 18, 2021, 05:24:49 AM »
file 2  button.bi


Code: [Select]
dim button as any ptr
dim as integer mousebuttons ,buttonposx,buttonposy
dim as integer buttonsizex,buttonsizey




    buttonsizex = 95
    buttonsizey = 30
    buttonposx = 10
    buttonposy = 700
   
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: new gui all freebasic
« Reply #3 on: March 18, 2021, 05:25:41 AM »

next file is icons.bi

Code: [Select]
dim icons as any ptr
dim as integer  iconsposx,iconsposy
dim as integer iconssizex,iconssizey

  icons = imagecreate(iconsposx,iconsposy)
 bload exepath + "/pic/icon.bmp",icons
 


    iconssizex = 44
    iconssizey = 46
    iconsposx = 46
    iconsposy = 46
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: new gui all freebasic
« Reply #4 on: March 18, 2021, 05:26:33 AM »

an make the file mouse.bi

Code: [Select]
Dim as integer Mouse,x,y,buttons



dim as integer mousex,mousey
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: new gui all freebasic
« Reply #5 on: March 18, 2021, 05:27:10 AM »
DECLARE SUB Cwindow(winax AS INTEGER,winay AS INTEGER,winex AS INTEGER,winey AS INTEGER,title AS STRING,wcolor AS INTEGER)
Code: [Select]
SUB Cwindow(winax AS INTEGER,winay AS INTEGER,winex AS INTEGER,winey AS INTEGER,title AS STRING,wcolor AS INTEGER)
LINE(winax,winay+1)-(winex+1,winey),RGBA(0, 0, 50, 0),    BF

LINE(winax+1,winay+1)-(winex-1,winey-1),rgb(238, 238, 238),  BF
LINE(winax+2,winay+2)-(winex-2,winey-2),rgb(30, 32, 65), B
LINE(winax+3,winay+3)-(winex-3,winay +21),rgb(30, 32, 65), BF


END SUB
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: new gui all freebasic
« Reply #6 on: March 18, 2021, 05:28:12 AM »
and the last file that you have to add is win.bi

Code: [Select]

dim win as any ptr


dim as integer winsx,winsy,winpx,winpy
   winsx = 440
    winsy = 25
    winpx = 500
    winpy = 200
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: new gui all freebasic
« Reply #7 on: March 18, 2021, 05:29:45 AM »
dont for get you have to make a file call pic an place icon image in there

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: new gui all freebasic
« Reply #8 on: March 18, 2021, 05:32:47 AM »
there was a ram leak an some how i fix it now its at 13.5 mb ram so thats good
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: new gui all freebasic
« Reply #9 on: March 18, 2021, 05:35:45 AM »
my freebasic ver is 0.4.6
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: new gui all freebasic
« Reply #10 on: March 18, 2021, 07:14:26 AM »
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