It is currently Mon Sep 28, 2020 7:36 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 13 posts ] 
Author Message
 Post subject:
PostPosted: Tue Aug 06, 2002 1:27 am 
Offline
PureBasic Guru
PureBasic Guru

Joined: Tue Apr 22, 2003 7:42 pm
Posts: 16777133
Restored from previous forum. Originally posted by Cloak.

Hi all,

I'm fearly new to pb, so this might be a dumb question, but here goes:

For my game i am using DivX movies.
Now when i open a screen, and play the movie at it's original size, it works perfectly. But when i resize the movie (width=800, height is calculated to be in perspective) it is blocky and slow.
But when i try the movieplayer (dunno the author, it,s 3:24 :)) and i doubleclick the titlebar (maximize the window) it resizes perfectly, and is all smooth.
How can i do this when i play the movie in a screen?

---messy code followes---


DefType.f

If InitMovie() = 0
MessageRequester("Error", "Can't initialize movie playback !", 0)
End
EndIf

;MovieName$ = OpenFileRequester("Choose the movie to play", "", "Movie/Audio files|*.avi;*.mpg;*.asf;*.mp3;*.wav|All Files|*.*", 0)
moviename$="d:\movies\evol-dmn.avi"

InitSprite()
InitKeyboard()
Result = OpenScreen(800, 600, 32, "Movie")
SetRefreshRate(60)
SetFrameRate(60)

If MovieName$
If LoadMovie(0, MovieName$)


mw=MovieWidth()
mh=MovieHeight()
new_width=799
scale.f = new_width / mw
new_height=mh*scale.f

starty=(600-new_height)/2

ResizeMovie(0,starty,new_width,new_height)
;ResizeMovie(0,0,800,mh)
PlayMovie(0, ScreenID())

Repeat
ExamineKeyboard()
x=KeyboardPushed(#PB_Key_Escape)
Delay(20)
Until x0
Else
MessageRequester("Error", "Can't load the movie...", 0)
EndIf
EndIf

---End of messy code---

The movie played here is not part of my game, but a DivX test.

I also code in blitz, and when i use the same resizer code, it is smooth.
Both PB and Blitz are using directshow..

PLEASE help me with this one...

Regards, Cloak.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri Aug 09, 2002 8:06 am 
Offline
PureBasic Guru
PureBasic Guru

Joined: Tue Apr 22, 2003 7:42 pm
Posts: 16777133
Restored from previous forum. Originally posted by Cloak.

No-one knows the answer?
Or is this forum just dead...

Regards, Cloak.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri Aug 09, 2002 3:39 pm 
Offline
PureBasic Guru
PureBasic Guru

Joined: Tue Apr 22, 2003 7:42 pm
Posts: 16777133
Restored from previous forum. Originally posted by Franco.

Quote:
No-one knows the answer?
Or is this forum just dead...


Sorry never played with DivX or the movie library.

If nobody answers, than you are the first diving into it (I suppose...)

Have a nice day...
Franco

Sometimes you have to go a lonely way to accomplish genius things.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri Aug 09, 2002 7:34 pm 
Offline
PureBasic Guru
PureBasic Guru

Joined: Tue Apr 22, 2003 7:42 pm
Posts: 16777133
Restored from previous forum. Originally posted by PB.

> For my game i am using DivX movies.
> when i open a screen, and play the movie at it's original size, it works.
> when i resize the movie [...] it is blocky and slow.

Are other videos (such as MPGs) also blocky when resized? If not, then DivX is
the problem... and from what I've read, DivX is a failed format anyway and you'd
probably be better off using MPGs or other AVI types.


PB - Registered PureBasic Coder


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri Aug 09, 2002 8:21 pm 
Offline
PureBasic Guru
PureBasic Guru

Joined: Tue Apr 22, 2003 7:42 pm
Posts: 16777133
Restored from previous forum. Originally posted by Cloak.

er, are you from mars or something?
DiVX is the best format ever (until now)
And it has to be divx, because my hardware project is mainly a divx player box :)
anyway, other formats also get blocky and slow
but only fullscreen
in a window it (all formats) works great, also when the window is maximized

Regards, Cloak.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri Aug 09, 2002 9:06 pm 
Offline
PureBasic Guru
PureBasic Guru

Joined: Tue Apr 22, 2003 7:42 pm
Posts: 16777133
Restored from previous forum. Originally posted by PB.

> DiVX is the best format ever




PB - Registered PureBasic Coder


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sat Aug 10, 2002 9:34 pm 
Offline
PureBasic Guru
PureBasic Guru

Joined: Tue Apr 22, 2003 7:42 pm
Posts: 16777133
Restored from previous forum. Originally posted by Cloak.

But still my problem is not solved.
is there a way to open a borderless black fullscreen window?
wich hides even the taskbar?

Regards, Cloak.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sat Aug 10, 2002 10:10 pm 
Offline
PureBasic Guru
PureBasic Guru

Joined: Tue Apr 22, 2003 7:42 pm
Posts: 16777133
Restored from previous forum. Originally posted by traumatic.

Quote:
is there a way to open a borderless black fullscreen window?
wich hides even the taskbar?


don't know if this helps, but in windows you can hide the taskbar with
Code:
hWnd = FindWindow_("Shell_traywnd", "")
SetWindowPos_(hWnd, 0, 0, 0, 0, 0, #SWP_HIDEWINDOW)

and display it again with
Code:
SetWindowPos_(hWnd, 0, 0, 0, 0, 0, #SWP_SHOWWINDOW)


regards,
traumatic


Edited by - traumatic on 10 August 2002 23:12:36


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sat Aug 10, 2002 10:53 pm 
Offline
PureBasic Guru
PureBasic Guru

Joined: Tue Apr 22, 2003 7:42 pm
Posts: 16777133
Restored from previous forum. Originally posted by freak.

Yes, and this one creates a fullscreen, borderless Window:
Code:
If OpenWindow(0, 0, 0, GetSystemMetrics_(#SM_CXSCREEN), GetSystemMetrics_(#SM_CYSCREEN), #PB_Window_BorderLess, "Movie")
   
EndIf

Doesn't have to be black, since you'll display a movie in it.
Otherwise, use this:
Code:
  StartDrawing(WindowOutput())
    FrontColor(0,0,0)
    Box(0,0, GetSystemMetrics_(#SM_CXSCREEN), GetSystemMetrics_(#SM_CYSCREEN))
  StopDrawing()


Combine all those three things, and you'll have a black, borderless, fullscreen Window hiding the Taskbar.

That's it, hope it helps...

Timo

--
If it stinks, it's chemistry. If it moves, it's biology.
If it does not work, It's computer science.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sun Aug 11, 2002 6:29 pm 
Offline
PureBasic Guru
PureBasic Guru

Joined: Tue Apr 22, 2003 7:42 pm
Posts: 16777133
Restored from previous forum. Originally posted by Cloak.

Okay, but now i dont see the movie, but it is playing...
how can i refresh the screen so the movie is visible?
(i'm a pb n00b, kill me :))

Regards, Cloak.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sun Aug 11, 2002 7:33 pm 
Offline
PureBasic Guru
PureBasic Guru

Joined: Tue Apr 22, 2003 7:42 pm
Posts: 16777133
Restored from previous forum. Originally posted by freak.

I don't know, what is wrong with your code,
you'll have to post it, so i can debug it.

Well, anyway, here's a working example playing a Video in fullscreen:

Code:
If InitKeyboard()
If InitMovie()
 
  file.s = OpenFileRequester("Play Movie", "C:\*.*","All Files | *.*",0)      ; get Filename from user
  If file = "": End: EndIf
 
  If LoadMovie(0, file)     ; load
 
    hWnd = FindWindow_("Shell_traywnd", "")                                 ; hide Taskbar
    SetWindowPos_(hWnd, 0, 0, 0, 0, 0, #SWP_HIDEWINDOW)
 
    If OpenWindow(0, 0, 0, GetSystemMetrics_(#SM_CXSCREEN), GetSystemMetrics_(#SM_CYSCREEN), #PB_Window_BorderLess, "Movie")    ; fullscreen Window
     
      PlayMovie(0, WindowID())                                                            ; play Movie 
      ResizeMovie(0, 0, GetSystemMetrics_(#SM_CXSCREEN), GetSystemMetrics_(#SM_CYSCREEN)) ; resize to screensize
 
      Repeat                      ; wait for ESC-key to be pressed
        ExamineKeyboard()
        x=KeyboardPushed(#PB_Key_Escape)
        Delay(20)
      Until x0   
      SetWindowPos_(hWnd, 0, 0, 0, 0, 0, #SWP_SHOWWINDOW)     ; show Taskbar
      End
       
    EndIf
  EndIf
EndIf
EndIf
 
MessageRequester("Movie","Some Error occured!",0)           ; in case of an error
SetWindowPos_(hWnd, 0, 0, 0, 0, 0, #SWP_SHOWWINDOW)
End


That's it, hope it helps a bit...

Timo

--
If it stinks, it's chemistry. If it moves, it's biology.
If it does not work, It's computer science.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sun Aug 11, 2002 8:43 pm 
Offline
PureBasic Guru
PureBasic Guru

Joined: Tue Apr 22, 2003 7:42 pm
Posts: 16777133
Restored from previous forum. Originally posted by traumatic.

Quote:
hWnd = FindWindow_("Shell_traywnd", "")


btw. you shouldn't use 'hWnd' as the variable-name since hWnd often refers to the main window handle, i.e. the return-value of OpenWindow().

of course, this doesn't make any difference to the behaviour of your program...


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Aug 12, 2002 3:57 pm 
Offline
PureBasic Guru
PureBasic Guru

Joined: Tue Apr 22, 2003 7:42 pm
Posts: 16777133
Restored from previous forum. Originally posted by Cloak.

Thank you very mucho!
this works great...

Regards, Cloak.


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

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 2 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