Author Topic: QB64 REPORT S01E02: "SCREEN modes"  (Read 8792 times)

0 Members and 1 Guest are viewing this topic.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: QB64 REPORT S01E02: "SCREEN modes"
« Reply #15 on: June 17, 2020, 04:08:04 pm »
I am just trying to show you, STx, that you don't have to makeup extra subs or functions to correct the y direction.

If you don't want to take the advice, fine, that is your business, but don't be complaining to everyone like there was no fix for y behavior readily available.

Offline STxAxTIC

  • Library Staff
  • Forum Resident
  • Posts: 1091
  • he lives
    • View Profile
Re: QB64 REPORT S01E02: "SCREEN modes"
« Reply #16 on: June 17, 2020, 04:42:41 pm »
If there was no fix then all my graphics would be up side down. When did you ever use WINDOW in a program? Honest question. Blackjack doesn't have it, are you admitting your thinking is going upside down to accommodate the way QB64 comes by default? Say it aint so.
« Last Edit: June 17, 2020, 04:43:44 pm by STxAxTIC »
You're not done when it works, you're done when it's right.

Offline STxAxTIC

  • Library Staff
  • Forum Resident
  • Posts: 1091
  • he lives
    • View Profile
Re: QB64 REPORT S01E02: "SCREEN modes"
« Reply #17 on: June 17, 2020, 04:47:50 pm »
I'll admit that window might be cleaner (no pun) but i've never tested it at all, let alone with resizing and all that crap. Here is how i jump through the hoops, its pretty much one modification to each graphics statement:

Code: QB64: [Select]
  1. SUB cline (x1 AS DOUBLE, y1 AS DOUBLE, x2 AS DOUBLE, y2 AS DOUBLE, col AS _UNSIGNED LONG)
  2.     LINE (_WIDTH / 2 + x1, -y1 + _HEIGHT / 2)-(_WIDTH / 2 + x2, -y2 + _HEIGHT / 2), col
  3.  
  4. SUB cpset (x1 AS DOUBLE, y1 AS DOUBLE, col AS _UNSIGNED LONG)
  5.     PSET (_WIDTH / 2 + x1, -y1 + _HEIGHT / 2), col

That is, you just have

Code: [Select]
x -> x + W/2
y -> -y + H/2

and the issue is over. Window may be simpler, you should test it!

« Last Edit: June 17, 2020, 04:49:12 pm by STxAxTIC »
You're not done when it works, you're done when it's right.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: QB64 REPORT S01E02: "SCREEN modes"
« Reply #18 on: June 17, 2020, 05:50:52 pm »
If there was no fix then all my graphics would be up side down. When did you ever use WINDOW in a program? Honest question. Blackjack doesn't have it, are you admitting your thinking is going upside down to accommodate the way QB64 comes by default? Say it aint so.

Right! Exactly You, Stx, are the only one I know who consistently moves the origin into the center of the screen. Does calcs and then runs the x, y's through converters for screen display. So that is why I thought of you and name you, Stx, the only one I know who might really benefit from using this keyword WINDOW.

It might make your job easier and your code more understandable to others. I was offering you a gift, trying to help you as you have helped me and others often enough.

S'OK you don't have to take my advice and you don't have to be always complaining Y only goes one way in QB64 or in QB4.5 because this WINDOW command comes from there probably to get the mathematicians off the developers backs ;-))

Offline _vince

  • Seasoned Forum Regular
  • Posts: 422
    • View Profile
Re: QB64 REPORT S01E02: "SCREEN modes"
« Reply #19 on: June 17, 2020, 07:44:16 pm »
It might make your job easier and your code more understandable to others. I was offering you a gift, trying to help you as you have helped me and others often enough.
Hey, let's not concede now. WINDOW is king and stx can suck it!

I'd agree that WINDOW is a bit of a toy for reasons:
Quote from: bplus
Be careful with graphics commands they don't all work and there is a special command to get correct mouse location, probably can find it in Wiki under Window or related keywords.
would be a nightmare in a major project with tons of graphical routines, libraries, etc. It's at most useful in small plotting programs like OldMoses and I mentioned.

The existence of WINDOW is certainly worth acknowledging when discussing coordinate systems in regards to BASIC, though.  Only a BASIC has the balls to promise a statement that drastically changes the graphical coordinate system across the entire language.  It also means that BASIC is just as beautiful as other fancy graphing calculators like mathematica, matlab, etc when it comes to plotting because you can have a clean singular "y = sin (x)" and it will generate a legible plot.  How many hoops do you have to jump through to plot a sine wave in C?

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: QB64 REPORT S01E02: "SCREEN modes"
« Reply #20 on: June 17, 2020, 09:19:42 pm »
Being careful for commands that don't convert, here is the extra step (see Wiki on PMAP function).

Demo focus on commands that don't convert like mouse location and _PRINTSTRING from my trig demo:
Code: QB64: [Select]
  1.     '...
  2.     mx = INT(PMAP(_MOUSEX, 2)): my = INT(PMAP(_MOUSEY, 3)) 'covert mouse to Cart Cood using PMAP
  3.     '...
  4.     _PRINTSTRING (PMAP(0, 0), PMAP(-1, 1)), s$
  5.     _PRINTSTRING (PMAP(-95, 0), PMAP(95, 1)), "COS = x/r = " + _TRIM$(STR$(mx / r))
  6.    '...
  7.  

Don't know why I am so enthusiastically advocating this, it probably would be boost to my PLOT program, hmm... :) as @OldMoses has shown.
« Last Edit: June 18, 2020, 11:36:41 am by bplus »

FellippeHeitor

  • Guest
Re: QB64 REPORT S01E02: "SCREEN modes"
« Reply #21 on: June 18, 2020, 10:01:37 am »
Thanks to everyone who's been listening.

WINDOW was mentioned while we were preparing the episode, but I honestly forgot about the axis-flipping behavior. All that occurred to me was that we could change the origin 0,0 to another physical location on the program's screen, which is why it didn't end up being mentioned in the episode.

Thanks for the code samples, they're all really useful.

@Dav There's a track that plays in the beginning and at the end, maybe it's too faint?

Fellippe.

Offline Dav

  • Forum Resident
  • Posts: 792
    • View Profile
Re: QB64 REPORT S01E02: "SCREEN modes"
« Reply #22 on: June 18, 2020, 10:07:03 am »
Wow, I guess I missed the music!? I really didn't notice it.  I'll listen to the next podcast without multitasking!

Will they be coming out every week?

- Dav

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: QB64 REPORT S01E02: "SCREEN modes"
« Reply #23 on: June 18, 2020, 11:41:19 am »
Wow, I guess I missed the music!? I really didn't notice it.  I'll listen to the next podcast without multitasking!

Will they be coming out every week?

- Dav

Yeah I was paying bills :)

I think it would be cool if Dav's music might be played, let's plug our members outside activities, Dav willing of course :) Either that or Bonkers Symphony #37 hee, hee

Offline TempodiBasic

  • Forum Resident
  • Posts: 1792
    • View Profile
Re: QB64 REPORT S01E02: "SCREEN modes"
« Reply #24 on: June 18, 2020, 01:11:39 pm »
about PMAP for getting values for WINDOW settings of VIEW area of the screen

can we think this one an alternative?
Code: QB64: [Select]
  1. ' p5.js Functions
  2. FUNCTION map! (value!, minRange!, maxRange!, newMinRange!, newMaxRange!)
  3.     map! = ((value! - minRange!) / (maxRange! - minRange!)) * (newMaxRange! - newMinRange!) + newMinRange!
  4.  
with which the user must define from what dimensions to What Dimensions  you are calculating.
Using this function can we invert the Y (and / or the X axis) axis?

Thanks to read
Programming isn't difficult, only it's  consuming time and coffee

Offline TempodiBasic

  • Forum Resident
  • Posts: 1792
    • View Profile
Re: QB64 REPORT S01E02: "SCREEN modes"
« Reply #25 on: June 18, 2020, 01:13:19 pm »
Sorry Fellippe
Is there an youtube version also for this podcast?
I'm improving my listening but I have time to spent first to follow your discussions only by audio.  :-)
Thanks
Programming isn't difficult, only it's  consuming time and coffee

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: QB64 REPORT S01E02: "SCREEN modes"
« Reply #26 on: June 18, 2020, 01:16:50 pm »
about PMAP for getting values for WINDOW settings of VIEW area of the screen

can we think this one an alternative?
Code: QB64: [Select]
  1. ' p5.js Functions
  2. FUNCTION map! (value!, minRange!, maxRange!, newMinRange!, newMaxRange!)
  3.     map! = ((value! - minRange!) / (maxRange! - minRange!)) * (newMaxRange! - newMinRange!) + newMinRange!
  4.  
with which the user must define from what dimensions to What Dimensions  you are calculating.
Using this function can we invert the Y (and / or the X axis) axis?

Thanks to read

What's wrong with PMAP it's built in and you only have to feed it one of 4 integer arguments?


Offline TempodiBasic

  • Forum Resident
  • Posts: 1792
    • View Profile
Re: QB64 REPORT S01E02: "SCREEN modes"
« Reply #27 on: June 18, 2020, 07:51:52 pm »
@bplus
Hi
Quote
What's wrong with PMAP it's built in and you only have to feed it one of 4 integer arguments?
the answer at your question is : nothing as already you know.
I was thinking about how the function of PMAP can be emulated and I remebered this function.
Good Coding
Programming isn't difficult, only it's  consuming time and coffee

FellippeHeitor

  • Guest
Re: QB64 REPORT S01E02: "SCREEN modes"
« Reply #28 on: June 18, 2020, 08:42:36 pm »
Sorry Fellippe
Is there an youtube version also for this podcast?
I'm improving my listening but I have time to spent first to follow your discussions only by audio.  :-)
Thanks

Hi Tempo. Yes, there is a YouTube version, but for some reason automatic closed captions were not added this time. I don't know if I did something wrong when I uploaded it, but I ended up without them this time. I'm sorry.

If anyone knows how to trigger auto captions, please let me know.
« Last Edit: June 21, 2020, 01:40:36 am by FellippeHeitor »

Marked as best answer by on October 18, 2024, 06:02:14 pm

Offline TempodiBasic

  • Forum Resident
  • Posts: 1792
    • View Profile
Re: QB64 REPORT S01E02: "SCREEN modes"
« Reply #29 on: June 19, 2020, 07:17:39 am »
  • Undo Best Answer
  • @Thanks Fellippe

    I'm not expert about loading video on Youtube but it seems that this time you have loaded the video with permission to edit it from the user that click on settings of Video...  when the user does this action (select Settings to activate subtitles that are disabled in this video) he has the only option to add subtitles at the place of choose the subtitle automated. And if he chooses to add subtitles he open a new window in the browser to edit the video about subtitles choosing the language and then inserting  the text or import a file with subtitles....

    In the action of loading there is maybe an option to enable or not to edit subtitles... I suggest you to disable this option.
    Thanks again for attempt.
    Programming isn't difficult, only it's  consuming time and coffee