Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (474)
Games in Android Showcase (105)
games submitted by our members
Games in WIP (524)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Fullscreen Mode  (Read 898 times)
0 Members and 1 Guest are viewing this topic.
Offline nickdotjava

Junior Member




I have fallen to the dark side.  I'm using DX9


« Posted 2003-06-30 23:48:41 »

Shouldn't this make the window fullscreen?  This is just BaseWindow, but everything that says fullscreen set to true.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
116  
117  
118  
119  
120  
121  
122  
123  
124  
125  
126  
127  
128  
129  
130  
131  
132  
133  
134  
135  
136  
137  
138  
139  
140  
141  
142  
143  
144  
145  
146  
147  
148  
149  
150  
151  
152  
import org.lwjgl.*;
import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.GL;
import org.lwjgl.opengl.GLU;

public class BaseWindow
{

    public BaseWindow()
    {
        fullscreen = true;
        done = false;
    }

    protected void resizeGLScene(int i, int j)
    {
        gl.viewport(0, 0, i, j);
        gl.matrixMode(5889);
        gl.loadIdentity();
        glu.perspective(45D, (float)i / (float)j, 0.10000000149011612D, 100D);
        gl.matrixMode(5888);
        gl.loadIdentity();
    }

    protected void initGL()
        throws Exception
    {
        gl.shadeModel(7425);
        gl.clearColor(0.0F, 0.0F, 0.0F, 0.0F);
        gl.clearDepth(1.0D);
        gl.enable(2929);
        gl.depthFunc(515);
        gl.hint(3152, 4354);
    }

    protected boolean drawGLScene(float f)
    {
        gl.clear(16640);
        gl.loadIdentity();
        return true;
    }

    protected void killGLWindow()
    {
        Mouse.destroy();
        Keyboard.destroy();
        gl.destroy();
    }

    protected void createGLWindow(int i, int j, int k, boolean flag)
        throws Exception
    {
        fullscreen = flag;
        try
        {
            byte byte0 = -1;
            DisplayMode adisplaymode[] = Display.getAvailableDisplayModes();
            int i1 = 0;
            do
            {
                if(i1 >= adisplaymode.length)
                    break;
                if(adisplaymode[i1].width == i && adisplaymode[i1].height == j && adisplaymode[i1].bpp >= k)
                {
                    int l = i1;
                    break;
                }
                i1++;
            } while(true);
            gl = new GL("LWJGL Example", 50, 50, i, j, k, 0, 0, 0);
            gl.create();
            glu = new GLU(gl);
            Keyboard.create();
            Keyboard.enableBuffer();
            Mouse.create();
            resizeGLScene(i, j);
            initGL();
        }
        catch(Exception exception)
        {
            throw new Exception("Problem initialising Lesson", exception);
        }
    }

    protected void start(int i, int j, int k, boolean flag)
        throws Exception
    {
        long l = 0L;
        timerRes = Sys.getTimerResolution();
        if(timerRes == 0L)
            throw new Exception("There are no timers availible!");
        try
        {
            createGLWindow(i, j, k, flag);
            long l1;
            do
            {
                gl.tick();
                l1 = Sys.getTime();
                Sys.setTime(0L);
            } while(!loop((float)l1 / (float)timerRes));
            killGLWindow();
        }
        catch(Exception exception)
        {
            throw new Exception("Problem starting loop", exception);
        }
    }

    protected boolean loop(float f)
    {
        if(!drawGLScene(f))
        {
            return true;
        } else
        {
            gl.paint();
            input(f);
            return done;
        }
    }

    protected void input(float f)
    {
        Keyboard.poll();
        if(Keyboard.isKeyDown(1))
            done = true;
    }

    public static void main(String args[])
    {
        int i = 0;
        BaseWindow basewindow = new BaseWindow();
        try
        {
            basewindow.start(640, 480, 16, true);
        }
        catch(Exception exception)
        {
            i = 1;
            exception.printStackTrace();
        }
        System.exit(i);
    }

    protected GL gl;
    protected GLU glu;
    protected boolean fullscreen;
    protected boolean done;
    protected long timerRes;
}

-Nick

"Oh ya, that's trivial.  I should have it done in an hour."
Offline cfmdobbie

Senior Member


Medals: 1


Who, me?


« Reply #1 - Posted 2003-07-01 01:16:33 »

There's a loop in there choosing a DisplayMode to change to, but no line to do the actual switch.

You need a line like "Display.setDisplayMode(i1)" before the call to the GL constructor.  You'll also need to call a different GL constructor, one without position or size information.

The real problem is that it appears to be decompiled code.  All the constants are numerical, the variables are badly named and the structure of the code is just nasty.  The lines to set the DisplayMode correctly and call the other GL constructor were probably optimised away after the compiler decided they weren't reachable.

You're bound to have issues with that file (not least trying to decode lines like "gl.hint(3152, 4354);"), so I'd get the real version first and play with that if I were you! Grin

Hellomynameis Charlie Dobbie.
Offline nickdotjava

Junior Member




I have fallen to the dark side.  I'm using DX9


« Reply #2 - Posted 2003-07-01 15:36:29 »

Thanks!  It works!  I'm in such a good mood.

You're right, this is the decompiled version.  I do get the decompiled and src mixed up a lot.  Some day, I'll get it cleared up...

-Nick

"Oh ya, that's trivial.  I should have it done in an hour."
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

Riven (28 views)
2014-07-10 20:20:18

CopyableCougar4 (26 views)
2014-07-10 02:26:14

CopyableCougar4 (32 views)
2014-07-09 02:55:38

Code Mage (33 views)
2014-07-08 23:57:00

Code Mage (20 views)
2014-07-08 23:49:08

AppleSauce (28 views)
2014-07-08 19:25:32

CopyableCougar4 (28 views)
2014-07-06 01:51:26

ipe369 (34 views)
2014-07-05 14:18:25

vastrolorde (44 views)
2014-07-04 18:45:44

theagentd (61 views)
2014-07-02 22:19:37
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!