It is currently Fri Oct 30, 2020 5:45 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: Hello world
PostPosted: Tue Oct 08, 2019 6:22 pm 
Offline
User
User

Joined: Sat Apr 13, 2019 12:17 pm
Posts: 48
Having a problem changing the color of the window could some kind person show me where I'm going wrong .
Code:
InitSprite()

OpenWindow(1,200,200,400,400,"pauls program")
ClearScreen(RGB(100,0,0))
FlipBuffers()
Delay(5000)
StartDrawing(WindowOutput(1))

DrawText(10,10,"hello world")
StopDrawing()

FlipBuffers()
Delay(5000)

End


Top
 Profile  
Reply with quote  
 Post subject: Re: Hello world
PostPosted: Tue Oct 08, 2019 6:25 pm 
Offline
User
User

Joined: Sat Apr 13, 2019 12:17 pm
Posts: 48
This has had me pulling my hair out for hours and could really do with some help. Thanks for reading.
The code clearscreen(rgb(100,0,0)) should turn the window red but it doesn't . I am new to this and this is my second day.
In my profile it says I joined in April but never really did anything with pure basic but now I'm off and made a start.


Top
 Profile  
Reply with quote  
 Post subject: Re: Hello world
PostPosted: Tue Oct 08, 2019 7:05 pm 
Offline
Addict
Addict

Joined: Sun Sep 07, 2008 12:45 pm
Posts: 4993
Location: Germany
You call ClearScreen(), but ... you have no Screen.
You have only a window :wink:

And you are mixing screen stuff with window stuff.

What do you want? A screen or a window?

And you need loops, not delays.

Have you looked in the help?


Top
 Profile  
Reply with quote  
 Post subject: Re: Hello world
PostPosted: Tue Oct 08, 2019 7:32 pm 
Offline
User
User

Joined: Sat Apr 13, 2019 12:17 pm
Posts: 48
Ok thanks for the reply I'll go back and see if I can sort it .


Top
 Profile  
Reply with quote  
 Post subject: Re: Hello world
PostPosted: Tue Oct 08, 2019 9:52 pm 
Offline
Addict
Addict

Joined: Sun Sep 07, 2008 12:45 pm
Posts: 4993
Location: Germany
Code:
EnableExplicit

Define Exit.i, Event.i

OpenWindow(0, 200, 200, 400, 400,"pauls program window")
CanvasGadget(0, 0, 0, 400, 400)

If StartDrawing(CanvasOutput(0))
  Box(0, 0, 400, 400, #Red)

  DrawText(10, 10, "hello world")
  StopDrawing()
EndIf

Repeat
  Event = WaitWindowEvent()
 
  Select Event
    Case #PB_Event_CloseWindow
      Exit = #True
     
  EndSelect
 
Until Exit


Exit = #False

InitSprite()
OpenWindow(0, 200, 200, 400, 400,"pauls program screen")
OpenWindowedScreen(WindowID(0), 0, 0, 400, 400)

ClearScreen(#Red)
If StartDrawing(ScreenOutput())
  DrawText(10, 10, "hello world")
  StopDrawing()
EndIf

Repeat
  Repeat
    Event = WindowEvent()
   
    Select Event
      Case #PB_Event_CloseWindow
        Exit = #True
     
    EndSelect
   
  Until Event = 0
 
  FlipBuffers()
 
Until Exit


But it depends what you want: an application or a game


Top
 Profile  
Reply with quote  
 Post subject: Re: Hello world
PostPosted: Tue Oct 08, 2019 9:59 pm 
Offline
Addict
Addict

Joined: Thu Apr 18, 2019 8:17 am
Posts: 1043
pfaber11 wrote:
clearscreen(rgb(100,0,0)) should turn the window red

No, this turns the window red:

Code:
SetWindowColor(WindowNumber,RGB(100,0,0))


Top
 Profile  
Reply with quote  
 Post subject: Re: Hello world
PostPosted: Sun Oct 13, 2019 10:44 am 
Offline
User
User

Joined: Sat Apr 13, 2019 12:17 pm
Posts: 48
OK thanks for all the input . It's all coming together now . I'm on day 6 of using pure basic .


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 34 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye