Horizontally Mirror View?

Discussion in 'Programming' started by athunson, Aug 29, 2016.

  1. athunson

    athunson Guest

    I am new at this and I just figured out view_angle so I use that to vertially flip the view but what I want to do is completely horizontally flip the view of my room. How do I achieve it? Thankyou in advance
     
  2. YellowAfterlife

    YellowAfterlife ᴏɴʟɪɴᴇ ᴍᴜʟᴛɪᴘʟᴀʏᴇʀ Forum Staff Moderator

    Joined:
    Apr 21, 2016
    Posts:
    2,403
    Setting view_wview to a negative value should work fine for this. You'll likely also have to adjust view_xview so that it's at the right spot.
     
    Yal likes this.
  3. jo-thijs

    jo-thijs Member

    Joined:
    Jun 20, 2016
    Posts:
    2,844
    What YellowAfterlive said.
    You'll need to be careful though with backgrounds and tiles, those might not be drawn automatically anymore,
    so you'll have to draw those yourself.
     
    TheouAegis likes this.
  4. athunson

    athunson Guest

    I tried view_wview like you asked but that didn't flip the camera like I want it to. My view in width is 432 so I changed view_wview into -432. but nothing happened

    I forgot to mention I am using d3d
     
  5. Yal

    Yal GMC Memer GMC Elder

    Joined:
    Jun 20, 2016
    Posts:
    3,688
    Then you should change the code that sets the projection instead. Are you using a perspective projection or an orthographic projection?
     
  6. Surgeon_

    Surgeon_ Symbian Curator

    Joined:
    Jun 22, 2016
    Posts:
    248
    Why not just turn off automatic drawing of the application_surface and then draw it yourself in the Post Draw event? With draw_surface_ext() you can set the xscale to -1 and have your mirroring effect. Though the problem is, all the text would be mirrored as well...
     
  7. Yal

    Yal GMC Memer GMC Elder

    Joined:
    Jun 20, 2016
    Posts:
    3,688
    He could draw all the text in the Draw GUI event, right? Or possibly draw the text in the Post Draw event as well after drawing the surface?
     
  8. TheouAegis

    TheouAegis Member

    Joined:
    Jul 3, 2016
    Posts:
    6,881
    view_wview *= -1;
    view_xview -= view_wview;

    Sure enough, the lone tile I had in my room was gone. Don't remember that happening in GM8. *sigh*
     
  9. TheouAegis

    TheouAegis Member

    Joined:
    Jul 3, 2016
    Posts:
    6,881
    Also he has to shift the coordinates of the surface. The surface is transformed across it's top-left corner, so drawing the surface at (0,0) when it's not scaled would black out the screen once you flip the scale; so the x offset would need to be surface_get_width(application_surface)*!scale to get the surface to display correctly once flipped.

    @Yal Correct, the GUI event is rendered separately from the Post Draw. The Post Draw is apparently before the GUI.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice