3232#gc.set_debug(gc.DEBUG_LEAK)
3333
3434
35- programIcon = pygame .image .load ('textures/pycraft-32.png' )
35+
36+ working_dir = os .path .dirname (os .path .realpath (__file__ ))
37+ image_dir = os .path .join (working_dir , 'textures' )
38+ sound_dir = os .path .join (working_dir , 'sounds' )
39+ gui_dir = os .path .join (working_dir , 'gui' )
40+
41+ pyglet .resource .path = [working_dir , image_dir , sound_dir , gui_dir ]
42+ pyglet .resource .reindex ()
43+
44+ programIcon = pygame .image .load ('textures\pycraft-32.png' )
3645
3746pygame .display .set_icon (programIcon )
3847
48+ pygame .DOUBLEBUF
49+
3950client_id = "851879525590630411"
4051RPC = Presence (client_id )
41- RPC .connect ()
4252
53+ if DiscordRP == True :
54+ RPC .connect ()
55+ RPC .update (state = "Loading" , large_image = "icon" , large_text = "PyCraft: Made By IAJ" , buttons = [{"label" : "PyCraft Github" , "url" : "https://github.com/IAJWasTooShort/PyCraft" }])
4356
4457def respawn ():
4558 pause ()
@@ -255,7 +268,9 @@ def genWorld(mc):
255268 IN_MENU = False
256269 PAUSE = False
257270
258- RPC .update (state = "In Game" , large_image = "icon" , large_text = "PyCraft: Made By IAJ" , buttons = [{"label" : "PyCraft Github" , "url" : "https://github.com/IAJWasTooShort/PyCraft" }])
271+ if DiscordRP == True :
272+ #RPC.connect()
273+ RPC .update (state = "In Game" , large_image = "icon" , large_text = "PyCraft: Made By IAJ" , buttons = [{"label" : "PyCraft Github" , "url" : "https://github.com/IAJWasTooShort/PyCraft" }])
259274
260275
261276 proc = round ((scene .worldGen .start - len (scene .worldGen .queue )) * 100 / chunkCnt )
@@ -273,7 +288,10 @@ def drawMainMenu(mc):
273288 glFogf (GL_FOG_START , 0 )
274289 glFogf (GL_FOG_END , 1000 )
275290
276- RPC .update (state = "On the Main Menu" , large_image = "icon" , large_text = "PyCraft: Made By IAJ" , buttons = [{"label" : "PyCraft Github" , "url" : "https://github.com/IAJWasTooShort/PyCraft" }])
291+
292+ if DiscordRP == True :
293+ #RPC.connect()
294+ RPC .update (state = "On the Main Menu" , large_image = "icon" , large_text = "PyCraft: Made By IAJ" , buttons = [{"label" : "PyCraft Github" , "url" : "https://github.com/IAJWasTooShort/PyCraft" }])
277295
278296
279297 scene .set3d ()
@@ -339,7 +357,10 @@ def drawMainMenu(mc):
339357
340358print ("Loading the game..." )
341359
342- RPC .update (state = "Loading PyCraft..." , large_image = "icon" , large_text = "PyCraft: Made By IAJ" , buttons = [{"label" : "PyCraft Github" , "url" : "https://github.com/IAJWasTooShort/PyCraft" }])
360+ #if DiscordRP == True:
361+ # RPC.connect()
362+ # RPC.update(state="Loading PyCraft...", large_image="icon", large_text="PyCraft: Made By IAJ", buttons=[{"label": "PyCraft Github", "url": "https://github.com/IAJWasTooShort/PyCraft"}])
363+
343364
344365resizeEvent = False
345366LAST_SAVED_RESOLUTION = [WIDTH , HEIGHT ]
@@ -357,7 +378,7 @@ def drawMainMenu(mc):
357378glLoadIdentity ()
358379gluOrtho2D (0 , WIDTH , 0 , HEIGHT )
359380
360- logo = pyglet .resource .image ("gui/ logo.png" )
381+ logo = pyglet .resource .image ("logo.png" )
361382logo .blit (WIDTH // 2 - (logo .width // 2 ), HEIGHT // 2 - (logo .height // 2 ))
362383pygame .display .flip ()
363384
@@ -454,24 +475,25 @@ def drawMainMenu(mc):
454475print ("Music loaded!" )
455476
456477print ("Loading GUI textures..." )
478+ #gui/
457479gui .GUI_TEXTURES = {
458- "crafting_table" : pyglet .resource .image ("gui/ crafting_table.png" ),
459- "inventory_window" : pyglet .resource .image ("gui/ inventory_window.png" ),
460- "crosshair" : pyglet .resource .image ("gui/ crosshair.png" ),
461- "inventory" : pyglet .resource .image ("gui/ inventory.png" ),
462- "sel_inventory" : pyglet .resource .image ("gui/ sel_inventory.png" ),
463- "fullheart" : pyglet .resource .image ("gui/ fullheart.png" ),
464- "halfheart" : pyglet .resource .image ("gui/ halfheart.png" ),
465- "heartbg" : pyglet .resource .image ("gui/ heartbg.png" ),
466- "game_logo" : pyglet .resource .image ("gui/ game_logo.png" ),
467- "button_bg" : pyglet .resource .image ("gui/ gui_elements/button_bg.png" ),
468- "button_bg_hover" : pyglet .resource .image ("gui/ gui_elements/button_bg_hover.png" ),
469- "edit_bg" : pyglet .resource .image ("gui/ gui_elements/edit_bg.png" ),
470- "options_background" : pyglet .resource .image ("gui/ gui_elements/options_background.png" ),
471- "black" : pyglet .resource .image ("gui/ gui_elements/black.png" ),
472- "red" : pyglet .resource .image ("gui/ gui_elements/red.png" ),
473- "selected" : pyglet .resource .image ("gui/ gui_elements/selected.png" ),
474- "slider" : pyglet .resource .image ("gui/ gui_elements/slider.png" ),
480+ "crafting_table" : pyglet .resource .image ("crafting_table.png" ),
481+ "inventory_window" : pyglet .resource .image ("inventory_window.png" ),
482+ "crosshair" : pyglet .resource .image ("crosshair.png" ),
483+ "inventory" : pyglet .resource .image ("inventory.png" ),
484+ "sel_inventory" : pyglet .resource .image ("sel_inventory.png" ),
485+ "fullheart" : pyglet .resource .image ("fullheart.png" ),
486+ "halfheart" : pyglet .resource .image ("halfheart.png" ),
487+ "heartbg" : pyglet .resource .image ("heartbg.png" ),
488+ "game_logo" : pyglet .resource .image ("game_logo.png" ),
489+ "button_bg" : pyglet .resource .image ("gui_elements/button_bg.png" ),
490+ "button_bg_hover" : pyglet .resource .image ("gui_elements/button_bg_hover.png" ),
491+ "edit_bg" : pyglet .resource .image ("gui_elements/edit_bg.png" ),
492+ "options_background" : pyglet .resource .image ("gui_elements/options_background.png" ),
493+ "black" : pyglet .resource .image ("gui_elements/black.png" ),
494+ "red" : pyglet .resource .image ("gui_elements/red.png" ),
495+ "selected" : pyglet .resource .image ("gui_elements/selected.png" ),
496+ "slider" : pyglet .resource .image ("gui_elements/slider.png" ),
475497}
476498
477499glTexParameteri (GL_TEXTURE_2D , GL_TEXTURE_MAG_FILTER , GL_NEAREST )
@@ -547,7 +569,7 @@ def drawMainMenu(mc):
547569showInfoLabel = False
548570
549571print ("Loading splashes..." )
550- splfile = open ("gui/ splashes.txt" , "r" , encoding = 'utf-8' )
572+ splfile = open ("gui\ splashes.txt" , "r" , encoding = 'utf-8' )
551573splash = splfile .read ().split ("\n " )
552574splash = splash [randint (0 , len (splash ) - 1 )]
553575splfile .close ()
0 commit comments